summaryrefslogtreecommitdiff
path: root/src/responder
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-02-03 13:57:00 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-02-29 12:53:47 -0500
commitb7b50b21d2254a079b1b1c299909483d23db1512 (patch)
treec2c9b2bff77dfadb9d70d348ad6ffb06c60e8d2b /src/responder
parentd2d2d6ae0c436461bcc8f881df059eb036314c44 (diff)
downloadsssd-b7b50b21d2254a079b1b1c299909483d23db1512.tar.gz
sssd-b7b50b21d2254a079b1b1c299909483d23db1512.tar.bz2
sssd-b7b50b21d2254a079b1b1c299909483d23db1512.zip
Remove sysdb_get_ctx_from_list()
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/autofs/autofssrv_cmd.c4
-rw-r--r--src/responder/nss/nsssrv_cmd.c28
-rw-r--r--src/responder/nss/nsssrv_netgroup.c4
-rw-r--r--src/responder/nss/nsssrv_services.c19
-rw-r--r--src/responder/pam/pam_LOCAL_domain.c7
-rw-r--r--src/responder/pam/pamsrv_cmd.c24
-rw-r--r--src/responder/ssh/sshsrv_cmd.c14
-rw-r--r--src/responder/sudo/sudosrv_get_sudorules.c11
8 files changed, 53 insertions, 58 deletions
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c
index 8123db2a..7497a18f 100644
--- a/src/responder/autofs/autofssrv_cmd.c
+++ b/src/responder/autofs/autofssrv_cmd.c
@@ -559,8 +559,8 @@ lookup_automntmap_step(struct setautomntent_lookup_ctx *lookup_ctx)
DEBUG(SSSDBG_TRACE_FUNC, ("Requesting info for [%s@%s]\n",
lookup_ctx->mapname, dom->name));
- ret = sysdb_get_ctx_from_list(lookup_ctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 2a2a16b8..1e9927c1 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -715,8 +715,8 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -944,8 +944,8 @@ static int nss_cmd_getpwuid_search(struct nss_dom_ctx *dctx)
DEBUG(4, ("Requesting info for [%d@%s]\n", cmdctx->id, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -1314,8 +1314,8 @@ static errno_t nss_cmd_setpwent_step(struct setent_step_ctx *step_ctx)
DEBUG(6, ("Requesting info for domain [%s]\n", dom->name));
- ret = sysdb_get_ctx_from_list(rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -2020,8 +2020,8 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx)
DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -2249,8 +2249,8 @@ static int nss_cmd_getgrgid_search(struct nss_dom_ctx *dctx)
DEBUG(4, ("Requesting info for [%d@%s]\n", cmdctx->id, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -2612,8 +2612,8 @@ static errno_t nss_cmd_setgrent_step(struct setent_step_ctx *step_ctx)
DEBUG(6, ("Requesting info for domain [%s]\n", dom->name));
- ret = sysdb_get_ctx_from_list(rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
@@ -3081,8 +3081,8 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx)
DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c
index 5c79342c..9cb3422f 100644
--- a/src/responder/nss/nsssrv_netgroup.c
+++ b/src/responder/nss/nsssrv_netgroup.c
@@ -412,8 +412,8 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx)
DEBUG(4, ("Requesting info for [%s@%s]\n",
name, dom->name));
- ret = sysdb_get_ctx_from_list(step_ctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return EIO;
}
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index 872b0701..a3ac8576 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -164,8 +164,8 @@ getserv_send(TALLOC_CTX *mem_ctx,
}
if (!dom) break;
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Critical: Sysdb CTX not found for [%s]!\n", dom->name));
ret = EINVAL;
@@ -479,9 +479,8 @@ static void lookup_service_done(struct tevent_req *subreq)
* be returned, if it exists. Otherwise, move to the
* next provider.
*/
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
- dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Critical: Sysdb CTX not found for [%s]!\n",
dom->name));
@@ -1370,10 +1369,11 @@ lookup_servent_send(TALLOC_CTX *mem_ctx,
/* No provider check required. Just ask the
* sysdb.
*/
- ret = sysdb_get_ctx_from_list(rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Sysdb CTX not found for [%s]!\n", dom->name));
+ ret = EINVAL;
goto immediate;
}
@@ -1431,10 +1431,11 @@ lookup_servent_done(struct tevent_req *subreq)
}
/* Check the cache now */
- ret = sysdb_get_ctx_from_list(state->rctx->db_list, state->dom, &sysdb);
- if (ret != EOK) {
+ sysdb = state->dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Sysdb CTX not found for [%s]!\n", state->dom->name));
+ ret = EINVAL;
goto done;
}
diff --git a/src/responder/pam/pam_LOCAL_domain.c b/src/responder/pam/pam_LOCAL_domain.c
index baf8cc66..71446b4f 100644
--- a/src/responder/pam/pam_LOCAL_domain.c
+++ b/src/responder/pam/pam_LOCAL_domain.c
@@ -236,12 +236,11 @@ int LOCAL_pam_handler(struct pam_auth_req *preq)
return ENOMEM;
}
- ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
- preq->domain, &lreq->dbctx);
- if (ret != EOK) {
+ lreq->dbctx = preq->domain->sysdb;
+ if (lreq->dbctx == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
talloc_free(lreq);
- return ret;
+ return ENOENT;
}
lreq->ev = preq->cctx->ev;
lreq->preq = preq;
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 841bbf43..3efa696a 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -331,10 +331,10 @@ static errno_t set_last_login(struct pam_auth_req *preq)
goto fail;
}
- ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list, preq->domain,
- &dbctx);
- if (ret != EOK) {
+ dbctx = preq->domain->sysdb;
+ if (dbctx == NULL) {
DEBUG(0, ("Fatal: Sysdb context not found for this domain!\n"));
+ ret = EINVAL;
goto fail;
}
@@ -377,9 +377,11 @@ static errno_t get_selinux_string(struct pam_auth_req *preq)
goto done;
}
- ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
- preq->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = preq->domain->sysdb;
+ if (sysdb == NULL) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("Fatal: Sysdb CTX not found for "
+ "domain [%s]!\n", preq->domain->name));
+ ret = EINVAL;
goto done;
}
@@ -655,9 +657,8 @@ static void pam_reply(struct pam_auth_req *preq)
/* do auth with offline credentials */
pd->offline_auth = true;
- ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
- preq->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = preq->domain->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for "
"domain [%s]!\n", preq->domain->name));
goto done;
@@ -994,7 +995,6 @@ static void pam_dp_send_acct_req_done(struct tevent_req *req);
static int pam_check_user_search(struct pam_auth_req *preq)
{
struct sss_domain_info *dom = preq->domain;
- struct cli_ctx *cctx = preq->cctx;
char *name = NULL;
struct sysdb_ctx *sysdb;
time_t cacheExpire;
@@ -1049,8 +1049,8 @@ static int pam_check_user_search(struct pam_auth_req *preq)
DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
return EFAULT;
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index be79f0c9..77ffd80c 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -258,7 +258,6 @@ static errno_t
ssh_user_pubkeys_search_next(struct ssh_cmd_ctx *cmd_ctx)
{
errno_t ret;
- struct cli_ctx *cctx = cmd_ctx->cctx;
struct sysdb_ctx *sysdb;
const char *attrs[] = { SYSDB_NAME, SYSDB_SSH_PUBKEY, NULL };
struct ldb_result *res;
@@ -267,8 +266,8 @@ ssh_user_pubkeys_search_next(struct ssh_cmd_ctx *cmd_ctx)
("Requesting SSH user public keys for [%s@%s]\n",
cmd_ctx->name, cmd_ctx->domain->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, cmd_ctx->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = cmd_ctx->domain->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Fatal: Sysdb CTX not found for this domain!\n"));
return EFAULT;
@@ -393,7 +392,6 @@ static errno_t
ssh_host_pubkeys_search_next(struct ssh_cmd_ctx *cmd_ctx)
{
errno_t ret;
- struct cli_ctx *cctx = cmd_ctx->cctx;
struct sysdb_ctx *sysdb;
const char *attrs[] = { SYSDB_NAME, SYSDB_SSH_PUBKEY, NULL };
@@ -401,8 +399,8 @@ ssh_host_pubkeys_search_next(struct ssh_cmd_ctx *cmd_ctx)
("Requesting SSH host public keys for [%s@%s]\n",
cmd_ctx->name, cmd_ctx->domain->name));
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, cmd_ctx->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = cmd_ctx->domain->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Fatal: Sysdb CTX not found for this domain!\n"));
return EFAULT;
@@ -504,8 +502,8 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
}
while (dom) {
- ret = sysdb_get_ctx_from_list(cctx->rctx->db_list, dom, &sysdb);
- if (ret != EOK) {
+ sysdb = dom->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
diff --git a/src/responder/sudo/sudosrv_get_sudorules.c b/src/responder/sudo/sudosrv_get_sudorules.c
index 2988b519..abdf3e76 100644
--- a/src/responder/sudo/sudosrv_get_sudorules.c
+++ b/src/responder/sudo/sudosrv_get_sudorules.c
@@ -111,9 +111,8 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx)
DEBUG(SSSDBG_FUNC_DATA, ("Requesting info about [%s@%s]\n",
name, dom->name));
- ret = sysdb_get_ctx_from_list(cli_ctx->rctx->db_list,
- dctx->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = dctx->domain->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
("sysdb context not found for this domain!\n"));
ret = EIO;
@@ -400,7 +399,6 @@ static errno_t sudosrv_get_sudorules_from_cache(struct sudo_dom_ctx *dctx)
TALLOC_CTX *tmp_ctx;
errno_t ret;
struct sysdb_ctx *sysdb;
- struct cli_ctx *cli_ctx = dctx->cmd_ctx->cli_ctx;
struct sudo_ctx *sudo_ctx = dctx->cmd_ctx->sudo_ctx;
uid_t uid;
char **groupnames;
@@ -410,9 +408,8 @@ static errno_t sudosrv_get_sudorules_from_cache(struct sudo_dom_ctx *dctx)
tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) return ENOMEM;
- ret = sysdb_get_ctx_from_list(cli_ctx->rctx->db_list,
- dctx->domain, &sysdb);
- if (ret != EOK) {
+ sysdb = dctx->domain->sysdb;
+ if (sysdb == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
("sysdb context not found for this domain!\n"));
ret = EIO;