patch for deselect "User Must Change Password at Next Logon" from usrmgr, samba-3.0.2pre1

Jianliang Lu j.lu at tiesse.com
Tue Jan 13 08:24:01 GMT 2004


This patch will allow deselect "User Must Change Password at Next Logon" on 
usrmgr. Today on Samba when the "User Must Change Password at Next Logon" was 
selected and the "Must Change Time" was set to zero, you can not deselect it 
in any way other than change the password. On NT the "deselect" is permitted.

Cheers,
Jianliang Lu

patch:

--- samba-3.0.2pre1/source/rpc_server/srv_samr_util.c.orig	Fri Jan  9 
11:09:26 2004
+++ samba-3.0.2pre1/source/rpc_server/srv_samr_util.c	Mon Jan 12 17:45:24 
2004
@@ -270,6 +269,23 @@
 	DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from-
>passmustchange));
 	if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
 		pdb_set_pass_must_change_time(to,0, PDB_CHANGED);	
	
+	}else {
+		uint32 expire;
+		if (pdb_get_pass_must_change_time(to) == 0){
+			if (!account_policy_get(AP_MAX_PASSWORD_AGE, &expire) 
+	    		|| (expire==(uint32)-1)) {
+				if (!pdb_set_pass_must_change_time (to, 
get_time_t_max(), PDB_CHANGED)){
+					DEBUG(0,
("pdb_set_pass_must_change_time failed!\n"));
+				}
+			} else {
+				if (!pdb_set_pass_must_change_time (to, 
+								    
pdb_get_pass_last_set_time(to)
+								    + expire, 
PDB_CHANGED)){
+					DEBUG(0,
("pdb_set_pass_must_change_time failed!\n"));
+				}
+			}
+	
+		}
 	}
 
 	DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2));



TieSse s.p.a.     Ivrea (To) - Italy
j.lu at tiesse.com   luj at libero.it
http://www.tiesse.com


More information about the samba-technical mailing list