summaryrefslogtreecommitdiff
path: root/modules/pam_access
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2007-03-29 13:45:38 +0000
committerTomas Mraz <tm@t8m.info>2007-03-29 13:45:38 +0000
commite2546c9b5832a738be84e5882c1804ff3b05c569 (patch)
treefcb49336e9f0b23ca9e5cfb3c011c3a5ad33d793 /modules/pam_access
parenta1063929e59148c38b8caefa1e8c6097385dc9a4 (diff)
Relevant BUGIDs:
Purpose of commit: cleanup Commit summary: --------------- 2007-03-29 Tomas Mraz <t8m@centrum.cz> * 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.
Diffstat (limited to 'modules/pam_access')
-rw-r--r--modules/pam_access/pam_access.c13
1 files changed, 8 insertions, 5 deletions
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);