From bd09ead65cded3207cf228c44a31bbc87c2979bd Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 3 Apr 2012 18:42:43 -0400 Subject: Prevent printing NULL from DEBUG messages --- src/providers/dp_pam_data_util.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/providers/dp_pam_data_util.c') diff --git a/src/providers/dp_pam_data_util.c b/src/providers/dp_pam_data_util.c index 7ac50c4e..889c47f0 100644 --- a/src/providers/dp_pam_data_util.c +++ b/src/providers/dp_pam_data_util.c @@ -45,6 +45,8 @@ } \ } while(0) +#define PAM_SAFE_ITEM(item) item ? item : "not set" + static const char *pamcmd2str(int cmd) { switch (cmd) { case SSS_PAM_AUTHENTICATE: @@ -138,12 +140,12 @@ failed: void pam_print_data(int l, struct pam_data *pd) { DEBUG(l, ("command: %s\n", pamcmd2str(pd->cmd))); - DEBUG(l, ("domain: %s\n", pd->domain)); - DEBUG(l, ("user: %s\n", pd->user)); - DEBUG(l, ("service: %s\n", pd->service)); - DEBUG(l, ("tty: %s\n", pd->tty)); - DEBUG(l, ("ruser: %s\n", pd->ruser)); - DEBUG(l, ("rhost: %s\n", pd->rhost)); + DEBUG(l, ("domain: %s\n", PAM_SAFE_ITEM(pd->domain))); + DEBUG(l, ("user: %s\n", PAM_SAFE_ITEM(pd->user))); + DEBUG(l, ("service: %s\n", PAM_SAFE_ITEM(pd->service))); + DEBUG(l, ("tty: %s\n", PAM_SAFE_ITEM(pd->tty))); + DEBUG(l, ("ruser: %s\n", PAM_SAFE_ITEM(pd->ruser))); + DEBUG(l, ("rhost: %s\n", PAM_SAFE_ITEM(pd->rhost))); DEBUG(l, ("authtok type: %d\n", pd->authtok_type)); DEBUG(l, ("authtok size: %d\n", pd->authtok_size)); DEBUG(l, ("newauthtok type: %d\n", pd->newauthtok_type)); -- cgit