summaryrefslogtreecommitdiffstats
path: root/src/providers/proxy.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:17:41 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:11 -0400
commitcae9c9fbdebc3f6a4c390a20e75447217439dff7 (patch)
treec154ccd741e229430e630aa8980f6d4a32e5587d /src/providers/proxy.c
parenta21698161dcc506e469d7af58099e952062ff256 (diff)
downloadsssd-cae9c9fbdebc3f6a4c390a20e75447217439dff7.tar.gz
sssd-cae9c9fbdebc3f6a4c390a20e75447217439dff7.tar.xz
sssd-cae9c9fbdebc3f6a4c390a20e75447217439dff7.zip
sysdb: convert sysdb_delete_entry
Diffstat (limited to 'src/providers/proxy.c')
-rw-r--r--src/providers/proxy.c108
1 files changed, 42 insertions, 66 deletions
diff --git a/src/providers/proxy.c b/src/providers/proxy.c
index 547c0e32c..84a966a2b 100644
--- a/src/providers/proxy.c
+++ b/src/providers/proxy.c
@@ -345,7 +345,6 @@ static int proxy_default_recv(struct tevent_req *req)
/* =Getpwnam-wrapper======================================================*/
static void get_pw_name_process(struct tevent_req *subreq);
-static void get_pw_name_remove_done(struct tevent_req *subreq);
static void get_pw_name_add_done(struct tevent_req *subreq);
static struct tevent_req *get_pw_name_send(TALLOC_CTX *mem_ctx,
@@ -467,10 +466,7 @@ static void get_pw_name_process(struct tevent_req *subreq)
return;
default:
- DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n",
- state->name, status));
- tevent_req_error(req, EIO);
- return;
+ break;
}
if (delete_user) {
@@ -486,39 +482,27 @@ static void get_pw_name_process(struct tevent_req *subreq)
return;
}
- subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true);
+ ret = sysdb_delete_entry(state->sysdb, dn, true);
+ if (ret) {
+ tevent_req_error(req, ret);
+ return;
+ }
+
+ subreq = sysdb_transaction_commit_send(state, state->ev, state->handle);
if (!subreq) {
tevent_req_error(req, ENOMEM);
return;
}
- tevent_req_set_callback(subreq, get_pw_name_remove_done, req);
- }
-}
-
-static void get_pw_name_add_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct proxy_state *state = tevent_req_data(req,
- struct proxy_state);
- int ret;
-
- ret = sysdb_store_user_recv(subreq);
- talloc_zfree(subreq);
- if (ret) {
- tevent_req_error(req, ret);
+ tevent_req_set_callback(subreq, proxy_default_done, req);
return;
}
- subreq = sysdb_transaction_commit_send(state, state->ev, state->handle);
- if (!subreq) {
- tevent_req_error(req, ENOMEM);
- return;
- }
- tevent_req_set_callback(subreq, proxy_default_done, req);
+ DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n",
+ state->name, status));
+ tevent_req_error(req, EIO);
}
-static void get_pw_name_remove_done(struct tevent_req *subreq)
+static void get_pw_name_add_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
@@ -526,7 +510,7 @@ static void get_pw_name_remove_done(struct tevent_req *subreq)
struct proxy_state);
int ret;
- ret = sysdb_delete_entry_recv(subreq);
+ ret = sysdb_store_user_recv(subreq);
talloc_zfree(subreq);
if (ret) {
tevent_req_error(req, ret);
@@ -926,7 +910,6 @@ fail:
} while(0)
static void get_gr_name_process(struct tevent_req *subreq);
-static void get_gr_name_remove_done(struct tevent_req *subreq);
static void get_gr_name_add_done(struct tevent_req *subreq);
static struct tevent_req *get_gr_name_send(TALLOC_CTX *mem_ctx,
@@ -1083,10 +1066,7 @@ again:
return;
default:
- DEBUG(2, ("proxy -> getgrnam_r failed for '%s' <%d>\n",
- state->name, status));
- tevent_req_error(req, EIO);
- return;
+ break;
}
if (delete_group) {
@@ -1102,39 +1082,27 @@ again:
return;
}
- subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true);
+ ret = sysdb_delete_entry(state->sysdb, dn, true);
+ if (ret) {
+ tevent_req_error(req, ret);
+ return;
+ }
+
+ subreq = sysdb_transaction_commit_send(state, state->ev, state->handle);
if (!subreq) {
tevent_req_error(req, ENOMEM);
return;
}
- tevent_req_set_callback(subreq, get_gr_name_remove_done, req);
- }
-}
-
-static void get_gr_name_add_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct proxy_state *state = tevent_req_data(req,
- struct proxy_state);
- int ret;
-
- ret = sysdb_store_group_recv(subreq);
- talloc_zfree(subreq);
- if (ret) {
- tevent_req_error(req, ret);
+ tevent_req_set_callback(subreq, proxy_default_done, req);
return;
}
- subreq = sysdb_transaction_commit_send(state, state->ev, state->handle);
- if (!subreq) {
- tevent_req_error(req, ENOMEM);
- return;
- }
- tevent_req_set_callback(subreq, proxy_default_done, req);
+ DEBUG(2, ("proxy -> getgrnam_r failed for '%s' <%d>\n",
+ state->name, status));
+ tevent_req_error(req, EIO);
}
-static void get_gr_name_remove_done(struct tevent_req *subreq)
+static void get_gr_name_add_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
@@ -1142,7 +1110,7 @@ static void get_gr_name_remove_done(struct tevent_req *subreq)
struct proxy_state);
int ret;
- ret = sysdb_delete_entry_recv(subreq);
+ ret = sysdb_store_group_recv(subreq);
talloc_zfree(subreq);
if (ret) {
tevent_req_error(req, ret);
@@ -1707,10 +1675,7 @@ static void get_initgr_process(struct tevent_req *subreq)
return;
default:
- DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n",
- state->name, status));
- tevent_req_error(req, EIO);
- return;
+ break;
}
if (delete_user) {
@@ -1723,13 +1688,24 @@ static void get_initgr_process(struct tevent_req *subreq)
return;
}
- subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true);
+ ret = sysdb_delete_entry(state->sysdb, dn, true);
+ if (ret) {
+ tevent_req_error(req, ret);
+ return;
+ }
+
+ subreq = sysdb_transaction_commit_send(state, state->ev, state->handle);
if (!subreq) {
tevent_req_error(req, ENOMEM);
return;
}
- tevent_req_set_callback(subreq, get_pw_name_remove_done, req);
+ tevent_req_set_callback(subreq, proxy_default_done, req);
+ return;
}
+
+ DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n",
+ state->name, status));
+ tevent_req_error(req, EIO);
}
static void get_initgr_groups_process(struct tevent_req *subreq)