r17366: Save the logon script path from the info3 in the PAM session allowing
authorGünther Deschner <gd@samba.org>
Tue, 1 Aug 2006 15:31:16 +0000 (15:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:28 +0000 (11:38 -0500)
other PAM modules to pick it up from there.

Guenther

source/nsswitch/pam_winbind.c
source/nsswitch/pam_winbind.h

index f96dd0ee9b6fd7e7529616ef8fe231bb4def7a5e..1aef5c6c4a228562b5ccd1238a1e38b56d4c07d7 100644 (file)
@@ -503,13 +503,27 @@ static int winbind_auth_request(pam_handle_t * pamh,
 
        /* save the CIFS homedir for pam_cifs / pam_mount */
        if (response.data.auth.info3.home_dir[0] != '\0') {
-               char *buf;
 
-               if (!asprintf(&buf, "%s", response.data.auth.info3.home_dir)) {
-                       return PAM_BUF_ERR;
+               int ret2 = pam_set_data(pamh, PAM_WINBIND_HOMEDIR,
+                                       (void *) strdup(response.data.auth.info3.home_dir),
+                                       _pam_winbind_cleanup_func);
+               if (ret2) {
+                       _pam_log_debug(ctrl, LOG_DEBUG, "Could not set data: %s", 
+                                      pam_strerror(pamh, ret2));
                }
 
-               pam_set_data( pamh, PAM_WINBIND_HOMEDIR, (void *)buf, _pam_winbind_cleanup_func);
+       }
+
+       /* save the logon script path for other PAM modules */
+       if (response.data.auth.info3.logon_script[0] != '\0') {
+
+               int ret2 = pam_set_data(pamh, PAM_WINBIND_LOGONSCRIPT, 
+                                       (void *) strdup(response.data.auth.info3.logon_script), 
+                                       _pam_winbind_cleanup_func);
+               if (ret2) {
+                       _pam_log_debug(ctrl, LOG_DEBUG, "Could not set data: %s", 
+                                      pam_strerror(pamh, ret2));
+               }
        }
 
        return ret;
index fb2769d1c1a4c8944cf2f0942b175c1bd8cca7a1..2b7080182be22987f9ea351bde965480a60e2872 100644 (file)
@@ -108,6 +108,7 @@ do {                             \
 
 #define PAM_WINBIND_NEW_AUTHTOK_REQD "PAM_WINBIND_NEW_AUTHTOK_REQD"
 #define PAM_WINBIND_HOMEDIR "PAM_WINBIND_HOMEDIR"
+#define PAM_WINBIND_LOGONSCRIPT "PAM_WINBIND_LOGONSCRIPT"
 #define PAM_WINBIND_PWD_LAST_SET "PAM_WINBIND_PWD_LAST_SET"
 
 #define SECONDS_PER_DAY 86400