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;
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. */
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. */
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;
{
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)
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;
}
/* 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++)
#endif
/* XXX - for parse_args() */
-const char *debug_file;
const char *debug_flags;
struct sudo_conf_table {
{
size_t filelen, proglen;
const char *progname;
+ char *debug_file;
/* Is this debug setting for me? */
progname = getprogname();
debug_file = estrndup(entry, filelen);
debug_flags = estrdup(debug_flags);
sudo_debug_init(debug_file, debug_flags);
+ efree(debug_file);
return TRUE;
}
extern int optind;
/* XXX */
-extern const char *debug_file;
extern const char *debug_flags;
int tgetpass_flags;
{ "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 }
};
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;