Check sudo_conf_read() return value and exit on fatal error (a
warning was already printed by sudo_conf_read()).
This commit is contained in:
@@ -51,12 +51,13 @@ main(int argc, char *argv[])
|
|||||||
initprogname(argc > 0 ? argv[0] : "conf_test");
|
initprogname(argc > 0 ? argv[0] : "conf_test");
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf(stderr, "usage: %s conf_file\n", getprogname());
|
fprintf(stderr, "usage: %s conf_file\n", getprogname());
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sudo_conf_read(argv[1], SUDO_CONF_ALL);
|
if (sudo_conf_read(argv[1], SUDO_CONF_ALL) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
sudo_conf_dump();
|
sudo_conf_dump();
|
||||||
|
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -211,7 +211,8 @@ main(int argc, char *argv[])
|
|||||||
sudo_fatal_callback_register(sudoreplay_cleanup);
|
sudo_fatal_callback_register(sudoreplay_cleanup);
|
||||||
|
|
||||||
/* Read sudo.conf and initialize the debug subsystem. */
|
/* Read sudo.conf and initialize the debug subsystem. */
|
||||||
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
|
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
sudo_debug_register(getprogname(), NULL, NULL,
|
sudo_debug_register(getprogname(), NULL, NULL,
|
||||||
sudo_conf_debug_files(getprogname()));
|
sudo_conf_debug_files(getprogname()));
|
||||||
|
|
||||||
|
@@ -132,7 +132,8 @@ main(int argc, char *argv[])
|
|||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
/* Initialize the debug subsystem. */
|
/* Initialize the debug subsystem. */
|
||||||
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
|
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
|
sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
|
||||||
|
|
||||||
dflag = 0;
|
dflag = 0;
|
||||||
|
@@ -163,7 +163,8 @@ main(int argc, char *argv[])
|
|||||||
sudo_fatal_callback_register(visudo_cleanup);
|
sudo_fatal_callback_register(visudo_cleanup);
|
||||||
|
|
||||||
/* Read debug and plugin sections of sudo.conf. */
|
/* Read debug and plugin sections of sudo.conf. */
|
||||||
sudo_conf_read(NULL, SUDO_CONF_DEBUG|SUDO_CONF_PLUGINS);
|
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG|SUDO_CONF_PLUGINS) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
/* Initialize the debug subsystem. */
|
/* Initialize the debug subsystem. */
|
||||||
sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
|
sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
|
||||||
|
@@ -77,7 +77,8 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
sudo_fatalx(U_("requires at least one argument"));
|
sudo_fatalx(U_("requires at least one argument"));
|
||||||
|
|
||||||
/* Read sudo.conf and initialize the debug subsystem. */
|
/* Read sudo.conf and initialize the debug subsystem. */
|
||||||
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
|
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
sudo_debug_register(getprogname(), NULL, NULL,
|
sudo_debug_register(getprogname(), NULL, NULL,
|
||||||
sudo_conf_debug_files(getprogname()));
|
sudo_conf_debug_files(getprogname()));
|
||||||
|
|
||||||
|
@@ -161,7 +161,8 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */
|
#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */
|
||||||
|
|
||||||
/* Initialize the debug subsystem. */
|
/* Initialize the debug subsystem. */
|
||||||
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
|
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG) == -1)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
sudo_debug_instance = sudo_debug_register(getprogname(),
|
sudo_debug_instance = sudo_debug_register(getprogname(),
|
||||||
NULL, NULL, sudo_conf_debug_files(getprogname()));
|
NULL, NULL, sudo_conf_debug_files(getprogname()));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user