summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-10-22 11:42:17 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-22 15:43:01 -0400
commitff75b1a0e342f694589c46d9d59c509ac69be980 (patch)
tree677187b71df53890a49fe58828d27d6c45010716 /server
parentf3bc40136878ab91cb98f1b206ff9517000112f7 (diff)
downloadsssd-ff75b1a0e342f694589c46d9d59c509ac69be980.tar.gz
sssd-ff75b1a0e342f694589c46d9d59c509ac69be980.tar.bz2
sssd-ff75b1a0e342f694589c46d9d59c509ac69be980.zip
Add pam_ctx (similar to nss_ctx) for storing global PAM config
Diffstat (limited to 'server')
-rw-r--r--server/responder/pam/pamsrv.c26
-rw-r--r--server/responder/pam/pamsrv.h4
2 files changed, 25 insertions, 5 deletions
diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c
index 4e740637..352c0469 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -111,17 +111,30 @@ static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void
/* pam_shutdown(rctx); */
}
+static errno_t pam_get_config(struct pam_ctx *pctx,
+ struct resp_ctx *rctx,
+ struct confdb_ctx *cdb)
+{
+ int ret = EOK;
+ return ret;
+}
+
static int pam_process_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct sss_cmd_table *pam_cmds;
struct be_conn *iter;
- struct resp_ctx *rctx;
+ struct pam_ctx *pctx;
int ret, max_retries;
+ pctx = talloc_zero(mem_ctx, struct pam_ctx);
+ if (!pctx) {
+ return ENOMEM;
+ }
+
pam_cmds = get_pam_cmds();
- ret = sss_process_init(mem_ctx, ev, cdb,
+ ret = sss_process_init(pctx, ev, cdb,
pam_cmds,
SSS_PAM_SOCKET_NAME,
SSS_PAM_PRIV_SOCKET_NAME,
@@ -130,23 +143,26 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
PAM_SBUS_SERVICE_VERSION,
&monitor_pam_interface,
"PAM", &pam_dp_interface,
- &rctx);
+ &pctx->rctx);
if (ret != EOK) {
return ret;
}
+ pctx->rctx->pvt_ctx = pctx;
+ ret = pam_get_config(pctx, pctx->rctx, pctx->rctx->cdb);
+
/* Enable automatic reconnection to the Data Provider */
/* FIXME: "retries" is too generic, either get it from a global config
* or specify these retries are about the sbus connections to DP */
- ret = confdb_get_int(rctx->cdb, rctx, CONFDB_PAM_CONF_ENTRY,
+ ret = confdb_get_int(pctx->rctx->cdb, pctx->rctx, CONFDB_PAM_CONF_ENTRY,
CONFDB_SERVICE_RECON_RETRIES, 3, &max_retries);
if (ret != EOK) {
DEBUG(0, ("Failed to set up automatic reconnection\n"));
return ret;
}
- for (iter = rctx->be_conns; iter; iter = iter->next) {
+ for (iter = pctx->rctx->be_conns; iter; iter = iter->next) {
sbus_reconnect_init(iter->conn, max_retries,
pam_dp_reconnect_init, iter);
}
diff --git a/server/responder/pam/pamsrv.h b/server/responder/pam/pamsrv.h
index 0963a05b..74115bcc 100644
--- a/server/responder/pam/pamsrv.h
+++ b/server/responder/pam/pamsrv.h
@@ -31,6 +31,10 @@ struct pam_auth_req;
typedef void (pam_dp_callback_t)(struct pam_auth_req *preq);
+struct pam_ctx {
+ struct resp_ctx *rctx;
+};
+
struct pam_auth_req {
struct cli_ctx *cctx;
struct sss_domain_info *domain;