From fefdb27f51ee4b8807314106674f7a3be1941610 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 19 Sep 2013 10:41:02 -0700 Subject: Fix entryCSN format Signed-off-by: Howard Chu Reviewed-by: Andrew Bartlett Reviewed-by: Nadezhda Ivanova --- source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 64dd863508..b5041e37bc 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -176,7 +176,13 @@ static struct ldb_val usn_to_entryCSN(struct ldb_module *module, TALLOC_CTX *ctx struct ldb_val out; unsigned long long usn = strtoull((const char *)val->data, NULL, 10); time_t t = (usn >> 24); - out = data_blob_string_const(talloc_asprintf(ctx, "%s#%06x#00#000000", ldb_timestring(ctx, t), (unsigned int)(usn & 0xFFFFFF))); + struct tm *tm = gmtime(&t); + /* CSN timestamp is YYYYMMDDhhmmss.ssssssZ */ + out = data_blob_string_const(talloc_asprintf(ctx, + "%04u%02u%02u%02u%02u%02u.000000Z#%06x#000#000000", + tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + (unsigned int)(usn & 0xFFFFFF))); return out; } -- cgit