diff options
author | Simo Sorce <idra@samba.org> | 2006-10-25 01:42:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:24:38 -0500 |
commit | 7f833458ca0083654e34cbfde1c6c6510cab1826 (patch) | |
tree | 0e2d7a740b8c29896ed7ee5635d2520b9913945e /source4 | |
parent | 3cee746a3f23f1040daa60d1208145bff87b3d01 (diff) | |
download | samba-7f833458ca0083654e34cbfde1c6c6510cab1826.tar.gz samba-7f833458ca0083654e34cbfde1c6c6510cab1826.tar.bz2 samba-7f833458ca0083654e34cbfde1c6c6510cab1826.zip |
r19489: Change ldb_msg_add_value and ldb_msg_add_empty to take a foruth argument.
This is a pointer to an element pointer. If it is not null it will be
filled with the pointer of the manipulated element.
Will avoid double searches on the elements list in some cases.
(This used to be commit 0fa5d4bc225b83e9f63ac6d75bffc4c08eb6b620)
Diffstat (limited to 'source4')
21 files changed, 82 insertions, 74 deletions
diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c index 855f159981..2f33b12a8d 100644 --- a/source4/auth/gensec/schannel_state.c +++ b/source4/auth/gensec/schannel_state.c @@ -109,10 +109,10 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx, server_state.length = sizeof(creds->server.data); ldb_msg_add_string(msg, "objectClass", "schannelState"); - ldb_msg_add_value(msg, "sessionKey", &val); - ldb_msg_add_value(msg, "seed", &seed); - ldb_msg_add_value(msg, "clientState", &client_state); - ldb_msg_add_value(msg, "serverState", &server_state); + ldb_msg_add_value(msg, "sessionKey", &val, NULL); + ldb_msg_add_value(msg, "seed", &seed, NULL); + ldb_msg_add_value(msg, "clientState", &client_state, NULL); + ldb_msg_add_value(msg, "serverState", &server_state, NULL); ldb_msg_add_string(msg, "negotiateFlags", f); ldb_msg_add_string(msg, "secureChannelType", sct); ldb_msg_add_string(msg, "accountName", creds->account_name); diff --git a/source4/dsdb/samdb/ldb_modules/local_password.c b/source4/dsdb/samdb/ldb_modules/local_password.c index a19b71a44f..b5cff0272d 100644 --- a/source4/dsdb/samdb/ldb_modules/local_password.c +++ b/source4/dsdb/samdb/ldb_modules/local_password.c @@ -498,12 +498,10 @@ static int lpdb_local_search_callback(struct ldb_context *ldb, void *context, st ares->message->elements[i].name); if (!el) { if (ldb_msg_add_empty(local_context->remote_res->message, - ares->message->elements[i].name, 0) != LDB_SUCCESS) { + ares->message->elements[i].name, 0, &el) != LDB_SUCCESS) { talloc_free(ares); return LDB_ERR_OPERATIONS_ERROR; } - el = ldb_msg_find_element(local_context->remote_res->message, - ares->message->elements[i].name); *el = ares->message->elements[i]; } } diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 0c4a493adb..76413ca56b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -151,7 +151,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - ret = ldb_msg_add_value(msg, "objectGUID", &v); + ret = ldb_msg_add_value(msg, "objectGUID", &v, NULL); if (ret) { talloc_free(down_req); return ret; diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index 9ba7bc44c4..1b35ec3e8c 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -106,10 +106,10 @@ static int add_password_hashes(struct ldb_module *module, struct ldb_message *ms } if (is_mod) { - if (ldb_msg_add_empty(msg, "ntPwdHash", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "ntPwdHash", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } } @@ -250,7 +250,7 @@ static int add_krb5_keys_from_password(struct ldb_module *module, struct ldb_mes hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys); return LDB_ERR_OPERATIONS_ERROR; } - ret = ldb_msg_add_value(msg, "krb5Key", &val); + ret = ldb_msg_add_value(msg, "krb5Key", &val, NULL); if (ret != LDB_SUCCESS) { hdb_free_keys (smb_krb5_context->krb5_context, num_keys, keys); return ret; @@ -301,7 +301,7 @@ static int add_krb5_keys_from_NThash(struct ldb_module *module, struct ldb_messa if (!val.data) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_value(msg, "krb5Key", &val) != 0) { + if (ldb_msg_add_value(msg, "krb5Key", &val, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } @@ -319,12 +319,12 @@ static int set_pwdLastSet(struct ldb_module *module, struct ldb_message *msg, in /* be sure there isn't a 0 value set (eg. coming from the template) */ ldb_msg_remove_attr(msg, "pwdLastSet"); /* add */ - if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_ADD) != 0) { + if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_ADD, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } } else { /* replace */ - if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "pwdLastSet", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } } @@ -339,7 +339,7 @@ static int set_pwdLastSet(struct ldb_module *module, struct ldb_message *msg, in static int add_keyVersionNumber(struct ldb_module *module, struct ldb_message *msg, int previous) { /* replace or add */ - if (ldb_msg_add_empty(msg, "msDS-KeyVersionNumber", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "msDS-KeyVersionNumber", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } @@ -385,7 +385,7 @@ static int setPwdHistory(struct ldb_module *module, struct ldb_message *msg, str } else { ZERO_STRUCT(new_nt_history[0]); } - if (ldb_msg_add_empty(msg, "sambaNTPwdHistory", LDB_FLAG_MOD_REPLACE) != LDB_SUCCESS) { + if (ldb_msg_add_empty(msg, "sambaNTPwdHistory", LDB_FLAG_MOD_REPLACE, NULL) != LDB_SUCCESS) { return LDB_ERR_OPERATIONS_ERROR; } if (samdb_msg_add_hashes(msg, msg, "sambaNTPwdHistory", new_nt_history, nt_hist_len) != LDB_SUCCESS) { @@ -408,7 +408,7 @@ static int setPwdHistory(struct ldb_module *module, struct ldb_message *msg, str } else { ZERO_STRUCT(new_lm_history[0]); } - if (ldb_msg_add_empty(msg, "sambaLMPwdHistory", LDB_FLAG_MOD_REPLACE) != LDB_SUCCESS) { + if (ldb_msg_add_empty(msg, "sambaLMPwdHistory", LDB_FLAG_MOD_REPLACE, NULL) != LDB_SUCCESS) { return LDB_ERR_OPERATIONS_ERROR; } if (samdb_msg_add_hashes(msg, msg, "sambaLMPwdHistory", new_lm_history, lm_hist_len) != LDB_SUCCESS) { @@ -1005,7 +1005,7 @@ static int password_hash_mod_do_mod(struct ldb_handle *h) { } /* we are going to replace the existing krb5key or delete it */ - if (ldb_msg_add_empty(msg, "krb5key", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "krb5key", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index f589ba859d..fbb5ead537 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -54,7 +54,7 @@ static BOOL samldb_msg_add_sid(struct ldb_module *module, struct ldb_message *ms if (!NT_STATUS_IS_OK(status)) { return -1; } - return (ldb_msg_add_value(msg, name, &v) == 0); + return (ldb_msg_add_value(msg, name, &v, NULL) == 0); } /* diff --git a/source4/dsdb/samdb/ldb_modules/schema.c b/source4/dsdb/samdb/ldb_modules/schema.c index 87b1d30269..fe275ce841 100644 --- a/source4/dsdb/samdb/ldb_modules/schema.c +++ b/source4/dsdb/samdb/ldb_modules/schema.c @@ -902,7 +902,7 @@ static int schema_add_build_down_req(struct schema_context *sctx) /* rebuild the objectclass list */ ldb_msg_remove_attr(msg, "objectClass"); - ret = ldb_msg_add_empty(msg, "objectClass", 0); + ret = ldb_msg_add_empty(msg, "objectClass", 0, NULL); if (ret != LDB_SUCCESS) { return ret; } diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 506c17a5fd..5578cdd7d6 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -773,7 +773,7 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru if (!NT_STATUS_IS_OK(status)) { return -1; } - return ldb_msg_add_value(msg, attr_name, &v); + return ldb_msg_add_value(msg, attr_name, &v, NULL); } @@ -785,7 +785,7 @@ int samdb_msg_add_delete(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc { /* we use an empty replace rather than a delete, as it allows for samdb_replace() to be used everywhere */ - return ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_REPLACE); + return ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_REPLACE, NULL); } /* @@ -890,7 +890,7 @@ int samdb_msg_add_hash(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct return -1; } val.length = 16; - return ldb_msg_add_value(msg, attr_name, &val); + return ldb_msg_add_value(msg, attr_name, &val, NULL); } /* @@ -909,7 +909,7 @@ int samdb_msg_add_hashes(TALLOC_CTX *mem_ctx, struct ldb_message *msg, for (i=0;i<count;i++) { memcpy(i*16 + (char *)val.data, hashes[i].hash, 16); } - return ldb_msg_add_value(msg, attr_name, &val); + return ldb_msg_add_value(msg, attr_name, &val, NULL); } /* @@ -930,7 +930,7 @@ int samdb_msg_add_logon_hours(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_val val; val.length = hours->units_per_week / 8; val.data = hours->bits; - return ldb_msg_add_value(msg, attr_name, &val); + return ldb_msg_add_value(msg, attr_name, &val, NULL); } /* @@ -939,7 +939,7 @@ int samdb_msg_add_logon_hours(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, int samdb_msg_add_value(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg, const char *attr_name, const struct ldb_val *val) { - return ldb_msg_add_value(msg, attr_name, val); + return ldb_msg_add_value(msg, attr_name, val, NULL); } /* @@ -954,7 +954,7 @@ int samdb_msg_set_value(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct if (el) { el->num_values = 0; } - return ldb_msg_add_value(msg, attr_name, val); + return ldb_msg_add_value(msg, attr_name, val, NULL); } /* diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index 4992eb01ad..135ce9eecd 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -613,7 +613,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb, } if (empty) { - if (ldb_msg_add_empty(msg, (char *)value.data, flags) != 0) { + if (ldb_msg_add_empty(msg, (char *)value.data, flags, NULL) != 0) { goto failed; } continue; diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 7e001f9180..da8ab4994f 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -119,7 +119,10 @@ struct ldb_val ldb_val_dup(void *mem_ctx, const struct ldb_val *v) /* add an empty element to a message */ -int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags) +int ldb_msg_add_empty( struct ldb_message *msg, + const char *attr_name, + int flags, + struct ldb_message_element **return_el) { struct ldb_message_element *els; @@ -146,6 +149,10 @@ int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags) msg->elements = els; msg->num_elements++; + if (return_el) { + *return_el = &els[msg->num_elements-1]; + } + return LDB_SUCCESS; } @@ -156,7 +163,7 @@ int ldb_msg_add(struct ldb_message *msg, const struct ldb_message_element *el, int flags) { - if (ldb_msg_add_empty(msg, el->name, flags) != 0) { + if (ldb_msg_add_empty(msg, el->name, flags, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } @@ -171,15 +178,15 @@ int ldb_msg_add(struct ldb_message *msg, */ int ldb_msg_add_value(struct ldb_message *msg, const char *attr_name, - const struct ldb_val *val) + const struct ldb_val *val, + struct ldb_message_element **return_el) { struct ldb_message_element *el; struct ldb_val *vals; el = ldb_msg_find_element(msg, attr_name); if (!el) { - ldb_msg_add_empty(msg, attr_name, 0); - el = ldb_msg_find_element(msg, attr_name); + ldb_msg_add_empty(msg, attr_name, 0, &el); } if (!el) { return LDB_ERR_OPERATIONS_ERROR; @@ -194,6 +201,10 @@ int ldb_msg_add_value(struct ldb_message *msg, el->values[el->num_values] = *val; el->num_values++; + if (return_el) { + *return_el = el; + } + return LDB_SUCCESS; } @@ -206,10 +217,10 @@ int ldb_msg_add_steal_value(struct ldb_message *msg, struct ldb_val *val) { int ret; - ret = ldb_msg_add_value(msg, attr_name, val); + struct ldb_message_element *el; + + ret = ldb_msg_add_value(msg, attr_name, val, &el); if (ret == LDB_SUCCESS) { - struct ldb_message_element *el; - el = ldb_msg_find_element(msg, attr_name); talloc_steal(el->values, val->data); } return ret; @@ -232,7 +243,7 @@ int ldb_msg_add_string(struct ldb_message *msg, return LDB_SUCCESS; } - return ldb_msg_add_value(msg, attr_name, &val); + return ldb_msg_add_value(msg, attr_name, &val, NULL); } /* @@ -576,7 +587,7 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb, if (!el) { if (ldb_msg_add_empty(mod, msg1->elements[i].name, - LDB_FLAG_MOD_DELETE) != 0) { + LDB_FLAG_MOD_DELETE, NULL) != 0) { return NULL; } } diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 62e8039a2c..aa8b9447b2 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -1366,7 +1366,10 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, /** add a new empty element to a ldb_message */ -int ldb_msg_add_empty(struct ldb_message *msg, const char *attr_name, int flags); +int ldb_msg_add_empty(struct ldb_message *msg, + const char *attr_name, + int flags, + struct ldb_message_element **return_el); /** add a element to a ldb_message @@ -1375,8 +1378,9 @@ int ldb_msg_add(struct ldb_message *msg, const struct ldb_message_element *el, int flags); int ldb_msg_add_value(struct ldb_message *msg, - const char *attr_name, - const struct ldb_val *val); + const char *attr_name, + const struct ldb_val *val, + struct ldb_message_element **return_el); int ldb_msg_add_steal_value(struct ldb_message *msg, const char *attr_name, struct ldb_val *val); diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c index f9ae66a2aa..1cdeeeb293 100644 --- a/source4/lib/ldb/modules/ldb_map.c +++ b/source4/lib/ldb/modules/ldb_map.c @@ -964,7 +964,7 @@ struct ldb_request *map_build_fixup_req(struct map_context *ac, const struct ldb if (dn == NULL) { goto failed; } - if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE, NULL) != 0) { goto failed; } if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) { diff --git a/source4/lib/ldb/modules/ldb_map_inbound.c b/source4/lib/ldb/modules/ldb_map_inbound.c index 404b2ce528..b83a17e502 100644 --- a/source4/lib/ldb/modules/ldb_map_inbound.c +++ b/source4/lib/ldb/modules/ldb_map_inbound.c @@ -345,7 +345,7 @@ int map_modify_do_local(struct ldb_handle *handle) /* Add local 'IS_MAPPED' */ /* TODO: use GUIDs here instead */ dn = ldb_dn_linearize(msg, ac->remote_req->op.mod.message->dn); - if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD) != 0) { + if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) { diff --git a/source4/lib/ldb/modules/ldb_map_outbound.c b/source4/lib/ldb/modules/ldb_map_outbound.c index cd33f29043..ff3b5c3aa2 100644 --- a/source4/lib/ldb/modules/ldb_map_outbound.c +++ b/source4/lib/ldb/modules/ldb_map_outbound.c @@ -192,12 +192,7 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele /* no local result, add as new element */ if (old == NULL) { - if (ldb_msg_add_empty(msg, el->name, 0) != 0) { - return -1; - } - - old = ldb_msg_find_element(msg, el->name); - if (old == NULL) { + if (ldb_msg_add_empty(msg, el->name, 0, &old) != 0) { return -1; } } diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c index e4040a8e3d..191238f9c9 100644 --- a/source4/lib/ldb/modules/objectclass.c +++ b/source4/lib/ldb/modules/objectclass.c @@ -250,7 +250,7 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req) } ldb_msg_remove_attr(msg, "objectClass"); - ret = ldb_msg_add_empty(msg, "objectClass", 0); + ret = ldb_msg_add_empty(msg, "objectClass", 0, NULL); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); @@ -351,7 +351,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req * because we need it sorted */ ldb_msg_remove_attr(msg, "objectClass"); - ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE); + ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); @@ -537,7 +537,7 @@ static int objectclass_do_mod(struct ldb_handle *h) { * We could do a constrained add/del, but we are meant to be * in a transaction... */ - ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE); + ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL); if (ret != LDB_SUCCESS) { ldb_set_errstring(ac->module->ldb, "objectclass: could not clear objectclass in modify msg"); talloc_free(mem_ctx); diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index fce1d34ac0..510a43dbc9 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -91,7 +91,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) attribute->num_values = 0; } - if (ldb_msg_add_value(msg, "name", &rdn->value) != 0) { + if (ldb_msg_add_value(msg, "name", &rdn->value, NULL) != 0) { talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; } @@ -99,7 +99,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) attribute = rdn_name_find_attribute(msg, rdn->name); if (!attribute) { - if (ldb_msg_add_value(msg, rdn->name, &rdn->value) != 0) { + if (ldb_msg_add_value(msg, rdn->name, &rdn->value, NULL) != 0) { talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; } @@ -213,16 +213,16 @@ static int rdn_name_rename_do_mod(struct ldb_handle *h) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_empty(msg, rdn->name, LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, rdn->name, LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_value(msg, rdn->name, &rdn->value) != 0) { + if (ldb_msg_add_value(msg, rdn->name, &rdn->value, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_REPLACE) != 0) { + if (ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_REPLACE, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - if (ldb_msg_add_value(msg, "name", &rdn->value) != 0) { + if (ldb_msg_add_value(msg, "name", &rdn->value, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/lib/ldb/standalone.sh b/source4/lib/ldb/standalone.sh index 5987380880..fa1b9bafe3 100755 --- a/source4/lib/ldb/standalone.sh +++ b/source4/lib/ldb/standalone.sh @@ -18,7 +18,7 @@ rm -fr build mkdir build cd build -../configure +../configure $* make dirs make all diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index 8edbc5a085..b9bfe8a230 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -77,14 +77,14 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CT case REG_SZ: case REG_EXPAND_SZ: val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, (void **)&val.data); - ldb_msg_add_value(msg, "data", &val); + ldb_msg_add_value(msg, "data", &val, NULL); break; case REG_DWORD: ldb_msg_add_string(msg, "data", talloc_asprintf(mem_ctx, "0x%x", IVAL(data.data, 0))); break; default: - ldb_msg_add_value(msg, "data", &data); + ldb_msg_add_value(msg, "data", &data, NULL); } diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index 31591e6246..a57e2735e7 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -174,7 +174,7 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx, return nt_status; } - ldb_msg_add_value(msg, "objectGUID", &v); + ldb_msg_add_value(msg, "objectGUID", &v, NULL); } } else if (database == SAM_DATABASE_BUILTIN) { /* work out the builtin_dn - useful for so many calls its worth diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 0ac7a4bb7f..798663eb8b 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -105,11 +105,11 @@ uint64_t winsdb_set_maxVersion(struct winsdb_handle *h, uint64_t newMaxVersion) msg->dn = dn; - ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE); + ret = ldb_msg_add_empty(msg, "objectClass", LDB_FLAG_MOD_REPLACE, NULL); if (ret != 0) goto failed; ret = ldb_msg_add_string(msg, "objectClass", "winsMaxVersion"); if (ret != 0) goto failed; - ret = ldb_msg_add_empty(msg, "maxVersion", LDB_FLAG_MOD_REPLACE); + ret = ldb_msg_add_empty(msg, "maxVersion", LDB_FLAG_MOD_REPLACE, NULL); if (ret != 0) goto failed; ret = ldb_msg_add_fmt(msg, "maxVersion", "%llu", (long long)newMaxVersion); if (ret != 0) goto failed; @@ -343,7 +343,7 @@ static int ldb_msg_add_winsdb_addr(struct ldb_message *msg, struct winsdb_record val.data = discard_const_p(uint8_t, str); val.length = strlen(str); - return ldb_msg_add_value(msg, attr_name, &val); + return ldb_msg_add_value(msg, attr_name, &val, NULL); } struct winsdb_addr **winsdb_addr_list_make(TALLOC_CTX *mem_ctx) @@ -794,17 +794,17 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, ret |= ldb_msg_add_fmt(msg, "recordState", "%u", rec->state); ret |= ldb_msg_add_fmt(msg, "nodeType", "%u", rec->node); ret |= ldb_msg_add_fmt(msg, "isStatic", "%u", rec->is_static); - ret |= ldb_msg_add_empty(msg, "expireTime", 0); + ret |= ldb_msg_add_empty(msg, "expireTime", 0, NULL); if (!(rec->is_static && rec->state == WREPL_STATE_ACTIVE)) { ret |= ldb_msg_add_string(msg, "expireTime", expire_time); } ret |= ldb_msg_add_fmt(msg, "versionID", "%llu", (long long)rec->version); ret |= ldb_msg_add_string(msg, "winsOwner", rec->wins_owner); - ret |= ldb_msg_add_empty(msg, "address", 0); + ret |= ldb_msg_add_empty(msg, "address", 0, NULL); for (i=0;rec->addresses[i];i++) { ret |= ldb_msg_add_winsdb_addr(msg, rec, "address", rec->addresses[i]); } - ret |= ldb_msg_add_empty(msg, "registeredBy", 0); + ret |= ldb_msg_add_empty(msg, "registeredBy", 0, NULL); if (rec->registered_by) { ret |= ldb_msg_add_string(msg, "registeredBy", rec->registered_by); if (ret != 0) goto failed; diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index ac56b950c8..62b529e6cf 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -280,7 +280,7 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx, } } while(0) #define SHARE_ADD_BLOB(name, value) do { \ - err = ldb_msg_add_value(msg, name, value); \ + err = ldb_msg_add_value(msg, name, value, NULL); \ if (err != LDB_SUCCESS) { \ DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \ ret = NT_STATUS_UNSUCCESSFUL; \ @@ -383,7 +383,7 @@ done: } #define SHARE_MOD_STRING(name, value) do { \ - err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \ + err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \ if (err != LDB_SUCCESS) { \ DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \ ret = NT_STATUS_UNSUCCESSFUL; \ @@ -397,7 +397,7 @@ done: } } while(0) #define SHARE_MOD_INT(name, value) do { \ - err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \ + err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \ if (err != LDB_SUCCESS) { \ DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \ ret = NT_STATUS_UNSUCCESSFUL; \ @@ -411,13 +411,13 @@ done: } } while(0) #define SHARE_MOD_BLOB(name, value) do { \ - err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE); \ + err = ldb_msg_add_empty(msg, name, LDB_FLAG_MOD_REPLACE, NULL); \ if (err != LDB_SUCCESS) { \ DEBUG(2,("ERROR: unable to add string share option %s to ldb msg\n", name)); \ ret = NT_STATUS_UNSUCCESSFUL; \ goto done; \ } \ - err = ldb_msg_add_value(msg, name, value); \ + err = ldb_msg_add_value(msg, name, value, NULL); \ if (err != LDB_SUCCESS) { \ DEBUG(2,("ERROR: unable to add blob share option %s to ldb msg\n", name)); \ ret = NT_STATUS_UNSUCCESSFUL; \ diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 7fb62e2e0d..c5c85a35fe 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -1955,7 +1955,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call, return NT_STATUS_NO_SUCH_USER; } - if (ldb_msg_add_empty(msg, "privilege", ldb_flag)) { + if (ldb_msg_add_empty(msg, "privilege", ldb_flag, NULL)) { return NT_STATUS_NO_MEMORY; } |