Changeset 185 in openpam


Ignore:
Timestamp:
Dec 12, 2002, 5:01:39 PM (11 years ago)
Author:
des
Message:

Declare _pam_func_name and _pam_err_name.
Add a member to the pam_handle structure indicating which primitive
is currently executing.
Add a ton of debugging macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_impl.h

    r161 r185  
    3232 * SUCH DAMAGE. 
    3333 * 
    34  * $P4: //depot/projects/openpam/lib/openpam_impl.h#16 $ 
     34 * $P4: //depot/projects/openpam/lib/openpam_impl.h#17 $ 
    3535 */ 
    3636 
     
    4040#include <security/openpam.h> 
    4141 
     42extern const char *_pam_func_name[PAM_NUM_PRIMITIVES]; 
    4243extern const char *_pam_sm_func_name[PAM_NUM_PRIMITIVES]; 
     44extern const char *_pam_err_name[PAM_NUM_ERRORS]; 
    4345 
    4446/* 
     
    8486        pam_chain_t     *chains[PAM_NUM_CHAINS]; 
    8587        pam_chain_t     *current; 
     88        int              primitive; 
    8689 
    8790        /* items and data */ 
     
    119122pam_module_t   *openpam_dynamic(const char *); 
    120123 
     124#ifdef DEBUG 
     125#define ENTER() openpam_log(PAM_LOG_DEBUG, "entering") 
     126#define RETURNV() openpam_log(PAM_LOG_DEBUG, "returning") 
     127#define RETURNC(c) do { \ 
     128        if ((c) >= 0 && (c) < PAM_NUM_ERRORS) 
     129                openpam_log(PAM_LOG_DEBUG, "returning %s", _pam_err_name[c]); \ 
     130        else \ 
     131                openpam_log(PAM_LOG_DEBUG, "returning %d!", (c)); \ 
     132        return (c); \ 
     133} while (0) 
     134#define RETURNI(n) do { \ 
     135        openpam_log(PAM_LOG_DEBUG, "returning %d", (n)); \ 
     136        return (n); \ 
     137} while (0) 
     138#define RETURNP(p) do { \ 
     139        if ((p) == NULL) \ 
     140                openpam_log(PAM_LOG_DEBUG, "returning NULL"); \ 
     141        else \ 
     142                openpam_log(PAM_LOG_DEBUG, "returning %p", (p)); \ 
     143        return (p); \ 
     144} while (0) 
     145#define RETURNS(s) do { \ 
     146        if ((s) == NULL) \ 
     147                openpam_log(PAM_LOG_DEBUG, "returning NULL"); \ 
     148        else \ 
     149                openpam_log(PAM_LOG_DEBUG, "returning '%s'", (s)); \ 
     150        return (s); \ 
     151} while (0) 
     152#else 
     153#define ENTER() 
     154#define RETURNV() return 
     155#define RETURNC(c) return (c) 
     156#define RETURNI(n) return (i) 
     157#define RETURNP(p) return (p) 
     158#define RETURNS(s) return (s) 
    121159#endif 
     160 
     161#endif 
Note: See TracChangeset for help on using the changeset viewer.