From 052c5349e602b090507ec61f792428da1b9ef839 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 16 Mar 2020 21:02:18 +0000 Subject: modules/pam_wheel: use pam_str_skip_prefix * modules/pam_wheel/pam_wheel.c: Include "pam_inline.h". (_pam_parse): Use pam_str_skip_prefix instead of ugly strncmp invocations. --- modules/pam_wheel/pam_wheel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/pam_wheel') diff --git a/modules/pam_wheel/pam_wheel.c b/modules/pam_wheel/pam_wheel.c index 6ea7b847..32b6cdb0 100644 --- a/modules/pam_wheel/pam_wheel.c +++ b/modules/pam_wheel/pam_wheel.c @@ -45,6 +45,7 @@ #include #include #include +#include "pam_inline.h" /* checks if a user is on a list of members of the GID 0 group */ static int is_on_list(char * const *list, const char *member) @@ -75,6 +76,7 @@ _pam_parse (const pam_handle_t *pamh, int argc, const char **argv, /* step through arguments */ for (ctrl=0; argc-- > 0; ++argv) { + const char *str; /* generic options */ @@ -88,8 +90,8 @@ _pam_parse (const pam_handle_t *pamh, int argc, const char **argv, ctrl |= PAM_DENY_ARG; else if (!strcmp(*argv,"root_only")) ctrl |= PAM_ROOT_ONLY_ARG; - else if (!strncmp(*argv,"group=",6)) - strncpy(use_group,*argv+6,group_length-1); + else if ((str = pam_str_skip_prefix(*argv, "group=")) != NULL) + strncpy(use_group, str, group_length - 1); else { pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv); } -- cgit v1.2.3