From 0372e0372297ef02c65d033b73db602a562f72cd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 13 Jun 2006 19:56:26 +0000 Subject: r16204: Fix Klocwork # 14 localtime() can return NULL. Volker (This used to be commit 07c5dcb8633e6fadb596dc5a22d8d31b2e16a3ef) --- source3/auth/auth_sam.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/auth') diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 50ce9065fd..e8018eb13d 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -93,9 +93,11 @@ static BOOL logon_hours_ok(struct samu *sampass) 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; } -- cgit