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 | a6fa12374401f786371e7066cb162ec363b37381 (patch) | |
tree | de1a0826986f6228064e39a161647640e12bc82a | |
parent | 83d378e6cc1635621803d2adc613378bd3847dd0 (diff) | |
download | pam-a6fa12374401f786371e7066cb162ec363b37381.tar.gz pam-a6fa12374401f786371e7066cb162ec363b37381.tar.bz2 pam-a6fa12374401f786371e7066cb162ec363b37381.zip |
modules/pam_rhosts: use pam_str_skip_prefix
* modules/pam_rhosts/pam_rhosts.c: Include "pam_inline.h".
(pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp
invocations.
-rw-r--r-- | modules/pam_rhosts/pam_rhosts.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/pam_rhosts/pam_rhosts.c b/modules/pam_rhosts/pam_rhosts.c index 60c9e854..258a7299 100644 --- a/modules/pam_rhosts/pam_rhosts.c +++ b/modules/pam_rhosts/pam_rhosts.c @@ -43,6 +43,7 @@ #include <security/pam_modules.h> #include <security/pam_modutil.h> #include <security/pam_ext.h> +#include "pam_inline.h" int pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc, const char **argv) @@ -59,12 +60,14 @@ int pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc, opt_silent = flags & PAM_SILENT; while (argc-- > 0) { + const char *str; + if (strcmp(*argv, "debug") == 0) opt_debug = 1; else if (strcmp (*argv, "silent") == 0 || strcmp(*argv, "suppress") == 0) opt_silent = 1; - else if (strncmp(*argv, "superuser=", sizeof("superuser=")-1) == 0) - opt_superuser = *argv+sizeof("superuser=")-1; + else if ((str = pam_str_skip_prefix(*argv, "superuser=")) != NULL) + opt_superuser = str; else pam_syslog(pamh, LOG_WARNING, "unrecognized option '%s'", *argv); |