summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-11-28 03:24:55 +0000
committerJakub Hrozek <jhrozek@redhat.com>2012-12-04 12:38:14 +0100
commit791abc91fd8b2a7f73511ab8051df1065f9f54b2 (patch)
tree05c0cf2d6768d74e04d8301f514d70138a33733b /src
parent7baccb545ac9829b7e1990f45ff6f70e2de55c2a (diff)
downloadsssd-791abc91fd8b2a7f73511ab8051df1065f9f54b2.tar.gz
sssd-791abc91fd8b2a7f73511ab8051df1065f9f54b2.tar.bz2
sssd-791abc91fd8b2a7f73511ab8051df1065f9f54b2.zip
Fix ipa_subdomain_id names and tevent_req style
Diffstat (limited to 'src')
-rw-r--r--src/providers/ipa/ipa_id.c5
-rw-r--r--src/providers/ipa/ipa_id.h10
-rw-r--r--src/providers/ipa/ipa_subdomains_id.c73
3 files changed, 36 insertions, 52 deletions
diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
index c74268b9..58bb1c11 100644
--- a/src/providers/ipa/ipa_id.c
+++ b/src/providers/ipa/ipa_id.c
@@ -78,8 +78,7 @@ void ipa_account_info_handler(struct be_req *breq)
ar = talloc_get_type(breq->req_data, struct be_acct_req);
if (strcasecmp(ar->domain, breq->be_ctx->domain->name) != 0) {
- req = ipa_get_subdomain_account_info_send(breq, breq->be_ctx->ev, ctx,
- ar);
+ req = ipa_get_subdom_acct_send(breq, breq->be_ctx->ev, ctx, ar);
if (!req) {
return sdap_handler_done(breq, DP_ERR_FATAL, ENOMEM, "Out of memory");
}
@@ -148,7 +147,7 @@ static void ipa_account_info_users_done(struct tevent_req *req)
struct be_req *breq = tevent_req_callback_data(req, struct be_req);
int ret, dp_error;
- ret = ipa_user_get_recv(req, &dp_error);
+ ret = ipa_get_subdom_acct_recv(req, &dp_error);
talloc_zfree(req);
ipa_account_info_complete(breq, dp_error, ret, "User lookup failed");
diff --git a/src/providers/ipa/ipa_id.h b/src/providers/ipa/ipa_id.h
index c264286f..82f2f489 100644
--- a/src/providers/ipa/ipa_id.h
+++ b/src/providers/ipa/ipa_id.h
@@ -60,9 +60,9 @@ struct tevent_req *ipa_s2n_get_acct_info_send(TALLOC_CTX *mem_ctx,
uid_t uid);
int ipa_s2n_get_acct_info_recv(struct tevent_req *req);
-struct tevent_req *ipa_get_subdomain_account_info_send(TALLOC_CTX *memctx,
- struct tevent_context *ev,
- struct sdap_id_ctx *ctx,
- struct be_acct_req *ar);
-int ipa_user_get_recv(struct tevent_req *req, int *dp_error_out);
+struct tevent_req *ipa_get_subdom_acct_send(TALLOC_CTX *memctx,
+ struct tevent_context *ev,
+ struct sdap_id_ctx *ctx,
+ struct be_acct_req *ar);
+int ipa_get_subdom_acct_recv(struct tevent_req *req, int *dp_error_out);
#endif
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 563fdf2f..518ff85d 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -32,7 +32,7 @@
#include "providers/ipa/ipa_id.h"
#include "providers/ipa/ipa_subdomains.h"
-struct ipa_user_get_state {
+struct ipa_get_subdom_acct {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
struct sdap_id_op *op;
@@ -48,19 +48,20 @@ struct ipa_user_get_state {
int dp_error;
};
-static int ipa_get_subdomain_account_info_retry(struct tevent_req *req);
-static void ipa_get_subdomain_account_info_connect_done(struct tevent_req *subreq);
-static void ipa_get_subdomain_account_info_done(struct tevent_req *subreq);
-struct tevent_req *ipa_get_subdomain_account_info_send(TALLOC_CTX *memctx,
- struct tevent_context *ev,
- struct sdap_id_ctx *ctx,
- struct be_acct_req *ar)
+static void ipa_get_subdom_acct_connected(struct tevent_req *subreq);
+static void ipa_get_subdom_acct_done(struct tevent_req *subreq);
+
+struct tevent_req *ipa_get_subdom_acct_send(TALLOC_CTX *memctx,
+ struct tevent_context *ev,
+ struct sdap_id_ctx *ctx,
+ struct be_acct_req *ar)
{
struct tevent_req *req;
- struct ipa_user_get_state *state;
+ struct ipa_get_subdom_acct *state;
+ struct tevent_req *subreq;
int ret;
- req = tevent_req_create(memctx, &state, struct ipa_user_get_state);
+ req = tevent_req_create(memctx, &state, struct ipa_get_subdom_acct);
if (!req) return NULL;
state->ev = ev;
@@ -112,10 +113,11 @@ struct tevent_req *ipa_get_subdomain_account_info_send(TALLOC_CTX *memctx,
}
if (ret != EOK) goto fail;
- ret = ipa_get_subdomain_account_info_retry(req);
- if (ret != EOK) {
+ subreq = sdap_id_op_connect_send(state->op, state, &ret);
+ if (!subreq) {
goto fail;
}
+ tevent_req_set_callback(subreq, ipa_get_subdom_acct_connected, req);
return req;
@@ -125,29 +127,12 @@ fail:
return req;
}
-static int ipa_get_subdomain_account_info_retry(struct tevent_req *req)
-{
- struct ipa_user_get_state *state = tevent_req_data(req,
- struct ipa_user_get_state);
- struct tevent_req *subreq;
- int ret = EOK;
-
- subreq = sdap_id_op_connect_send(state->op, state, &ret);
- if (!subreq) {
- return ret;
- }
-
- tevent_req_set_callback(subreq, ipa_get_subdomain_account_info_connect_done,
- req);
- return EOK;
-}
-
-static void ipa_get_subdomain_account_info_connect_done(struct tevent_req *subreq)
+static void ipa_get_subdom_acct_connected(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct ipa_user_get_state *state = tevent_req_data(req,
- struct ipa_user_get_state);
+ struct tevent_req);
+ struct ipa_get_subdom_acct *state = tevent_req_data(req,
+ struct ipa_get_subdom_acct);
int dp_error = DP_ERR_FATAL;
int ret;
const char *name;
@@ -194,17 +179,17 @@ static void ipa_get_subdomain_account_info_connect_done(struct tevent_req *subre
tevent_req_error(req, ENOMEM);
return;
}
- tevent_req_set_callback(subreq, ipa_get_subdomain_account_info_done, req);
+ tevent_req_set_callback(subreq, ipa_get_subdom_acct_done, req);
return;
}
-static void ipa_get_subdomain_account_info_done(struct tevent_req *subreq)
+static void ipa_get_subdom_acct_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct ipa_user_get_state *state = tevent_req_data(req,
- struct ipa_user_get_state);
+ struct tevent_req);
+ struct ipa_get_subdom_acct *state = tevent_req_data(req,
+ struct ipa_get_subdom_acct);
int dp_error = DP_ERR_FATAL;
int ret;
@@ -214,12 +199,12 @@ static void ipa_get_subdomain_account_info_done(struct tevent_req *subreq)
ret = sdap_id_op_done(state->op, ret, &dp_error);
if (dp_error == DP_ERR_OK && ret != EOK) {
/* retry */
- ret = ipa_get_subdomain_account_info_retry(req);
- if (ret != EOK) {
+ subreq = sdap_id_op_connect_send(state->op, state, &ret);
+ if (!subreq) {
tevent_req_error(req, ret);
return;
}
-
+ tevent_req_set_callback(subreq, ipa_get_subdom_acct_connected, req);
return;
}
@@ -235,10 +220,10 @@ static void ipa_get_subdomain_account_info_done(struct tevent_req *subreq)
tevent_req_done(req);
}
-int ipa_user_get_recv(struct tevent_req *req, int *dp_error_out)
+int ipa_get_subdom_acct_recv(struct tevent_req *req, int *dp_error_out)
{
- struct ipa_user_get_state *state = tevent_req_data(req,
- struct ipa_user_get_state);
+ struct ipa_get_subdom_acct *state = tevent_req_data(req,
+ struct ipa_get_subdom_acct);
if (dp_error_out) {
*dp_error_out = state->dp_error;