Changeset 209 in openpam for trunk


Ignore:
Timestamp:
May 1, 2003, 6:18:06 PM (16 years ago)
Author:
Dag-Erling Smørgrav
Message:

Add a global variable controlling the output of debugging messages.
This allows modules etc. to emit PAM_LOG_DEBUG messages independently
of whether libpam was compiled with -DDEBUG.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_impl.h

    r200 r209  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_impl.h#20 $
     34 * $P4: //depot/projects/openpam/lib/openpam_impl.h#21 $
    3535 */
    3636
     
    4444extern const char *_pam_err_name[PAM_NUM_ERRORS];
    4545extern const char *_pam_item_name[PAM_NUM_ITEMS];
     46
     47extern int _openpam_debug;
    4648
    4749/*
  • trunk/lib/openpam_log.c

    r187 r209  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_log.c#17 $
     34 * $P4: //depot/projects/openpam/lib/openpam_log.c#18 $
    3535 */
    3636
     
    4545
    4646#include "openpam_impl.h"
     47
     48int _openpam_debug = 0;
    4749
    4850#if defined(openpam_log)
     
    6365        switch (level) {
    6466        case PAM_LOG_DEBUG:
    65 #ifndef DEBUG
    66                 return;
    67 #else
     67                if (!_openpam_debug)
     68                        return;
    6869                priority = LOG_DEBUG;
    6970                break;
    70 #endif
    7171        case PAM_LOG_VERBOSE:
    7272                priority = LOG_INFO;
     
    109109        switch (level) {
    110110        case PAM_LOG_DEBUG:
    111 #ifndef DEBUG
    112                 return;
    113 #else
     111                if (!_openpam_debug)
     112                        return;
    114113                priority = LOG_DEBUG;
    115114                break;
    116 #endif
    117115        case PAM_LOG_VERBOSE:
    118116                priority = LOG_INFO;
Note: See TracChangeset for help on using the changeset viewer.