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

Diff for /src/usr.bin/sudo/Attic/env.c between version 1.10 and 1.11

version 1.10, 2004/11/12 16:37:38 version 1.11, 2004/11/17 18:14:06
Line 88 
Line 88 
  */   */
 static const char *initial_badenv_table[] = {  static const char *initial_badenv_table[] = {
     "IFS",      "IFS",
       "CDPATH",
     "LOCALDOMAIN",      "LOCALDOMAIN",
     "RES_OPTIONS",      "RES_OPTIONS",
     "HOSTALIASES",      "HOSTALIASES",
Line 141 
Line 142 
 static size_t env_len;          /* number of slots used, not counting NULL */  static size_t env_len;          /* number of slots used, not counting NULL */
   
 /*  /*
  * Zero out environment and replace with a minimal set of   * Zero out environment and replace with a minimal set of KRB5CCNAME
  * USER, LOGNAME, HOME, TZ, PATH (XXX - should just set path to default)   * USER, LOGNAME, HOME, TZ, PATH (XXX - should just set path to default)
  * May set user_path, user_shell, and/or user_prompt as side effects.   * May set user_path, user_shell, and/or user_prompt as side effects.
  */   */
Line 149 
Line 150 
 zero_env(envp)  zero_env(envp)
     char **envp;      char **envp;
 {  {
     static char *newenv[8];      static char *newenv[9];
     char **ep, **nep = newenv;      char **ep, **nep = newenv;
       char **ne_last = &newenv[(sizeof(newenv) / sizeof(newenv[0])) - 1];
     extern char *prev_user;      extern char *prev_user;
   
     for (ep = envp; *ep; ep++) {      for (ep = envp; *ep; ep++) {
Line 159 
Line 161 
                 if (strncmp("HOME=", *ep, 5) == 0)                  if (strncmp("HOME=", *ep, 5) == 0)
                     break;                      break;
                 continue;                  continue;
               case 'K':
                   if (strncmp("KRB5CCNAME=", *ep, 11) == 0)
                       break;
                   continue;
             case 'L':              case 'L':
                 if (strncmp("LOGNAME=", *ep, 8) == 0)                  if (strncmp("LOGNAME=", *ep, 8) == 0)
                     break;                      break;
Line 195 
Line 201 
             if (**nep == **ep)              if (**nep == **ep)
                 break;                  break;
         }          }
         if (*nep == NULL)          if (*nep == NULL) {
             *nep++ = *ep;              if (nep < ne_last)
                   *nep++ = *ep;
               else
                   errx(1, "internal error, attempt to write outside newenv");
           }
     }      }
   
 #ifdef HAVE_LDAP  #ifdef HAVE_LDAP
Line 205 
Line 215 
      * or files in the current directory.       * or files in the current directory.
      *       *
      */       */
     *nep++ = "LDAPNOINIT=1";      if (nep < ne_last)
           *nep++ = "LDAPNOINIT=1";
       else
           errx(1, "internal error, attempt to write outside newenv");
 #endif  #endif
   
     return(&newenv[0]);      return(&newenv[0]);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11