From 6cbe5ee74631122839cb4ebf85be6768e4fd23c5 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 30 Jul 2009 23:25:03 +0200 Subject: Add ignore_not_found parameter to sysdb delete functions Also add tests --- server/db/sysdb_ops.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'server/db/sysdb_ops.c') diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c index c172b70ed..8610e634b 100644 --- a/server/db/sysdb_ops.c +++ b/server/db/sysdb_ops.c @@ -245,7 +245,8 @@ static int sysdb_op_default_recv(struct tevent_req *req) struct tevent_req *sysdb_delete_entry_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct sysdb_handle *handle, - struct ldb_dn *dn) + struct ldb_dn *dn, + bool ignore_not_found) { struct tevent_req *req, *subreq; struct sysdb_op_state *state; @@ -257,7 +258,7 @@ struct tevent_req *sysdb_delete_entry_send(TALLOC_CTX *mem_ctx, state->ev = ev; state->handle = handle; - state->ignore_not_found = true; + state->ignore_not_found = ignore_not_found; state->ldbreply = NULL; ret = ldb_build_del_req(&ldbreq, handle->ctx->ldb, state, dn, @@ -613,7 +614,8 @@ struct tevent_req *sysdb_delete_user_by_uid_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct sysdb_handle *handle, struct sss_domain_info *domain, - uid_t uid) + uid_t uid, + bool ignore_not_found) { struct tevent_req *req, *subreq; struct sysdb_op_state *state; @@ -623,7 +625,7 @@ struct tevent_req *sysdb_delete_user_by_uid_send(TALLOC_CTX *mem_ctx, state->ev = ev; state->handle = handle; - state->ignore_not_found = true; + state->ignore_not_found = ignore_not_found; state->ldbreply = NULL; subreq = sysdb_search_user_by_uid_send(state, ev, NULL, handle, @@ -656,7 +658,9 @@ static void sysdb_delete_user_by_uid_found(struct tevent_req *subreq) return; } - subreq = sysdb_delete_entry_send(state, state->ev, state->handle, msg->dn); + subreq = sysdb_delete_entry_send(state, state->ev, + state->handle, msg->dn, + state->ignore_not_found); if (!subreq) { tevent_req_error(req, ENOMEM); return; @@ -896,7 +900,8 @@ struct tevent_req *sysdb_delete_group_by_gid_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct sysdb_handle *handle, struct sss_domain_info *domain, - gid_t gid) + gid_t gid, + bool ignore_not_found) { struct tevent_req *req, *subreq; struct sysdb_op_state *state; @@ -906,7 +911,7 @@ struct tevent_req *sysdb_delete_group_by_gid_send(TALLOC_CTX *mem_ctx, state->ev = ev; state->handle = handle; - state->ignore_not_found = true; + state->ignore_not_found = ignore_not_found; state->ldbreply = NULL; subreq = sysdb_search_group_by_gid_send(state, ev, NULL, handle, @@ -939,7 +944,9 @@ static void sysdb_delete_group_by_gid_found(struct tevent_req *subreq) return; } - subreq = sysdb_delete_entry_send(state, state->ev, state->handle, msg->dn); + subreq = sysdb_delete_entry_send(state, state->ev, + state->handle, msg->dn, + state->ignore_not_found); if (!subreq) { tevent_req_error(req, ENOMEM); return; -- cgit