diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-11 17:26:19 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-21 22:17:34 +0100 |
commit | 03abdaa21ecf562b714f204ca42379ff08626f75 (patch) | |
tree | 0b6a9d40fc90292d4cadd4c738b8cda8a5dacd06 /src/providers/proxy | |
parent | 99151f2217ddaa179543b89b49f836f29f7dcd2a (diff) | |
download | sssd-03abdaa21ecf562b714f204ca42379ff08626f75.tar.gz sssd-03abdaa21ecf562b714f204ca42379ff08626f75.tar.bz2 sssd-03abdaa21ecf562b714f204ca42379ff08626f75.zip |
Add be_req_get_be_ctx() helper.
In preparation for making be_req opaque
Diffstat (limited to 'src/providers/proxy')
-rw-r--r-- | src/providers/proxy/proxy_auth.c | 19 | ||||
-rw-r--r-- | src/providers/proxy/proxy_id.c | 11 | ||||
-rw-r--r-- | src/providers/proxy/proxy_init.c | 3 |
3 files changed, 17 insertions, 16 deletions
diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index 7b6a26f5..2eacfa4e 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -35,6 +35,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx, static void proxy_child_done(struct tevent_req *child_req); void proxy_pam_handler(struct be_req *req) { + struct be_ctx *be_ctx = be_req_get_be_ctx(req); struct pam_data *pd; struct proxy_auth_ctx *ctx; struct tevent_req *child_req = NULL; @@ -44,16 +45,16 @@ void proxy_pam_handler(struct be_req *req) switch (pd->cmd) { case SSS_PAM_AUTHENTICATE: - ctx = talloc_get_type(req->be_ctx->bet_info[BET_AUTH].pvt_bet_data, + ctx = talloc_get_type(be_ctx->bet_info[BET_AUTH].pvt_bet_data, struct proxy_auth_ctx); break; case SSS_PAM_CHAUTHTOK: case SSS_PAM_CHAUTHTOK_PRELIM: - ctx = talloc_get_type(req->be_ctx->bet_info[BET_CHPASS].pvt_bet_data, + ctx = talloc_get_type(be_ctx->bet_info[BET_CHPASS].pvt_bet_data, struct proxy_auth_ctx); break; case SSS_PAM_ACCT_MGMT: - ctx = talloc_get_type(req->be_ctx->bet_info[BET_ACCESS].pvt_bet_data, + ctx = talloc_get_type(be_ctx->bet_info[BET_ACCESS].pvt_bet_data, struct proxy_auth_ctx); break; case SSS_PAM_SETCRED: @@ -711,6 +712,7 @@ static void proxy_child_done(struct tevent_req *req) { struct proxy_client_ctx *client_ctx = tevent_req_callback_data(req, struct proxy_client_ctx); + struct be_ctx *be_ctx = be_req_get_be_ctx(client_ctx->be_req); struct pam_data *pd = NULL; const char *password; int ret; @@ -721,7 +723,7 @@ static void proxy_child_done(struct tevent_req *req) /* Start the next auth in the queue, if any */ client_ctx->auth_ctx->running--; - imm = tevent_create_immediate(client_ctx->be_req->be_ctx->ev); + imm = tevent_create_immediate(be_ctx->ev); if (imm == NULL) { DEBUG(1, ("tevent_create_immediate failed.\n")); /* We'll still finish the current request, but we're @@ -732,8 +734,7 @@ static void proxy_child_done(struct tevent_req *req) * to create this immediate event. */ } else { - tevent_schedule_immediate(imm, - client_ctx->be_req->be_ctx->ev, + tevent_schedule_immediate(imm, be_ctx->ev, run_proxy_child_queue, client_ctx->auth_ctx); } @@ -747,8 +748,7 @@ static void proxy_child_done(struct tevent_req *req) /* Check if we need to save the cached credentials */ if ((pd->cmd == SSS_PAM_AUTHENTICATE || pd->cmd == SSS_PAM_CHAUTHTOK) && - (pd->pam_status == PAM_SUCCESS) && - client_ctx->be_req->be_ctx->domain->cache_credentials) { + (pd->pam_status == PAM_SUCCESS) && be_ctx->domain->cache_credentials) { ret = sss_authtok_get_password(&pd->authtok, &password, NULL); if (ret) { @@ -757,8 +757,7 @@ static void proxy_child_done(struct tevent_req *req) goto done; } - ret = sysdb_cache_password(client_ctx->be_req->be_ctx->domain->sysdb, - client_ctx->be_req->be_ctx->domain, + ret = sysdb_cache_password(be_ctx->domain->sysdb, be_ctx->domain, pd->user, password); /* password caching failures are not fatal errors */ diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index a4f7b19e..802c1364 100644 --- a/src/providers/proxy/proxy_id.c +++ b/src/providers/proxy/proxy_id.c @@ -1339,6 +1339,7 @@ static int get_initgr_groups_process(TALLOC_CTX *memctx, void proxy_get_account_info(struct be_req *breq) { + struct be_ctx *be_ctx = be_req_get_be_ctx(breq); struct be_acct_req *ar; struct proxy_id_ctx *ctx; struct sysdb_ctx *sysdb; @@ -1349,12 +1350,12 @@ void proxy_get_account_info(struct be_req *breq) char *endptr; ar = talloc_get_type(breq->req_data, struct be_acct_req); - ctx = talloc_get_type(breq->be_ctx->bet_info[BET_ID].pvt_bet_data, + ctx = talloc_get_type(be_ctx->bet_info[BET_ID].pvt_bet_data, struct proxy_id_ctx); - sysdb = breq->be_ctx->domain->sysdb; - domain = breq->be_ctx->domain; + sysdb = be_ctx->domain->sysdb; + domain = be_ctx->domain; - if (be_is_offline(breq->be_ctx)) { + if (be_is_offline(be_ctx)) { return be_req_terminate(breq, DP_ERR_OFFLINE, EAGAIN, "Offline"); } @@ -1479,7 +1480,7 @@ void proxy_get_account_info(struct be_req *breq) if (ret) { if (ret == ENXIO) { DEBUG(2, ("proxy returned UNAVAIL error, going offline!\n")); - be_mark_offline(breq->be_ctx); + be_mark_offline(be_ctx); } be_req_terminate(breq, DP_ERR_FATAL, ret, NULL); return; diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c index bb071688..2b154a07 100644 --- a/src/providers/proxy/proxy_init.c +++ b/src/providers/proxy/proxy_init.c @@ -48,7 +48,8 @@ static void proxy_shutdown(struct be_req *req) static void proxy_auth_shutdown(struct be_req *req) { - talloc_free(req->be_ctx->bet_info[BET_AUTH].pvt_bet_data); + struct be_ctx *be_ctx = be_req_get_be_ctx(req); + talloc_free(be_ctx->bet_info[BET_AUTH].pvt_bet_data); be_req_terminate(req, DP_ERR_OK, EOK, NULL); } |