diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-01-11 13:11:48 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-01-13 14:51:59 +0100 |
commit | 8d4b913ce24632eca2a6fc08ef8f553eaa9afa77 (patch) | |
tree | 24fd5b1ea7b1a3a89135add1beba600d0ea1a9a7 | |
parent | 7147c8453e7174e5b6bf20172b48b065fb9b8e99 (diff) | |
download | samba-8d4b913ce24632eca2a6fc08ef8f553eaa9afa77.tar.gz samba-8d4b913ce24632eca2a6fc08ef8f553eaa9afa77.tar.bz2 samba-8d4b913ce24632eca2a6fc08ef8f553eaa9afa77.zip |
s4:ldb: be more strict in parsing ldb time strings
metze
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 9b33d7e351..cb8d4a8d9a 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -820,7 +820,7 @@ time_t ldb_string_to_time(const char *s) if (s == NULL) return 0; memset(&tm, 0, sizeof(tm)); - if (sscanf(s, "%04u%02u%02u%02u%02u%02u", + if (sscanf(s, "%04u%02u%02u%02u%02u%02u.0Z", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { return 0; @@ -839,13 +839,13 @@ int ldb_val_to_time(const struct ldb_val *v, time_t *t) { struct tm tm; - if (v == NULL || !v->data || v->length < 14) { + if (v == NULL || !v->data || v->length < 17) { return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } memset(&tm, 0, sizeof(tm)); - if (sscanf((char *)v->data, "%04u%02u%02u%02u%02u%02u", + if (sscanf((char *)v->data, "%04u%02u%02u%02u%02u%02u.0Z", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; @@ -899,7 +899,7 @@ time_t ldb_string_utc_to_time(const char *s) if (s == NULL) return 0; memset(&tm, 0, sizeof(tm)); - if (sscanf(s, "%02u%02u%02u%02u%02u%02u", + if (sscanf(s, "%02u%02u%02u%02u%02u%02uZ", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { return 0; |