diff --git a/logging.c b/logging.c index c3f665fed..d70d85b4f 100644 --- a/logging.c +++ b/logging.c @@ -269,6 +269,12 @@ void log_error(code) tty, cwd, runas_user); break; + case NO_CMND_SAFE: + (void) sprintf(p, + "internal error, cmnd_safe never got set for %s; %s", cmnd, + "please report this error to sudo-bugs@courtesan.com"); + break; + #ifdef HAVE_KERB5 case GLOBAL_KRB5_INIT_ERR: (void) sprintf(p, "Could not initialize Kerberos V"); @@ -662,6 +668,11 @@ void inform_user(code) "Resource allocation failure.\n"); break; + case NO_CMND_SAFE: + (void) fprintf(stderr, + "Internal error, cmnd_safe never got set for %s\n", cmnd); + break; + default: (void) fprintf(stderr, "Something weird happened.\n\n"); @@ -720,6 +731,7 @@ static int appropriate(code) case BAD_STAMPDIR: case BAD_STAMPFILE: case BAD_ALLOCATION: + case NO_CMND_SAFE: default: return (1); break; diff --git a/sudo.c b/sudo.c index cbb7cd3b2..98ef37419 100644 --- a/sudo.c +++ b/sudo.c @@ -333,6 +333,11 @@ int main(argc, argv) if ((sudo_mode & MODE_RESET_HOME) && runas_homedir) (void) sudo_setenv("HOME", runas_homedir); + /* this *must* have been set if we got a match but... */ + if (cmnd_safe == NULL) { + inform_user(NO_CMND_SAFE); + exit(1); + } #ifndef PROFILING if ((sudo_mode & MODE_BACKGROUND) && fork() > 0) exit(0); diff --git a/sudo.h b/sudo.h index 9d0a93931..0ac1b6903 100644 --- a/sudo.h +++ b/sudo.h @@ -161,8 +161,9 @@ struct generic_alias { #define BAD_STAMPDIR 0x0C #define BAD_STAMPFILE 0x0D #define BAD_ALLOCATION 0x0E +#define NO_CMND_SAFE 0x0F #ifdef HAVE_KERB5 -#define GLOBAL_KRB5_INIT_ERR ( 0x0F | GLOBAL_PROBLEM ) +#define GLOBAL_KRB5_INIT_ERR ( 0x10 | GLOBAL_PROBLEM ) #endif /* HAVE_KERB5 */ /*