Revert change to initialize io_operations earlier.
Instead, check io_operations.open for NULL which is the case for "sudo -V". Also move the early return in sudoers_io_open() for "sudo -V" until after we have initialized debugging.
This commit is contained in:
@@ -656,13 +656,6 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
sudo_conv = conversation;
|
sudo_conv = conversation;
|
||||||
sudo_printf = plugin_printf;
|
sudo_printf = plugin_printf;
|
||||||
|
|
||||||
/* Initialize io_operations. */
|
|
||||||
sudoers_io_setops();
|
|
||||||
|
|
||||||
/* If we have no command (because -V was specified) just return. */
|
|
||||||
if (argc == 0)
|
|
||||||
debug_return_int(true);
|
|
||||||
|
|
||||||
bindtextdomain("sudoers", LOCALEDIR);
|
bindtextdomain("sudoers", LOCALEDIR);
|
||||||
|
|
||||||
/* Initialize the debug subsystem. */
|
/* Initialize the debug subsystem. */
|
||||||
@@ -684,6 +677,10 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we have no command (because -V was specified) just return. */
|
||||||
|
if (argc == 0)
|
||||||
|
debug_return_int(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pull iolog settings out of command_info.
|
* Pull iolog settings out of command_info.
|
||||||
*/
|
*/
|
||||||
@@ -704,6 +701,9 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize io_operations. */
|
||||||
|
sudoers_io_setops();
|
||||||
|
|
||||||
if (sudo_gettime_awake(&last_time) == -1) {
|
if (sudo_gettime_awake(&last_time) == -1) {
|
||||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO,
|
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO,
|
||||||
"%s: unable to get time of day", __func__);
|
"%s: unable to get time of day", __func__);
|
||||||
@@ -776,7 +776,8 @@ sudoers_io_close(int exit_status, int error)
|
|||||||
const char *errstr = NULL;
|
const char *errstr = NULL;
|
||||||
debug_decl(sudoers_io_close, SUDOERS_DEBUG_PLUGIN);
|
debug_decl(sudoers_io_close, SUDOERS_DEBUG_PLUGIN);
|
||||||
|
|
||||||
io_operations.close(exit_status, error, &errstr);
|
if (io_operations.close != NULL)
|
||||||
|
io_operations.close(exit_status, error, &errstr);
|
||||||
|
|
||||||
sudo_freepwcache();
|
sudo_freepwcache();
|
||||||
sudo_freegrcache();
|
sudo_freegrcache();
|
||||||
|
Reference in New Issue
Block a user