cb617f1dd2a446f7ba44810920a7d122fec43fdd
[rsync/rsync-patches.git] / write-only.diff
1 After applying this patch and running configure, you MUST run this
2 command before "make":
3
4     make proto
5
6 peter pan (lanwanhr@yahoo.com) writes:
7
8 I've added a write only option to rsyncd.conf which is essentially the opposite
9 of read only.  This means that although it's possible someone on our allowed IP
10 range could overwrite (or delete) files on the rsync share, they would not be
11 allowed to download any files (my primary concern).
12
13
14 --- loadparm.c  4 Feb 2004 07:31:29 -0000       1.50
15 +++ loadparm.c  22 Apr 2004 23:49:29 -0000
16 @@ -119,6 +119,7 @@ typedef struct
17         char *comment;
18         char *lock_file;
19         BOOL read_only;
20 +       BOOL write_only;
21         BOOL list;
22         BOOL use_chroot;
23         BOOL transfer_logging;
24 @@ -151,6 +152,7 @@ static service sDefault =
25         NULL,    /* comment */
26         DEFAULT_LOCK_FILE,    /* lock file */
27         True,    /* read only */
28 +       False,   /* write only */
29         True,    /* list */
30         True,    /* use chroot */
31         False,   /* transfer logging */
32 @@ -277,6 +279,7 @@ static struct parm_struct parm_table[] =
33    {"lock file",        P_STRING,  P_LOCAL,  &sDefault.lock_file,   NULL,   0},
34    {"path",             P_PATH,    P_LOCAL,  &sDefault.path,        NULL,   0},
35    {"read only",        P_BOOL,    P_LOCAL,  &sDefault.read_only,   NULL,   0},
36 +  {"write only",       P_BOOL,    P_LOCAL,  &sDefault.write_only,  NULL,   0},
37    {"list",             P_BOOL,    P_LOCAL,  &sDefault.list,        NULL,   0},
38    {"use chroot",       P_BOOL,    P_LOCAL,  &sDefault.use_chroot,  NULL,   0},
39    {"ignore nonreadable",P_BOOL,   P_LOCAL,  &sDefault.ignore_nonreadable,  NULL,   0},
40 @@ -356,6 +359,7 @@ FN_LOCAL_STRING(lp_comment, comment)
41  FN_LOCAL_STRING(lp_path, path)
42  FN_LOCAL_STRING(lp_lock_file, lock_file)
43  FN_LOCAL_BOOL(lp_read_only, read_only)
44 +FN_LOCAL_BOOL(lp_write_only, write_only)
45  FN_LOCAL_BOOL(lp_list, list)
46  FN_LOCAL_BOOL(lp_use_chroot, use_chroot)
47  FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
48 --- main.c      10 Feb 2004 03:54:47 -0000      1.192
49 +++ main.c      22 Apr 2004 23:49:29 -0000
50 @@ -370,6 +370,12 @@ static void do_server_sender(int f_in, i
51                         (long)getpid());
52         }
53  
54 +       if (am_daemon && lp_write_only(module_id) && !am_sender) {
55 +               rprintf(FERROR, "ERROR: module is write only\n");
56 +               exit_cleanup(RERR_SYNTAX);
57 +               return;
58 +       }
59 +
60         if (!relative_paths && !push_dir(dir)) {
61                 rprintf(FERROR, "push_dir %s failed: %s (3)\n",
62                         full_fname(dir), strerror(errno));