summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-14 22:26:44 +0200
committerAndrew Bartlett <abartlet@samba.org>2011-03-01 06:29:03 +0100
commitc66780332bba2270ada4391fbb88728d06b94119 (patch)
treea4702e399685ffbf939cc56e5793eb9208272bac /source4
parentdbf6b481e9be61287d5c82d23b581ca4bfd09865 (diff)
downloadsamba-c66780332bba2270ada4391fbb88728d06b94119.tar.gz
samba-c66780332bba2270ada4391fbb88728d06b94119.tar.bz2
samba-c66780332bba2270ada4391fbb88728d06b94119.zip
s4:remove many invocations of "samdb_msg_add_string"
This call can be substituted by "ldb_msg_add_string". We only need to be careful on local objects or talloc'ed ones which live shorter than the message. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/common/util.c4
-rw-r--r--source4/dsdb/common/util_samr.c14
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c4
-rw-r--r--source4/libnet/libnet_samsync_ldb.c22
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c2
-rw-r--r--source4/rpc_server/backupkey/dcesrv_backupkey.c4
-rw-r--r--source4/rpc_server/drsuapi/writespn.c7
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c11
8 files changed, 29 insertions, 39 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 21318cba33..7527f355b7 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2311,8 +2311,8 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
return NT_STATUS_NO_MEMORY;
}
- ret = samdb_msg_add_string(sam_ctx, msg, msg,
- "objectClass", "foreignSecurityPrincipal");
+ ret = ldb_msg_add_string(msg, "objectClass",
+ "foreignSecurityPrincipal");
if (ret != LDB_SUCCESS) {
talloc_free(sidstr);
return NT_STATUS_NO_MEMORY;
diff --git a/source4/dsdb/common/util_samr.c b/source4/dsdb/common/util_samr.c
index 02b412e433..deaea2e07f 100644
--- a/source4/dsdb/common/util_samr.c
+++ b/source4/dsdb/common/util_samr.c
@@ -140,10 +140,8 @@ NTSTATUS dsdb_add_user(struct ldb_context *ldb,
return NT_STATUS_FOOBAR;
}
- samdb_msg_add_string(ldb, tmp_ctx, msg, "sAMAccountName",
- account_name);
- samdb_msg_add_string(ldb, tmp_ctx, msg, "objectClass",
- obj_class);
+ ldb_msg_add_string(msg, "sAMAccountName", account_name);
+ ldb_msg_add_string(msg, "objectClass", obj_class);
/* create the user */
ret = ldb_add(ldb, msg);
@@ -289,8 +287,8 @@ NTSTATUS dsdb_add_domain_group(struct ldb_context *ldb,
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(ldb, tmp_ctx, msg, "sAMAccountName", groupname);
- samdb_msg_add_string(ldb, tmp_ctx, msg, "objectClass", "group");
+ ldb_msg_add_string(msg, "sAMAccountName", groupname);
+ ldb_msg_add_string(msg, "objectClass", "group");
/* create the group */
ret = ldb_add(ldb, msg);
@@ -369,8 +367,8 @@ NTSTATUS dsdb_add_domain_alias(struct ldb_context *ldb,
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(ldb, mem_ctx, msg, "sAMAccountName", alias_name);
- samdb_msg_add_string(ldb, mem_ctx, msg, "objectClass", "group");
+ ldb_msg_add_string(msg, "sAMAccountName", alias_name);
+ ldb_msg_add_string(msg, "objectClass", "group");
samdb_msg_add_int(ldb, mem_ctx, msg, "groupType", GTYPE_SECURITY_DOMAIN_LOCAL_GROUP);
/* create the alias */
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index d9b4a49918..f59aae8969 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1268,8 +1268,8 @@ static int samldb_user_account_control_change(struct samldb_ctx *ac)
if (user_account_control
& (UF_SERVER_TRUST_ACCOUNT | UF_PARTIAL_SECRETS_ACCOUNT)) {
- ret = samdb_msg_add_string(ldb, ac->msg, ac->msg,
- "isCriticalSystemObject", "TRUE");
+ ret = ldb_msg_add_string(ac->msg, "isCriticalSystemObject",
+ "TRUE");
if (ret != LDB_SUCCESS) {
return ret;
}
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c
index b821160525..2832a3f0af 100644
--- a/source4/libnet/libnet_samsync_ldb.c
+++ b/source4/libnet/libnet_samsync_ldb.c
@@ -93,9 +93,7 @@ static NTSTATUS samsync_ldb_add_foreignSecurityPrincipal(TALLOC_CTX *mem_ctx,
if ( ! ldb_dn_add_child_fmt(msg->dn, "CN=%s", sidstr))
return NT_STATUS_UNSUCCESSFUL;
- samdb_msg_add_string(state->sam_ldb, mem_ctx, msg,
- "objectClass",
- "foreignSecurityPrincipal");
+ ldb_msg_add_string(msg, "objectClass", "foreignSecurityPrincipal");
*fsp_dn = msg->dn;
@@ -194,8 +192,8 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(state->sam_ldb, mem_ctx,
- msg, "oEMInformation", domain->oem_information.string);
+ ldb_msg_add_string(msg, "oEMInformation",
+ domain->oem_information.string);
samdb_msg_add_int64(state->sam_ldb, mem_ctx,
msg, "forceLogoff", domain->force_logoff_time);
@@ -418,8 +416,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
obj_class = "user";
}
if (add) {
- samdb_msg_add_string(state->sam_ldb, mem_ctx, msg,
- "objectClass", obj_class);
+ ldb_msg_add_string(msg, "objectClass", obj_class);
if (!msg->dn) {
msg->dn = ldb_dn_copy(mem_ctx, state->base_dn[database]);
ldb_dn_add_child_fmt(msg->dn, "CN=%s,CN=%s", cn_name, container);
@@ -573,8 +570,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
obj_class = "group";
if (add) {
- samdb_msg_add_string(state->sam_ldb, mem_ctx, msg,
- "objectClass", obj_class);
+ ldb_msg_add_string(msg, "objectClass", obj_class);
msg->dn = ldb_dn_copy(mem_ctx, state->base_dn[database]);
ldb_dn_add_child_fmt(msg->dn, "CN=%s,CN=%s", cn_name, container);
if (!msg->dn) {
@@ -791,8 +787,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
obj_class = "group";
if (add) {
- samdb_msg_add_string(state->sam_ldb, mem_ctx, msg,
- "objectClass", obj_class);
+ ldb_msg_add_string(msg, "objectClass", obj_class);
msg->dn = ldb_dn_copy(mem_ctx, state->base_dn[database]);
ldb_dn_add_child_fmt(msg->dn, "CN=%s,CN=%s", cn_name, container);
if (!msg->dn) {
@@ -970,8 +965,7 @@ static NTSTATUS samsync_ldb_handle_account(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg->dn, msg);
for (i=0; i< account->privilege_entries; i++) {
- samdb_msg_add_string(state->pdb, mem_ctx, msg, "privilege",
- account->privilege_name[i].string);
+ ldb_msg_add_string(msg, "privilege", account->privilege_name[i].string);
}
ret = dsdb_replace(state->pdb, msg, 0);
@@ -980,7 +974,7 @@ static NTSTATUS samsync_ldb_handle_account(TALLOC_CTX *mem_ctx,
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(state->pdb, msg, msg, "comment", "added via samsync");
+ ldb_msg_add_string(msg, "comment", "added via samsync");
ret = ldb_add(state->pdb, msg);
}
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index 5849df9c04..27ab6dec6d 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -76,7 +76,7 @@ static int sptr_db_search(struct ldb_context *ldb,
#define SET_STRING(ldb, mod, attr, value) do { \
if (value == NULL) return WERR_INVALID_PARAM; \
- if (samdb_msg_add_string(ldb, (TALLOC_CTX *)mod, mod, attr, value) != LDB_SUCCESS) { \
+ if (ldb_msg_add_string(mod, attr, value) != LDB_SUCCESS) { \
return WERR_NOMEM; \
} \
} while (0)
diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey.c b/source4/rpc_server/backupkey/dcesrv_backupkey.c
index 1cd9a9f1eb..586eab81fb 100644
--- a/source4/rpc_server/backupkey/dcesrv_backupkey.c
+++ b/source4/rpc_server/backupkey/dcesrv_backupkey.c
@@ -118,12 +118,12 @@ static NTSTATUS set_lsa_secret(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- ret = samdb_msg_add_string(ldb, mem_ctx, msg, "cn", name2);
+ ret = ldb_msg_add_string(msg, "cn", name2);
if (ret != LDB_SUCCESS) {
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
}
- ret = samdb_msg_add_string(ldb, mem_ctx, msg, "objectClass", "secret");
+ ret = ldb_msg_add_string(msg, "objectClass", "secret");
if (ret != LDB_SUCCESS) {
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
diff --git a/source4/rpc_server/drsuapi/writespn.c b/source4/rpc_server/drsuapi/writespn.c
index 652fd2c4b9..e2e12f1689 100644
--- a/source4/rpc_server/drsuapi/writespn.c
+++ b/source4/rpc_server/drsuapi/writespn.c
@@ -185,10 +185,9 @@ WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_call, TALL
req->spn_names[i].str)) {
passed_checks = false;
}
- ret = samdb_msg_add_string(b_state->sam_ctx,
- msg, msg,
- "servicePrincipalName",
- req->spn_names[i].str);
+ ret = ldb_msg_add_string(msg,
+ "servicePrincipalName",
+ req->spn_names[i].str);
if (ret != LDB_SUCCESS) {
return WERR_NOMEM;
}
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 5cd532ea13..f58263d92b 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -1017,7 +1017,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(sam_ldb, mem_ctx, msg, "flatname", netbios_name);
+ ldb_msg_add_string(msg, "flatname", netbios_name);
if (r->in.info->sid) {
ret = samdb_msg_add_dom_sid(sam_ldb, mem_ctx, msg, "securityIdentifier", r->in.info->sid);
@@ -1027,7 +1027,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc
}
}
- samdb_msg_add_string(sam_ldb, mem_ctx, msg, "objectClass", "trustedDomain");
+ ldb_msg_add_string(msg, "objectClass", "trustedDomain");
samdb_msg_add_int(sam_ldb, mem_ctx, msg, "trustType", r->in.info->trust_type);
@@ -1036,7 +1036,7 @@ static NTSTATUS dcesrv_lsa_CreateTrustedDomain_base(struct dcesrv_call_state *dc
samdb_msg_add_int(sam_ldb, mem_ctx, msg, "trustDirection", r->in.info->trust_direction);
if (dns_name) {
- samdb_msg_add_string(sam_ldb, mem_ctx, msg, "trustPartner", dns_name);
+ ldb_msg_add_string(msg, "trustPartner", dns_name);
}
if (trustAuthIncoming.data) {
@@ -2630,7 +2630,7 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
}
- samdb_msg_add_string(state->pdb, msg, msg, "comment", "added via LSA");
+ ldb_msg_add_string(msg, "comment", "added via LSA");
ret = ldb_add(state->pdb, msg);
}
if (ret != LDB_SUCCESS) {
@@ -2957,8 +2957,7 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
if (ret != LDB_SUCCESS) return NT_STATUS_NO_MEMORY;
}
- ret = samdb_msg_add_string(secret_state->sam_ldb, mem_ctx, msg,
- "objectClass", "secret");
+ ret = ldb_msg_add_string(msg, "objectClass", "secret");
if (ret != LDB_SUCCESS) return NT_STATUS_NO_MEMORY;
secret_state->secret_dn = talloc_reference(secret_state, msg->dn);