Diff for /embedaddon/sudo/src/parse_args.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2012/10/09 09:29:52 version 1.1.1.4, 2013/07/22 10:46:13
Line 1 Line 1
 /*  /*
 * Copyright (c) 1993-1996, 1998-2012 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1993-1996, 1998-2013 Todd C. Miller <Todd.Miller@courtesan.com>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 21 Line 21
 #include <config.h>  #include <config.h>
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/param.h>  
   
 #include <stdio.h>  #include <stdio.h>
 #ifdef STDC_HEADERS  #ifdef STDC_HEADERS
Line 45 Line 44
 #include <grp.h>  #include <grp.h>
 #include <pwd.h>  #include <pwd.h>
   
#include <sudo_usage.h>#include "sudo_usage.h"
 #include "sudo.h"  #include "sudo.h"
 #include "lbuf.h"  #include "lbuf.h"
   
Line 108  static struct sudo_settings { Line 107  static struct sudo_settings {
     { "closefrom" },      { "closefrom" },
 #define ARG_NET_ADDRS 19  #define ARG_NET_ADDRS 19
     { "network_addrs" },      { "network_addrs" },
#define NUM_SETTINGS 20#define ARG_MAX_GROUPS 20
     { "max_groups" },
 #define ARG_PLUGIN_DIR 21
     { "plugin_dir" },
 #define NUM_SETTINGS 22
     { NULL }      { NULL }
 };  };
   
Line 151  parse_args(int argc, char **argv, int *nargc, char *** Line 154  parse_args(int argc, char **argv, int *nargc, char ***
     if (debug_flags != NULL)      if (debug_flags != NULL)
         sudo_settings[ARG_DEBUG_FLAGS].value = debug_flags;          sudo_settings[ARG_DEBUG_FLAGS].value = debug_flags;
   
       /* Set max_groups from sudo.conf. */
       i = sudo_conf_max_groups();
       if (i != -1) {
           easprintf(&cp, "%d", i);
           sudo_settings[ARG_MAX_GROUPS].value = cp;
       }
   
     /* Returns true if the last option string was "--" */      /* Returns true if the last option string was "--" */
 #define got_end_of_args (optind > 1 && argv[optind - 1][0] == '-' && \  #define got_end_of_args (optind > 1 && argv[optind - 1][0] == '-' && \
             argv[optind - 1][1] == '-' && argv[optind - 1][2] == '\0')              argv[optind - 1][1] == '-' && argv[optind - 1][2] == '\0')
Line 273  parse_args(int argc, char **argv, int *nargc, char *** Line 283  parse_args(int argc, char **argv, int *nargc, char ***
                     break;                      break;
                 case 'U':                  case 'U':
                     if ((getpwnam(optarg)) == NULL)                      if ((getpwnam(optarg)) == NULL)
                        errorx(1, _("unknown user: %s"), optarg);                        fatalx(_("unknown user: %s"), optarg);
                     list_user = optarg;                      list_user = optarg;
                     break;                      break;
                 case 'u':                  case 'u':
Line 419  parse_args(int argc, char **argv, int *nargc, char *** Line 429  parse_args(int argc, char **argv, int *nargc, char ***
     /*      /*
      * Format setting_pairs into settings array.       * Format setting_pairs into settings array.
      */       */
   #ifdef _PATH_SUDO_PLUGIN_DIR
       sudo_settings[ARG_PLUGIN_DIR].value = _PATH_SUDO_PLUGIN_DIR;
   #endif
     settings = emalloc2(NUM_SETTINGS + 1, sizeof(char *));      settings = emalloc2(NUM_SETTINGS + 1, sizeof(char *));
     for (i = 0, j = 0; i < NUM_SETTINGS; i++) {      for (i = 0, j = 0; i < NUM_SETTINGS; i++) {
         if (sudo_settings[i].value) {          if (sudo_settings[i].value) {
Line 427  parse_args(int argc, char **argv, int *nargc, char *** Line 440  parse_args(int argc, char **argv, int *nargc, char ***
             settings[j] = fmt_string(sudo_settings[i].name,              settings[j] = fmt_string(sudo_settings[i].name,
                 sudo_settings[i].value);                  sudo_settings[i].value);
             if (settings[j] == NULL)              if (settings[j] == NULL)
                errorx(1, _("unable to allocate memory"));                fatalx(NULL);
             j++;              j++;
         }          }
     }      }
Line 440  parse_args(int argc, char **argv, int *nargc, char *** Line 453  parse_args(int argc, char **argv, int *nargc, char ***
         argv--;          argv--;
         argv[0] = "sudoedit";          argv[0] = "sudoedit";
 #else  #else
        errorx(1, _("sudoedit is not supported on this platform"));        fatalx(_("sudoedit is not supported on this platform"));
 #endif  #endif
     }      }
   
Line 535  help(void) Line 548  help(void)
     usage(0);      usage(0);
   
     lbuf_append(&lbuf, _("\nOptions:\n"));      lbuf_append(&lbuf, _("\nOptions:\n"));
 #ifdef HAVE_BSD_AUTH_H  
     lbuf_append(&lbuf, "  -A            %s",      lbuf_append(&lbuf, "  -A            %s",
         _("use helper program for password prompting\n"));          _("use helper program for password prompting\n"));
#endif#ifdef HAVE_BSD_AUTH_H
     lbuf_append(&lbuf, "  -a type       %s",      lbuf_append(&lbuf, "  -a type       %s",
         _("use specified BSD authentication type\n"));          _("use specified BSD authentication type\n"));
   #endif
     lbuf_append(&lbuf, "  -b            %s",      lbuf_append(&lbuf, "  -b            %s",
         _("run command in the background\n"));          _("run command in the background\n"));
     lbuf_append(&lbuf, "  -C fd         %s",      lbuf_append(&lbuf, "  -C fd         %s",

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>