X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/5d935dce63ae975db0efc23e3d94c32b17424444..24d677fc16b62a3b6c320e3edb5016b5fa193e8b:/options.c diff --git a/options.c b/options.c index 4331fc65..77d52f3e 100644 --- a/options.c +++ b/options.c @@ -25,6 +25,7 @@ extern int module_id; extern int sanitize_paths; +extern int daemon_over_rsh; extern struct filter_list_struct filter_list; extern struct filter_list_struct server_filter_list; @@ -95,7 +96,6 @@ int recurse = 0; int allow_inc_recurse = 1; int xfer_dirs = -1; int am_daemon = 0; -int daemon_over_rsh = 0; int do_stats = 0; int do_progress = 0; int keep_partial = 0; @@ -122,10 +122,15 @@ long block_size = 0; /* "long" because popt can't set an int32. */ char *skip_compress = NULL; /** Network address family. **/ +int default_af_hint #ifdef INET6 -int default_af_hint = 0; /* Any protocol */ + = 0; /* Any protocol */ #else -int default_af_hint = AF_INET; /* Must use IPv4 */ + = AF_INET; /* Must use IPv4 */ +# ifdef AF_INET6 +# undef AF_INET6 +# endif +# define AF_INET6 AF_INET /* make -6 option a no-op */ #endif /** Do not go into the background when run as --daemon. Good @@ -329,7 +334,7 @@ void usage(enum logcode F) rprintf(F," -A, --acls preserve ACLs (implies --perms)\n"); #endif #ifdef SUPPORT_XATTRS - rprintf(F," -X, --xattrs preserve extended attributes (implies --perms)\n"); + rprintf(F," -X, --xattrs preserve extended attributes\n"); #endif rprintf(F," -o, --owner preserve owner (super-user only)\n"); rprintf(F," -g, --group preserve group\n"); @@ -414,10 +419,8 @@ void usage(enum logcode F) #ifdef ICONV_OPTION rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filesnames\n"); #endif -#ifdef INET6 rprintf(F," -4, --ipv4 prefer IPv4\n"); rprintf(F," -6, --ipv6 prefer IPv6\n"); -#endif rprintf(F," --version print version number\n"); rprintf(F,"(-h) --help show this help (-h works with no other options)\n"); @@ -593,10 +596,8 @@ static struct poptOption long_options[] = { #ifdef ICONV_OPTION {"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 }, #endif -#ifdef INET6 {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, -#endif {"8-bit-output", '8', POPT_ARG_NONE, &allow_8bit_chars, 0, 0, 0 }, {"qsort", 0, POPT_ARG_NONE, &use_qsort, 0, 0, 0 }, {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, @@ -632,10 +633,8 @@ static void daemon_usage(enum logcode F) rprintf(F," --log-file-format=FMT override the \"log format\" setting\n"); rprintf(F," --sockopts=OPTIONS specify custom TCP options\n"); rprintf(F," -v, --verbose increase verbosity\n"); -#ifdef INET6 rprintf(F," -4, --ipv4 prefer IPv4\n"); rprintf(F," -6, --ipv6 prefer IPv6\n"); -#endif rprintf(F," --help show this help screen\n"); rprintf(F,"\n"); @@ -649,10 +648,8 @@ static struct poptOption long_daemon_options[] = { {"bwlimit", 0, POPT_ARG_INT, &daemon_bwlimit, 0, 0, 0 }, {"config", 0, POPT_ARG_STRING, &config_file, 0, 0, 0 }, {"daemon", 0, POPT_ARG_NONE, &daemon_opt, 0, 0, 0 }, -#ifdef INET6 {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, -#endif {"detach", 0, POPT_ARG_VAL, &no_detach, 0, 0, 0 }, {"no-detach", 0, POPT_ARG_VAL, &no_detach, 1, 0, 0 }, {"log-file", 0, POPT_ARG_STRING, &logfile_name, 0, 0, 0 }, @@ -1190,7 +1187,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain) case 'X': #ifdef SUPPORT_XATTRS preserve_xattrs++; - preserve_perms = 1; break; #else snprintf(err_buf,sizeof(err_buf), @@ -1617,7 +1613,7 @@ void server_options(char **args,int *argc) /* This should always remain first on the server's command-line. */ args[ac++] = "--server"; - if (daemon_over_rsh) { + if (daemon_over_rsh > 0) { args[ac++] = "--daemon"; *argc = ac; /* if we're passing --daemon, we're done */ @@ -1981,7 +1977,7 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr) if (p[1] == ':') *port_ptr = atoi(p+2); } else { - if ((p = strchr(s, ':')) != NULL) { + if ((p = strchr(s, ':')) != NULL && p < s + hostlen) { hostlen = p - s; *port_ptr = atoi(p+1); }