diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-07-13 13:26:48 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-07-13 12:51:05 +0200 |
commit | 014fca10697c80d49d2c3438089935c63f445644 (patch) | |
tree | 4c35467200fa869af1d6d5e744a52199e4554308 /source4 | |
parent | fc476ec8ac3357c81b805e0634624f183a6f7b49 (diff) | |
download | samba-014fca10697c80d49d2c3438089935c63f445644.tar.gz samba-014fca10697c80d49d2c3438089935c63f445644.tar.xz samba-014fca10697c80d49d2c3438089935c63f445644.zip |
dsdb: fixed special case of zero NTTIME
we can't convert 0 NTTIME via a unix time_t
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index a93cdfaaa9..d443c009af 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -554,6 +554,11 @@ static WERROR dsdb_syntax_NTTIME_UTC_drsuapi_to_ldb(const struct dsdb_syntax_ctx } v = BVAL(in->value_ctr.values[i].blob->data, 0); + if (v == 0) { + /* special case for 1601 zero timestamp */ + out->values[i] = data_blob_string_const("16010101000000.0Z"); + continue; + } v *= 10000000; t = nt_time_to_unix(v); @@ -607,6 +612,11 @@ static WERROR dsdb_syntax_NTTIME_UTC_ldb_to_drsuapi(const struct dsdb_syntax_ctx blobs[i] = data_blob_talloc(blobs, NULL, 8); W_ERROR_HAVE_NO_MEMORY(blobs[i].data); + if (ldb_val_string_cmp("16010101000000.0Z", &in->values[i]) == 0) { + SBVALS(blobs[i].data, 0, 0); + continue; + } + t = ldb_string_utc_to_time((const char *)in->values[i].data); unix_to_nt_time(&v, t); v /= 10000000; @@ -693,6 +703,11 @@ static WERROR dsdb_syntax_NTTIME_drsuapi_to_ldb(const struct dsdb_syntax_ctx *ct } v = BVAL(in->value_ctr.values[i].blob->data, 0); + if (v == 0) { + /* special case for 1601 zero timestamp */ + out->values[i] = data_blob_string_const("16010101000000.0Z"); + continue; + } v *= 10000000; t = nt_time_to_unix(v); @@ -739,6 +754,11 @@ static WERROR dsdb_syntax_NTTIME_ldb_to_drsuapi(const struct dsdb_syntax_ctx *ct blobs[i] = data_blob_talloc(blobs, NULL, 8); W_ERROR_HAVE_NO_MEMORY(blobs[i].data); + if (ldb_val_string_cmp("16010101000000.0Z", &in->values[i]) == 0) { + SBVALS(blobs[i].data, 0, 0); + continue; + } + ret = ldb_val_to_time(&in->values[i], &t); if (ret != LDB_SUCCESS) { return WERR_DS_INVALID_ATTRIBUTE_SYNTAX; |