patch logon time, samba-3.0.2pre1

Jianliang Lu j.lu at tiesse.com
Fri Jan 9 11:02:59 GMT 2004


Now the user logon time is updated every time the logon is successful.

Patch:

--- samba-3.0.2pre1/source/auth/auth_sam.c.orig	Thu Jan  8 18:01:12 2004
+++ samba-3.0.2pre1/source/auth/auth_sam.c	Thu Jan  8 17:58:51 2004
@@ -216,6 +216,17 @@
 		pdb_free_sam(&sampass);
 		return nt_status;
 	}
+	if (pdb_get_acct_ctrl(sampass) &ACB_NORMAL){
+		if (!pdb_set_logon_time(sampass, time(NULL), PDB_CHANGED))
+	             DEBUG(0, ("auth_sam.c : pdb_set_logon_time fialed!\n"));
+
+ 		become_root();
+		if(!pdb_update_sam_account(sampass))
+			DEBUG(0, ("Failed to modify entry for user % s.\n",
+						user_info-
>internal_username.str));
+		unbecome_root();
+	}          
+
 
 	if (!NT_STATUS_IS_OK(nt_status = make_server_info_sam(server_info, 
sampass))) {		
 		DEBUG(0,("check_sam_security: make_server_info_sam() failed 
with '%s'\n", nt_errstr(nt_status)));

----------------------------------------------------------------------
Cheers,
Jianliang Lu

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


More information about the samba-technical mailing list