]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: none
authorThorsten Kukuk <kukuk@thkukuk.de>
Wed, 23 Nov 2005 16:42:39 +0000 (16:42 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Wed, 23 Nov 2005 16:42:39 +0000 (16:42 +0000)
Purpose of commit: bugfix

Commit summary:
---------------

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/.

ChangeLog
libpam/pam_modutil_getlogin.c
modules/pam_xauth/pam_xauth.c

index 368b9d9e054c793e12113f8775dd204d76ba4a5c..9c38b0653f2fc213b61c1d84de7b70577ce6b9b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index d30f1dfa2bed9dff84b4ae4b027d2f4cbe165d9a..04a20fd88d34f3820deae426137ee132a9f4aa99 100644 (file)
@@ -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();
index 886b2f8874fc8f2059bba8bfbb0ac0e82e0c5855..5376bd8b18354caa31700d239cad591f8dfbd6fa 100644 (file)
@@ -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;
                        }
                }