summaryrefslogtreecommitdiffstats
path: root/src/responder/pam/pamsrv_cmd.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-04-05 17:02:20 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-04-08 23:51:26 +0200
commit9ef2f2a4abba3d10c3aeeba0e99a6f2374f2a5ba (patch)
tree01d797060b95c6cf4f0a943a64cc6a06d68c5a24 /src/responder/pam/pamsrv_cmd.c
parent81cd0deb83b42df0ee9371fda035af774f3be886 (diff)
downloadsssd-9ef2f2a4abba3d10c3aeeba0e99a6f2374f2a5ba.tar.gz
sssd-9ef2f2a4abba3d10c3aeeba0e99a6f2374f2a5ba.tar.xz
sssd-9ef2f2a4abba3d10c3aeeba0e99a6f2374f2a5ba.zip
Allocate PAM DP request data on responder context
https://fedorahosted.org/sssd/ticket/1869 Currently the private data passed to the PAM request is a structure allocated on the client context. But in the odd case where the back end would be stopped or stuck until the idle timeout hits, the DP callback would access data that were freed when the client timed out. This patch introduces a new structure allocated on responder context, whose only purpose is to live as long as the request is active.
Diffstat (limited to 'src/responder/pam/pamsrv_cmd.c')
-rw-r--r--src/responder/pam/pamsrv_cmd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 6f2d0202c..94de4df5f 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -1034,6 +1034,17 @@ done:
return ret;
}
+static int pam_auth_req_destructor(struct pam_auth_req *preq)
+{
+ if (preq && preq->dpreq_spy) {
+ /* If there is still a request pending, tell the spy
+ * the client is going away
+ */
+ preq->dpreq_spy->preq = NULL;
+ }
+ return 0;
+}
+
static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
{
struct sss_domain_info *dom;
@@ -1049,6 +1060,7 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
if (!preq) {
return ENOMEM;
}
+ talloc_set_destructor(preq, pam_auth_req_destructor);
preq->cctx = cctx;
preq->pd = talloc_zero(preq, struct pam_data);