[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-29-29-g36729f6

Günther Deschner gd at samba.org
Fri Jun 6 14:09:47 GMT 2008


The branch, v3-0-test has been updated
       via  36729f6f1680310d51f126aa4b7760f11e405a9c (commit)
      from  db528addf9fa8b0a4ce3b1270cd492725e6cd4d2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 36729f6f1680310d51f126aa4b7760f11e405a9c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jun 6 15:59:52 2008 +0200

    pam_winbind: fix pam_sm_chauthtok for storing modified cached creds.
    
    Thanks to Bo Yang for pointing this out.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/nsswitch/pam_winbind.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nsswitch/pam_winbind.c b/source/nsswitch/pam_winbind.c
index 2846e14..5993840 100644
--- a/source/nsswitch/pam_winbind.c
+++ b/source/nsswitch/pam_winbind.c
@@ -1946,6 +1946,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 	unsigned int lctrl;
 	int ret;
 	unsigned int ctrl;
+	bool cached_login = False;
 
 	/* <DO NOT free() THESE> */
 	const char *user;
@@ -1969,7 +1970,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_chauthtok", pamh, ctrl, flags);
 
-	/* clearing offline bit for the auth in the password change */
+	cached_login = (ctrl & WINBIND_CACHED_LOGIN);
+
+	/* clearing offline bit for auth */
 	ctrl &= ~WINBIND_CACHED_LOGIN;
 
 	/*
@@ -2117,6 +2120,15 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 		_pam_get_data( pamh, PAM_WINBIND_PWD_LAST_SET,
 			       &pwdlastset_update);
 
+		/*
+		 * if cached creds were enabled, make sure to set the
+		 * WINBIND_CACHED_LOGIN bit here in order to have winbindd
+		 * update the cached creds storage - gd
+		 */
+		if (cached_login) {
+			ctrl |= WINBIND_CACHED_LOGIN;
+		}
+
 		ret = winbind_chauthtok_request(pamh, ctrl, user, pass_old, pass_new, pwdlastset_update);
 		if (ret) {
 			_pam_overwrite(pass_new);
@@ -2130,6 +2142,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 			const char *member = get_member_from_config(pamh, argc, argv, ctrl, d);
 			const char *cctype = get_krb5_cc_type_from_config(pamh, argc, argv, ctrl, d);
 
+			/* clearing offline bit for auth */
+			ctrl &= ~WINBIND_CACHED_LOGIN;
+
 			ret = winbind_auth_request(pamh, ctrl, user, pass_new,
 							member, cctype, &response, NULL, &username_ret);
 			_pam_overwrite(pass_new);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list