diff --git a/include/security/openpam.h b/include/security/openpam.h index 76c982e..cf2c45d 100644 --- a/include/security/openpam.h +++ b/include/security/openpam.h @@ -163,6 +163,7 @@ openpam_readline(FILE *_f, * Log levels */ enum { + PAM_LOG_LIBDEBUG = -1, PAM_LOG_DEBUG, PAM_LOG_VERBOSE, PAM_LOG_NOTICE, diff --git a/lib/openpam_debug.h b/lib/openpam_debug.h index 9d5263c..abf30f6 100644 --- a/lib/openpam_debug.h +++ b/lib/openpam_debug.h @@ -39,53 +39,53 @@ #define OPENPAM_DEBUG_INCLUDED #ifdef OPENPAM_DEBUG -#define ENTER() openpam_log(PAM_LOG_DEBUG, "entering") +#define ENTER() openpam_log(PAM_LOG_LIBDEBUG, "entering") #define ENTERI(i) do { \ int i_ = (i); \ if (i_ > 0 && i_ < PAM_NUM_ITEMS) \ - openpam_log(PAM_LOG_DEBUG, "entering: %s", pam_item_name[i_]); \ + openpam_log(PAM_LOG_LIBDEBUG, "entering: %s", pam_item_name[i_]); \ else \ - openpam_log(PAM_LOG_DEBUG, "entering: %d", i_); \ + openpam_log(PAM_LOG_LIBDEBUG, "entering: %d", i_); \ } while (0) #define ENTERN(n) do { \ int n_ = (n); \ - openpam_log(PAM_LOG_DEBUG, "entering: %d", n_); \ + openpam_log(PAM_LOG_LIBDEBUG, "entering: %d", n_); \ } while (0) #define ENTERS(s) do { \ const char *s_ = (s); \ if (s_ == NULL) \ - openpam_log(PAM_LOG_DEBUG, "entering: NULL"); \ + openpam_log(PAM_LOG_LIBDEBUG, "entering: NULL"); \ else \ - openpam_log(PAM_LOG_DEBUG, "entering: '%s'", s_); \ + openpam_log(PAM_LOG_LIBDEBUG, "entering: '%s'", s_); \ } while (0) -#define RETURNV() openpam_log(PAM_LOG_DEBUG, "returning") +#define RETURNV() openpam_log(PAM_LOG_LIBDEBUG, "returning") #define RETURNC(c) do { \ int c_ = (c); \ if (c_ >= 0 && c_ < PAM_NUM_ERRORS) \ - openpam_log(PAM_LOG_DEBUG, "returning %s", pam_err_name[c_]); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning %s", pam_err_name[c_]); \ else \ - openpam_log(PAM_LOG_DEBUG, "returning %d!", c_); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning %d!", c_); \ return (c_); \ } while (0) #define RETURNN(n) do { \ int n_ = (n); \ - openpam_log(PAM_LOG_DEBUG, "returning %d", n_); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning %d", n_); \ return (n_); \ } while (0) #define RETURNP(p) do { \ void *p_ = (p); \ if (p_ == NULL) \ - openpam_log(PAM_LOG_DEBUG, "returning NULL"); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning NULL"); \ else \ - openpam_log(PAM_LOG_DEBUG, "returning %p", p_); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning %p", p_); \ return (p_); \ } while (0) #define RETURNS(s) do { \ const char *s_ = (s); \ if (s_ == NULL) \ - openpam_log(PAM_LOG_DEBUG, "returning NULL"); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning NULL"); \ else \ - openpam_log(PAM_LOG_DEBUG, "returning '%s'", s_); \ + openpam_log(PAM_LOG_LIBDEBUG, "returning '%s'", s_); \ return (s_); \ } while (0) #else diff --git a/lib/openpam_log.c b/lib/openpam_log.c index 27967cd..861553b 100644 --- a/lib/openpam_log.c +++ b/lib/openpam_log.c @@ -71,6 +71,7 @@ openpam_log(int level, const char *fmt, ...) int priority; switch (level) { + case PAM_LOG_LIBDEBUG: case PAM_LOG_DEBUG: if (!openpam_debug) return;