Add support for multiple Debug lines per program. Callers may
register arbitrary debug facilities or use built-in defaults. We now use separate Debug statements for plugins and programs.
This commit is contained in:
@@ -120,7 +120,7 @@ sudoers_policy_init(void *info, char * const envp[])
|
||||
volatile int sources = 0;
|
||||
struct sudo_nss *nss, *nss_next;
|
||||
int rval = -1;
|
||||
debug_decl(sudoers_policy_init, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(sudoers_policy_init, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
bindtextdomain("sudoers", LOCALEDIR);
|
||||
|
||||
@@ -225,7 +225,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
struct sudo_nss *nss;
|
||||
int cmnd_status = -1, oldlocale, validated;
|
||||
volatile int rval = true;
|
||||
debug_decl(sudoers_policy_main, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(sudoers_policy_main, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
/* Is root even allowed to run sudo? */
|
||||
if (user_uid == 0 && !def_root_sudo) {
|
||||
@@ -560,7 +560,7 @@ init_vars(char * const envp[])
|
||||
{
|
||||
char * const * ep;
|
||||
bool unknown_user = false;
|
||||
debug_decl(init_vars, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(init_vars, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale);
|
||||
|
||||
@@ -641,7 +641,7 @@ set_cmnd(void)
|
||||
{
|
||||
int rval = FOUND;
|
||||
char *path = user_path;
|
||||
debug_decl(set_cmnd, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(set_cmnd, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
/* Allocate user_stat for find_path() and match functions. */
|
||||
user_stat = sudo_ecalloc(1, sizeof(struct stat));
|
||||
@@ -738,7 +738,7 @@ open_sudoers(const char *sudoers, bool doedit, bool *keepopen)
|
||||
{
|
||||
struct stat sb;
|
||||
FILE *fp = NULL;
|
||||
debug_decl(open_sudoers, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(open_sudoers, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
if (!set_perms(PERM_SUDOERS))
|
||||
debug_return_ptr(NULL);
|
||||
@@ -816,7 +816,7 @@ set_loginclass(struct passwd *pw)
|
||||
const int errflags = SLOG_RAW_MSG;
|
||||
login_cap_t *lc;
|
||||
bool rval = true;
|
||||
debug_decl(set_loginclass, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(set_loginclass, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
if (!def_use_loginclass)
|
||||
goto done;
|
||||
@@ -872,7 +872,7 @@ set_fqdn(void)
|
||||
{
|
||||
struct addrinfo *res0, hint;
|
||||
char *p;
|
||||
debug_decl(set_fqdn, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(set_fqdn, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
memset(&hint, 0, sizeof(hint));
|
||||
hint.ai_family = PF_UNSPEC;
|
||||
@@ -902,7 +902,7 @@ static bool
|
||||
set_runaspw(const char *user, bool quiet)
|
||||
{
|
||||
struct passwd *pw = NULL;
|
||||
debug_decl(set_runaspw, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(set_runaspw, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
if (*user == '#') {
|
||||
const char *errstr;
|
||||
@@ -933,7 +933,7 @@ static bool
|
||||
set_runasgr(const char *group, bool quiet)
|
||||
{
|
||||
struct group *gr = NULL;
|
||||
debug_decl(set_runasgr, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(set_runasgr, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
if (*group == '#') {
|
||||
const char *errstr;
|
||||
@@ -985,7 +985,7 @@ void
|
||||
sudoers_cleanup(void)
|
||||
{
|
||||
struct sudo_nss *nss;
|
||||
debug_decl(sudoers_cleanup, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(sudoers_cleanup, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
if (snl != NULL) {
|
||||
TAILQ_FOREACH(nss, snl, entries) {
|
||||
@@ -1006,7 +1006,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files, int *argc
|
||||
char *cp, **nargv, *editor, *editor_path = NULL;
|
||||
int ac, i, nargc;
|
||||
bool wasblank;
|
||||
debug_decl(resolve_editor, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(resolve_editor, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
/* Note: editor becomes part of argv_out and is not freed. */
|
||||
editor = sudo_emalloc(edlen + 1);
|
||||
@@ -1060,7 +1060,7 @@ find_editor(int nfiles, char **files, int *argc_out, char ***argv_out)
|
||||
const char *cp, *ep, *editor;
|
||||
char *editor_path = NULL, **ev, *ev0[4];
|
||||
size_t len;
|
||||
debug_decl(find_editor, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(find_editor, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
/*
|
||||
* If any of SUDO_EDITOR, VISUAL or EDITOR are set, choose the first one.
|
||||
@@ -1101,7 +1101,7 @@ create_admin_success_flag(void)
|
||||
struct stat statbuf;
|
||||
char flagfile[PATH_MAX];
|
||||
int fd, n;
|
||||
debug_decl(create_admin_success_flag, SUDO_DEBUG_PLUGIN)
|
||||
debug_decl(create_admin_success_flag, SUDO_DEBUG_PLUGIN, sudoers_debug_instance)
|
||||
|
||||
/* Check whether the user is in the admin group. */
|
||||
if (!user_in_group(sudo_user.pw, "admin"))
|
||||
|
Reference in New Issue
Block a user