No longer pass debug_file to plugin, plugins must now use CONV_DEBUG_MSG
This commit is contained in:
@@ -250,6 +250,9 @@ sudo_debug_write(const char *str, int len)
|
||||
|
||||
if (sudo_debug_fd == -1) {
|
||||
/* Use conversation function if no debug fd. */
|
||||
if (sudo_conv == NULL)
|
||||
return;
|
||||
|
||||
struct sudo_conv_message msg;
|
||||
struct sudo_conv_reply repl;
|
||||
|
||||
@@ -297,7 +300,7 @@ sudo_debug_printf2(int level, const char *fmt, ...)
|
||||
va_list ap;
|
||||
char *buf;
|
||||
|
||||
if (sudo_debug_fd == -1)
|
||||
if (sudo_debug_fd == -1 && sudo_conv == NULL)
|
||||
return;
|
||||
|
||||
/* Extract pri and subsystem from level. */
|
||||
@@ -325,11 +328,7 @@ sudo_debug_execve2(int level, const char *path, char *const argv[], char *const
|
||||
int buflen, pri, subsys, log_envp = 0;
|
||||
size_t plen;
|
||||
|
||||
if (sudo_debug_fd == -1)
|
||||
return;
|
||||
|
||||
#define EXEC_PREFIX "exec "
|
||||
if (sudo_debug_fd == -1)
|
||||
if (sudo_debug_fd == -1 && sudo_conv == NULL)
|
||||
return;
|
||||
|
||||
/* Extract pri and subsystem from level. */
|
||||
@@ -344,6 +343,8 @@ sudo_debug_execve2(int level, const char *path, char *const argv[], char *const
|
||||
if (sudo_debug_settings[subsys] >= SUDO_DEBUG_DEBUG - 1 && envp[0] != NULL)
|
||||
log_envp = 1;
|
||||
|
||||
#define EXEC_PREFIX "exec "
|
||||
|
||||
/* Alloc and build up buffer. */
|
||||
plen = strlen(path);
|
||||
buflen = sizeof(EXEC_PREFIX) -1 + plen;
|
||||
|
@@ -1198,7 +1198,7 @@ deserialize_info(char * const settings[], char * const user_info[])
|
||||
{
|
||||
char * const *cur;
|
||||
const char *p, *groups = NULL;
|
||||
const char *debug_file = NULL, *debug_flags = NULL;
|
||||
const char *debug_flags = NULL;
|
||||
int flags = 0;
|
||||
debug_decl(deserialize_info, SUDO_DEBUG_PLUGIN)
|
||||
|
||||
@@ -1211,10 +1211,6 @@ deserialize_info(char * const settings[], char * const user_info[])
|
||||
user_closefrom = atoi(*cur + sizeof("closefrom=") - 1);
|
||||
continue;
|
||||
}
|
||||
if (MATCHES(*cur, "debug_file=")) {
|
||||
debug_file = *cur + sizeof("debug_file=") - 1;
|
||||
continue;
|
||||
}
|
||||
if (MATCHES(*cur, "debug_flags=")) {
|
||||
debug_flags = *cur + sizeof("debug_flags=") - 1;
|
||||
continue;
|
||||
@@ -1409,8 +1405,8 @@ deserialize_info(char * const settings[], char * const user_info[])
|
||||
}
|
||||
|
||||
/* Setup debugging if indicated. */
|
||||
if (debug_file != NULL && debug_flags != NULL) {
|
||||
sudo_debug_init(debug_file, debug_flags);
|
||||
if (debug_flags != NULL) {
|
||||
sudo_debug_init(NULL, debug_flags);
|
||||
for (cur = settings; *cur != NULL; cur++)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s", *cur);
|
||||
for (cur = user_info; *cur != NULL; cur++)
|
||||
|
@@ -61,7 +61,6 @@ const char *noexec_path = _PATH_SUDO_NOEXEC;
|
||||
#endif
|
||||
|
||||
/* XXX - for parse_args() */
|
||||
const char *debug_file;
|
||||
const char *debug_flags;
|
||||
|
||||
struct sudo_conf_table {
|
||||
@@ -105,6 +104,7 @@ set_debug(const char *entry, void *data)
|
||||
{
|
||||
size_t filelen, proglen;
|
||||
const char *progname;
|
||||
char *debug_file;
|
||||
|
||||
/* Is this debug setting for me? */
|
||||
progname = getprogname();
|
||||
@@ -129,6 +129,7 @@ set_debug(const char *entry, void *data)
|
||||
debug_file = estrndup(entry, filelen);
|
||||
debug_flags = estrdup(debug_flags);
|
||||
sudo_debug_init(debug_file, debug_flags);
|
||||
efree(debug_file);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -54,7 +54,6 @@ extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
/* XXX */
|
||||
extern const char *debug_file;
|
||||
extern const char *debug_flags;
|
||||
|
||||
int tgetpass_flags;
|
||||
@@ -76,47 +75,45 @@ static struct sudo_settings {
|
||||
{ "bsdauth_type" },
|
||||
#define ARG_LOGIN_CLASS 1
|
||||
{ "login_class" },
|
||||
#define ARG_DEBUG_FILE 2
|
||||
{ "debug_file" },
|
||||
#define ARG_DEBUG_FLAGS 3
|
||||
#define ARG_DEBUG_FLAGS 2
|
||||
{ "debug_flags" },
|
||||
#define ARG_DEBUG_LEVEL 4
|
||||
#define ARG_DEBUG_LEVEL 3
|
||||
{ "debug_level" },
|
||||
#define ARG_PRESERVE_ENVIRONMENT 5
|
||||
#define ARG_PRESERVE_ENVIRONMENT 4
|
||||
{ "preserve_environment" },
|
||||
#define ARG_RUNAS_GROUP 6
|
||||
#define ARG_RUNAS_GROUP 5
|
||||
{ "runas_group" },
|
||||
#define ARG_SET_HOME 7
|
||||
#define ARG_SET_HOME 6
|
||||
{ "set_home" },
|
||||
#define ARG_USER_SHELL 8
|
||||
#define ARG_USER_SHELL 7
|
||||
{ "run_shell" },
|
||||
#define ARG_LOGIN_SHELL 9
|
||||
#define ARG_LOGIN_SHELL 8
|
||||
{ "login_shell" },
|
||||
#define ARG_IGNORE_TICKET 10
|
||||
#define ARG_IGNORE_TICKET 9
|
||||
{ "ignore_ticket" },
|
||||
#define ARG_PROMPT 11
|
||||
#define ARG_PROMPT 10
|
||||
{ "prompt" },
|
||||
#define ARG_SELINUX_ROLE 12
|
||||
#define ARG_SELINUX_ROLE 11
|
||||
{ "selinux_role" },
|
||||
#define ARG_SELINUX_TYPE 13
|
||||
#define ARG_SELINUX_TYPE 12
|
||||
{ "selinux_type" },
|
||||
#define ARG_RUNAS_USER 14
|
||||
#define ARG_RUNAS_USER 13
|
||||
{ "runas_user" },
|
||||
#define ARG_PROGNAME 15
|
||||
#define ARG_PROGNAME 14
|
||||
{ "progname" },
|
||||
#define ARG_IMPLIED_SHELL 16
|
||||
#define ARG_IMPLIED_SHELL 15
|
||||
{ "implied_shell" },
|
||||
#define ARG_PRESERVE_GROUPS 17
|
||||
#define ARG_PRESERVE_GROUPS 16
|
||||
{ "preserve_groups" },
|
||||
#define ARG_NONINTERACTIVE 18
|
||||
#define ARG_NONINTERACTIVE 17
|
||||
{ "noninteractive" },
|
||||
#define ARG_SUDOEDIT 19
|
||||
#define ARG_SUDOEDIT 18
|
||||
{ "sudoedit" },
|
||||
#define ARG_CLOSEFROM 20
|
||||
#define ARG_CLOSEFROM 19
|
||||
{ "closefrom" },
|
||||
#define ARG_NET_ADDRS 21
|
||||
#define ARG_NET_ADDRS 20
|
||||
{ "network_addrs" },
|
||||
#define NUM_SETTINGS 22
|
||||
#define NUM_SETTINGS 21
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -154,8 +151,6 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
sudo_settings[ARG_NET_ADDRS].value = cp;
|
||||
|
||||
/* Set debug file and flags from sudo.conf. */
|
||||
if (debug_file != NULL)
|
||||
sudo_settings[ARG_DEBUG_FILE].value = debug_file;
|
||||
if (debug_flags != NULL)
|
||||
sudo_settings[ARG_DEBUG_FLAGS].value = debug_flags;
|
||||
|
||||
|
Reference in New Issue
Block a user