Commit | Line | Data |
---|---|---|
4aa43585 WD |
1 | From: peter pan <lanwanhr@yahoo.com> |
2 | Subject: [PATCH] write only | |
3 | Date: Thu, 12 Feb 2004 04:08:00 -0800 (PST) | |
4 | ||
5 | I've added a write only option to rsyncd.conf which is essentially the opposite | |
6 | of read only. This means that although it's possible someone on our allowed IP | |
7 | range could overwrite (or delete) files on the rsync share, they would not be | |
8 | allowed to download any files (my primary concern). | |
9 | ||
10 | J | |
11 | ||
12 | [Updated to CVS version by Wayne Davison.] | |
13 | ||
14 | ||
15 | --- loadparm.c 4 Feb 2004 07:31:29 -0000 1.50 | |
16 | +++ loadparm.c 27 Feb 2004 18:18:38 -0000 | |
17 | @@ -119,6 +119,7 @@ typedef struct | |
18 | char *comment; | |
19 | char *lock_file; | |
20 | BOOL read_only; | |
21 | + BOOL write_only; | |
22 | BOOL list; | |
23 | BOOL use_chroot; | |
24 | BOOL transfer_logging; | |
25 | @@ -151,6 +152,7 @@ static service sDefault = | |
26 | NULL, /* comment */ | |
27 | DEFAULT_LOCK_FILE, /* lock file */ | |
28 | True, /* read only */ | |
29 | + False, /* write only */ | |
30 | True, /* list */ | |
31 | True, /* use chroot */ | |
32 | False, /* transfer logging */ | |
33 | @@ -277,6 +279,7 @@ static struct parm_struct parm_table[] = | |
34 | {"lock file", P_STRING, P_LOCAL, &sDefault.lock_file, NULL, 0}, | |
35 | {"path", P_PATH, P_LOCAL, &sDefault.path, NULL, 0}, | |
36 | {"read only", P_BOOL, P_LOCAL, &sDefault.read_only, NULL, 0}, | |
37 | + {"write only", P_BOOL, P_LOCAL, &sDefault.write_only, NULL, 0}, | |
38 | {"list", P_BOOL, P_LOCAL, &sDefault.list, NULL, 0}, | |
39 | {"use chroot", P_BOOL, P_LOCAL, &sDefault.use_chroot, NULL, 0}, | |
40 | {"ignore nonreadable",P_BOOL, P_LOCAL, &sDefault.ignore_nonreadable, NULL, 0}, | |
41 | @@ -356,6 +359,7 @@ FN_LOCAL_STRING(lp_comment, comment) | |
42 | FN_LOCAL_STRING(lp_path, path) | |
43 | FN_LOCAL_STRING(lp_lock_file, lock_file) | |
44 | FN_LOCAL_BOOL(lp_read_only, read_only) | |
45 | +FN_LOCAL_BOOL(lp_write_only, write_only) | |
46 | FN_LOCAL_BOOL(lp_list, list) | |
47 | FN_LOCAL_BOOL(lp_use_chroot, use_chroot) | |
48 | FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging) | |
49 | --- main.c 10 Feb 2004 03:54:47 -0000 1.192 | |
50 | +++ main.c 27 Feb 2004 18:18:38 -0000 | |
51 | @@ -370,6 +370,12 @@ static void do_server_sender(int f_in, i | |
52 | (long)getpid()); | |
53 | } | |
54 | ||
55 | + if (am_daemon && lp_write_only(module_id) && !am_sender) { | |
56 | + rprintf(FERROR, "ERROR: module is write only\n"); | |
57 | + exit_cleanup(RERR_SYNTAX); | |
58 | + return; | |
59 | + } | |
60 | + | |
61 | if (!relative_paths && !push_dir(dir)) { | |
62 | rprintf(FERROR, "push_dir %s failed: %s (3)\n", | |
63 | full_fname(dir), strerror(errno)); | |
64 | --- proto.h 17 Feb 2004 23:13:06 -0000 1.184 | |
65 | +++ proto.h 27 Feb 2004 18:53:40 -0000 | |
66 | @@ -134,6 +134,7 @@ char *lp_comment(int ); | |
67 | char *lp_path(int ); | |
68 | char *lp_lock_file(int ); | |
69 | BOOL lp_read_only(int ); | |
70 | +BOOL lp_write_only(int ); | |
71 | BOOL lp_list(int ); | |
72 | BOOL lp_use_chroot(int ); | |
73 | BOOL lp_transfer_logging(int ); |