1 A crude attempt to add two new daemon module options:
6 The pre-exec command runs prior to the chroot() (if enabled) as the daemon user.
8 The post-exec command runs inside any chroot() as the module user.
10 You'll want to run "make proto" after applying this patch.
12 --- cleanup.c 5 Mar 2005 18:58:38 -0000 1.30
13 +++ cleanup.c 10 Jun 2005 21:25:24 -0000
18 +extern int am_daemon;
20 extern int keep_partial;
21 extern int log_got_error;
22 +extern int module_id;
23 extern char *partial_dir;
26 @@ -152,6 +154,16 @@ void _exit_cleanup(int code, const char
27 ocode, safe_fname(file), line, code);
31 + char *p = lp_post_exec(module_id);
34 + if (asprintf(&arg, "RSYNC_EXIT_STATUS=%d", code) == 0)
35 + putenv(arg); /* XXX Need configure support? */
36 + system(p); /* XXX Check for errors */
43 --- clientserver.c 10 Jun 2005 16:57:43 -0000 1.159
44 +++ clientserver.c 10 Jun 2005 21:25:25 -0000
45 @@ -347,6 +347,10 @@ static int rsync_module(int f_in, int f_
51 + system(p); /* XXX Check for errors */
55 * XXX: The 'use chroot' flag is a fairly reliable
56 --- loadparm.c 10 Jun 2005 16:57:43 -0000 1.59
57 +++ loadparm.c 10 Jun 2005 21:25:25 -0000
58 @@ -140,6 +140,8 @@ typedef struct
67 @@ -175,6 +177,8 @@ static service sDefault =
68 "%o %h [%a] %m (%u) %f %l", /* log format */
69 NULL, /* refuse options */
70 "*.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz", /* dont compress */
71 + NULL, /* pre_exec */
72 + NULL, /* post_exec */
74 0, /* max connections */
75 1, /* max verbosity */
76 @@ -298,6 +302,8 @@ static struct parm_struct parm_table[] =
77 {"log format", P_STRING, P_LOCAL, &sDefault.log_format, NULL, 0},
78 {"refuse options", P_STRING, P_LOCAL, &sDefault.refuse_options,NULL, 0},
79 {"dont compress", P_STRING, P_LOCAL, &sDefault.dont_compress,NULL, 0},
80 + {"pre-exec", P_STRING, P_LOCAL, &sDefault.pre_exec, NULL, 0},
81 + {"post-exec", P_STRING, P_LOCAL, &sDefault.post_exec, NULL, 0},
82 {NULL, P_BOOL, P_NONE, NULL, NULL, 0}
85 @@ -379,6 +385,8 @@ FN_LOCAL_STRING(lp_include_from, include
86 FN_LOCAL_STRING(lp_log_format, log_format)
87 FN_LOCAL_STRING(lp_refuse_options, refuse_options)
88 FN_LOCAL_STRING(lp_dont_compress, dont_compress)
89 +FN_LOCAL_STRING(lp_pre_exec, pre_exec)
90 +FN_LOCAL_STRING(lp_post_exec, post_exec)
91 FN_LOCAL_INTEGER(lp_timeout, timeout)
92 FN_LOCAL_INTEGER(lp_max_connections, max_connections)
93 FN_LOCAL_INTEGER(lp_max_verbosity, max_verbosity)