summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2013-09-19 10:41:02 -0700
committerNadezhda Ivanova <nivanova@symas.com>2013-09-23 20:42:18 -0700
commitfefdb27f51ee4b8807314106674f7a3be1941610 (patch)
tree9cfac8841a64547b19e7d1d19dc54947a5aba887 /source4/dsdb
parent75705776929d87f1a694582261c07d1724574370 (diff)
downloadsamba-fefdb27f51ee4b8807314106674f7a3be1941610.tar.gz
samba-fefdb27f51ee4b8807314106674f7a3be1941610.tar.bz2
samba-fefdb27f51ee4b8807314106674f7a3be1941610.zip
Fix entryCSN format
Signed-off-by: Howard Chu <hyc@symas.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/simple_ldap_map.c8
1 files changed, 7 insertions, 1 deletions
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;
}