diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-11 12:25:53 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-21 22:17:34 +0100 |
commit | 8e5549e453558d4bebdec333a93e215d5d6ffaec (patch) | |
tree | a9004b07b800492ecb8bdaeb2019512c3fccb229 | |
parent | ccc2af010bbbe6d8a7496fb717216135bc4c1993 (diff) | |
download | sssd-8e5549e453558d4bebdec333a93e215d5d6ffaec.tar.gz sssd-8e5549e453558d4bebdec333a93e215d5d6ffaec.tar.bz2 sssd-8e5549e453558d4bebdec333a93e215d5d6ffaec.zip |
Introduce be_req_terminate() helper
Call it everywhere instead of directly dereferencing be_req->fn
This is in preparation of making be_req opaque.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/providers/ad/ad_access.c | 11 | ||||
-rw-r--r-- | src/providers/data_provider_be.c | 11 | ||||
-rw-r--r-- | src/providers/dp_backend.h | 6 | ||||
-rw-r--r-- | src/providers/ipa/ipa_access.c | 12 | ||||
-rw-r--r-- | src/providers/ipa/ipa_auth.c | 17 | ||||
-rw-r--r-- | src/providers/ipa/ipa_selinux.c | 8 | ||||
-rw-r--r-- | src/providers/ipa/ipa_subdomains.c | 21 | ||||
-rw-r--r-- | src/providers/krb5/krb5_auth.c | 13 | ||||
-rw-r--r-- | src/providers/ldap/ldap_access.c | 4 | ||||
-rw-r--r-- | src/providers/ldap/ldap_auth.c | 19 | ||||
-rw-r--r-- | src/providers/ldap/ldap_common.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_autofs.c | 2 | ||||
-rw-r--r-- | src/providers/proxy/proxy.h | 4 | ||||
-rw-r--r-- | src/providers/proxy/proxy_auth.c | 12 | ||||
-rw-r--r-- | src/providers/proxy/proxy_common.c | 31 | ||||
-rw-r--r-- | src/providers/proxy/proxy_id.c | 34 | ||||
-rw-r--r-- | src/providers/proxy/proxy_init.c | 4 | ||||
-rw-r--r-- | src/providers/simple/simple_access.c | 2 |
19 files changed, 84 insertions, 130 deletions
diff --git a/Makefile.am b/Makefile.am index d32f81cb..8a47af8d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1334,7 +1334,6 @@ libsss_ldap_la_LDFLAGS = \ libsss_proxy_la_SOURCES = \ - src/providers/proxy/proxy_common.c \ src/providers/proxy/proxy_init.c \ src/providers/proxy/proxy_id.c \ src/providers/proxy/proxy_netgroup.c \ diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c index ec086d4e..66eb4eaa 100644 --- a/src/providers/ad/ad_access.c +++ b/src/providers/ad/ad_access.c @@ -47,7 +47,7 @@ ad_access_handler(struct be_req *breq) pd->domain, NULL, NULL); if (domain == NULL) { DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); - breq->fn(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); + be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); return; } } else { @@ -61,7 +61,7 @@ ad_access_handler(struct be_req *breq) access_ctx->sdap_access_ctx, pd); if (!req) { - breq->fn(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); + be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); return; } tevent_req_set_callback(req, ad_access_done, breq); @@ -79,7 +79,7 @@ ad_access_done(struct tevent_req *req) ret = sdap_access_recv(req, &pam_status); talloc_zfree(req); if (ret != EOK) { - breq->fn(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, strerror(ret)); + be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, strerror(ret)); return; } @@ -87,12 +87,13 @@ ad_access_done(struct tevent_req *req) if (pam_status == PAM_SUCCESS || pam_status == PAM_PERM_DENIED) { /* We got the proper approval or denial */ - breq->fn(breq, DP_ERR_OK, pam_status, NULL); + be_req_terminate(breq, DP_ERR_OK, pam_status, NULL); return; } /* Something went wrong */ pd->pam_status = PAM_SYSTEM_ERR; - breq->fn(breq, DP_ERR_FATAL, pam_status, pam_strerror(NULL, pam_status)); + be_req_terminate(breq, DP_ERR_FATAL, pam_status, + pam_strerror(NULL, pam_status)); return; } diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 133959a1..818927c2 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -119,6 +119,13 @@ static struct bet_data bet_data[] = { {BET_MAX, NULL, NULL} }; +void be_req_terminate(struct be_req *be_req, + int dp_err_type, int errnum, const char *errstr) +{ + be_req->fn(be_req, dp_err_type, errnum, errstr); +} + + struct be_async_req { be_req_fn_t fn; struct be_req *req; @@ -2062,7 +2069,7 @@ static void be_target_access_permit(struct be_req *be_req) DEBUG(9, ("be_target_access_permit called, returning PAM_SUCCESS.\n")); pd->pam_status = PAM_SUCCESS; - be_req->fn(be_req, DP_ERR_OK, PAM_SUCCESS, NULL); + be_req_terminate(be_req, DP_ERR_OK, PAM_SUCCESS, NULL); } static struct bet_ops be_target_access_permit_ops = { @@ -2077,7 +2084,7 @@ static void be_target_access_deny(struct be_req *be_req) DEBUG(9, ("be_target_access_deny called, returning PAM_PERM_DENIED.\n")); pd->pam_status = PAM_PERM_DENIED; - be_req->fn(be_req, DP_ERR_OK, PAM_PERM_DENIED, NULL); + be_req_terminate(be_req, DP_ERR_OK, PAM_PERM_DENIED, NULL); } static struct bet_ops be_target_access_deny_ops = { diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h index f0c52832..2b393a6c 100644 --- a/src/providers/dp_backend.h +++ b/src/providers/dp_backend.h @@ -254,4 +254,10 @@ int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx, const char *service_name); void reset_fo(struct be_ctx *be_ctx); + +/* be_req helpers */ + +void be_req_terminate(struct be_req *be_req, + int dp_err_type, int errnum, const char *errstr); + #endif /* __DP_BACKEND_H___ */ diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c index 927a9cbc..1b626029 100644 --- a/src/providers/ipa/ipa_access.c +++ b/src/providers/ipa/ipa_access.c @@ -46,9 +46,9 @@ static void ipa_access_reply(struct hbac_ctx *hbac_ctx, int pam_status) talloc_zfree(hbac_ctx); if (pam_status == PAM_SUCCESS || pam_status == PAM_PERM_DENIED) { - be_req->fn(be_req, DP_ERR_OK, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_OK, pam_status, NULL); } else { - be_req->fn(be_req, DP_ERR_FATAL, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, pam_status, NULL); } } @@ -96,7 +96,7 @@ void ipa_access_handler(struct be_req *be_req) ipa_access_ctx->sdap_access_ctx, pd); if (!req) { - be_req->fn(be_req, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); return; } tevent_req_set_callback(req, ipa_hbac_check, be_req); @@ -130,12 +130,12 @@ static void ipa_hbac_check(struct tevent_req *req) * here. */ pd->pam_status = PAM_PERM_DENIED; - be_req->fn(be_req, DP_ERR_OK, PAM_PERM_DENIED, NULL); + be_req_terminate(be_req, DP_ERR_OK, PAM_PERM_DENIED, NULL); return; default: /* We got an unexpected error. Return it as-is */ pd->pam_status = PAM_SYSTEM_ERR; - be_req->fn(be_req, DP_ERR_FATAL, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, pam_status, NULL); return; } @@ -180,7 +180,7 @@ fail: /* Return an proper error */ ipa_access_reply(hbac_ctx, pam_status); } else { - be_req->fn(be_req, DP_ERR_FATAL, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, pam_status, NULL); } } diff --git a/src/providers/ipa/ipa_auth.c b/src/providers/ipa/ipa_auth.c index 5097899f..c0912e64 100644 --- a/src/providers/ipa/ipa_auth.c +++ b/src/providers/ipa/ipa_auth.c @@ -32,11 +32,6 @@ #include "providers/ipa/ipa_common.h" #include "providers/ipa/ipa_config.h" -static void ipa_auth_reply(struct be_req *be_req, int dp_err, int result) -{ - be_req->fn(be_req, dp_err, result, NULL); -} - struct get_password_migration_flag_state { struct tevent_context *ev; struct sdap_id_op *sdap_op; @@ -240,7 +235,7 @@ void ipa_auth(struct be_req *be_req) fail: talloc_free(state); pd->pam_status = PAM_SYSTEM_ERR; - ipa_auth_reply(be_req, DP_ERR_FATAL, pd->pam_status); + be_req_terminate(be_req, DP_ERR_FATAL, pd->pam_status, NULL); } static void ipa_auth_handler_done(struct tevent_req *req) @@ -283,7 +278,7 @@ static void ipa_auth_handler_done(struct tevent_req *req) } done: - ipa_auth_reply(state->be_req, dp_err, state->pd->pam_status); + be_req_terminate(state->be_req, dp_err, state->pd->pam_status, NULL); } static void ipa_get_migration_flag_done(struct tevent_req *req) @@ -322,7 +317,7 @@ static void ipa_get_migration_flag_done(struct tevent_req *req) DEBUG(SSSDBG_CONF_SETTINGS, ("Password migration is not enabled.\n")); dp_err = DP_ERR_OK; done: - ipa_auth_reply(state->be_req, dp_err, state->pd->pam_status); + be_req_terminate(state->be_req, dp_err, state->pd->pam_status, NULL); } static void ipa_migration_flag_connect_done(struct tevent_req *req) @@ -385,7 +380,7 @@ static void ipa_migration_flag_connect_done(struct tevent_req *req) return; done: - ipa_auth_reply(state->be_req, dp_err, state->pd->pam_status); + be_req_terminate(state->be_req, dp_err, state->pd->pam_status, NULL); } static void ipa_auth_ldap_done(struct tevent_req *req) @@ -429,7 +424,7 @@ static void ipa_auth_ldap_done(struct tevent_req *req) return; done: - ipa_auth_reply(state->be_req, dp_err, state->pd->pam_status); + be_req_terminate(state->be_req, dp_err, state->pd->pam_status, NULL); } static void ipa_auth_handler_retry_done(struct tevent_req *req) @@ -452,5 +447,5 @@ static void ipa_auth_handler_retry_done(struct tevent_req *req) state->pd->pam_status = pam_status; done: - ipa_auth_reply(state->be_req, dp_err, state->pd->pam_status); + be_req_terminate(state->be_req, dp_err, state->pd->pam_status, NULL); } diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c index e130c4c8..8ed17a2f 100644 --- a/src/providers/ipa/ipa_selinux.c +++ b/src/providers/ipa/ipa_selinux.c @@ -120,7 +120,7 @@ void ipa_selinux_handler(struct be_req *be_req) return; fail: - be_req->fn(be_req, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL); } static struct ipa_selinux_op_ctx * @@ -248,7 +248,7 @@ static void ipa_selinux_handler_done(struct tevent_req *req) in_transaction = false; pd->pam_status = PAM_SUCCESS; - breq->fn(breq, DP_ERR_OK, EOK, "Success"); + be_req_terminate(breq, DP_ERR_OK, EOK, "Success"); return; fail: @@ -259,9 +259,9 @@ fail: } } if (ret == EAGAIN) { - breq->fn(breq, DP_ERR_OFFLINE, EAGAIN, "Offline"); + be_req_terminate(breq, DP_ERR_OFFLINE, EAGAIN, "Offline"); } else { - breq->fn(breq, DP_ERR_FATAL, ret, NULL); + be_req_terminate(breq, DP_ERR_FATAL, ret, NULL); } } diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 63a82c08..70806bb4 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -107,11 +107,6 @@ const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, return NULL; } -static void ipa_subdomains_reply(struct be_req *be_req, int dp_err, int result) -{ - be_req->fn(be_req, dp_err, result, NULL); -} - static errno_t ipa_ranges_parse_results(TALLOC_CTX *mem_ctx, size_t count, struct sysdb_attrs **reply, @@ -589,7 +584,7 @@ done: if (ret == EOK) { dp_error = DP_ERR_OK; } - ipa_subdomains_reply(be_req, dp_error, ret); + be_req_terminate(be_req, dp_error, ret, NULL); } static void ipa_subdomains_get_conn_done(struct tevent_req *req) @@ -626,7 +621,7 @@ static void ipa_subdomains_get_conn_done(struct tevent_req *req) return; fail: - ipa_subdomains_reply(ctx->be_req, dp_error, ret); + be_req_terminate(ctx->be_req, dp_error, ret, NULL); } static errno_t @@ -752,7 +747,7 @@ static void ipa_subdomains_handler_done(struct tevent_req *req) ret = EINVAL; done: - ipa_subdomains_reply(ctx->be_req, DP_ERR_FATAL, ret); + be_req_terminate(ctx->be_req, DP_ERR_FATAL, ret, NULL); } @@ -819,7 +814,7 @@ done: if (ret == EOK) { dp_error = DP_ERR_OK; } - ipa_subdomains_reply(ctx->be_req, dp_error, ret); + be_req_terminate(ctx->be_req, dp_error, ret, NULL); } static void ipa_subdomains_handler_master_done(struct tevent_req *req) @@ -899,7 +894,7 @@ done: if (ret == EOK) { dp_error = DP_ERR_OK; } - ipa_subdomains_reply(ctx->be_req, dp_error, ret); + be_req_terminate(ctx->be_req, dp_error, ret, NULL); } static void ipa_subdom_online_cb(void *pvt); @@ -1004,7 +999,7 @@ void ipa_subdomains_handler(struct be_req *be_req) ctx = talloc_get_type(be_req->be_ctx->bet_info[BET_SUBDOMAINS].pvt_bet_data, struct ipa_subdomains_ctx); if (!ctx) { - ipa_subdomains_reply(be_req, DP_ERR_FATAL, EINVAL); + be_req_terminate(be_req, DP_ERR_FATAL, EINVAL, NULL); return; } @@ -1012,12 +1007,12 @@ void ipa_subdomains_handler(struct be_req *be_req) if (ctx->disabled_until > now) { DEBUG(SSSDBG_TRACE_ALL, ("Subdomain provider disabled.\n")); - ipa_subdomains_reply(be_req, DP_ERR_OK, EOK); + be_req_terminate(be_req, DP_ERR_OK, EOK, NULL); return; } if (ctx->last_refreshed > now - IPA_SUBDOMAIN_REFRESH_LIMIT) { - ipa_subdomains_reply(be_req, DP_ERR_OK, EOK); + be_req_terminate(be_req, DP_ERR_OK, EOK, NULL); return; } diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c index 0d9fe793..e3fd5f78 100644 --- a/src/providers/krb5/krb5_auth.c +++ b/src/providers/krb5/krb5_auth.c @@ -238,8 +238,6 @@ static struct krb5_ctx *get_krb5_ctx(struct be_req *be_req) } } -static void krb_reply(struct be_req *req, int dp_err, int result); - static int krb5_cleanup(void *ptr) { struct krb5child_req *kr = talloc_get_type(ptr, struct krb5child_req); @@ -1123,11 +1121,6 @@ int krb5_auth_recv(struct tevent_req *req, int *pam_status, int *dp_err) return EOK; } -static void krb_reply(struct be_req *req, int dp_err, int result) -{ - req->fn(req, dp_err, result, NULL); -} - void krb5_pam_handler_auth_done(struct tevent_req *req); static void krb5_pam_handler_access_done(struct tevent_req *req); @@ -1202,7 +1195,7 @@ void krb5_pam_handler(struct be_req *be_req) return; done: - krb_reply(be_req, dp_err, pd->pam_status); + be_req_terminate(be_req, dp_err, pd->pam_status, NULL); } void krb5_pam_handler_auth_done(struct tevent_req *req) @@ -1232,7 +1225,7 @@ void krb5_pam_handler_auth_done(struct tevent_req *req) DEBUG(1, ("Kerberos context not available.\n")); } - krb_reply(be_req, dp_err, pd->pam_status); + be_req_terminate(be_req, dp_err, pd->pam_status, NULL); } static void krb5_pam_handler_access_done(struct tevent_req *req) @@ -1259,5 +1252,5 @@ static void krb5_pam_handler_access_done(struct tevent_req *req) dp_err = DP_ERR_OK; done: - krb_reply(be_req, dp_err, pd->pam_status); + be_req_terminate(be_req, dp_err, pd->pam_status, NULL); } diff --git a/src/providers/ldap/ldap_access.c b/src/providers/ldap/ldap_access.c index 83f27736..cc1127c2 100644 --- a/src/providers/ldap/ldap_access.c +++ b/src/providers/ldap/ldap_access.c @@ -35,9 +35,9 @@ static void sdap_access_reply(struct be_req *be_req, int pam_status) pd->pam_status = pam_status; if (pam_status == PAM_SUCCESS || pam_status == PAM_PERM_DENIED) { - be_req->fn(be_req, DP_ERR_OK, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_OK, pam_status, NULL); } else { - be_req->fn(be_req, DP_ERR_FATAL, pam_status, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, pam_status, NULL); } } diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c index 8b033952..b24f7f39 100644 --- a/src/providers/ldap/ldap_auth.c +++ b/src/providers/ldap/ldap_auth.c @@ -729,7 +729,6 @@ struct sdap_pam_chpass_state { static void sdap_auth4chpass_done(struct tevent_req *req); static void sdap_pam_chpass_done(struct tevent_req *req); -static void sdap_pam_auth_reply(struct be_req *breq, int dp_err, int result); void sdap_pam_chpass_handler(struct be_req *breq) { @@ -783,7 +782,7 @@ void sdap_pam_chpass_handler(struct be_req *breq) return; done: - sdap_pam_auth_reply(breq, dp_err, pd->pam_status); + be_req_terminate(breq, dp_err, pd->pam_status, NULL); } static void sdap_lastchange_done(struct tevent_req *req); @@ -904,7 +903,7 @@ static void sdap_auth4chpass_done(struct tevent_req *req) } done: - sdap_pam_auth_reply(state->breq, dp_err, state->pd->pam_status); + be_req_terminate(state->breq, dp_err, state->pd->pam_status, NULL); } static void sdap_pam_chpass_done(struct tevent_req *req) @@ -973,7 +972,7 @@ static void sdap_pam_chpass_done(struct tevent_req *req) } done: - sdap_pam_auth_reply(state->breq, dp_err, state->pd->pam_status); + be_req_terminate(state->breq, dp_err, state->pd->pam_status, NULL); } static void sdap_lastchange_done(struct tevent_req *req) @@ -993,7 +992,7 @@ static void sdap_lastchange_done(struct tevent_req *req) state->pd->pam_status = PAM_SUCCESS; done: - sdap_pam_auth_reply(state->breq, dp_err, state->pd->pam_status); + be_req_terminate(state->breq, dp_err, state->pd->pam_status, NULL); } /* ==Perform-User-Authentication-and-Password-Caching===================== */ @@ -1060,7 +1059,7 @@ void sdap_pam_auth_handler(struct be_req *breq) } done: - sdap_pam_auth_reply(breq, dp_err, pd->pam_status); + be_req_terminate(breq, dp_err, pd->pam_status, NULL); } static void sdap_pam_auth_done(struct tevent_req *req) @@ -1173,11 +1172,5 @@ static void sdap_pam_auth_done(struct tevent_req *req) } done: - sdap_pam_auth_reply(state->breq, dp_err, state->pd->pam_status); + be_req_terminate(state->breq, dp_err, state->pd->pam_status, NULL); } - -static void sdap_pam_auth_reply(struct be_req *req, int dp_err, int result) -{ - req->fn(req, dp_err, result, NULL); -} - diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index a0587acb..ddc88ab5 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -745,7 +745,7 @@ done: void sdap_handler_done(struct be_req *req, int dp_err, int error, const char *errstr) { - return req->fn(req, dp_err, error, errstr); + return be_req_terminate(req, dp_err, error, errstr); } void sdap_mark_offline(struct sdap_id_ctx *ctx) diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c index fae933ca..6fb64099 100644 --- a/src/providers/ldap/sdap_autofs.c +++ b/src/providers/ldap/sdap_autofs.c @@ -116,7 +116,7 @@ void sdap_autofs_handler(struct be_req *be_req) return; fail: - be_req->fn(be_req, DP_ERR_FATAL, ret, NULL); + be_req_terminate(be_req, DP_ERR_FATAL, ret, NULL); } struct autofs_get_map_state { diff --git a/src/providers/proxy/proxy.h b/src/providers/proxy/proxy.h index 962cb28f..305cbe97 100644 --- a/src/providers/proxy/proxy.h +++ b/src/providers/proxy/proxy.h @@ -142,10 +142,6 @@ struct pc_init_ctx { #define DEFAULT_BUFSIZE 4096 #define MAX_BUF_SIZE 1024*1024 /* max 1MiB */ -/* From proxy_common.c */ -void proxy_reply(struct be_req *req, int dp_err, - int error, const char *errstr); - /* From proxy_id.c */ void proxy_get_account_info(struct be_req *breq); diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index 02a95fe6..7b6a26f5 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -60,18 +60,18 @@ void proxy_pam_handler(struct be_req *req) case SSS_PAM_OPEN_SESSION: case SSS_PAM_CLOSE_SESSION: pd->pam_status = PAM_SUCCESS; - proxy_reply(req, DP_ERR_OK, EOK, NULL); + be_req_terminate(req, DP_ERR_OK, EOK, NULL); return; default: DEBUG(1, ("Unsupported PAM task.\n")); pd->pam_status = PAM_MODULE_UNKNOWN; - proxy_reply(req, DP_ERR_OK, EINVAL, "Unsupported PAM task"); + be_req_terminate(req, DP_ERR_OK, EINVAL, "Unsupported PAM task"); return; } client_ctx = talloc(req, struct proxy_client_ctx); if (client_ctx == NULL) { - proxy_reply(req, DP_ERR_FATAL, ENOMEM, NULL); + be_req_terminate(req, DP_ERR_FATAL, ENOMEM, NULL); return; } client_ctx->auth_ctx = ctx; @@ -85,7 +85,7 @@ void proxy_pam_handler(struct be_req *req) /* Could not queue request * Return an error */ - proxy_reply(req, DP_ERR_FATAL, EINVAL, "Could not queue request\n"); + be_req_terminate(req, DP_ERR_FATAL, EINVAL, "Could not queue request\n"); return; } tevent_req_set_callback(child_req, proxy_child_done, client_ctx); @@ -740,7 +740,7 @@ static void proxy_child_done(struct tevent_req *req) if (ret != EOK) { /* Pam child failed */ - proxy_reply(client_ctx->be_req, DP_ERR_FATAL, ret, + be_req_terminate(client_ctx->be_req, DP_ERR_FATAL, ret, "PAM child failed"); return; } @@ -770,7 +770,7 @@ static void proxy_child_done(struct tevent_req *req) } done: - proxy_reply(client_ctx->be_req, DP_ERR_OK, EOK, NULL); + be_req_terminate(client_ctx->be_req, DP_ERR_OK, EOK, NULL); } static void run_proxy_child_queue(struct tevent_context *ev, diff --git a/src/providers/proxy/proxy_common.c b/src/providers/proxy/proxy_common.c deleted file mode 100644 index 6d5c455c..00000000 --- a/src/providers/proxy/proxy_common.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - SSSD - - proxy_common.c - - Authors: - Stephen Gallagher <sgallagh@redhat.com> - - Copyright (C) 2010 Red Hat - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "providers/proxy/proxy.h" - -void proxy_reply(struct be_req *req, int dp_err, - int error, const char *errstr) -{ - return req->fn(req, dp_err, error, errstr); -} diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index 33869e5a..a4f7b19e 100644 --- a/src/providers/proxy/proxy_id.c +++ b/src/providers/proxy/proxy_id.c @@ -1355,12 +1355,12 @@ void proxy_get_account_info(struct be_req *breq) domain = breq->be_ctx->domain; if (be_is_offline(breq->be_ctx)) { - return proxy_reply(breq, DP_ERR_OFFLINE, EAGAIN, "Offline"); + return be_req_terminate(breq, DP_ERR_OFFLINE, EAGAIN, "Offline"); } /* for now we support only core attrs */ if (ar->attr_type != BE_ATTR_CORE) { - return proxy_reply(breq, DP_ERR_FATAL, EINVAL, "Invalid attr type"); + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid attr type"); } switch (ar->entry_type & BE_REQ_TYPE_MASK) { @@ -1377,13 +1377,13 @@ void proxy_get_account_info(struct be_req *breq) case BE_FILTER_IDNUM: uid = (uid_t) strtouint32(ar->filter_value, &endptr, 10); if (errno || *endptr || (ar->filter_value == endptr)) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid attr type"); } ret = get_pw_uid(breq, ctx, sysdb, domain, uid); break; default: - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid filter type"); } break; @@ -1399,24 +1399,24 @@ void proxy_get_account_info(struct be_req *breq) case BE_FILTER_IDNUM: gid = (gid_t) strtouint32(ar->filter_value, &endptr, 10); if (errno || *endptr || (ar->filter_value == endptr)) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid attr type"); } ret = get_gr_gid(breq, ctx, sysdb, domain, gid, 0); break; default: - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid filter type"); } break; case BE_REQ_INITGROUPS: /* init groups for user */ if (ar->filter_type != BE_FILTER_NAME) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid filter type"); } if (ctx->ops.initgroups_dyn == NULL) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, ENODEV, "Initgroups call not supported"); } ret = get_initgr(breq, ctx, sysdb, domain, ar->filter_value); @@ -1424,12 +1424,12 @@ void proxy_get_account_info(struct be_req *breq) case BE_REQ_NETGROUP: if (ar->filter_type != BE_FILTER_NAME) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid filter type"); } if (ctx->ops.setnetgrent == NULL || ctx->ops.getnetgrent_r == NULL || ctx->ops.endnetgrent == NULL) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, ENODEV, "Netgroups are not supported"); } @@ -1440,7 +1440,7 @@ void proxy_get_account_info(struct be_req *breq) switch (ar->filter_type) { case BE_FILTER_NAME: if (ctx->ops.getservbyname_r == NULL) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, ENODEV, "Services are not supported"); } ret = get_serv_byname(ctx, sysdb, domain, @@ -1449,7 +1449,7 @@ void proxy_get_account_info(struct be_req *breq) break; case BE_FILTER_IDNUM: if (ctx->ops.getservbyport_r == NULL) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, ENODEV, "Services are not supported"); } ret = get_serv_byport(ctx, sysdb, domain, @@ -1460,19 +1460,19 @@ void proxy_get_account_info(struct be_req *breq) if (!ctx->ops.setservent || !ctx->ops.getservent_r || !ctx->ops.endservent) { - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, ENODEV, "Services are not supported"); } ret = enum_services(ctx, sysdb, domain); break; default: - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid filter type"); } break; default: /*fail*/ - return proxy_reply(breq, DP_ERR_FATAL, + return be_req_terminate(breq, DP_ERR_FATAL, EINVAL, "Invalid request type"); } @@ -1481,8 +1481,8 @@ void proxy_get_account_info(struct be_req *breq) DEBUG(2, ("proxy returned UNAVAIL error, going offline!\n")); be_mark_offline(breq->be_ctx); } - proxy_reply(breq, DP_ERR_FATAL, ret, NULL); + be_req_terminate(breq, DP_ERR_FATAL, ret, NULL); return; } - proxy_reply(breq, DP_ERR_OK, EOK, NULL); + be_req_terminate(breq, DP_ERR_OK, EOK, NULL); } diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c index de4d7b61..bb071688 100644 --- a/src/providers/proxy/proxy_init.c +++ b/src/providers/proxy/proxy_init.c @@ -43,13 +43,13 @@ struct sbus_interface proxy_interface = { static void proxy_shutdown(struct be_req *req) { /* TODO: Clean up any internal data */ - req->fn(req, DP_ERR_OK, EOK, NULL); + be_req_terminate(req, DP_ERR_OK, EOK, NULL); } static void proxy_auth_shutdown(struct be_req *req) { talloc_free(req->be_ctx->bet_info[BET_AUTH].pvt_bet_data); - req->fn(req, DP_ERR_OK, EOK, NULL); + be_req_terminate(req, DP_ERR_OK, EOK, NULL); } struct bet_ops proxy_id_ops = { diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c index d00e95ba..b7e1bb35 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -65,7 +65,7 @@ void simple_access_handler(struct be_req *be_req) } done: - be_req->fn(be_req, DP_ERR_OK, pd->pam_status, NULL); + be_req_terminate(be_req, DP_ERR_OK, pd->pam_status, NULL); } struct bet_ops simple_access_ops = { |