summaryrefslogtreecommitdiff
path: root/modules/pam_wheel
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
commit052c5349e602b090507ec61f792428da1b9ef839 (patch)
tree12d95feeb29d96b95489e5e0acb950d3c0df22e9 /modules/pam_wheel
parenta49bdd6697c51625a52275fe8616bce0d77431c6 (diff)
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.
Diffstat (limited to 'modules/pam_wheel')
-rw-r--r--modules/pam_wheel/pam_wheel.c6
1 files changed, 4 insertions, 2 deletions
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 <security/pam_modules.h>
#include <security/pam_modutil.h>
#include <security/pam_ext.h>
+#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);
}