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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2013 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 2009-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
|
||||
@@ -56,8 +56,7 @@
|
||||
# endif
|
||||
#endif /* !__linux__ */
|
||||
|
||||
#include "sudo_compat.h"
|
||||
#include "sudo_debug.h"
|
||||
#include "sudoers.h"
|
||||
|
||||
/*
|
||||
* Fill in a struct timeval with the time the system booted.
|
||||
@@ -73,7 +72,7 @@ get_boottime(struct timeval *tv)
|
||||
bool found = false;
|
||||
ssize_t len;
|
||||
FILE *fp;
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL, sudoers_debug_instance)
|
||||
|
||||
/* read btime from /proc/stat */
|
||||
fp = fopen("/proc/stat", "r");
|
||||
@@ -103,7 +102,7 @@ get_boottime(struct timeval *tv)
|
||||
{
|
||||
size_t size;
|
||||
int mib[2];
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL, sudoers_debug_instance)
|
||||
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_BOOTTIME;
|
||||
@@ -116,11 +115,11 @@ get_boottime(struct timeval *tv)
|
||||
|
||||
#elif defined(HAVE_GETUTXID)
|
||||
|
||||
int
|
||||
bool
|
||||
get_boottime(struct timeval *tv)
|
||||
{
|
||||
struct utmpx *ut, key;
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL, sudoers_debug_instance)
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
key.ut_type = BOOT_TIME;
|
||||
@@ -135,11 +134,11 @@ get_boottime(struct timeval *tv)
|
||||
|
||||
#elif defined(HAVE_GETUTID)
|
||||
|
||||
int
|
||||
bool
|
||||
get_boottime(struct timeval *tv)
|
||||
{
|
||||
struct utmp *ut, key;
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL, sudoers_debug_instance)
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
key.ut_type = BOOT_TIME;
|
||||
@@ -154,10 +153,10 @@ get_boottime(struct timeval *tv)
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
bool
|
||||
get_boottime(struct timeval *tv)
|
||||
{
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL)
|
||||
debug_decl(get_boottime, SUDO_DEBUG_UTIL, sudoers_debug_instance)
|
||||
debug_return_bool(false);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user