diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-10-24 19:30:12 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-10-24 17:57:06 +0000 |
commit | 49dee0e453049a2b26aaacf81e61a0f11afccd91 (patch) | |
tree | 67cc5d76f097367c1af1fa56a18b6816735f7cb9 /source4/dsdb/samdb/ldb_modules/repl_meta_data.c | |
parent | 482c02284068810a57b35a509857fb1273d833b0 (diff) | |
download | samba-49dee0e453049a2b26aaacf81e61a0f11afccd91.tar.gz samba-49dee0e453049a2b26aaacf81e61a0f11afccd91.tar.bz2 samba-49dee0e453049a2b26aaacf81e61a0f11afccd91.zip |
s4:dsdb - use the more safe "samdb_msg_add_(u)int*" calls always where possible
This should prevent all possible integer storage problems in future.
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/repl_meta_data.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 0ee7996a99..5188a66efb 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -536,16 +536,19 @@ static int add_time_element(struct ldb_message *msg, const char *attr, time_t t) /* add a uint64_t element to a record */ -static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_t v) +static int add_uint64_element(struct ldb_context *ldb, struct ldb_message *msg, + const char *attr, uint64_t v) { struct ldb_message_element *el; + int ret; if (ldb_msg_find_element(msg, attr) != NULL) { return LDB_SUCCESS; } - if (ldb_msg_add_fmt(msg, attr, "%llu", (unsigned long long)v) != LDB_SUCCESS) { - return LDB_ERR_OPERATIONS_ERROR; + ret = samdb_msg_add_uint64(ldb, msg, msg, attr, v); + if (ret != LDB_SUCCESS) { + return ret; } el = ldb_msg_find_element(msg, attr); @@ -2232,7 +2235,8 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req) return ret; } - if (add_uint64_element(msg, "uSNChanged", ac->seq_num) != LDB_SUCCESS) { + if (add_uint64_element(ldb, msg, "uSNChanged", + ac->seq_num) != LDB_SUCCESS) { talloc_free(ac); return ret; } @@ -2347,7 +2351,8 @@ static int replmd_rename_callback(struct ldb_request *req, struct ldb_reply *are return ret; } - if (add_uint64_element(msg, "uSNChanged", ac->seq_num) != LDB_SUCCESS) { + if (add_uint64_element(ldb, msg, "uSNChanged", + ac->seq_num) != LDB_SUCCESS) { talloc_free(ac); return ret; } @@ -4063,7 +4068,8 @@ linked_attributes[0]: return ldb_operr(ldb); } - if (add_uint64_element(msg, "uSNChanged", seq_num) != LDB_SUCCESS) { + if (add_uint64_element(ldb, msg, "uSNChanged", + seq_num) != LDB_SUCCESS) { talloc_free(tmp_ctx); return ldb_operr(ldb); } |