summaryrefslogtreecommitdiff
path: root/server/responder/pam
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-10-02 19:36:01 -0400
committerSimo Sorce <ssorce@redhat.com>2009-10-09 16:11:08 -0400
commitdc55d62f4d9f6520ffcb4aa8c6beb308896d9fbb (patch)
tree7842b16b9ce9e4367c2a9a6f05db25fc40b2ab08 /server/responder/pam
parent1f2b3f82f9896a99f8f2b8b2145af47402a9c3c6 (diff)
downloadsssd-dc55d62f4d9f6520ffcb4aa8c6beb308896d9fbb.tar.gz
sssd-dc55d62f4d9f6520ffcb4aa8c6beb308896d9fbb.tar.bz2
sssd-dc55d62f4d9f6520ffcb4aa8c6beb308896d9fbb.zip
Remove DP process
Turn the backend process into data provider servers Make Frontends (pam, nss) directly attach to the backends
Diffstat (limited to 'server/responder/pam')
-rw-r--r--server/responder/pam/pamsrv.c31
-rw-r--r--server/responder/pam/pamsrv_dp.c18
2 files changed, 27 insertions, 22 deletions
diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c
index f8af665b..53478522 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -88,8 +88,8 @@ static struct sbus_method pam_dp_methods[] = {
};
struct sbus_interface pam_dp_interface = {
- DP_CLI_INTERFACE,
- DP_CLI_PATH,
+ DP_INTERFACE,
+ DP_PATH,
SBUS_DEFAULT_VTABLE,
pam_dp_methods,
NULL
@@ -98,7 +98,7 @@ struct sbus_interface pam_dp_interface = {
static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void *pvt)
{
- struct resp_ctx *rctx = talloc_get_type(pvt, struct resp_ctx);
+ struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn);
int ret;
/* Did we reconnect successfully? */
@@ -106,18 +106,19 @@ static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void
DEBUG(1, ("Reconnected to the Data Provider.\n"));
/* Identify ourselves to the data provider */
- ret = dp_common_send_id(conn,
- DP_CLI_FRONTEND,
+ ret = dp_common_send_id(be_conn->conn,
DATA_PROVIDER_VERSION,
- "PAM", "");
+ "PAM", be_conn->domain->name);
/* all fine */
if (ret == EOK) return;
}
/* Handle failure */
- DEBUG(0, ("Could not reconnect to data provider.\n"));
- /* Kill the backend and let the monitor restart it */
- pam_shutdown(rctx);
+ DEBUG(0, ("Could not reconnect to %s provider.\n",
+ be_conn->domain->name));
+
+ /* FIXME: kill the frontend and let the monitor restart it ? */
+ /* pam_shutdown(rctx); */
}
static int pam_process_init(TALLOC_CTX *mem_ctx,
@@ -125,6 +126,7 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
struct confdb_ctx *cdb)
{
struct sss_cmd_table *pam_cmds;
+ struct be_conn *iter;
struct resp_ctx *rctx;
int ret, max_retries;
@@ -137,10 +139,7 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
PAM_SBUS_SERVICE_NAME,
PAM_SBUS_SERVICE_VERSION,
&monitor_pam_interface,
- DP_CLI_FRONTEND,
- DATA_PROVIDER_VERSION,
- "PAM", "",
- &pam_dp_interface,
+ "PAM", &pam_dp_interface,
&rctx);
if (ret != EOK) {
return ret;
@@ -157,8 +156,10 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
return ret;
}
- sbus_reconnect_init(rctx->dp_conn, max_retries,
- pam_dp_reconnect_init, rctx);
+ for (iter = rctx->be_conns; iter; iter = iter->next) {
+ sbus_reconnect_init(iter->conn, max_retries,
+ pam_dp_reconnect_init, iter);
+ }
return EOK;
}
diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c
index 7ea2b7e4..071d09b8 100644
--- a/server/responder/pam/pamsrv_dp.c
+++ b/server/responder/pam/pamsrv_dp.c
@@ -82,26 +82,30 @@ done:
int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
{
struct pam_data *pd = preq->pd;
+ struct be_conn *be_conn;
DBusMessage *msg;
DBusPendingCall *pending_reply;
DBusConnection *dbus_conn;
dbus_bool_t ret;
+ int res;
/* double check dp_ctx has actually been initialized.
* in some pathological cases it may happen that nss starts up before
* dp connection code is actually able to establish a connection.
*/
- if (!preq->cctx->rctx->dp_conn) {
- DEBUG(1, ("The Data Provider connection is not available yet!"
- " This maybe a bug, it shouldn't happen!\n"));
+ res = sss_dp_get_domain_conn(preq->cctx->rctx,
+ preq->domain->name, &be_conn);
+ if (res != EOK) {
+ DEBUG(1, ("The Data Provider connection for %s is not available!"
+ " This maybe a bug, it shouldn't happen!\n", preq->domain));
return EIO;
}
- dbus_conn = sbus_get_connection(preq->cctx->rctx->dp_conn);
+ dbus_conn = sbus_get_connection(be_conn->conn);
msg = dbus_message_new_method_call(NULL,
- DP_CLI_PATH,
- DP_CLI_INTERFACE,
- DP_SRV_METHOD_PAMHANDLER);
+ DP_PATH,
+ DP_INTERFACE,
+ DP_METHOD_PAMHANDLER);
if (msg == NULL) {
DEBUG(0,("Out of memory?!\n"));
return ENOMEM;