]> granicus.if.org Git - sudo/commitdiff
catch case where cmnd_safe is not set (this should not be possible)
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Apr 1999 04:37:35 +0000 (04:37 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Apr 1999 04:37:35 +0000 (04:37 +0000)
logging.c
sudo.c
sudo.h

index c3f665fed65cecb6591dc30c29e302257ab39abe..d70d85b4f16e4bceb14556ca051e3a25b3166004 100644 (file)
--- 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 cbb7cd3b23993d1d0a3204ef7e9cafb5c913bab4..98ef37419c05f836060446678117ca6988c93337 100644 (file)
--- 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 9d0a93931b4dfe7fa121a2047b337694c5a5f2ee..0ac1b6903193259c5a70863a35fa1bbddc475f0f 100644 (file)
--- 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 */
 
 /*