svn commit: samba r16204 - branches/SAMBA_3_0/source/auth trunk/source/auth

vlendec at samba.org vlendec at samba.org
Tue Jun 13 19:56:26 GMT 2006


Author: vlendec
Date: 2006-06-13 19:56:26 +0000 (Tue, 13 Jun 2006)
New Revision: 16204

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16204

Log:
Fix Klocwork # 14

localtime() can return NULL.

Volker


Modified:
   branches/SAMBA_3_0/source/auth/auth_sam.c
   trunk/source/auth/auth_sam.c


Changeset:
Modified: branches/SAMBA_3_0/source/auth/auth_sam.c
===================================================================
--- branches/SAMBA_3_0/source/auth/auth_sam.c	2006-06-13 19:40:28 UTC (rev 16203)
+++ branches/SAMBA_3_0/source/auth/auth_sam.c	2006-06-13 19:56:26 UTC (rev 16204)
@@ -93,9 +93,11 @@
 	bitmask = 1 << (bitpos % 8);
 
 	if (! (hours[bitpos/8] & bitmask)) {
-		DEBUG(1,("logon_hours_ok: Account for user %s not allowed to logon at this time (%s).\n",
-			pdb_get_username(sampass), 
-			asctime(localtime(&lasttime)) ));
+		struct tm *t = localtime(&lasttime);
+		DEBUG(1, ("logon_hours_ok: Account for user %s not allowed to "
+			  "logon at this time (%s).\n",
+			  pdb_get_username(sampass),
+			  t ? asctime(t) : "INVALID TIME"));
 		return False;
 	}
 

Modified: trunk/source/auth/auth_sam.c
===================================================================
--- trunk/source/auth/auth_sam.c	2006-06-13 19:40:28 UTC (rev 16203)
+++ trunk/source/auth/auth_sam.c	2006-06-13 19:56:26 UTC (rev 16204)
@@ -93,9 +93,11 @@
 	bitmask = 1 << (bitpos % 8);
 
 	if (! (hours[bitpos/8] & bitmask)) {
-		DEBUG(1,("logon_hours_ok: Account for user %s not allowed to logon at this time (%s).\n",
-			pdb_get_username(sampass), 
-			asctime(localtime(&lasttime)) ));
+		struct tm *t = localtime(&lasttime);
+		DEBUG(1, ("logon_hours_ok: Account for user %s not allowed to "
+			  "logon at this time (%s).\n",
+			  pdb_get_username(sampass),
+			  t ? asctime(t) : "INVALID TIME"));
 		return False;
 	}
 



More information about the samba-cvs mailing list