diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-03-20 17:38:30 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-04-12 09:22:16 -0400 |
commit | 08d9d10747da6900971cdd8fced05ca66f5111e2 (patch) | |
tree | 00052037e1279b115b143adb532c0a506472f1c7 /src/providers/krb5 | |
parent | ac660a221255b761615f6ecdb63b92a6391a58a2 (diff) | |
download | sssd-08d9d10747da6900971cdd8fced05ca66f5111e2.tar.gz sssd-08d9d10747da6900971cdd8fced05ca66f5111e2.tar.bz2 sssd-08d9d10747da6900971cdd8fced05ca66f5111e2.zip |
sysdb: convert sysdb_get_user_attr
Diffstat (limited to 'src/providers/krb5')
-rw-r--r-- | src/providers/krb5/krb5_auth.c | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c index 0d5ea5d2..6a57fe5f 100644 --- a/src/providers/krb5/krb5_auth.c +++ b/src/providers/krb5/krb5_auth.c @@ -610,7 +610,6 @@ static int handle_child_recv(struct tevent_req *req, return EOK; } -static void get_user_attr_done(void *pvt, int err, struct ldb_result *res); static void krb5_resolve_kdc_done(struct tevent_req *req); static void krb5_resolve_kpasswd_done(struct tevent_req *req); static void krb5_find_ccache_step(struct krb5child_req *kr); @@ -623,6 +622,12 @@ void krb5_pam_handler(struct be_req *be_req) const char **attrs; int pam_status = PAM_SYSTEM_ERR; int dp_err = DP_ERR_FATAL; + struct ldb_result *res; + struct krb5child_req *kr = NULL; + const char *ccache_file = NULL; + const char *realm; + krb5_error_code kerr; + struct tevent_req *req; int ret; pd = talloc_get_type(be_req->req_data, struct pam_data); @@ -668,49 +673,20 @@ void krb5_pam_handler(struct be_req *be_req) attrs[5] = NULL; ret = sysdb_get_user_attr(be_req, be_req->be_ctx->sysdb, - be_req->be_ctx->domain, pd->user, attrs, - get_user_attr_done, be_req); - + be_req->be_ctx->domain, pd->user, + attrs, &res); if (ret) { + DEBUG(5, ("sysdb search for upn of user [%s] failed.\n", pd->user)); goto done; } - return; - -done: - pd->pam_status = pam_status; - - krb_reply(be_req, dp_err, pd->pam_status); -} - -static void get_user_attr_done(void *pvt, int err, struct ldb_result *res) -{ - struct be_req *be_req = talloc_get_type(pvt, struct be_req); - struct krb5_ctx *krb5_ctx; - struct krb5child_req *kr = NULL; - struct tevent_req *req; - krb5_error_code kerr; - int ret; - struct pam_data *pd = talloc_get_type(be_req->req_data, struct pam_data); - int pam_status = PAM_SYSTEM_ERR; - int dp_err = DP_ERR_FATAL; - const char *ccache_file = NULL; - const char *realm; - ret = krb5_setup(be_req, &kr); if (ret != EOK) { DEBUG(1, ("krb5_setup failed.\n")); goto failed; } - krb5_ctx = kr->krb5_ctx; - - if (err != LDB_SUCCESS) { - DEBUG(5, ("sysdb search for upn of user [%s] failed.\n", pd->user)); - goto failed; - } - - realm = dp_opt_get_cstring(krb5_ctx->opts, KRB5_REALM); + realm = dp_opt_get_cstring(kr->krb5_ctx->opts, KRB5_REALM); if (realm == NULL) { DEBUG(1, ("Missing Kerberos realm.\n")); goto failed; @@ -782,8 +758,7 @@ static void get_user_attr_done(void *pvt, int err, struct ldb_result *res) break; default: - DEBUG(1, ("A user search by name (%s) returned > 1 results!\n", - pd->user)); + DEBUG(1, ("User search for (%s) returned > 1 results!\n", pd->user)); goto failed; break; } @@ -791,7 +766,7 @@ static void get_user_attr_done(void *pvt, int err, struct ldb_result *res) kr->srv = NULL; kr->kpasswd_srv = NULL; req = be_resolve_server_send(kr, be_req->be_ctx->ev, be_req->be_ctx, - krb5_ctx->service->name); + kr->krb5_ctx->service->name); if (req == NULL) { DEBUG(1, ("be_resolve_server_send failed.\n")); goto failed; @@ -803,7 +778,7 @@ static void get_user_attr_done(void *pvt, int err, struct ldb_result *res) failed: talloc_free(kr); - +done: pd->pam_status = pam_status; krb_reply(be_req, dp_err, pd->pam_status); } |