Changeset 210 in openpam


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

If compiled with -DDEBUG, enable debugging right before calling a
module which has the "debug" option, and disable it upon return.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_dispatch.c

    r186 r210  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dispatch.c#18 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dispatch.c#19 $
    3535 */
    3636
     
    6060        pam_chain_t *chain;
    6161        int err, fail, r;
     62#ifdef DEBUG
     63        int debug;
     64#endif
    6265
    6366        ENTER();
     
    97100        /* execute */
    98101        for (err = fail = 0; chain != NULL; chain = chain->next) {
    99                 openpam_log(PAM_LOG_DEBUG, "calling %s() in %s",
    100                     _pam_sm_func_name[primitive], chain->module->path);
    101102                if (chain->module->func[primitive] == NULL) {
    102103                        openpam_log(PAM_LOG_ERROR, "%s: no %s()",
     
    106107                        pamh->primitive = primitive;
    107108                        pamh->current = chain;
     109#ifdef DEBUG
     110                        debug = (openpam_get_option(pamh, "debug") != NULL);
     111                        if (debug)
     112                                ++_openpam_debug;
     113                        openpam_log(PAM_LOG_DEBUG, "calling %s() in %s",
     114                            _pam_sm_func_name[primitive], chain->module->path);
     115#endif
    108116                        r = (chain->module->func[primitive])(pamh, flags,
    109117                            chain->optc, (const char **)chain->optv);
    110118                        pamh->current = NULL;
     119#ifdef DEBUG
    111120                        openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
    112121                            chain->module->path, _pam_sm_func_name[primitive],
    113122                            pam_strerror(pamh, r));
     123                        if (debug)
     124                                --_openpam_debug;
     125#endif
    114126                }
    115127
Note: See TracChangeset for help on using the changeset viewer.