1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r26135: Remove samdb_add(), samdb_delete() and samdb_modify(), which were just

wrappers to ldb_add() etc.  samdb_replace() remains, as it sets flags on
all entries as 'replace'.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2007-11-27 01:25:11 +01:00 committed by Stefan Metzmacher
parent 29c1c96fe0
commit 09c0faa5b7
7 changed files with 26 additions and 49 deletions

View File

@ -1021,30 +1021,6 @@ int samdb_msg_set_string(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc
return samdb_msg_add_string(sam_ldb, mem_ctx, msg, attr_name, str);
}
/*
add a record
*/
int samdb_add(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
{
return ldb_add(sam_ldb, msg);
}
/*
delete a record
*/
int samdb_delete(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_dn *dn)
{
return ldb_delete(sam_ldb, dn);
}
/*
modify a record
*/
int samdb_modify(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
{
return ldb_modify(sam_ldb, msg);
}
/*
replace elements in a record
*/
@ -1058,7 +1034,7 @@ int samdb_replace(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_m
}
/* modify the samdb record */
return samdb_modify(sam_ldb, mem_ctx, msg);
return ldb_modify(sam_ldb, msg);
}
/*
@ -1992,7 +1968,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
"foreignSecurityPrincipal");
/* create the alias */
ret = samdb_add(sam_ctx, mem_ctx, msg);
ret = ldb_add(sam_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to create foreignSecurityPrincipal "
"record %s: %s\n",

View File

@ -1136,7 +1136,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
}
/* create the secret */
ret = samdb_add(ldb, tmp_mem, msg);
ret = ldb_add(ldb, msg);
if (ret != 0) {
r->out.error_string = talloc_asprintf(mem_ctx, "Failed to create secret record %s",
ldb_dn_get_linearized(msg->dn));

View File

@ -101,7 +101,7 @@ static NTSTATUS samsync_ldb_add_foreignSecurityPrincipal(TALLOC_CTX *mem_ctx,
*fsp_dn = msg->dn;
/* create the alias */
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
ret = ldb_add(state->sam_ldb, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create foreignSecurityPrincipal "
"record %s: %s",
@ -429,7 +429,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
}
}
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
ret = ldb_add(state->sam_ldb, msg);
if (ret != 0) {
struct ldb_dn *first_try_dn = msg->dn;
/* Try again with the default DN */
@ -440,7 +440,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else {
msg->dn = talloc_steal(msg, remote_msgs[0]->dn);
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
ret = ldb_add(state->sam_ldb, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create user record. Tried both %s and %s: %s",
ldb_dn_get_linearized(first_try_dn),
@ -493,7 +493,7 @@ static NTSTATUS samsync_ldb_delete_user(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
ret = ldb_delete(state->sam_ldb, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete user record %s: %s",
ldb_dn_get_linearized(msgs[0]->dn),
@ -582,7 +582,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
ret = ldb_add(state->sam_ldb, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create group record %s: %s",
ldb_dn_get_linearized(msg->dn),
@ -632,7 +632,7 @@ static NTSTATUS samsync_ldb_delete_group(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
ret = ldb_delete(state->sam_ldb, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete group record %s: %s",
ldb_dn_get_linearized(msgs[0]->dn),
@ -796,7 +796,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
ret = samdb_add(state->sam_ldb, mem_ctx, msg);
ret = ldb_add(state->sam_ldb, msg);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to create alias record %s: %s",
ldb_dn_get_linearized(msg->dn),
@ -841,7 +841,7 @@ static NTSTATUS samsync_ldb_delete_alias(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
ret = samdb_delete(state->sam_ldb, mem_ctx, msgs[0]->dn);
ret = ldb_delete(state->sam_ldb, msgs[0]->dn);
if (ret != 0) {
*error_string = talloc_asprintf(mem_ctx, "Failed to delete alias record %s: %s",
ldb_dn_get_linearized(msgs[0]->dn),

View File

@ -318,7 +318,7 @@ static WERROR sptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC
return WERR_UNKNOWN_LEVEL;
}
ret = samdb_add(sptr_db, mem_ctx, msg);
ret = ldb_add(sptr_db, msg);
if (ret != 0) {
return WERR_FOOBAR;
}
@ -424,7 +424,7 @@ static WERROR sptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TAL
return WERR_FOOBAR;
}
ret = samdb_delete(sptr_db, mem_ctx, msgs[0]->dn);
ret = ldb_delete(sptr_db, msgs[0]->dn);
if (ret != 0) {
return WERR_FOOBAR;
}

View File

@ -431,7 +431,7 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal
/* Apply to database */
ret = samdb_modify(b_state->sam_ctx, mem_ctx, msg);
ret = ldb_modify(b_state->sam_ctx, msg);
if (ret != 0) {
DEBUG(0,("Failed to modify SPNs on %s: %s\n",
ldb_dn_get_linearized(msg->dn),

View File

@ -100,7 +100,8 @@ static NTSTATUS dcesrv_lsa_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX
DCESRV_PULL_HANDLE(h, r->in.handle, DCESRV_HANDLE_ANY);
if (h->wire_handle.handle_type == LSA_HANDLE_SECRET) {
struct lsa_secret_state *secret_state = h->data;
ret = samdb_delete(secret_state->sam_ldb, mem_ctx, secret_state->secret_dn);
ret = ldb_delete(secret_state->sam_ldb,
secret_state->secret_dn);
talloc_free(h);
if (ret != 0) {
return NT_STATUS_INVALID_HANDLE;
@ -109,8 +110,8 @@ static NTSTATUS dcesrv_lsa_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX
return NT_STATUS_OK;
} else if (h->wire_handle.handle_type == LSA_HANDLE_TRUSTED_DOMAIN) {
struct lsa_trusted_domain_state *trusted_domain_state = h->data;
ret = samdb_delete(trusted_domain_state->policy->sam_ldb, mem_ctx,
trusted_domain_state->trusted_domain_dn);
ret = ldb_delete(trusted_domain_state->policy->sam_ldb,
trusted_domain_state->trusted_domain_dn);
talloc_free(h);
if (ret != 0) {
return NT_STATUS_INVALID_HANDLE;
@ -1478,7 +1479,7 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_
return NT_STATUS_OK;
}
ret = samdb_modify(state->sam_ldb, mem_ctx, msg);
ret = ldb_modify(state->sam_ldb, msg);
if (ret != 0) {
if (ldb_flag == LDB_FLAG_MOD_DELETE && ret == LDB_ERR_NO_SUCH_ATTRIBUTE) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@ -1747,7 +1748,7 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
secret_state->secret_dn = talloc_reference(secret_state, msg->dn);
/* create the secret */
ret = samdb_add(secret_state->sam_ldb, mem_ctx, msg);
ret = ldb_add(secret_state->sam_ldb, msg);
if (ret != 0) {
DEBUG(0,("Failed to create secret record %s: %s\n",
ldb_dn_get_linearized(msg->dn),

View File

@ -1021,7 +1021,7 @@ static NTSTATUS dcesrv_samr_CreateDomainGroup(struct dcesrv_call_state *dce_call
samdb_msg_add_string(d_state->sam_ctx, mem_ctx, msg, "objectClass", "group");
/* create the group */
ret = samdb_add(d_state->sam_ctx, mem_ctx, msg);
ret = ldb_add(d_state->sam_ctx, msg);
switch (ret) {
case LDB_SUCCESS:
break;
@ -1303,7 +1303,7 @@ static NTSTATUS dcesrv_samr_CreateUser2(struct dcesrv_call_state *dce_call, TALL
/* Start a transaction, so we can query and do a subsequent atomic modify */
/* create the user */
ret = samdb_add(d_state->sam_ctx, mem_ctx, msg);
ret = ldb_add(d_state->sam_ctx, msg);
switch (ret) {
case LDB_SUCCESS:
break;
@ -1586,7 +1586,7 @@ static NTSTATUS dcesrv_samr_CreateDomAlias(struct dcesrv_call_state *dce_call, T
samdb_msg_add_int(d_state->sam_ctx, mem_ctx, msg, "groupType", GTYPE_SECURITY_DOMAIN_LOCAL_GROUP);
/* create the alias */
ret = samdb_add(d_state->sam_ctx, mem_ctx, msg);
ret = ldb_add(d_state->sam_ctx, msg);
switch (ret) {
case LDB_SUCCESS:
break;
@ -2263,7 +2263,7 @@ static NTSTATUS dcesrv_samr_DeleteDomainGroup(struct dcesrv_call_state *dce_call
a_state = h->data;
ret = samdb_delete(a_state->sam_ctx, mem_ctx, a_state->account_dn);
ret = ldb_delete(a_state->sam_ctx, a_state->account_dn);
if (ret != 0) {
return NT_STATUS_UNSUCCESSFUL;
}
@ -2637,7 +2637,7 @@ static NTSTATUS dcesrv_samr_DeleteDomAlias(struct dcesrv_call_state *dce_call, T
a_state = h->data;
ret = samdb_delete(a_state->sam_ctx, mem_ctx, a_state->account_dn);
ret = ldb_delete(a_state->sam_ctx, a_state->account_dn);
if (ret != 0) {
return NT_STATUS_UNSUCCESSFUL;
}
@ -2910,7 +2910,7 @@ static NTSTATUS dcesrv_samr_DeleteUser(struct dcesrv_call_state *dce_call, TALLO
a_state = h->data;
ret = samdb_delete(a_state->sam_ctx, mem_ctx, a_state->account_dn);
ret = ldb_delete(a_state->sam_ctx, a_state->account_dn);
if (ret != 0) {
return NT_STATUS_UNSUCCESSFUL;
}