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-07-25 18:55:41 +0200
commit5bcb3dae4ad4ea09938a3c79b092ff939164dbda (patch)
tree9bc0ef69babebd030a15165769919920d8fdf8f5 /src/responder/pam/pamsrv_cmd.c
parent10efde3a8f213bec0245f57ef272e1e6a645110f (diff)
downloadsssd-5bcb3dae4ad4ea09938a3c79b092ff939164dbda.tar.gz
sssd-5bcb3dae4ad4ea09938a3c79b092ff939164dbda.tar.xz
sssd-5bcb3dae4ad4ea09938a3c79b092ff939164dbda.zip
Allocate PAM DP request data on responder context1.9.2-92
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 426964220..bd08fed87 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -1022,6 +1022,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;
@@ -1037,6 +1048,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);