From dc1ef1998cff01323a93ee312f638cf4ba45c794 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Wed, 23 Nov 2005 16:42:39 +0000 Subject: [PATCH] Relevant BUGIDs: none Purpose of commit: bugfix Commit summary: --------------- 2005-11-23 Thorsten Kukuk * modules/pam_xauth/pam_xauth.c (pam_sm_open_session): Introduce new variable to fix compiler warning. * libpam/pam_modutil_getlogin.c (pam_modutil_getlogin): PAM_TTY don't need to start with /dev/. --- ChangeLog | 8 ++++++++ libpam/pam_modutil_getlogin.c | 10 ++++++++-- modules/pam_xauth/pam_xauth.c | 11 ++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 368b9d9e..9c38b065 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-11-23 Thorsten Kukuk + + * modules/pam_xauth/pam_xauth.c (pam_sm_open_session): Introduce + new variable to fix compiler warning. + + * libpam/pam_modutil_getlogin.c (pam_modutil_getlogin): PAM_TTY + don't need to start with /dev/. + 2005-11-21 Thorsten Kukuk * release version 0.99.2.0 diff --git a/libpam/pam_modutil_getlogin.c b/libpam/pam_modutil_getlogin.c index d30f1dfa..04a20fd8 100644 --- a/libpam/pam_modutil_getlogin.c +++ b/libpam/pam_modutil_getlogin.c @@ -35,11 +35,17 @@ pam_modutil_getlogin(pam_handle_t *pamh) else curr_tty = (const char*)void_curr_tty; - if ((curr_tty == NULL) || memcmp(curr_tty, "/dev/", 5)) { + if (curr_tty == NULL) { return NULL; } - curr_tty += 5; /* strlen("/dev/") */ + if (curr_tty[0] == '/') { /* full path */ + const char *t; + curr_tty++; + if ((t = strchr(curr_tty, '/')) != NULL) { + curr_tty = t + 1; + } + } logname = NULL; setutent(); diff --git a/modules/pam_xauth/pam_xauth.c b/modules/pam_xauth/pam_xauth.c index 886b2f88..5376bd8b 100644 --- a/modules/pam_xauth/pam_xauth.c +++ b/modules/pam_xauth/pam_xauth.c @@ -64,7 +64,7 @@ #define XAUTHTMP ".xauthXXXXXX" /* Possible paths to xauth executable */ -static const char * const xauthpaths[] = { +static const char * const xauthpaths[] = { #ifdef PAM_PATH_XAUTH PAM_PATH_XAUTH, #endif @@ -329,11 +329,12 @@ pam_sm_open_session (pam_handle_t *pamh, int flags UNUSED, pam_syslog(pamh, LOG_WARNING, "unrecognized option `%s'", argv[i]); } - + if (xauth == NULL) { - for (i = 0; i < sizeof(xauthpaths)/sizeof(xauthpaths[0]); i++) { - if (access(xauthpaths[i], X_OK) == 0) { - xauth = xauthpaths[i]; + size_t j; + for (j = 0; j < sizeof(xauthpaths)/sizeof(xauthpaths[0]); j++) { + if (access(xauthpaths[j], X_OK) == 0) { + xauth = xauthpaths[j]; break; } } -- 2.40.0