Diff for /embedaddon/sudo/src/hooks.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/05/29 12:26:49 version 1.1.1.2, 2012/10/09 09:29:52
Line 60  static struct sudo_hook_list *sudo_hook_unsetenv_list; Line 60  static struct sudo_hook_list *sudo_hook_unsetenv_list;
 static struct sudo_hook_list *sudo_hook_getenv_list;  static struct sudo_hook_list *sudo_hook_getenv_list;
 static struct sudo_hook_list *sudo_hook_putenv_list;  static struct sudo_hook_list *sudo_hook_putenv_list;
   
   /* NOTE: must not anything that might call setenv() */
 int  int
 process_hooks_setenv(const char *name, const char *value, int overwrite)  process_hooks_setenv(const char *name, const char *value, int overwrite)
 {  {
     struct sudo_hook_list *hook;      struct sudo_hook_list *hook;
     int rc = SUDO_HOOK_RET_NEXT;      int rc = SUDO_HOOK_RET_NEXT;
     debug_decl(process_hooks_setenv, SUDO_DEBUG_HOOKS)  
   
     /* First process the hooks. */      /* First process the hooks. */
     for (hook = sudo_hook_setenv_list; hook != NULL; hook = hook->next) {      for (hook = sudo_hook_setenv_list; hook != NULL; hook = hook->next) {
Line 77  process_hooks_setenv(const char *name, const char *val Line 77  process_hooks_setenv(const char *name, const char *val
             case SUDO_HOOK_RET_STOP:              case SUDO_HOOK_RET_STOP:
                 goto done;                  goto done;
             default:              default:
                warningx("invalid setenv hook return value: %d", rc);                warningx2("invalid setenv hook return value: %d", rc);
                 break;                  break;
         }          }
     }      }
 done:  done:
    debug_return_int(rc);    return rc;
 }  }
   
   /* NOTE: must not anything that might call putenv() */
 int  int
 process_hooks_putenv(char *string)  process_hooks_putenv(char *string)
 {  {
     struct sudo_hook_list *hook;      struct sudo_hook_list *hook;
     int rc = SUDO_HOOK_RET_NEXT;      int rc = SUDO_HOOK_RET_NEXT;
     debug_decl(process_hooks_putenv, SUDO_DEBUG_HOOKS)  
   
     /* First process the hooks. */      /* First process the hooks. */
     for (hook = sudo_hook_putenv_list; hook != NULL; hook = hook->next) {      for (hook = sudo_hook_putenv_list; hook != NULL; hook = hook->next) {
Line 102  process_hooks_putenv(char *string) Line 102  process_hooks_putenv(char *string)
             case SUDO_HOOK_RET_STOP:              case SUDO_HOOK_RET_STOP:
                 goto done;                  goto done;
             default:              default:
                warningx("invalid putenv hook return value: %d", rc);                warningx2("invalid putenv hook return value: %d", rc);
                 break;                  break;
         }          }
     }      }
 done:  done:
    debug_return_int(rc);    return rc;
 }  }
   
   /* NOTE: must not anything that might call getenv() */
 int  int
 process_hooks_getenv(const char *name, char **value)  process_hooks_getenv(const char *name, char **value)
 {  {
     struct sudo_hook_list *hook;      struct sudo_hook_list *hook;
     char *val = NULL;      char *val = NULL;
     int rc = SUDO_HOOK_RET_NEXT;      int rc = SUDO_HOOK_RET_NEXT;
     debug_decl(process_hooks_getenv, SUDO_DEBUG_HOOKS)  
   
     /* First process the hooks. */      /* First process the hooks. */
     for (hook = sudo_hook_getenv_list; hook != NULL; hook = hook->next) {      for (hook = sudo_hook_getenv_list; hook != NULL; hook = hook->next) {
Line 128  process_hooks_getenv(const char *name, char **value) Line 128  process_hooks_getenv(const char *name, char **value)
             case SUDO_HOOK_RET_STOP:              case SUDO_HOOK_RET_STOP:
                 goto done;                  goto done;
             default:              default:
                warningx("invalid getenv hook return value: %d", rc);                warningx2("invalid getenv hook return value: %d", rc);
                 break;                  break;
         }          }
     }      }
 done:  done:
     if (val != NULL)      if (val != NULL)
         *value = val;          *value = val;
    debug_return_int(rc);    return rc;
 }  }
   
   /* NOTE: must not anything that might call unsetenv() */
 int  int
 process_hooks_unsetenv(const char *name)  process_hooks_unsetenv(const char *name)
 {  {
     struct sudo_hook_list *hook;      struct sudo_hook_list *hook;
     int rc = SUDO_HOOK_RET_NEXT;      int rc = SUDO_HOOK_RET_NEXT;
     debug_decl(process_hooks_unsetenv, SUDO_DEBUG_HOOKS)  
   
     /* First process the hooks. */      /* First process the hooks. */
     for (hook = sudo_hook_unsetenv_list; hook != NULL; hook = hook->next) {      for (hook = sudo_hook_unsetenv_list; hook != NULL; hook = hook->next) {
Line 155  process_hooks_unsetenv(const char *name) Line 155  process_hooks_unsetenv(const char *name)
             case SUDO_HOOK_RET_STOP:              case SUDO_HOOK_RET_STOP:
                 goto done;                  goto done;
             default:              default:
                warningx("invalid unsetenv hook return value: %d", rc);                warningx2("invalid unsetenv hook return value: %d", rc);
                 break;                  break;
         }          }
     }      }
 done:  done:
    debug_return_int(rc);    return rc;
 }  }
   
 /* Hook registration internals. */  /* Hook registration internals. */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


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