]> andersk Git - moira.git/blame_incremental - update/xfer_003.c
subnet status should be %s, not %d.
[moira.git] / update / xfer_003.c
... / ...
CommitLineData
1/* $Id$
2 *
3 * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
5 * <mit-copyright.h>.
6 */
7
8#include <mit-copyright.h>
9#include <moira.h>
10#include "update_server.h"
11
12#include <ctype.h>
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16
17RCSID("$Header$");
18
19/*
20 *
21 * syntax:
22 * >>> (STRING)"xfer_003" filesize checksum pathname
23 * <<< (int)0
24 * >>> (STRING)data
25 * <<< (int)code
26 * >>> (STRING)data
27 * <<< (int)code
28 * ...
29 * >>> (STRING)data (last data block)
30 * <<< (int)code (from read, write, checksum verify)
31 *
32 * function:
33 * perform initial preparations and receive file as
34 * a single string, storing it into <pathname>.moira_update.
35 * this version of transfer encrypts the file being transferred.
36 */
37
38void xfer_003(int conn, char *str)
39{
40 int file_size, checksum, code;
41 char *pathname, *p;
42
43 str += 8;
44 while (*str == ' ')
45 str++;
46 if (!*str)
47 {
48 failure:
49 send_int(conn, MR_ARGS);
50 return;
51 }
52
53 file_size = strtol(str, &p, 10);
54 if (p == str)
55 {
56 send_int(conn, MR_ARGS);
57 return;
58 }
59 else
60 str = p;
61 while (*str == ' ')
62 str++;
63
64 checksum = strtol(str, &p, 10);
65 if (p == str)
66 {
67 send_int(conn, MR_ARGS);
68 return;
69 }
70 else
71 str = p;
72 while (*str == ' ')
73 str++;
74
75 if (*str != '/')
76 goto failure;
77 pathname = str;
78
79 if (!have_authorization)
80 {
81 send_int(conn, MR_PERM);
82 return;
83 }
84
85 send_ok(conn);
86 code = get_file(conn, pathname, file_size, checksum, 0444, 1);
87 if (!code)
88 com_err(whoami, 0, "Transferred file %s", pathname);
89
90 return;
91}
This page took 0.030964 seconds and 5 git commands to generate.