summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2011-07-01 13:01:51 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-07-01 08:07:53 -0400
commitf0f439c77363627115ca6b452d80b2f1822e4a36 (patch)
treea7311b2f13d9b6ebbf4ed3ded48ac7cd32bf4c4a /src/util
parenta57cca518ba0b1dda8868448e176ab626272c84b (diff)
downloadsssd-f0f439c77363627115ca6b452d80b2f1822e4a36.tar.gz
sssd-f0f439c77363627115ca6b452d80b2f1822e4a36.tar.bz2
sssd-f0f439c77363627115ca6b452d80b2f1822e4a36.zip
Do not access state after tevent_req_done() is called.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sss_ldap.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c
index 8d6660fa..e24ae82b 100644
--- a/src/util/sss_ldap.c
+++ b/src/util/sss_ldap.c
@@ -123,6 +123,7 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx,
struct sdap_async_sys_connect_state *state;
long flags;
int ret;
+ int fret;
flags = fcntl(fd, F_GETFL, 0);
if (flags == -1) {
@@ -150,7 +151,6 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx,
ret = connect(fd, addr, addr_len);
if (ret == EOK) {
- tevent_req_done(req);
goto done;
}
@@ -175,14 +175,17 @@ static struct tevent_req *sdap_async_sys_connect_send(TALLOC_CTX *mem_ctx,
}
done:
- if (ret != EOK) {
- tevent_req_error(req, ret);
+ fret = fcntl(fd, F_SETFL, flags);
+ if (fret != EOK) {
+ DEBUG(1, ("fcntl F_SETFL failed.\n"));
}
- ret = fcntl(fd, F_SETFL, flags);
- if (ret != EOK) {
- DEBUG(1, ("fcntl F_SETFL failed.\n"));
+ if (ret == EOK) {
+ tevent_req_done(req);
+ } else {
+ tevent_req_error(req, ret);
}
+
tevent_req_post(req, ev);
return req;
}
@@ -195,6 +198,7 @@ static void sdap_async_sys_connect_done(struct tevent_context *ev,
struct sdap_async_sys_connect_state *state = tevent_req_data(req,
struct sdap_async_sys_connect_state);
int ret = EOK;
+ int fret;
/* I found the following comment in samba's lib/async_req/async_sock.c:
* Stevens, Network Programming says that if there's a
@@ -220,16 +224,18 @@ static void sdap_async_sys_connect_done(struct tevent_context *ev,
done:
talloc_zfree(fde);
+
+ fret = fcntl(state->fd, F_SETFL, state->old_flags);
+ if (fret != EOK) {
+ DEBUG(1, ("fcntl F_SETFL failed.\n"));
+ }
+
if (ret == EOK) {
tevent_req_done(req);
} else {
tevent_req_error(req, ret);
}
- ret = fcntl(state->fd, F_SETFL, state->old_flags);
- if (ret != EOK) {
- DEBUG(1, ("fcntl F_SETFL failed.\n"));
- }
return;
}