summaryrefslogtreecommitdiff
path: root/server/responder/pam
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-09-03 19:29:41 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-08 15:10:50 -0400
commit28d9dcbeabdf919506fe59e9d1cbed84fbd6e649 (patch)
tree3d5d878b1adc0ec8af94a52359d219689c763bd8 /server/responder/pam
parentaef967dc115c64f0288b8ecc3ff1d927aa42af70 (diff)
downloadsssd-28d9dcbeabdf919506fe59e9d1cbed84fbd6e649.tar.gz
sssd-28d9dcbeabdf919506fe59e9d1cbed84fbd6e649.tar.bz2
sssd-28d9dcbeabdf919506fe59e9d1cbed84fbd6e649.zip
Split database in multiple files
The special persistent local database retains the original name. All other backends now have their own cache-NAME.ldb file.
Diffstat (limited to 'server/responder/pam')
-rw-r--r--server/responder/pam/pam_LOCAL_domain.c8
-rw-r--r--server/responder/pam/pamsrv_cache.c9
-rw-r--r--server/responder/pam/pamsrv_cmd.c29
3 files changed, 41 insertions, 5 deletions
diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c
index 5d76891f..41d64b3e 100644
--- a/server/responder/pam/pam_LOCAL_domain.c
+++ b/server/responder/pam/pam_LOCAL_domain.c
@@ -459,7 +459,13 @@ int LOCAL_pam_handler(struct pam_auth_req *preq)
return ENOMEM;
}
- lreq->dbctx = preq->cctx->rctx->sysdb;
+ ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
+ preq->domain, &lreq->dbctx);
+ if (ret != EOK) {
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ talloc_free(lreq);
+ return ret;
+ }
lreq->ev = preq->cctx->ev;
lreq->preq = preq;
diff --git a/server/responder/pam/pamsrv_cache.c b/server/responder/pam/pamsrv_cache.c
index 7cfd97b1..9c5c209f 100644
--- a/server/responder/pam/pamsrv_cache.c
+++ b/server/responder/pam/pamsrv_cache.c
@@ -132,6 +132,7 @@ done:
int pam_cache_auth(struct pam_auth_req *preq)
{
+ struct sysdb_ctx *sysdb;
int ret;
static const char *attrs[] = {SYSDB_NAME,
@@ -144,7 +145,13 @@ int pam_cache_auth(struct pam_auth_req *preq)
"lastFailedLogin",
NULL};
- ret = sysdb_get_user_attr(preq, preq->cctx->rctx->sysdb,
+ ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
+ preq->domain, &sysdb);
+ if (ret != EOK) {
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ return ret;
+ }
+ ret = sysdb_get_user_attr(preq, sysdb,
preq->domain, preq->pd->user, attrs,
pam_cache_auth_callback, preq);
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c
index 12625509..1204e325 100644
--- a/server/responder/pam/pamsrv_cmd.c
+++ b/server/responder/pam/pamsrv_cmd.c
@@ -382,6 +382,7 @@ static void pam_dom_forwarder(struct pam_auth_req *preq);
static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
{
struct sss_domain_info *dom;
+ struct sysdb_ctx *sysdb;
struct pam_auth_req *preq;
struct pam_data *pd;
uint8_t *body;
@@ -486,7 +487,13 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
else {
preq->check_provider = NEED_CHECK_PROVIDER(preq->domain->provider);
- ret = sysdb_getpwnam(preq, cctx->rctx->sysdb,
+ ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
+ preq->domain, &sysdb);
+ if (ret != EOK) {
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ goto done;
+ }
+ ret = sysdb_getpwnam(preq, sysdb,
preq->domain, preq->pd->user,
pam_check_user_callback, preq);
}
@@ -509,6 +516,7 @@ static void pam_check_user_dp_callback(uint16_t err_maj, uint32_t err_min,
{
struct pam_auth_req *preq = talloc_get_type(ptr, struct pam_auth_req);
struct ldb_result *res = NULL;
+ struct sysdb_ctx *sysdb;
int ret;
if ((err_maj != DP_ERR_OK) && (err_maj != DP_ERR_OFFLINE)) {
@@ -531,7 +539,13 @@ static void pam_check_user_dp_callback(uint16_t err_maj, uint32_t err_min,
return;
}
- ret = sysdb_getpwnam(preq, preq->cctx->rctx->sysdb,
+ ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
+ preq->domain, &sysdb);
+ if (ret != EOK) {
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ goto done;
+ }
+ ret = sysdb_getpwnam(preq, sysdb,
preq->domain, preq->pd->user,
pam_check_user_callback, preq);
@@ -547,6 +561,7 @@ static void pam_check_user_callback(void *ptr, int status,
{
struct pam_auth_req *preq = talloc_get_type(ptr, struct pam_auth_req);
struct sss_domain_info *dom;
+ struct sysdb_ctx *sysdb;
uint64_t lastUpdate;
bool call_provider = false;
time_t timeout;
@@ -673,7 +688,15 @@ static void pam_check_user_callback(void *ptr, int status,
else {
preq->check_provider = NEED_CHECK_PROVIDER(preq->domain->provider);
- ret = sysdb_getpwnam(preq, preq->cctx->rctx->sysdb,
+ ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
+ preq->domain, &sysdb);
+ if (ret != EOK) {
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ preq->pd->pam_status = PAM_SYSTEM_ERR;
+ pam_reply(preq);
+ return;
+ }
+ ret = sysdb_getpwnam(preq, sysdb,
preq->domain, preq->pd->user,
pam_check_user_callback, preq);
}