catch case where cmnd_safe is not set (this should not be possible)
This commit is contained in:
12
logging.c
12
logging.c
@@ -269,6 +269,12 @@ void log_error(code)
|
|||||||
tty, cwd, runas_user);
|
tty, cwd, runas_user);
|
||||||
break;
|
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
|
#ifdef HAVE_KERB5
|
||||||
case GLOBAL_KRB5_INIT_ERR:
|
case GLOBAL_KRB5_INIT_ERR:
|
||||||
(void) sprintf(p, "Could not initialize Kerberos V");
|
(void) sprintf(p, "Could not initialize Kerberos V");
|
||||||
@@ -662,6 +668,11 @@ void inform_user(code)
|
|||||||
"Resource allocation failure.\n");
|
"Resource allocation failure.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NO_CMND_SAFE:
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"Internal error, cmnd_safe never got set for %s\n", cmnd);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Something weird happened.\n\n");
|
"Something weird happened.\n\n");
|
||||||
@@ -720,6 +731,7 @@ static int appropriate(code)
|
|||||||
case BAD_STAMPDIR:
|
case BAD_STAMPDIR:
|
||||||
case BAD_STAMPFILE:
|
case BAD_STAMPFILE:
|
||||||
case BAD_ALLOCATION:
|
case BAD_ALLOCATION:
|
||||||
|
case NO_CMND_SAFE:
|
||||||
default:
|
default:
|
||||||
return (1);
|
return (1);
|
||||||
break;
|
break;
|
||||||
|
5
sudo.c
5
sudo.c
@@ -333,6 +333,11 @@ int main(argc, argv)
|
|||||||
if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
|
if ((sudo_mode & MODE_RESET_HOME) && runas_homedir)
|
||||||
(void) sudo_setenv("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
|
#ifndef PROFILING
|
||||||
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0)
|
if ((sudo_mode & MODE_BACKGROUND) && fork() > 0)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
3
sudo.h
3
sudo.h
@@ -161,8 +161,9 @@ struct generic_alias {
|
|||||||
#define BAD_STAMPDIR 0x0C
|
#define BAD_STAMPDIR 0x0C
|
||||||
#define BAD_STAMPFILE 0x0D
|
#define BAD_STAMPFILE 0x0D
|
||||||
#define BAD_ALLOCATION 0x0E
|
#define BAD_ALLOCATION 0x0E
|
||||||
|
#define NO_CMND_SAFE 0x0F
|
||||||
#ifdef HAVE_KERB5
|
#ifdef HAVE_KERB5
|
||||||
#define GLOBAL_KRB5_INIT_ERR ( 0x0F | GLOBAL_PROBLEM )
|
#define GLOBAL_KRB5_INIT_ERR ( 0x10 | GLOBAL_PROBLEM )
|
||||||
#endif /* HAVE_KERB5 */
|
#endif /* HAVE_KERB5 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user