diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-01-06 14:48:55 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-01-08 13:03:00 +1100 |
commit | 45550f83f00f259a64cd70f7b2f741a12ee55854 (patch) | |
tree | 41e61e4c08bc1e6b892dd5a466977f28d4dd3ba8 /source4/dsdb/samdb | |
parent | c12b9ab2f2d26147a0878bbb2a1672892599293e (diff) | |
download | samba-45550f83f00f259a64cd70f7b2f741a12ee55854.tar.gz samba-45550f83f00f259a64cd70f7b2f741a12ee55854.tar.bz2 samba-45550f83f00f259a64cd70f7b2f741a12ee55854.zip |
s4-dsdb: added dsdb_module_set_integer()
This will be used by ridalloc.c
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 09b41a254b..12972eb185 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -597,3 +597,27 @@ int dsdb_next_callback(struct ldb_request *req, struct ldb_reply *ares) return up_req->callback(up_req, ares); } + +/* + set an integer attribute + */ +int dsdb_module_set_integer(struct ldb_module *module, struct ldb_dn *dn, + const char *attr, uint64_t new_val) +{ + struct ldb_message *msg; + int ret; + + msg = ldb_msg_new(module); + msg->dn = dn; + + ret = ldb_msg_add_fmt(msg, attr, "%llu", (unsigned long long)new_val); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + msg->elements[0].flags = LDB_FLAG_MOD_REPLACE; + + ret = dsdb_module_modify(module, msg, 0); + talloc_free(msg); + return ret; +} |