X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0c2e8f93643fd94a8d388e4373c30331d0af75b4..8b48c682855602589519cfc6f6c9598d6e462143:/options.c diff --git a/options.c b/options.c index 1f8f5721..dbde289e 100644 --- a/options.c +++ b/options.c @@ -3,7 +3,7 @@ * * Copyright (C) 1998-2001 Andrew Tridgell * Copyright (C) 2000, 2001, 2002 Martin Pool - * Copyright (C) 2002-2009 Wayne Davison + * Copyright (C) 2002-2010 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +93,7 @@ char *files_from = NULL; int filesfrom_fd = -1; char *filesfrom_host = NULL; int eol_nulls = 0; -int protect_args = 0; +int protect_args = -1; int human_readable = 1; int recurse = 0; int allow_inc_recurse = 1; @@ -277,7 +277,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = { DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"), DEBUG_WORD(GENR, W_REC, "Debug generator functions"), DEBUG_WORD(HASH, W_SND|W_REC, "Debug hashtable code"), - DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions"), + DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions (levels 1-3)"), DEBUG_WORD(ICONV, W_CLI|W_SRV, "Debug iconv character conversions (levels 1-2)"), DEBUG_WORD(IO, W_CLI|W_SRV, "Debug I/O routines (levels 1-4)"), DEBUG_WORD(OWN, W_REC, "Debug ownership changes in users & groups (levels 1-2)"), @@ -603,7 +603,7 @@ static void print_rsync_version(enum logcode f) rprintf(f, "%s version %s protocol version %d%s\n", RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol); - rprintf(f, "Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.\n"); + rprintf(f, "Copyright (C) 1996-2010 by Andrew Tridgell, Wayne Davison, and others.\n"); rprintf(f, "Web site: http://rsync.samba.org/\n"); rprintf(f, "Capabilities:\n"); rprintf(f, " %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n", @@ -889,8 +889,8 @@ static struct poptOption long_options[] = { {"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 }, {"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 }, {"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 }, - {"no-one-file-system",'x',POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, - {"no-x", 'x', POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, + {"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, + {"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, {"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 }, {"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 }, {"ignore-non-existing",0,POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 }, @@ -1278,7 +1278,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) } #ifdef ICONV_OPTION - if (!am_daemon && !protect_args && (arg = getenv("RSYNC_ICONV")) != NULL && *arg) + if (!am_daemon && protect_args <= 0 && (arg = getenv("RSYNC_ICONV")) != NULL && *arg) iconv_opt = strdup(arg); #endif @@ -1333,6 +1333,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) #ifdef ICONV_OPTION iconv_opt = NULL; #endif + protect_args = 0; poptFreeContext(pc); pc = poptGetContext(RSYNC_NAME, argc, argv, long_daemon_options, 0); @@ -1778,6 +1779,20 @@ int parse_arguments(int *argc_p, const char ***argv_p) } } + if (protect_args < 0) { + if (am_server) + protect_args = 0; + else if ((arg = getenv("RSYNC_PROTECT_ARGS")) != NULL && *arg) + protect_args = atoi(arg) ? 1 : 0; + else { +#ifdef RSYNC_USE_PROTECTED_ARGS + protect_args = 1; +#else + protect_args = 0; +#endif + } + } + if (human_readable > 1 && argc == 2 && !am_server) { /* Allow the old meaning of 'h' (--help) on its own. */ usage(FINFO);