From 7a92ded39a3f278dc31323ccddb680748db5b7ab Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 19 May 2004 22:19:19 +0000 Subject: [PATCH] Added the "write only" option to the daemon config file. --- loadparm.c | 4 ++++ main.c | 6 ++++++ rsyncd.conf.yo | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/loadparm.c b/loadparm.c index dfadc444..5df51b42 100644 --- a/loadparm.c +++ b/loadparm.c @@ -119,6 +119,7 @@ typedef struct char *comment; char *lock_file; BOOL read_only; + BOOL write_only; BOOL list; BOOL use_chroot; BOOL transfer_logging; @@ -151,6 +152,7 @@ static service sDefault = NULL, /* comment */ DEFAULT_LOCK_FILE, /* lock file */ True, /* read only */ + False, /* write only */ True, /* list */ True, /* use chroot */ False, /* transfer logging */ @@ -277,6 +279,7 @@ static struct parm_struct parm_table[] = {"lock file", P_STRING, P_LOCAL, &sDefault.lock_file, NULL, 0}, {"path", P_PATH, P_LOCAL, &sDefault.path, NULL, 0}, {"read only", P_BOOL, P_LOCAL, &sDefault.read_only, NULL, 0}, + {"write only", P_BOOL, P_LOCAL, &sDefault.write_only, NULL, 0}, {"list", P_BOOL, P_LOCAL, &sDefault.list, NULL, 0}, {"use chroot", P_BOOL, P_LOCAL, &sDefault.use_chroot, NULL, 0}, {"ignore nonreadable",P_BOOL, P_LOCAL, &sDefault.ignore_nonreadable, NULL, 0}, @@ -356,6 +359,7 @@ FN_LOCAL_STRING(lp_comment, comment) FN_LOCAL_STRING(lp_path, path) FN_LOCAL_STRING(lp_lock_file, lock_file) FN_LOCAL_BOOL(lp_read_only, read_only) +FN_LOCAL_BOOL(lp_write_only, write_only) FN_LOCAL_BOOL(lp_list, list) FN_LOCAL_BOOL(lp_use_chroot, use_chroot) FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging) diff --git a/main.c b/main.c index 915d1dff..0aeb29c0 100644 --- a/main.c +++ b/main.c @@ -369,6 +369,12 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[]) (long)getpid()); } + if (am_daemon && lp_write_only(module_id) && am_sender) { + rprintf(FERROR, "ERROR: module is write only\n"); + exit_cleanup(RERR_SYNTAX); + return; + } + if (!relative_paths && !push_dir(dir)) { rsyserr(FERROR, errno, "push_dir#3 %s failed", full_fname(dir)); diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo index aad08f2c..3a631dcd 100644 --- a/rsyncd.conf.yo +++ b/rsyncd.conf.yo @@ -179,6 +179,12 @@ attempted uploads will fail. If "read only" is false then uploads will be possible if file permissions on the server allow them. The default is for all modules to be read only. +dit(bf(write only)) The "write only" option determines whether clients +will be able to download files or not. If "write only" is true then any +attempted downloads will fail. If "write only" is false then downloads +will be possible if file permissions on the server allow them. The +default is for this option to be disabled. + dit(bf(list)) The "list" option determines if this module should be listed when the client asks for a listing of available modules. By setting this to false you can create hidden modules. The default is -- 2.34.1