version 1.1, 1999/11/18 16:29:01 |
version 1.2, 1999/12/10 06:45:11 |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: defaults.c,v 1.12 1999/11/05 22:11:55 millert Exp $"; |
static const char rcsid[] = "$Sudo: defaults.c,v 1.13 1999/12/02 20:31:24 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
"log_year", T_FLAG, { 0 }, |
"log_year", T_FLAG, { 0 }, |
"Log the year in the (non-syslog) log file" |
"Log the year in the (non-syslog) log file" |
}, { |
}, { |
"shell_noargs", T_FLAG, { 0 }, |
|
"If sudo is invoked with no arguments, start a shell" |
|
}, { |
|
"set_home", T_FLAG, { 0 }, |
"set_home", T_FLAG, { 0 }, |
"Set $HOME to the target user when starting a shell with -s" |
"Set $HOME to the target user when starting a shell with -s" |
}, { |
}, { |
|
|
int op; /* TRUE or FALSE */ |
int op; /* TRUE or FALSE */ |
{ |
{ |
struct sudo_defs_types *cur; |
struct sudo_defs_types *cur; |
|
int num; |
|
|
for (cur = sudo_defs_table; cur->name; cur++) { |
for (cur = sudo_defs_table, num = 0; cur->name; cur++, num++) { |
if (strcmp(var, cur->name) == 0) |
if (strcmp(var, cur->name) == 0) |
break; |
break; |
} |
} |
|
|
return(FALSE); |
return(FALSE); |
} |
} |
cur->sd_un.flag = op; |
cur->sd_un.flag = op; |
|
|
|
/* Special action for I_FQDN. Move to own switch if we get more */ |
|
if (num == I_FQDN && op) |
|
set_fqdn(); |
break; |
break; |
} |
} |
|
|
|
|
#ifdef HOST_IN_LOG |
#ifdef HOST_IN_LOG |
def_flag(I_LOG_HOST) = TRUE; |
def_flag(I_LOG_HOST) = TRUE; |
#endif |
#endif |
#ifdef SHELL_IF_NO_ARGS |
|
def_flag(I_SHELL_NOARGS) = TRUE; |
|
#endif |
|
#ifdef SHELL_SETS_HOME |
#ifdef SHELL_SETS_HOME |
def_flag(I_SET_HOME) = TRUE; |
def_flag(I_SET_HOME) = TRUE; |
#endif |
#endif |
|
|
return(FALSE); /* not found */ |
return(FALSE); /* not found */ |
|
|
/* Store both name and number. */ |
/* Store both name and number. */ |
if (def->sd_un.str) |
if (def->sd_un.str) { |
free(def->sd_un.str); |
free(def->sd_un.str); |
|
closelog(); |
|
} |
|
openlog("sudo", 0, fac->num); |
def->sd_un.str = estrdup(fac->name); |
def->sd_un.str = estrdup(fac->name); |
sudo_defs_table[I_LOGFAC].sd_un.ival = fac->num; |
sudo_defs_table[I_LOGFAC].sd_un.ival = fac->num; |
#else |
#else |
if (def->sd_un.str) |
if (def->sd_un.str) { |
free(def->sd_un.str); |
free(def->sd_un.str); |
|
closelog(); |
|
} |
|
openlog("sudo", 0); |
def->sd_un.str = estrdup("default"); |
def->sd_un.str = estrdup("default"); |
#endif /* LOG_NFACILITIES */ |
#endif /* LOG_NFACILITIES */ |
return(TRUE); |
return(TRUE); |