Change how sudo.conf is parsed. We now do a quick parse and then

set the values after the entire file has been parsed.  This lets
us init the debug system earlier.  Plugin-specific debug flags are
now stored in struct plugin_info and struct plugin_container and
passed to the plugin via one or more debug_flags settings.
This commit is contained in:
Todd C. Miller
2014-10-22 13:20:32 -06:00
parent 346ff6766e
commit a7e724b75d
25 changed files with 868 additions and 522 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2013-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -43,6 +43,7 @@
#include "sudo_compat.h"
#include "sudo_conf.h"
#include "sudo_debug.h"
#include "sudo_util.h"
static void sudo_conf_dump(void);
@@ -72,6 +73,9 @@ static void
sudo_conf_dump(void)
{
struct plugin_info_list *plugins = sudo_conf_plugins();
struct sudo_conf_debug_list *debug_list = sudo_conf_debugging();
struct sudo_conf_debug *debug_spec;
struct sudo_debug_file *debug_file;
struct plugin_info *info;
printf("Set disable_coredump %s\n",
@@ -80,8 +84,6 @@ sudo_conf_dump(void)
sudo_conf_group_source() == GROUP_SOURCE_ADAPTIVE ? "adaptive" :
sudo_conf_group_source() == GROUP_SOURCE_STATIC ? "static" : "dynamic");
printf("Set max_groups %d\n", sudo_conf_max_groups());
if (sudo_conf_debug_flags() != NULL)
printf("Debug %s %s\n", getprogname(), sudo_conf_debug_flags());
if (sudo_conf_askpass_path() != NULL)
printf("Path askpass %s\n", sudo_conf_askpass_path());
#ifdef _PATH_SUDO_NOEXEC
@@ -97,4 +99,10 @@ sudo_conf_dump(void)
}
putchar('\n');
}
TAILQ_FOREACH(debug_spec, debug_list, entries) {
TAILQ_FOREACH(debug_file, &debug_spec->debug_files, entries) {
printf("Debug %s %s %s\n", debug_spec->progname,
debug_file->debug_file, debug_file->debug_flags);
}
}
}