[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2740-g516a067

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


The branch, v3-3-test has been updated
       via  516a067016955938988ab37c777102a14b41e100 (commit)
      from  8a4577ebb00b0b190f6a9c708a1bc6e1bc8f9712 (commit)

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


- Log -----------------------------------------------------------------
commit 516a067016955938988ab37c777102a14b41e100
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 47e0e3c..7288d7a 100644
--- a/source/nsswitch/pam_winbind.c
+++ b/source/nsswitch/pam_winbind.c
@@ -2417,6 +2417,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 {
 	unsigned int lctrl;
 	int ret;
+	bool cached_login = false;
 
 	/* <DO NOT free() THESE> */
 	const char *user;
@@ -2439,7 +2440,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 
 	_PAM_LOG_FUNCTION_ENTER("pam_sm_chauthtok", ctx);
 
-	/* clearing offline bit for the auth in the password change */
+	cached_login = (ctx->ctrl & WINBIND_CACHED_LOGIN);
+
+	/* clearing offline bit for auth */
 	ctx->ctrl &= ~WINBIND_CACHED_LOGIN;
 
 	/*
@@ -2595,6 +2598,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) {
+			ctx->ctrl |= WINBIND_CACHED_LOGIN;
+		}
+
 		ret = winbind_chauthtok_request(ctx, user, pass_old,
 						pass_new, pwdlastset_update);
 		if (ret) {
@@ -2614,6 +2626,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
 			cctype = get_krb5_cc_type_from_config(ctx);
 			warn_pwd_expire = get_warn_pwd_expire_from_config(ctx);
 
+			/* clearing offline bit for auth */
+			ctx->ctrl &= ~WINBIND_CACHED_LOGIN;
+
 			ret = winbind_auth_request(ctx, user, pass_new,
 						   member, cctype, 0, &response,
 						   NULL, &username_ret);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list