summaryrefslogtreecommitdiff
path: root/modules/pam_rhosts/pam_rhosts.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-03-16 21:02:18 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-03-19 18:40:16 +0000
commita6fa12374401f786371e7066cb162ec363b37381 (patch)
treede1a0826986f6228064e39a161647640e12bc82a /modules/pam_rhosts/pam_rhosts.c
parent83d378e6cc1635621803d2adc613378bd3847dd0 (diff)
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.
Diffstat (limited to 'modules/pam_rhosts/pam_rhosts.c')
-rw-r--r--modules/pam_rhosts/pam_rhosts.c7
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);