summaryrefslogtreecommitdiff
path: root/modules/pam_tty_audit
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
commit6de381b638547ca6625c2fa8d6355ad61e452fc7 (patch)
treeb88f3806a99d86d44d5f799d500e47a5847795b2 /modules/pam_tty_audit
parent15c568dc2fa87736d3f92b2e89d41ada04f89886 (diff)
modules/pam_tty_audit: use pam_str_skip_prefix
* modules/pam_tty_audit/pam_tty_audit.c: Include "pam_inline.h". (pam_sm_open_session): Use pam_str_skip_prefix instead of ugly strncmp invocations.
Diffstat (limited to 'modules/pam_tty_audit')
-rw-r--r--modules/pam_tty_audit/pam_tty_audit.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/pam_tty_audit/pam_tty_audit.c b/modules/pam_tty_audit/pam_tty_audit.c
index 589c60a2..1d9256c3 100644
--- a/modules/pam_tty_audit/pam_tty_audit.c
+++ b/modules/pam_tty_audit/pam_tty_audit.c
@@ -55,6 +55,7 @@
#include <security/pam_modutil.h>
#include "pam_cc_compat.h"
+#include "pam_inline.h"
#define DATANAME "pam_tty_audit_last_state"
@@ -288,14 +289,16 @@ pam_sm_open_session (pam_handle_t *pamh, int flags, int argc, const char **argv)
#endif /* HAVE_STRUCT_AUDIT_TTY_STATUS_LOG_PASSWD */
for (i = 0; i < argc; i++)
{
- if (strncmp (argv[i], "enable=", 7) == 0
- || strncmp (argv[i], "disable=", 8) == 0)
+ const char *str;
+
+ if ((str = pam_str_skip_prefix(argv[i], "enable=")) != NULL
+ || (str = pam_str_skip_prefix(argv[i], "disable=")) != NULL)
{
enum command this_command;
char *copy, *tok_data, *tok;
this_command = *argv[i] == 'e' ? CMD_ENABLE : CMD_DISABLE;
- copy = strdup (strchr (argv[i], '=') + 1);
+ copy = strdup (str);
if (copy == NULL)
return PAM_SESSION_ERR;
for (tok = strtok_r (copy, ",", &tok_data);