version 1.12, 2004/11/29 17:29:05 |
version 1.13, 2007/07/26 16:10:16 |
|
|
/* |
/* |
* Copyright (c) 1999-2001, 2003-2004 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1999-2005 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 |
|
|
* Materiel Command, USAF, under agreement number F39502-99-1-0512. |
* Materiel Command, USAF, under agreement number F39502-99-1-0512. |
*/ |
*/ |
|
|
#include "config.h" |
#include <config.h> |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/param.h> |
#include <sys/param.h> |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: defaults.c,v 1.48 2004/06/06 23:58:10 millert Exp $"; |
__unused static const char rcsid[] = "$Sudo: defaults.c,v 1.48.2.5 2007/06/18 15:51:35 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
for (def = sudo_defs_table; def->name; def++) |
for (def = sudo_defs_table; def->name; def++) |
switch (def->type & T_MASK) { |
switch (def->type & T_MASK) { |
case T_STR: |
case T_STR: |
if (def->sd_un.str) { |
efree(def->sd_un.str); |
free(def->sd_un.str); |
def->sd_un.str = NULL; |
def->sd_un.str = NULL; |
|
} |
|
break; |
break; |
case T_LIST: |
case T_LIST: |
list_op(NULL, 0, def, freeall); |
list_op(NULL, 0, def, freeall); |
|
|
#ifdef ENV_EDITOR |
#ifdef ENV_EDITOR |
def_env_editor = TRUE; |
def_env_editor = TRUE; |
#endif |
#endif |
|
def_env_reset = TRUE; |
def_set_logname = TRUE; |
def_set_logname = TRUE; |
|
|
/* Syslog options need special care since they both strings and ints */ |
/* Syslog options need special care since they both strings and ints */ |
|
|
int op; |
int op; |
{ |
{ |
|
|
if (def->sd_un.str) |
efree(def->sd_un.str); |
free(def->sd_un.str); |
|
if (op == FALSE) |
if (op == FALSE) |
def->sd_un.str = NULL; |
def->sd_un.str = NULL; |
else |
else |
|
|
for (cur = def->sd_un.list; cur; ) { |
for (cur = def->sd_un.list; cur; ) { |
tmp = cur; |
tmp = cur; |
cur = tmp->next; |
cur = tmp->next; |
free(tmp->value); |
efree(tmp->value); |
free(tmp); |
efree(tmp); |
} |
} |
def->sd_un.list = NULL; |
def->sd_un.list = NULL; |
return; |
return; |
|
|
prev->next = cur->next; |
prev->next = cur->next; |
else |
else |
def->sd_un.list = cur->next; |
def->sd_un.list = cur->next; |
free(cur->value); |
efree(cur->value); |
free(cur); |
efree(cur); |
break; |
break; |
} |
} |
} |
} |