diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-16 21:02:18 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-03-19 18:40:16 +0000 |
commit | af8ecfc12823594c9f53ab352d16e009d69917e1 (patch) | |
tree | 2c7b33583a92947bd633c555bf41e3c4b43ec772 /modules/pam_echo | |
parent | 498f844615bad7a03a483bcb3322620f1e638e0b (diff) | |
download | pam-af8ecfc12823594c9f53ab352d16e009d69917e1.tar.gz pam-af8ecfc12823594c9f53ab352d16e009d69917e1.tar.bz2 pam-af8ecfc12823594c9f53ab352d16e009d69917e1.zip |
modules/pam_echo: use pam_str_skip_prefix
* modules/pam_echo/pam_echo.c: Include "pam_inline.h".
(pam_echo): Use pam_str_skip_prefix instead of ugly strncmp invocations.
Diffstat (limited to 'modules/pam_echo')
-rw-r--r-- | modules/pam_echo/pam_echo.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/pam_echo/pam_echo.c b/modules/pam_echo/pam_echo.c index 38303880..bd5910b9 100644 --- a/modules/pam_echo/pam_echo.c +++ b/modules/pam_echo/pam_echo.c @@ -61,6 +61,7 @@ #include <security/pam_modutil.h> #include <security/_pam_macros.h> #include <security/pam_ext.h> +#include "pam_inline.h" static int replace_and_print (pam_handle_t *pamh, const char *mesg) @@ -150,8 +151,9 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv) for (; argc-- > 0; ++argv) { - if (!strncmp (*argv, "file=", 5)) - file = (5 + *argv); + const char *str = pam_str_skip_prefix(*argv, "file="); + if (str != NULL) + file = str; } /* No file= option, use argument for output. */ |