]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorTomas Mraz <tm@t8m.info>
Mon, 8 Nov 2004 10:57:15 +0000 (10:57 +0000)
committerTomas Mraz <tm@t8m.info>
Mon, 8 Nov 2004 10:57:15 +0000 (10:57 +0000)
Purpose of commit: bugfix

Commit summary:
---------------
getlogin doesn't cache the login name properly

modules/pammodutil/modutil_getlogin.c

index 1bbb2450149c1b8dc9919e3e11cb9eb03f6bcae9..ef09d03154ea82fc69260ec0ea1e74c36f4e87f1 100644 (file)
@@ -52,10 +52,10 @@ const char *_pammodutil_getlogin(pam_handle_t *pamh)
        goto clean_up_and_go_home;
     }
 
-    strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user));
-    curr_user[sizeof(line.ut_user)] = '\0';
+    strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user)); 
+    /* calloc already zeroed the memory */
 
-    status = pam_set_data(pamh, _PAMMODUTIL_GETLOGIN, logname,
+    status = pam_set_data(pamh, _PAMMODUTIL_GETLOGIN, curr_user,
                          _pammodutil_cleanup);
     if (status != PAM_SUCCESS) {
        free(curr_user);