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:47:23 +0200
commita28391f68a09eaedbe1a515f513ca56bbb94d7a5 (patch)
tree7c64db5073623d05c8ebe9bbc2ba08a08439f406 /src/responder/pam/pamsrv_cmd.c
parent827e8dbc3c792ed34b0608c3bd3a4d7b0eedf4f5 (diff)
downloadsssd-a28391f68a09eaedbe1a515f513ca56bbb94d7a5.tar.gz
sssd-a28391f68a09eaedbe1a515f513ca56bbb94d7a5.tar.xz
sssd-a28391f68a09eaedbe1a515f513ca56bbb94d7a5.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 e6300a759..ba4e969ff 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -739,6 +739,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;
@@ -754,6 +765,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 = create_pam_data(preq);