[BACK]Return to defaults.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Diff for /src/usr.bin/sudo/Attic/defaults.c between version 1.8 and 1.9

version 1.8, 2002/01/03 03:49:16 version 1.9, 2003/04/03 19:15:34
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1999-2001 Todd C. Miller <Todd.Miller@courtesan.com>   * Copyright (c) 1999-2001, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
Line 55 
Line 55 
 # ifdef HAVE_UNISTD_H  # ifdef HAVE_UNISTD_H
 #include <unistd.h>  #include <unistd.h>
 #endif /* HAVE_UNISTD_H */  #endif /* HAVE_UNISTD_H */
   #ifdef HAVE_ERR_H
   # include <err.h>
   #else
   # include "emul/err.h"
   #endif /* HAVE_ERR_H */
 #include <ctype.h>  #include <ctype.h>
   
 #include "sudo.h"  #include "sudo.h"
   
 #ifndef lint  #ifndef lint
 static const char rcsid[] = "$Sudo: defaults.c,v 1.38 2001/12/30 18:40:09 millert Exp $";  static const char rcsid[] = "$Sudo: defaults.c,v 1.39 2003/04/02 18:25:19 millert Exp $";
 #endif /* lint */  #endif /* lint */
   
 /*  /*
Line 219 
Line 224 
             break;              break;
     }      }
     if (!cur->name) {      if (!cur->name) {
         (void) fprintf(stderr,          warnx("unknown defaults entry `%s' referenced near line %d",
             "%s: unknown defaults entry `%s' referenced near line %d\n", Argv[0],  
             var, sudolineno);              var, sudolineno);
         return(FALSE);          return(FALSE);
     }      }
Line 229 
Line 233 
         case T_LOGFAC:          case T_LOGFAC:
             if (!store_syslogfac(val, cur, op)) {              if (!store_syslogfac(val, cur, op)) {
                 if (val)                  if (val)
                     (void) fprintf(stderr,                      warnx("value `%s' is invalid for option `%s'", val, var);
                         "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                         val, var);  
                 else                  else
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                 return(FALSE);                  return(FALSE);
             }              }
Line 242 
Line 243 
         case T_LOGPRI:          case T_LOGPRI:
             if (!store_syslogpri(val, cur, op)) {              if (!store_syslogpri(val, cur, op)) {
                 if (val)                  if (val)
                     (void) fprintf(stderr,                      warnx("value `%s' is invalid for option `%s'", val, var);
                         "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                         val, var);  
                 else                  else
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                 return(FALSE);                  return(FALSE);
             }              }
Line 255 
Line 253 
         case T_PWFLAG:          case T_PWFLAG:
             if (!store_pwflag(val, cur, op)) {              if (!store_pwflag(val, cur, op)) {
                 if (val)                  if (val)
                     (void) fprintf(stderr,                      warnx("value `%s' is invalid for option `%s'", val, var);
                         "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                         val, var);  
                 else                  else
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                 return(FALSE);                  return(FALSE);
             }              }
Line 269 
Line 264 
             if (!val) {              if (!val) {
                 /* Check for bogus boolean usage or lack of a value. */                  /* Check for bogus boolean usage or lack of a value. */
                 if (!(cur->type & T_BOOL) || op != FALSE) {                  if (!(cur->type & T_BOOL) || op != FALSE) {
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                     return(FALSE);                      return(FALSE);
                 }                  }
             }              }
             if ((cur->type & T_PATH) && val && *val != '/') {              if ((cur->type & T_PATH) && val && *val != '/') {
                 (void) fprintf(stderr,                  warnx("values for `%s' must start with a '/'", var);
                     "%s: values for `%s' must start with a '/'\n", Argv[0],  
                     var);  
                 return(FALSE);                  return(FALSE);
             }              }
             if (!store_str(val, cur, op)) {              if (!store_str(val, cur, op)) {
                 (void) fprintf(stderr,                  warnx("value `%s' is invalid for option `%s'", val, var);
                     "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                     val, var);  
                 return(FALSE);                  return(FALSE);
             }              }
             break;              break;
Line 292 
Line 282 
             if (!val) {              if (!val) {
                 /* Check for bogus boolean usage or lack of a value. */                  /* Check for bogus boolean usage or lack of a value. */
                 if (!(cur->type & T_BOOL) || op != FALSE) {                  if (!(cur->type & T_BOOL) || op != FALSE) {
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                     return(FALSE);                      return(FALSE);
                 }                  }
             }              }
             if (!store_int(val, cur, op)) {              if (!store_int(val, cur, op)) {
                 (void) fprintf(stderr,                  warnx("value `%s' is invalid for option `%s'", val, var);
                     "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                     val, var);  
                 return(FALSE);                  return(FALSE);
             }              }
             break;              break;
Line 309 
Line 296 
             if (!val) {              if (!val) {
                 /* Check for bogus boolean usage or lack of a value. */                  /* Check for bogus boolean usage or lack of a value. */
                 if (!(cur->type & T_BOOL) || op != FALSE) {                  if (!(cur->type & T_BOOL) || op != FALSE) {
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                     return(FALSE);                      return(FALSE);
                 }                  }
             }              }
             if (!store_uint(val, cur, op)) {              if (!store_uint(val, cur, op)) {
                 (void) fprintf(stderr,                  warnx("value `%s' is invalid for option `%s'", val, var);
                     "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                     val, var);  
                 return(FALSE);                  return(FALSE);
             }              }
             break;              break;
Line 326 
Line 310 
             if (!val) {              if (!val) {
                 /* Check for bogus boolean usage or lack of a value. */                  /* Check for bogus boolean usage or lack of a value. */
                 if (!(cur->type & T_BOOL) || op != FALSE) {                  if (!(cur->type & T_BOOL) || op != FALSE) {
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                     return(FALSE);                      return(FALSE);
                 }                  }
             }              }
             if (!store_mode(val, cur, op)) {              if (!store_mode(val, cur, op)) {
                 (void) fprintf(stderr,                  warnx("value `%s' is invalid for option `%s'", val, var);
                     "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                     val, var);  
                 return(FALSE);                  return(FALSE);
             }              }
             break;              break;
         case T_FLAG:          case T_FLAG:
             if (val) {              if (val) {
                 (void) fprintf(stderr,                  warnx("option `%s' does not take a value on line %d",
                     "%s: option `%s' does not take a value on line %d\n",                      var, sudolineno);
                     Argv[0], var, sudolineno);  
                 return(FALSE);                  return(FALSE);
             }              }
             cur->sd_un.flag = op;              cur->sd_un.flag = op;
Line 356 
Line 336 
             if (!val) {              if (!val) {
                 /* Check for bogus boolean usage or lack of a value. */                  /* Check for bogus boolean usage or lack of a value. */
                 if (!(cur->type & T_BOOL) || op != FALSE) {                  if (!(cur->type & T_BOOL) || op != FALSE) {
                     (void) fprintf(stderr,                      warnx("no value specified for `%s' on line %d",
                         "%s: no value specified for `%s' on line %d\n", Argv[0],  
                         var, sudolineno);                          var, sudolineno);
                     return(FALSE);                      return(FALSE);
                 }                  }
             }              }
             if (!store_list(val, cur, op)) {              if (!store_list(val, cur, op)) {
                 (void) fprintf(stderr,                  warnx("value `%s' is invalid for option `%s'", val, var);
                     "%s: value '%s' is invalid for option '%s'\n", Argv[0],  
                     val, var);  
                 return(FALSE);                  return(FALSE);
             }              }
     }      }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9