* 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.
---
modules/pam_tty_audit/pam_tty_audit.c | 9 ++++++---
1 file 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..9f90894e 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="))
+ || (str = pam_str_skip_prefix(argv[i], "disable=")))
{
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);
--
ldv