From 14d9ee846db42a95880abda26a08fd30e7d9c0f1 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 16 Mar 2020 21:02:18 +0000 Subject: modules/pam_localuser: use pam_str_skip_prefix * modules/pam_localuser/pam_localuser.c: Include "pam_inline.h". (pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp invocations. --- modules/pam_localuser/pam_localuser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'modules/pam_localuser') diff --git a/modules/pam_localuser/pam_localuser.c b/modules/pam_localuser/pam_localuser.c index e32ea6d7..ac51e4ef 100644 --- a/modules/pam_localuser/pam_localuser.c +++ b/modules/pam_localuser/pam_localuser.c @@ -52,6 +52,7 @@ #include #include #include +#include "pam_inline.h" #define MODULE_NAME "pam_localuser" @@ -73,8 +74,10 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, } } for(i = 0; i < argc; i++) { - if(strncmp("file=", argv[i], 5) == 0) { - filename = argv[i] + 5; + const char *str; + + if ((str = pam_str_skip_prefix(argv[i], "file=")) != NULL) { + filename = str; if(debug) { pam_syslog (pamh, LOG_DEBUG, "set filename to \"%s\"", -- cgit v1.2.3