diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-16 21:02:18 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-19 18:40:16 +0000 |
commit | 40bcefca56fe98fab2f28a73ef19979dc1bbcc64 (patch) | |
tree | e8064a32218befbd655f8b53100b8ec2eac3e76c /modules/pam_mail | |
parent | 14d9ee846db42a95880abda26a08fd30e7d9c0f1 (diff) | |
download | pam-40bcefca56fe98fab2f28a73ef19979dc1bbcc64.tar.gz pam-40bcefca56fe98fab2f28a73ef19979dc1bbcc64.tar.bz2 pam-40bcefca56fe98fab2f28a73ef19979dc1bbcc64.zip |
modules/pam_mail: use pam_str_skip_prefix
* modules/pam_mail/pam_mail.c: Include "pam_inline.h".
(_pam_parse): Use pam_str_skip_prefix instead of ugly strncmp
invocations.
Diffstat (limited to 'modules/pam_mail')
-rw-r--r-- | modules/pam_mail/pam_mail.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/pam_mail/pam_mail.c b/modules/pam_mail/pam_mail.c index 703c93cb..2439ae75 100644 --- a/modules/pam_mail/pam_mail.c +++ b/modules/pam_mail/pam_mail.c @@ -44,6 +44,7 @@ #include <security/_pam_macros.h> #include <security/pam_modutil.h> #include <security/pam_ext.h> +#include "pam_inline.h" /* argument parsing */ @@ -77,6 +78,7 @@ _pam_parse (const pam_handle_t *pamh, int flags, int argc, /* step through arguments */ for (; argc-- > 0; ++argv) { + const char *str; /* generic options */ @@ -86,8 +88,8 @@ _pam_parse (const pam_handle_t *pamh, int flags, int argc, ctrl |= PAM_QUIET_MAIL; else if (!strcmp(*argv,"standard")) ctrl |= PAM_STANDARD_MAIL | PAM_EMPTY_TOO; - else if (!strncmp(*argv,"dir=",4)) { - *maildir = 4 + *argv; + else if ((str = pam_str_skip_prefix(*argv, "dir=")) != NULL) { + *maildir = str; if (**maildir != '\0') { D(("new mail directory: %s", *maildir)); ctrl |= PAM_NEW_MAIL_DIR; @@ -95,9 +97,9 @@ _pam_parse (const pam_handle_t *pamh, int flags, int argc, pam_syslog(pamh, LOG_ERR, "dir= specification missing argument - ignored"); } - } else if (!strncmp(*argv,"hash=",5)) { + } else if ((str = pam_str_skip_prefix(*argv, "hash=")) != NULL) { char *ep = NULL; - *hashcount = strtoul(*argv+5,&ep,10); + *hashcount = strtoul(str,&ep,10); if (!ep) { *hashcount = 0; } |