summaryrefslogtreecommitdiff
path: root/modules
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
commit14d9ee846db42a95880abda26a08fd30e7d9c0f1 (patch)
tree4ceb6b63376614aa737c46d1083f3c6f669948b1 /modules
parent09ec054e56b358aac224ea8cb6813365f556ab18 (diff)
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.
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_localuser/pam_localuser.c7
1 files changed, 5 insertions, 2 deletions
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 <security/pam_modules.h>
#include <security/_pam_macros.h>
#include <security/pam_ext.h>
+#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\"",