summaryrefslogtreecommitdiffstats
path: root/server/responder
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-03-27 14:52:21 -0400
committerSimo Sorce <ssorce@redhat.com>2009-03-27 15:13:45 -0400
commita06644dfe4f680d6b14f7e654aad4982ea10a6cc (patch)
tree39f03b64dad15cff58ce943e3ca30b561cae3e94 /server/responder
parent11cd9b94e6fc6ce22387a49f146f875c03bf9b54 (diff)
downloadsssd-a06644dfe4f680d6b14f7e654aad4982ea10a6cc.tar.gz
sssd-a06644dfe4f680d6b14f7e654aad4982ea10a6cc.tar.xz
sssd-a06644dfe4f680d6b14f7e654aad4982ea10a6cc.zip
Fix potential segfault if dp_ctx is still NULL.
May happen at startup if, for some reason dp is very slow to start and we receive a request before a reconnection is rescheduled in the responder dp reconnection code. This shouldn't happen normally so make it clear with a debug statement.
Diffstat (limited to 'server/responder')
-rw-r--r--server/responder/nss/nsssrv_dp.c9
-rw-r--r--server/responder/pam/pamsrv_dp.c11
2 files changed, 18 insertions, 2 deletions
diff --git a/server/responder/nss/nsssrv_dp.c b/server/responder/nss/nsssrv_dp.c
index 0668a5b5f..b2e15df3a 100644
--- a/server/responder/nss/nsssrv_dp.c
+++ b/server/responder/nss/nsssrv_dp.c
@@ -142,6 +142,15 @@ int nss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
return ENOMEM;
}
+ /* 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 (!rctx->dp_ctx) {
+ DEBUG(1, ("The Data Provider connection is not available yet!"
+ " This maybe a bug, it shouldn't happen!\n"));
+ return EIO;
+ }
conn = sbus_get_connection(rctx->dp_ctx->scon_ctx);
/* create the message */
diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c
index 9bd249e29..5eaf7d14d 100644
--- a/server/responder/pam/pamsrv_dp.c
+++ b/server/responder/pam/pamsrv_dp.c
@@ -95,7 +95,6 @@ int pam_dp_send_req(struct cli_ctx *cctx,
DBusMessage *msg;
DBusPendingCall *pending_reply;
DBusConnection *conn;
- DBusError dbus_error;
dbus_bool_t ret;
struct pam_reply_ctx *rctx;
@@ -117,8 +116,16 @@ int pam_dp_send_req(struct cli_ctx *cctx,
return EINVAL;
}
+ /* 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 (!rctx->dp_ctx) {
+ DEBUG(1, ("The Data Provider connection is not available yet!"
+ " This maybe a bug, it shouldn't happen!\n"));
+ return EIO;
+ }
conn = sbus_get_connection(cctx->rctx->dp_ctx->scon_ctx);
- dbus_error_init(&dbus_error);
msg = dbus_message_new_method_call(NULL,
DP_CLI_PATH,