diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-07-08 11:32:59 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-07-09 09:27:11 +0200 |
commit | 1d6f321a918699906cabbe3ee2970bd0a635180b (patch) | |
tree | 1deee973e59334ecfa9af266bdcc3062a89b4530 /source4/dsdb/samdb/ldb_modules | |
parent | 388e955f28a578e5421182c0aa3afe9da27a6c34 (diff) | |
download | samba-1d6f321a918699906cabbe3ee2970bd0a635180b.tar.gz samba-1d6f321a918699906cabbe3ee2970bd0a635180b.tar.bz2 samba-1d6f321a918699906cabbe3ee2970bd0a635180b.zip |
s4:dsdb: add dsdb_module_constrainted_update_int32/64() functions
metze
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 29fc8d7508..fe7f46cb8b 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -1042,3 +1042,61 @@ int dsdb_msg_constrainted_update_int64(struct ldb_module *module, return LDB_SUCCESS; } + +/* + update an int32 attribute safely via a constrained delete/add + */ +int dsdb_module_constrainted_update_int32(struct ldb_module *module, + struct ldb_dn *dn, + const char *attr, + const int32_t *old_val, + const int32_t *new_val) +{ + struct ldb_message *msg; + int ret; + + msg = ldb_msg_new(module); + msg->dn = dn; + + ret = dsdb_msg_constrainted_update_int32(module, + msg, attr, + old_val, + new_val); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + + ret = dsdb_module_modify(module, msg, DSDB_FLAG_NEXT_MODULE); + talloc_free(msg); + return ret; +} + +/* + update an int64 attribute safely via a constrained delete/add + */ +int dsdb_module_constrainted_update_int64(struct ldb_module *module, + struct ldb_dn *dn, + const char *attr, + const int64_t *old_val, + const int64_t *new_val) +{ + struct ldb_message *msg; + int ret; + + msg = ldb_msg_new(module); + msg->dn = dn; + + ret = dsdb_msg_constrainted_update_int64(module, + msg, attr, + old_val, + new_val); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + + ret = dsdb_module_modify(module, msg, DSDB_FLAG_NEXT_MODULE); + talloc_free(msg); + return ret; +} |