summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-11 18:13:36 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-21 22:17:34 +0100
commitcbaba2f47da96c4191971bce86f03afb3f88864a (patch)
treea599a9c3680e4476d975ea42ca163716f1ee327b /src
parent03abdaa21ecf562b714f204ca42379ff08626f75 (diff)
downloadsssd-cbaba2f47da96c4191971bce86f03afb3f88864a.tar.gz
sssd-cbaba2f47da96c4191971bce86f03afb3f88864a.tar.bz2
sssd-cbaba2f47da96c4191971bce86f03afb3f88864a.zip
Add be_req_get_data() helper funciton.
In preparation for making struct be_req opaque.
Diffstat (limited to 'src')
-rw-r--r--src/providers/ad/ad_access.c7
-rw-r--r--src/providers/data_provider_be.c15
-rw-r--r--src/providers/dp_backend.h3
-rw-r--r--src/providers/ipa/ipa_access.c6
-rw-r--r--src/providers/ipa/ipa_auth.c3
-rw-r--r--src/providers/ipa/ipa_hostid.c2
-rw-r--r--src/providers/ipa/ipa_id.c4
-rw-r--r--src/providers/ipa/ipa_selinux.c5
-rw-r--r--src/providers/krb5/krb5_auth.c8
-rw-r--r--src/providers/ldap/ldap_access.c4
-rw-r--r--src/providers/ldap/ldap_auth.c4
-rw-r--r--src/providers/ldap/ldap_id.c2
-rw-r--r--src/providers/ldap/sdap_autofs.c2
-rw-r--r--src/providers/ldap/sdap_sudo.c4
-rw-r--r--src/providers/proxy/proxy_auth.c4
-rw-r--r--src/providers/proxy/proxy_id.c2
-rw-r--r--src/providers/simple/simple_access.c2
17 files changed, 45 insertions, 32 deletions
diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c
index 3c5c66bd..9508ffb2 100644
--- a/src/providers/ad/ad_access.c
+++ b/src/providers/ad/ad_access.c
@@ -38,8 +38,8 @@ ad_access_handler(struct be_req *breq)
struct ad_access_ctx *access_ctx =
talloc_get_type(be_ctx->bet_info[BET_ACCESS].pvt_bet_data,
struct ad_access_ctx);
-
- struct pam_data *pd = talloc_get_type(breq->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(breq), struct pam_data);
struct sss_domain_info *domain;
/* Handle subdomains */
@@ -72,7 +72,8 @@ ad_access_done(struct tevent_req *req)
int pam_status;
struct be_req *breq =
tevent_req_callback_data(req, struct be_req);
- struct pam_data *pd = talloc_get_type(breq->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(breq), struct pam_data);
ret = sdap_access_recv(req, &pam_status);
talloc_zfree(req);
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index a70dd6ad..f52d3e40 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -141,6 +141,11 @@ struct be_ctx *be_req_get_be_ctx(struct be_req *be_req)
return be_req->be_ctx;
}
+void *be_req_get_data(struct be_req *be_req)
+{
+ return be_req->req_data;
+}
+
void be_req_terminate(struct be_req *be_req,
int dp_err_type, int errnum, const char *errstr)
{
@@ -684,7 +689,7 @@ done:
static errno_t be_initgroups_prereq(struct be_req *be_req)
{
- struct be_acct_req *ar = talloc_get_type(be_req->req_data,
+ struct be_acct_req *ar = talloc_get_type(be_req_get_data(be_req),
struct be_acct_req);
struct be_initgr_prereq *pr;
struct ldb_result *res;
@@ -983,7 +988,7 @@ static void be_pam_handler_callback(struct be_req *req,
dp_err_type, errnum, errstr?errstr:"<NULL>",
dp_pam_err_to_string(req, dp_err_type, errnum)));
- pd = talloc_get_type(req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(req), struct pam_data);
if (pd->cmd == SSS_PAM_ACCT_MGMT &&
pd->pam_status == PAM_SUCCESS &&
@@ -2066,7 +2071,8 @@ static int be_srv_init(struct be_ctx *ctx)
static void be_target_access_permit(struct be_req *be_req)
{
- struct pam_data *pd = talloc_get_type(be_req->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(be_req), struct pam_data);
DEBUG(9, ("be_target_access_permit called, returning PAM_SUCCESS.\n"));
pd->pam_status = PAM_SUCCESS;
@@ -2081,7 +2087,8 @@ static struct bet_ops be_target_access_permit_ops = {
static void be_target_access_deny(struct be_req *be_req)
{
- struct pam_data *pd = talloc_get_type(be_req->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(be_req), struct pam_data);
DEBUG(9, ("be_target_access_deny called, returning PAM_PERM_DENIED.\n"));
pd->pam_status = PAM_PERM_DENIED;
diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h
index f51c44ea..dcb531bd 100644
--- a/src/providers/dp_backend.h
+++ b/src/providers/dp_backend.h
@@ -261,6 +261,9 @@ struct be_req *be_req_create(TALLOC_CTX *mem_ctx,
struct be_client *becli, struct be_ctx *be_ctx,
be_async_callback_t fn, void *pvt_fn_data);
struct be_ctx *be_req_get_be_ctx(struct be_req *be_req);
+
+void *be_req_get_data(struct be_req *be_req);
+
void be_req_terminate(struct be_req *be_req,
int dp_err_type, int errnum, const char *errstr);
diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index 7a3dbaaf..430b2f7a 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -39,7 +39,7 @@ static void ipa_access_reply(struct hbac_ctx *hbac_ctx, int pam_status)
{
struct be_req *be_req = hbac_ctx->be_req;
struct pam_data *pd;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
pd->pam_status = pam_status;
/* destroy HBAC context now to release all used resources and LDAP connection */
@@ -80,7 +80,7 @@ void ipa_access_handler(struct be_req *be_req)
struct tevent_req *req;
struct be_ctx *be_ctx = be_req_get_be_ctx(be_req);
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
ipa_access_ctx = talloc_get_type(be_ctx->bet_info[BET_ACCESS].pvt_bet_data,
struct ipa_access_ctx);
@@ -112,7 +112,7 @@ static void ipa_hbac_check(struct tevent_req *req)
be_req = tevent_req_callback_data(req, struct be_req);
be_ctx = be_req_get_be_ctx(be_req);
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
ret = sdap_access_recv(req, &pam_status);
talloc_zfree(req);
diff --git a/src/providers/ipa/ipa_auth.c b/src/providers/ipa/ipa_auth.c
index 5c5b34ae..2a033db9 100644
--- a/src/providers/ipa/ipa_auth.c
+++ b/src/providers/ipa/ipa_auth.c
@@ -189,7 +189,8 @@ void ipa_auth(struct be_req *be_req)
{
struct tevent_req *req;
struct ipa_auth_state *state;
- struct pam_data *pd = talloc_get_type(be_req->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(be_req), struct pam_data);
struct be_ctx *be_ctx = be_req_get_be_ctx(be_req);
state = talloc_zero(be_req, struct ipa_auth_state);
diff --git a/src/providers/ipa/ipa_hostid.c b/src/providers/ipa/ipa_hostid.c
index 448914ba..cb37e9a4 100644
--- a/src/providers/ipa/ipa_hostid.c
+++ b/src/providers/ipa/ipa_hostid.c
@@ -75,7 +75,7 @@ ipa_host_info_handler(struct be_req *breq)
goto done;
}
- hr = talloc_get_type(breq->req_data, struct be_host_req);
+ hr = talloc_get_type(be_req_get_data(breq), struct be_host_req);
if (hr->filter_type != BE_FILTER_NAME) {
ret = EINVAL;
diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
index 0344a184..5f94eb2c 100644
--- a/src/providers/ipa/ipa_id.c
+++ b/src/providers/ipa/ipa_id.c
@@ -80,7 +80,7 @@ void ipa_account_info_handler(struct be_req *breq)
return sdap_handler_done(breq, DP_ERR_OFFLINE, EAGAIN, "Offline");
}
- ar = talloc_get_type(breq->req_data, struct be_acct_req);
+ ar = talloc_get_type(be_req_get_data(breq), struct be_acct_req);
if (strcasecmp(ar->domain, be_ctx->domain->name) != 0) {
/* if domain names do not match, this is a subdomain case */
@@ -110,7 +110,7 @@ void ipa_account_info_handler(struct be_req *breq)
static void ipa_account_info_done(struct tevent_req *req)
{
struct be_req *breq = tevent_req_callback_data(req, struct be_req);
- struct be_acct_req *ar = talloc_get_type(breq->req_data,
+ struct be_acct_req *ar = talloc_get_type(be_req_get_data(breq),
struct be_acct_req);
const char *error_text;
int ret, dp_error;
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 2203069c..29e98870 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -89,7 +89,7 @@ void ipa_selinux_handler(struct be_req *be_req)
struct pam_data *pd;
const char *hostname;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
selinux_ctx = talloc_get_type(be_ctx->bet_info[BET_SELINUX].pvt_bet_data,
struct ipa_selinux_ctx);
@@ -194,7 +194,8 @@ static void ipa_selinux_handler_done(struct tevent_req *req)
struct sysdb_attrs **maps = NULL;
bool in_transaction = false;
char *default_user = NULL;
- struct pam_data *pd = talloc_get_type(breq->req_data, struct pam_data);
+ struct pam_data *pd =
+ talloc_get_type(be_req_get_data(breq), struct pam_data);
char *map_order = NULL;
size_t hbac_count = 0;
struct sysdb_attrs **hbac_rules = 0;
diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c
index fd521c30..0b56f3a5 100644
--- a/src/providers/krb5/krb5_auth.c
+++ b/src/providers/krb5/krb5_auth.c
@@ -216,7 +216,7 @@ static struct krb5_ctx *get_krb5_ctx(struct be_req *be_req)
struct be_ctx *be_ctx = be_req_get_be_ctx(be_req);
struct pam_data *pd;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
switch (pd->cmd) {
case SSS_PAM_AUTHENTICATE:
@@ -1134,7 +1134,7 @@ void krb5_pam_handler(struct be_req *be_req)
int dp_err = DP_ERR_FATAL;
int ret;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
pd->pam_status = PAM_SYSTEM_ERR;
krb5_ctx = get_krb5_ctx(be_req);
@@ -1207,7 +1207,7 @@ void krb5_pam_handler_auth_done(struct tevent_req *req)
struct pam_data *pd;
struct krb5_ctx *krb5_ctx;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
ret = krb5_auth_recv(req, &pam_status, &dp_err);
talloc_zfree(req);
@@ -1236,7 +1236,7 @@ static void krb5_pam_handler_access_done(struct tevent_req *req)
struct pam_data *pd;
int dp_err = DP_ERR_OK;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
pd->pam_status = PAM_SYSTEM_ERR;
ret = krb5_access_recv(req, &access_allowed);
diff --git a/src/providers/ldap/ldap_access.c b/src/providers/ldap/ldap_access.c
index 5ab17abd..5a8e12f0 100644
--- a/src/providers/ldap/ldap_access.c
+++ b/src/providers/ldap/ldap_access.c
@@ -31,7 +31,7 @@
static void sdap_access_reply(struct be_req *be_req, int pam_status)
{
struct pam_data *pd;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
pd->pam_status = pam_status;
if (pam_status == PAM_SUCCESS || pam_status == PAM_PERM_DENIED) {
@@ -49,7 +49,7 @@ void sdap_pam_access_handler(struct be_req *breq)
struct tevent_req *req;
struct sdap_access_ctx *access_ctx;
- pd = talloc_get_type(breq->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(breq), struct pam_data);
access_ctx =
talloc_get_type(be_ctx->bet_info[BET_ACCESS].pvt_bet_data,
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index 76c23e15..bc91e2f7 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -741,7 +741,7 @@ void sdap_pam_chpass_handler(struct be_req *breq)
ctx = talloc_get_type(be_ctx->bet_info[BET_CHPASS].pvt_bet_data,
struct sdap_auth_ctx);
- pd = talloc_get_type(breq->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(breq), struct pam_data);
if (be_is_offline(ctx->be)) {
DEBUG(4, ("Backend is marked offline, retry later!\n"));
@@ -1015,7 +1015,7 @@ void sdap_pam_auth_handler(struct be_req *breq)
ctx = talloc_get_type(be_ctx->bet_info[BET_AUTH].pvt_bet_data,
struct sdap_auth_ctx);
- pd = talloc_get_type(breq->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(breq), struct pam_data);
if (be_is_offline(ctx->be)) {
DEBUG(4, ("Backend is marked offline, retry later!\n"));
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index efa1769b..d24b8aa6 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -937,7 +937,7 @@ void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx)
return sdap_handler_done(breq, DP_ERR_OFFLINE, EAGAIN, "Offline");
}
- ar = talloc_get_type(breq->req_data, struct be_acct_req);
+ ar = talloc_get_type(be_req_get_data(breq), struct be_acct_req);
switch (ar->entry_type & BE_REQ_TYPE_MASK) {
case BE_REQ_USER: /* user */
diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c
index 2c8a238a..0bb211aa 100644
--- a/src/providers/ldap/sdap_autofs.c
+++ b/src/providers/ldap/sdap_autofs.c
@@ -93,7 +93,7 @@ void sdap_autofs_handler(struct be_req *be_req)
return sdap_handler_done(be_req, DP_ERR_OFFLINE, EAGAIN, "Offline");
}
- autofs_req = talloc_get_type(be_req->req_data, struct be_autofs_req);
+ autofs_req = talloc_get_type(be_req_get_data(be_req), struct be_autofs_req);
DEBUG(SSSDBG_FUNC_DATA, ("Requested refresh for: %s\n",
autofs_req->mapname ? autofs_req->mapname : "<ALL>\n"));
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index e42560a2..3472da67 100644
--- a/src/providers/ldap/sdap_sudo.c
+++ b/src/providers/ldap/sdap_sudo.c
@@ -461,7 +461,7 @@ static void sdap_sudo_reply(struct tevent_req *req)
int ret;
be_req = tevent_req_callback_data(req, struct be_req);
- sudo_req = talloc_get_type(be_req->req_data, struct be_sudo_req);
+ sudo_req = talloc_get_type(be_req_get_data(be_req), struct be_sudo_req);
switch (sudo_req->type) {
case BE_REQ_SUDO_FULL:
@@ -498,7 +498,7 @@ void sdap_sudo_handler(struct be_req *be_req)
struct sdap_sudo_ctx);
id_ctx = sudo_ctx->id_ctx;
- sudo_req = talloc_get_type(be_req->req_data, struct be_sudo_req);
+ sudo_req = talloc_get_type(be_req_get_data(be_req), struct be_sudo_req);
switch (sudo_req->type) {
case BE_REQ_SUDO_FULL:
diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c
index 2eacfa4e..3e6a514a 100644
--- a/src/providers/proxy/proxy_auth.c
+++ b/src/providers/proxy/proxy_auth.c
@@ -41,7 +41,7 @@ void proxy_pam_handler(struct be_req *req)
struct tevent_req *child_req = NULL;
struct proxy_client_ctx *client_ctx;
- pd = talloc_get_type(req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(req), struct pam_data);
switch (pd->cmd) {
case SSS_PAM_AUTHENTICATE:
@@ -138,7 +138,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx,
state->be_req = be_req;
state->auth_ctx = auth_ctx;
- state->pd = talloc_get_type(be_req->req_data, struct pam_data);
+ state->pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
/* Find an available key */
key.type = HASH_KEY_ULONG;
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 802c1364..7d7fab20 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -1349,7 +1349,7 @@ void proxy_get_account_info(struct be_req *breq)
int ret;
char *endptr;
- ar = talloc_get_type(breq->req_data, struct be_acct_req);
+ ar = talloc_get_type(be_req_get_data(breq), struct be_acct_req);
ctx = talloc_get_type(be_ctx->bet_info[BET_ID].pvt_bet_data,
struct proxy_id_ctx);
sysdb = be_ctx->domain->sysdb;
diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c
index 8ec1883f..3dcea869 100644
--- a/src/providers/simple/simple_access.c
+++ b/src/providers/simple/simple_access.c
@@ -40,7 +40,7 @@ void simple_access_handler(struct be_req *be_req)
struct pam_data *pd;
struct simple_ctx *ctx;
- pd = talloc_get_type(be_req->req_data, struct pam_data);
+ pd = talloc_get_type(be_req_get_data(be_req), struct pam_data);
pd->pam_status = PAM_SYSTEM_ERR;