mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
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)
This commit is contained in:
parent
3cee746a3f
commit
7f833458ca
@ -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);
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ rm -fr build
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
../configure
|
||||
../configure $*
|
||||
make dirs
|
||||
make all
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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; \
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user