diff options
author | Tomas Mraz <tm@t8m.info> | 2007-03-29 13:45:38 +0000 |
---|---|---|
committer | Tomas Mraz <tm@t8m.info> | 2007-03-29 13:45:38 +0000 |
commit | e2546c9b5832a738be84e5882c1804ff3b05c569 (patch) | |
tree | fcb49336e9f0b23ca9e5cfb3c011c3a5ad33d793 /modules/pam_unix | |
parent | a1063929e59148c38b8caefa1e8c6097385dc9a4 (diff) | |
download | pam-e2546c9b5832a738be84e5882c1804ff3b05c569.tar.gz pam-e2546c9b5832a738be84e5882c1804ff3b05c569.tar.bz2 pam-e2546c9b5832a738be84e5882c1804ff3b05c569.zip |
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_unix')
-rw-r--r-- | modules/pam_unix/pam_unix_passwd.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c index bec856f4..c8ee5492 100644 --- a/modules/pam_unix/pam_unix_passwd.c +++ b/modules/pam_unix/pam_unix_passwd.c @@ -330,11 +330,12 @@ static int check_old_password(const char *forwho, const char *newpass) while (fgets(buf, 16380, opwfile)) { if (!strncmp(buf, forwho, strlen(forwho))) { + char *sptr; buf[strlen(buf) - 1] = '\0'; - s_luser = strtok(buf, ":,"); - s_uid = strtok(NULL, ":,"); - s_npas = strtok(NULL, ":,"); - s_pas = strtok(NULL, ":,"); + s_luser = strtok_r(buf, ":,", &sptr); + s_uid = strtok_r(NULL, ":,", &sptr); + s_npas = strtok_r(NULL, ":,", &sptr); + s_pas = strtok_r(NULL, ":,", &sptr); while (s_pas != NULL) { char *md5pass = Goodcrypt_md5(newpass, s_pas); if (!strcmp(md5pass, s_pas)) { @@ -342,7 +343,7 @@ static int check_old_password(const char *forwho, const char *newpass) retval = PAM_AUTHTOK_ERR; break; } - s_pas = strtok(NULL, ":,"); + s_pas = strtok_r(NULL, ":,", &sptr); _pam_delete(md5pass); } break; @@ -432,11 +433,12 @@ static int save_old_password(pam_handle_t *pamh, while (fgets(buf, 16380, opwfile)) { if (!strncmp(buf, forwho, strlen(forwho))) { + char *sptr; buf[strlen(buf) - 1] = '\0'; - s_luser = strtok(buf, ":"); - s_uid = strtok(NULL, ":"); - s_npas = strtok(NULL, ":"); - s_pas = strtok(NULL, ":"); + s_luser = strtok_r(buf, ":", &sptr); + s_uid = strtok_r(NULL, ":", &sptr); + s_npas = strtok_r(NULL, ":", &sptr); + s_pas = strtok_r(NULL, ":", &sptr); npas = strtol(s_npas, NULL, 10) + 1; while (npas > howmany) { s_pas = strpbrk(s_pas, ","); |