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 | 2dda82239dfa0ef5f91c6a6b72e3c0c2e62af6fe (patch) | |
tree | 06628fd4ba619620f4c88833246a54c746d6e414 | |
parent | caa9f98b43f5471104168a96dfb234755cf154f1 (diff) | |
download | pam-2dda82239dfa0ef5f91c6a6b72e3c0c2e62af6fe.tar.gz pam-2dda82239dfa0ef5f91c6a6b72e3c0c2e62af6fe.tar.bz2 pam-2dda82239dfa0ef5f91c6a6b72e3c0c2e62af6fe.zip |
modules/pam_motd: use pam_str_skip_prefix
* modules/pam_motd/pam_motd.c: Include "pam_inline.h".
(pam_sm_open_session): Use pam_str_skip_prefix instead of ugly strncmp
invocations.
-rw-r--r-- | modules/pam_motd/pam_motd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/pam_motd/pam_motd.c b/modules/pam_motd/pam_motd.c index 0435a904..d1a4d436 100644 --- a/modules/pam_motd/pam_motd.c +++ b/modules/pam_motd/pam_motd.c @@ -39,6 +39,7 @@ #include <security/pam_modules.h> #include <security/pam_modutil.h> +#include "pam_inline.h" /* --- session management functions (only) --- */ @@ -314,9 +315,10 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags, } for (; argc-- > 0; ++argv) { - if (!strncmp(*argv,"motd=",5)) { + const char *str; + if ((str = pam_str_skip_prefix(*argv, "motd=")) != NULL) { - motd_path = 5 + *argv; + motd_path = str; if (*motd_path != '\0') { D(("set motd path: %s", motd_path)); } else { @@ -325,9 +327,9 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags, "motd= specification missing argument - ignored"); } } - else if (!strncmp(*argv,"motd_dir=",9)) { + else if ((str = pam_str_skip_prefix(*argv, "motd_dir=")) != NULL) { - motd_dir_path = 9 + *argv; + motd_dir_path = str; if (*motd_dir_path != '\0') { D(("set motd.d path: %s", motd_dir_path)); } else { |