summaryrefslogtreecommitdiffstats
path: root/server/providers/ldap/sdap_async_connection.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-12-18 10:23:41 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-18 15:41:36 -0500
commit3a1f8aa6f6464d8e80b79664e204ca3b24663e00 (patch)
tree616eca757c8807a3a0ee97c12ff97b10a9041441 /server/providers/ldap/sdap_async_connection.c
parent172ed348f92121f6c17433a65815d5f5cc81d626 (diff)
downloadsssd-3a1f8aa6f6464d8e80b79664e204ca3b24663e00.tar.gz
sssd-3a1f8aa6f6464d8e80b79664e204ca3b24663e00.tar.xz
sssd-3a1f8aa6f6464d8e80b79664e204ca3b24663e00.zip
Fix ldap child memory hierarchy and other issues
The timeout handler was not a child of the request so it could fire even though the request was already freed. The code wouldn't use async writes to the children so it could incur in a short write with no way to detect or recover from it. Also fixed style of some helper functions to pass explicit paramters instead of a general structure. Add common code to do async writes to pipes. Fixed async write issue for the krb5_child as well. Fix also sdap_kinit_done(), a return statement was missing and we were mixing SDAP_AUTH and errno return codes in state->result Remove usless helper function that just replicates talloc_strndup()
Diffstat (limited to 'server/providers/ldap/sdap_async_connection.c')
-rw-r--r--server/providers/ldap/sdap_async_connection.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/providers/ldap/sdap_async_connection.c b/server/providers/ldap/sdap_async_connection.c
index 134979039..7ccb301bd 100644
--- a/server/providers/ldap/sdap_async_connection.c
+++ b/server/providers/ldap/sdap_async_connection.c
@@ -581,8 +581,7 @@ struct tevent_req *sdap_kinit_send(TALLOC_CTX *memctx,
}
}
- subreq = sdap_krb5_get_tgt_send(state, ev, timeout,
- realm, principal, keytab);
+ subreq = sdap_get_tgt_send(state, ev, realm, principal, keytab, timeout);
if (!subreq) {
talloc_zfree(req);
return NULL;
@@ -603,19 +602,20 @@ static void sdap_kinit_done(struct tevent_req *subreq)
int result;
char *ccname = NULL;
- ret = sdap_krb5_get_tgt_recv(subreq, state, &result, &ccname);
+ ret = sdap_get_tgt_recv(subreq, state, &result, &ccname);
talloc_zfree(subreq);
if (ret != EOK) {
- state->result = ret;
+ state->result = SDAP_AUTH_FAILED;
DEBUG(1, ("child failed (%d [%s])\n", ret, strerror(ret)));
tevent_req_error(req, ret);
+ return;
}
if (result == EOK) {
ret = setenv("KRB5CCNAME", ccname, 1);
if (ret == -1) {
DEBUG(2, ("Unable to set env. variable KRB5CCNAME!\n"));
- state->result = EFAULT;
+ state->result = SDAP_AUTH_FAILED;
tevent_req_error(req, EFAULT);
}