summaryrefslogtreecommitdiff
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:30 -0500
commitbb78a286dbc90d248bd7a9d29344de87051920f2 (patch)
tree79dc659b368e88e7fe247fe535fc48b83862d50e /server/providers/ldap/sdap_async_connection.c
parent6b94e84a0455ebb68506e70cf8ccc2a4656a2c91 (diff)
downloadsssd-bb78a286dbc90d248bd7a9d29344de87051920f2.tar.gz
sssd-bb78a286dbc90d248bd7a9d29344de87051920f2.tar.bz2
sssd-bb78a286dbc90d248bd7a9d29344de87051920f2.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 13497903..7ccb301b 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);
}