diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | libpam/pam_modutil_getlogin.c | 10 | ||||
-rw-r--r-- | modules/pam_xauth/pam_xauth.c | 11 |
3 files changed, 22 insertions, 7 deletions
@@ -1,3 +1,11 @@ +2005-11-23 Thorsten Kukuk <kukuk@suse.de> + + * 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 <kukuk@thkukuk.de> * 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; } } |