summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/daemon.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-09-29 14:08:35 -0600
committerRich Megginson <rmeggins@redhat.com>2009-09-29 16:57:19 -0600
commit675508c6b5482161510514055d0d42006471551b (patch)
tree57faf125383268b51603f23255d6d577e0bd6b1d /ldap/servers/slapd/daemon.c
parent467df90a6ed7ac6c1a0d4588ee14ebe79f2c22c2 (diff)
downloadds-675508c6b5482161510514055d0d42006471551b.tar.gz
ds-675508c6b5482161510514055d0d42006471551b.tar.xz
ds-675508c6b5482161510514055d0d42006471551b.zip
SASL IO sometimes loops with "error: would block"
https://bugzilla.redhat.com/show_bug.cgi?id=526319 Resolves: bug 526319 Bug Description: SASL IO sometimes loops with "error: would block" Reviewed by: nkinder (Thanks!) Fix Description: The semantics for recv() are that it returns -1 for errors, 0 for connection closed, and non-zero for some bytes received. The sasl code was not using those semantics - it was returning 0 for successful read and -1 for error. Although I have not been able to reproduce the exact failure, what I believe is happening is that the initial read of the packet length in sasl_io_start_packet() works, and the sasl IO is received. At some point, the connection is closed by the client, and the PR_Recv return of 0 is not handled correctly, and somehow the errno gets set to EWOULDBLOCK. From this point on, PR_Recv() will return -1 (since the socket has been closed) and errno is not reset from EWOULDBLOCK. The fix is to make sure the sasl IO code handles the PR_Recv() return value correctly. Note that with CONNS (8) error log level, you may still occasionally see "would block" errors, but as long as they are not endlessly repeating, this should be ok. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap/servers/slapd/daemon.c')
-rw-r--r--ldap/servers/slapd/daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 59ae3a03..3b8986c3 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1695,7 +1695,7 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket
} else if (bytes == 0) { /* disconnect */
PRErrorCode prerr = PR_GetError();
LDAPDebug(LDAP_DEBUG_CONNS,
- "PR_Recv(%d) - 0 (EOF) %d:%s\n", /* disconnected */
+ "PR_Write(%d) - 0 (EOF) %d:%s\n", /* disconnected */
fd, prerr, slapd_pr_strerror(prerr));
PR_SetError(PR_PIPE_ERROR, EPIPE);
break;