added entries for new errors
This commit is contained in:
79
logging.c
79
logging.c
@@ -195,6 +195,37 @@ void log_error(code)
|
|||||||
#endif /* LOGGING & SLOG_SYSLOG */
|
#endif /* LOGGING & SLOG_SYSLOG */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_NO_OWNER:
|
||||||
|
(void) sprintf(p, "no passwd entry for sudoers file owner (%s) ",
|
||||||
|
SUDOERS_OWNER);
|
||||||
|
#if (LOGGING & SLOG_SYSLOG)
|
||||||
|
pri = Syslog_priority_NO;
|
||||||
|
#endif /* LOGGING & SLOG_SYSLOG */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_NOT_FILE:
|
||||||
|
(void) sprintf(p, "%s is not a regular file ", _PATH_SUDO_SUDOERS);
|
||||||
|
#if (LOGGING & SLOG_SYSLOG)
|
||||||
|
pri = Syslog_priority_NO;
|
||||||
|
#endif /* LOGGING & SLOG_SYSLOG */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_WRONG_OWNER:
|
||||||
|
(void) sprintf(p, "%s is not owned by %s ", _PATH_SUDO_SUDOERS,
|
||||||
|
SUDOERS_OWNER);
|
||||||
|
#if (LOGGING & SLOG_SYSLOG)
|
||||||
|
pri = Syslog_priority_NO;
|
||||||
|
#endif /* LOGGING & SLOG_SYSLOG */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_RW_OTHER:
|
||||||
|
(void) sprintf(p, "%s is readable or writeable by other than %s ",
|
||||||
|
_PATH_SUDO_SUDOERS, SUDOERS_OWNER);
|
||||||
|
#if (LOGGING & SLOG_SYSLOG)
|
||||||
|
pri = Syslog_priority_NO;
|
||||||
|
#endif /* LOGGING & SLOG_SYSLOG */
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
strcat(p, "found a wierd error : ");
|
strcat(p, "found a wierd error : ");
|
||||||
#if (LOGGING & SLOG_SYSLOG)
|
#if (LOGGING & SLOG_SYSLOG)
|
||||||
@@ -485,49 +516,75 @@ void inform_user(code)
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case VALIDATE_NO_USER:
|
case VALIDATE_NO_USER:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"%s is not in the sudoers file. This incident will be reported.\n\n",
|
"%s is not in the sudoers file. This incident will be reported.\n\n",
|
||||||
user);
|
user);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALIDATE_NOT_OK:
|
case VALIDATE_NOT_OK:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Sorry, user %s is not allowed to execute %s on %s.\n\n",
|
"Sorry, user %s is not allowed to execute %s on %s.\n\n",
|
||||||
user, cmnd, host);
|
user, cmnd, host);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALIDATE_ERROR:
|
case VALIDATE_ERROR:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Sorry, there is a fatal error in the sudoers file.\n\n");
|
"Sorry, there is a fatal error in the sudoers file.\n\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GLOBAL_NO_PW_ENT:
|
case GLOBAL_NO_PW_ENT:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Intruder Alert! You don\'t exist in the passwd file\n\n");
|
"Intruder Alert! You don\'t exist in the passwd file\n\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GLOBAL_NO_AUTH_ENT:
|
case GLOBAL_NO_AUTH_ENT:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Intruder Alert! You don\'t exist in the auth database\n\n");
|
"Intruder Alert! You don\'t exist in the auth database\n\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GLOBAL_NO_HOSTNAME:
|
case GLOBAL_NO_HOSTNAME:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"This machine does not have a hostname\n\n");
|
"This machine does not have a hostname\n\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GLOBAL_HOST_UNREGISTERED:
|
case GLOBAL_HOST_UNREGISTERED:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"This machine is not available via gethostbyname()\n\n");
|
"This machine is not available via gethostbyname()\n\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PASSWORD_NOT_CORRECT:
|
case PASSWORD_NOT_CORRECT:
|
||||||
(void) fprintf(stderr, "Password not entered correctly after %d tries\n\n",
|
(void) fprintf(stderr, "Password not entered correctly after %d tries\n\n",
|
||||||
TRIES_FOR_PASSWORD);
|
TRIES_FOR_PASSWORD);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_NO_OWNER:
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"No passwd entry for sudoers file owner (%s)\n", SUDOERS_OWNER);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NO_SUDOERS_FILE:
|
||||||
|
(void) fprintf(stderr, "Can't stat %s: ", _PATH_SUDO_SUDOERS);
|
||||||
|
perror("");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_NOT_FILE:
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"%s is not a regular file!\n", _PATH_SUDO_SUDOERS);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_WRONG_OWNER:
|
||||||
|
(void) fprintf(stderr, "%s is not owned by %s!\n",
|
||||||
|
_PATH_SUDO_SUDOERS, SUDOERS_OWNER);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUDOERS_RW_OTHER:
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"%s is readable or writeable by other than %s!\n",
|
||||||
|
_PATH_SUDO_SUDOERS, SUDOERS_OWNER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Something wierd happened.\n\n");
|
"Something wierd happened.\n\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
sudo.h
5
sudo.h
@@ -110,6 +110,11 @@ extern int top;
|
|||||||
#define ALL_SYSTEMS_GO 0x00
|
#define ALL_SYSTEMS_GO 0x00
|
||||||
#define NO_SUDOERS_FILE ( 0x05 | GLOBAL_PROBLEM )
|
#define NO_SUDOERS_FILE ( 0x05 | GLOBAL_PROBLEM )
|
||||||
#define GLOBAL_NO_AUTH_ENT ( 0x06 | GLOBAL_PROBLEM )
|
#define GLOBAL_NO_AUTH_ENT ( 0x06 | GLOBAL_PROBLEM )
|
||||||
|
#define BAD_SUDOERS_FILE ( 0x07 | GLOBAL_PROBLEM )
|
||||||
|
#define SUDOERS_NO_OWNER ( 0x08 | GLOBAL_PROBLEM )
|
||||||
|
#define SUDOERS_WRONG_OWNER ( 0x09 | GLOBAL_PROBLEM )
|
||||||
|
#define SUDOERS_NOT_FILE ( 0x0A | GLOBAL_PROBLEM )
|
||||||
|
#define SUDOERS_RW_OTHER ( 0x0B | GLOBAL_PROBLEM )
|
||||||
|
|
||||||
#undef TRUE
|
#undef TRUE
|
||||||
#define TRUE 0x01
|
#define TRUE 0x01
|
||||||
|
Reference in New Issue
Block a user