diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-07-30 23:25:03 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-07-31 12:08:39 -0400 |
commit | 6cbe5ee74631122839cb4ebf85be6768e4fd23c5 (patch) | |
tree | ffd79bb9b4514d006e25d88bb39aa6a6c21cbb15 /server/db | |
parent | 679e67f319974dfdd23371798ef94d441ce195cd (diff) | |
download | sssd-6cbe5ee74631122839cb4ebf85be6768e4fd23c5.tar.gz sssd-6cbe5ee74631122839cb4ebf85be6768e4fd23c5.tar.bz2 sssd-6cbe5ee74631122839cb4ebf85be6768e4fd23c5.zip |
Add ignore_not_found parameter to sysdb delete functions
Also add tests
Diffstat (limited to 'server/db')
-rw-r--r-- | server/db/sysdb.h | 9 | ||||
-rw-r--r-- | server/db/sysdb_ops.c | 23 |
2 files changed, 21 insertions, 11 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h index d6ecb2ae..df2a946e 100644 --- a/server/db/sysdb.h +++ b/server/db/sysdb.h @@ -274,7 +274,8 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, 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); int sysdb_delete_entry_recv(struct tevent_req *req); /* Search Entry */ @@ -313,7 +314,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); int sysdb_delete_user_by_uid_recv(struct tevent_req *req); /* Search Group (gy gid or name) */ @@ -340,7 +342,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); int sysdb_delete_group_by_gid_recv(struct tevent_req *req); /* Replace entry attrs */ diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c index c172b70e..8610e634 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; |