io_start_multiplex_out(fd);
if (!ret) {
- rprintf(FERROR,"Error parsing options (unsupported option?) - aborting\n");
- exit_cleanup(RERR_SYNTAX);
+ option_error();
}
if (lp_timeout(i)) {
char *exclude;
char *exclude_from;
char *log_format;
+ char *refuse_options;
int timeout;
} service;
NULL, /* exclude */
NULL, /* exclude from */
"%o %h [%a] %m (%u) %f %l", /* log format */
+ NULL, /* refuse options */
0 /* timeout */
};
{"exclude from", P_STRING, P_LOCAL, &sDefault.exclude_from,NULL, 0},
{"transfer logging", P_BOOL, P_LOCAL, &sDefault.transfer_logging,NULL,0},
{"log format", P_STRING, P_LOCAL, &sDefault.log_format, NULL, 0},
+ {"refuse options", P_STRING, P_LOCAL, &sDefault.refuse_options,NULL, 0},
{NULL, P_BOOL, P_NONE, NULL, NULL, 0}
};
FN_LOCAL_STRING(lp_exclude, exclude)
FN_LOCAL_STRING(lp_exclude_from, exclude_from)
FN_LOCAL_STRING(lp_log_format, log_format)
+FN_LOCAL_STRING(lp_refuse_options, refuse_options)
FN_LOCAL_INTEGER(lp_timeout, timeout)
/* local prototypes */
{0,0,0,0}};
+static char err_buf[100];
+
+void option_error(void)
+{
+ if (err_buf[0]) {
+ rprintf(FLOG,"%s", err_buf);
+ rprintf(FERROR,"%s", err_buf);
+ } else {
+ rprintf(FLOG,"Error parsing options - unsupported option?\n");
+ rprintf(FERROR,"Error parsing options - unsupported option?\n");
+ }
+ exit_cleanup(RERR_UNSUPPORTED);
+}
+
+/* check to see if we should refuse this option */
+static int check_refuse_options(char *ref, int opt)
+{
+ int i, len;
+ char *p;
+ const char *name;
+
+ for (i=0; long_options[i].name; i++) {
+ if (long_options[i].val == opt) break;
+ }
+
+ if (!long_options[i].name) return 0;
+
+ name = long_options[i].name;
+ len = strlen(name);
+
+ while ((p = strstr(ref,name))) {
+ if (p[len] == ' ' || p[len] == 0) {
+ slprintf(err_buf,sizeof(err_buf),
+ "The '%s' option is not supported by this server\n", name);
+ return 1;
+ }
+ ref += len;
+ }
+ return 0;
+}
+
+
int parse_arguments(int argc, char *argv[])
{
int opt;
int option_index;
+ char *ref = lp_refuse_options(module_id);
while ((opt = getopt_long(argc, argv,
short_options, long_options, &option_index))
!= -1) {
+
+ if (ref) {
+ if (check_refuse_options(ref, opt)) return 0;
+ }
+
switch (opt) {
case OPT_VERSION:
rprintf(FINFO,"rsync version %s protocol version %d\n\n",
#if SUPPORT_HARD_LINKS
preserve_hard_links=1;
#else
+ slprintf(err_buf,sizeof(err_buf),"hard links are not supported on this server\n");
rprintf(FERROR,"ERROR: hard links not supported on this platform\n");
return 0;
#endif
break;
default:
+ slprintf(err_buf,sizeof(err_buf),"unrecognised option\n");
return 0;
}
}
default. A good choice for anonymous rsync servers may be 600 (giving
a 10 minute timeout).
+dit(bf(refuse options)) The "refuse options" option allows you to
+specify a space separated list of rsync command line options that will
+be refused by your rsync server. When an option is refused the server
+prints an error message and exits.
+
+The full names of the options must be used (ie. you must use
+"compress" not "z" to disable compression).
+
enddit()
manpagesection(AUTHENTICATION STRENGTH)