From c66780332bba2270ada4391fbb88728d06b94119 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 14 Oct 2010 22:26:44 +0200 Subject: 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 --- source4/rpc_server/backupkey/dcesrv_backupkey.c | 4 ++-- source4/rpc_server/drsuapi/writespn.c | 7 +++---- source4/rpc_server/lsa/dcesrv_lsa.c | 11 +++++------ 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'source4/rpc_server') 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); -- cgit