From e2546c9b5832a738be84e5882c1804ff3b05c569 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 29 Mar 2007 13:45:38 +0000 Subject: Relevant BUGIDs: Purpose of commit: cleanup Commit summary: --------------- 2007-03-29 Tomas Mraz * modules/pam_access/pam_access.c (login_access, list_match): Replace strtok with strtok_r. * modules/pam_cracklib/pam_cracklib.c (check_old_password): Likewise. * modules/pam_ftp/pam_ftp.c (lookup, pam_authenticate): Likewise. * modules/pam_unix/pam_unix_passwd.c (check_old_password, save_old_password): Likewise. --- modules/pam_access/pam_access.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'modules/pam_access') diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c index 80d94cc9..34ee56bd 100644 --- a/modules/pam_access/pam_access.c +++ b/modules/pam_access/pam_access.c @@ -321,6 +321,7 @@ login_access (pam_handle_t *pamh, struct login_info *item) int match = NO; int end; int lineno = 0; /* for diagnostics */ + char *sptr; if (pam_access_debug) pam_syslog (pamh, LOG_DEBUG, @@ -354,9 +355,9 @@ login_access (pam_handle_t *pamh, struct login_info *item) continue; /* Allow field seperator in last field of froms */ - if (!(perm = strtok(line, fs)) - || !(users = strtok((char *) 0, fs)) - || !(froms = strtok((char *) 0, "\n"))) { + if (!(perm = strtok_r(line, fs, &sptr)) + || !(users = strtok_r(NULL, fs, &sptr)) + || !(froms = strtok_r(NULL, "\n", &sptr))) { pam_syslog(pamh, LOG_ERR, "%s: line %d: bad field count", item->config_file, lineno); continue; @@ -398,6 +399,7 @@ static int list_match(pam_handle_t *pamh, { char *tok; int match = NO; + char *sptr; /* * Process tokens one at a time. We have exhausted all possible matches @@ -406,7 +408,8 @@ static int list_match(pam_handle_t *pamh, * the match is affected by any exceptions. */ - for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) { + for (tok = strtok_r(list, sep, &sptr); tok != 0; + tok = strtok_r(NULL, sep, &sptr)) { if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */ break; if ((match = (*match_fn) (pamh, tok, item))) /* YES */ @@ -415,7 +418,7 @@ static int list_match(pam_handle_t *pamh, /* Process exceptions to matches. */ if (match != NO) { - while ((tok = strtok((char *) 0, sep)) && strcasecmp(tok, "EXCEPT")) + while ((tok = strtok_r(NULL, sep, &sptr)) && strcasecmp(tok, "EXCEPT")) /* VOID */ ; if (tok == 0 || list_match(pamh, (char *) 0, item, match_fn) == NO) return (match); -- cgit v1.2.3