Changeset 200 in openpam


Ignore:
Timestamp:
Feb 2, 2003, 1:10:00 PM (13 years ago)
Author:
des
Message:

More debugging macros: ENTERI() (item type), ENTERN() (int),
ENTERS() (string). Rename RETURNI() to RETURNN() for consistency.

Location:
trunk/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_findenv.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_findenv.c#9 $
     34 * $P4: //depot/projects/openpam/lib/openpam_findenv.c#10 $
    3535 */
    3636
     
    5656        ENTER();
    5757        if (pamh == NULL)
    58                 RETURNI(-1);
     58                RETURNN(-1);
    5959        for (i = 0; i < pamh->env_count; ++i)
    6060                if (strncmp(pamh->env[i], name, len) == 0 &&
    6161                    pamh->env[i][len] == '=')
    62                         RETURNI(i);
    63         RETURNI(-1);
     62                        RETURNN(i);
     63        RETURNN(-1);
    6464}
    6565
  • trunk/lib/openpam_get_option.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_get_option.c#5 $
     34 * $P4: //depot/projects/openpam/lib/openpam_get_option.c#6 $
    3535 */
    3636
     
    5858        int i;
    5959
    60         ENTER();
     60        ENTERS(option);
    6161        if (pamh == NULL || pamh->current == NULL || option == NULL)
    6262                RETURNS(NULL);
  • trunk/lib/openpam_impl.h

    r191 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_impl.h#19 $
     34 * $P4: //depot/projects/openpam/lib/openpam_impl.h#20 $
    3535 */
    3636
     
    4343extern const char *_pam_sm_func_name[PAM_NUM_PRIMITIVES];
    4444extern const char *_pam_err_name[PAM_NUM_ERRORS];
     45extern const char *_pam_item_name[PAM_NUM_ITEMS];
    4546
    4647/*
     
    124125#ifdef DEBUG
    125126#define ENTER() openpam_log(PAM_LOG_DEBUG, "entering")
     127#define ENTERI(i) do { \
     128        if ((i) > 0 && (i) < PAM_NUM_ITEMS) \
     129                openpam_log(PAM_LOG_DEBUG, "entering: %s", _pam_item_name[i]); \
     130        else \
     131                openpam_log(PAM_LOG_DEBUG, "entering: %d", (i)); \
     132} while (0);
     133#define ENTERN(n) do { \
     134        openpam_log(PAM_LOG_DEBUG, "entering: %d", (n)); \
     135} while (0);
     136#define ENTERS(s) do { \
     137        if ((s) == NULL) \
     138                openpam_log(PAM_LOG_DEBUG, "entering: NULL"); \
     139        else \
     140                openpam_log(PAM_LOG_DEBUG, "entering: '%s'", (s)); \
     141} while (0);
    126142#define RETURNV() openpam_log(PAM_LOG_DEBUG, "returning")
    127143#define RETURNC(c) do { \
     
    132148        return (c); \
    133149} while (0)
    134 #define RETURNI(i) do { \
    135         openpam_log(PAM_LOG_DEBUG, "returning %d", (i)); \
    136         return (i); \
     150#define RETURNN(n) do { \
     151        openpam_log(PAM_LOG_DEBUG, "returning %d", (n)); \
     152        return (n); \
    137153} while (0)
    138154#define RETURNP(p) do { \
     
    152168#else
    153169#define ENTER()
     170#define ENTERI(i)
     171#define ENTERN(n)
     172#define ENTERS(s)
    154173#define RETURNV() return
    155174#define RETURNC(c) return (c)
    156 #define RETURNI(i) return (i)
     175#define RETURNN(n) return (n)
    157176#define RETURNP(p) return (p)
    158177#define RETURNS(s) return (s)
  • trunk/lib/openpam_set_option.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_set_option.c#6 $
     34 * $P4: //depot/projects/openpam/lib/openpam_set_option.c#7 $
    3535 */
    3636
     
    6262        int i;
    6363
    64         ENTER();
     64        ENTERS(option);
    6565        if (pamh == NULL || pamh->current == NULL || option == NULL)
    6666                RETURNC(PAM_SYSTEM_ERR);
  • trunk/lib/pam_get_data.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_data.c#9 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_data.c#10 $
    3535 */
    3636
     
    5555        pam_data_t *dp;
    5656
    57         ENTER();
     57        ENTERS(module_data_name);
    5858        if (pamh == NULL)
    5959                RETURNC(PAM_SYSTEM_ERR);
  • trunk/lib/pam_get_item.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_item.c#14 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_item.c#15 $
    3535 */
    3636
     
    4040
    4141#include "openpam_impl.h"
     42
     43const char *_pam_item_name[PAM_NUM_ITEMS] = {
     44        "(NO ITEM)",
     45        "PAM_SERVICE",
     46        "PAM_USER",
     47        "PAM_TTY",
     48        "PAM_RHOST",
     49        "PAM_CONV",
     50        "PAM_AUTHTOK",
     51        "PAM_OLDAUTHTOK",
     52        "PAM_RUSER",
     53        "PAM_USER_PROMPT",
     54        "PAM_REPOSITORY",
     55        "PAM_AUTHTOK_PROMPT",
     56        "PAM_OLDAUTHTOK_PROMPT"
     57};
    4258
    4359/*
     
    5470{
    5571
    56         ENTER();
     72        ENTERI(item_type);
    5773        if (pamh == NULL)
    5874                RETURNC(PAM_SYSTEM_ERR);
  • trunk/lib/pam_set_data.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_set_data.c#11 $
     34 * $P4: //depot/projects/openpam/lib/pam_set_data.c#12 $
    3535 */
    3636
     
    5959        pam_data_t *dp;
    6060
    61         ENTER();
     61        ENTERS(module_data_name);
    6262        if (pamh == NULL)
    6363                RETURNC(PAM_SYSTEM_ERR);
  • trunk/lib/pam_set_item.c

    r187 r200  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_set_item.c#16 $
     34 * $P4: //depot/projects/openpam/lib/pam_set_item.c#17 $
    3535 */
    3636
     
    5959        size_t nsize, osize;
    6060
    61         ENTER();
     61        ENTERI(item_type);
    6262        if (pamh == NULL)
    6363                RETURNC(PAM_SYSTEM_ERR);
Note: See TracChangeset for help on using the changeset viewer.