From dd80f758c4772b8bebb2fc3335bf3457ab1eb7ca Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Mon, 25 Jun 2007 11:09:32 +0000 Subject: Relevant BUGIDs: Purpose of commit: bugfix Commit summary: --------------- 2007-06-25 Thorsten Kukuk * modules/pam_access/pam_access.c (list_match): Use saveptr of strtok_r result for recursive calls. * xtests/Makefile.am: Add new pam_access test cases. * xtests/pam_access1.c: New test case. * xtests/pam_access2.c: Likewise. * xtests/pam_access3.c: Likewise. * xtests/pam_access4.c: Likewise. * xtests/pam_access1.sh: Wrapper to create user accounts. * xtests/pam_access2.sh: Likewise. * xtests/pam_access3.sh: Likewise. * xtests/pam_access4.sh: Likewise. * xtests/pam_access1.pamd: PAM config file for pam_access tests. * xtests/pam_access2.pamd: Likewise. * xtests/pam_access3.pamd: Likewise. * xtests/pam_access4.pamd: Likewise. * xtests/access.conf: Config file for pam_access tests. * xtests/run-tests.sh: Install access.conf into system. --- modules/pam_access/pam_access.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/pam_access/pam_access.c') diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c index 82fdfcc7..29a1606c 100644 --- a/modules/pam_access/pam_access.c +++ b/modules/pam_access/pam_access.c @@ -407,6 +407,10 @@ static int list_match(pam_handle_t *pamh, int match = NO; char *sptr; + if (pam_access_debug) + pam_syslog (pamh, LOG_DEBUG, + "list_match: list=%s, item=%s", list, item->user->pw_name); + /* * Process tokens one at a time. We have exhausted all possible matches * when we reach an "EXCEPT" token or the end of the list. If we do find @@ -426,7 +430,7 @@ static int list_match(pam_handle_t *pamh, if (match != NO) { while ((tok = strtok_r(NULL, sep, &sptr)) && strcasecmp(tok, "EXCEPT")) /* VOID */ ; - if (tok == 0 || list_match(pamh, (char *) 0, item, match_fn) == NO) + if (tok == 0 || list_match(pamh, sptr, item, match_fn) == NO) return (match); } return (NO); @@ -434,7 +438,7 @@ static int list_match(pam_handle_t *pamh, /* myhostname - figure out local machine name */ -static char * myhostname(void) +static char *myhostname(void) { static char name[MAXHOSTNAMELEN + 1]; -- cgit v1.2.3