From c50dff4ccea48de81815e0b92066b89b2bf3ddec Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sat, 1 Aug 2009 14:02:58 +0400 Subject: Return infinite time for last last logoff when last logoff = 0 --- source4/dsdb/common/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/dsdb/common/util.c') diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 247aec7035..5c5386b64c 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -435,6 +435,22 @@ NTTIME samdb_result_nttime(struct ldb_message *msg, const char *attr, NTTIME def return ldb_msg_find_attr_as_uint64(msg, attr, default_value); } +/* + * Windows stores 0 for lastLogoff. + * But when a MS DC return the lastLogoff (as Logoff Time) + * it returns 0x7FFFFFFFFFFFFFFF, not returning this value in this case + * cause windows 2008 and newer version to fail for SMB requests + */ +NTTIME samdb_result_last_logoff(struct ldb_message *msg) +{ + NTTIME ret = ldb_msg_find_attr_as_uint64(msg, "lastLogoff",0); + + if (ret == 0) + ret = 0x7FFFFFFFFFFFFFFFULL; + + return ret; +} + /* * Windows uses both 0 and 9223372036854775807 (0x7FFFFFFFFFFFFFFFULL) to * indicate an account doesn't expire. -- cgit