summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-10-25 01:42:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:24:38 -0500
commit7f833458ca0083654e34cbfde1c6c6510cab1826 (patch)
tree0e2d7a740b8c29896ed7ee5635d2520b9913945e /source4/dsdb
parent3cee746a3f23f1040daa60d1208145bff87b3d01 (diff)
downloadsamba-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/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/local_password.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c20
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema.c2
-rw-r--r--source4/dsdb/samdb/samdb.c14
6 files changed, 21 insertions, 23 deletions
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);
}
/*