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:
Todd C. Miller
2014-10-22 13:23:05 -06:00
parent a7e724b75d
commit 866cfc4fc3
100 changed files with 1509 additions and 949 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 1998-2005, 2007-2013
* Copyright (c) 1996, 1998-2005, 2007-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -73,7 +73,7 @@ tgetpass(const char *prompt, int timeout, int flags)
static const char *askpass;
static char buf[SUDO_CONV_REPL_MAX + 1];
int i, input, output, save_errno, neednl = 0, need_restart;
debug_decl(tgetpass, SUDO_DEBUG_CONV)
debug_decl(tgetpass, SUDO_DEBUG_CONV, sudo_debug_instance)
(void) fflush(stdout);
@@ -212,7 +212,7 @@ sudo_askpass(const char *askpass, const char *prompt)
sigaction_t sa, saved_sa_pipe;
int pfd[2];
pid_t pid;
debug_decl(sudo_askpass, SUDO_DEBUG_CONV)
debug_decl(sudo_askpass, SUDO_DEBUG_CONV, sudo_debug_instance)
if (pipe(pfd) == -1)
sudo_fatal(U_("unable to create pipe"));
@@ -270,7 +270,7 @@ getln(int fd, char *buf, size_t bufsiz, int feedback)
ssize_t nr = -1;
char *cp = buf;
char c = '\0';
debug_decl(getln, SUDO_DEBUG_CONV)
debug_decl(getln, SUDO_DEBUG_CONV, sudo_debug_instance)
if (left == 0) {
errno = EINVAL;
@@ -327,7 +327,7 @@ int
tty_present(void)
{
int fd;
debug_decl(tty_present, SUDO_DEBUG_UTIL)
debug_decl(tty_present, SUDO_DEBUG_UTIL, sudo_debug_instance)
if ((fd = open(_PATH_TTY, O_RDWR|O_NOCTTY)) != -1)
close(fd);