[dovecot-cvs] dovecot/src/auth db-ldap.c,1.7,1.8
cras at procontrol.fi
cras at procontrol.fi
Mon Feb 17 15:38:40 EET 2003
Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv3610/auth
Modified Files:
db-ldap.c
Log Message:
Rather than block for two seconds, we can just call ldap_result() again if
it returns 0..
Index: db-ldap.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- db-ldap.c 11 Feb 2003 14:06:46 -0000 1.7
+++ db-ldap.c 17 Feb 2003 13:38:38 -0000 1.8
@@ -14,8 +14,8 @@
#include <stddef.h>
-/* This may block the process for two seconds, but at least it works. */
-#if LDAP_VENDOR_VERSION <= 20026
+/* Older versions may require calling ldap_result() twice */
+#if LDAP_VENDOR_VERSION <= 20112
# define OPENLDAP_ASYNC_WORKAROUND
#endif
@@ -130,12 +130,14 @@
for (;;) {
memset(&timeout, 0, sizeof(timeout));
+ ret = ldap_result(conn->ld, LDAP_RES_ANY, 1, &timeout, &res);
#ifdef OPENLDAP_ASYNC_WORKAROUND
- /* we may block, but at least we work */
- timeout.tv_sec = 2;
+ if (ret == 0) {
+ /* try again, there may be another in buffer */
+ ret = ldap_result(conn->ld, LDAP_RES_ANY, 1,
+ &timeout, &res);
+ }
#endif
-
- ret = ldap_result(conn->ld, LDAP_RES_ANY, 1, &timeout, &res);
if (ret <= 0) {
if (ret < 0) {
i_error("LDAP: ldap_result() failed: %s",
More information about the dovecot-cvs
mailing list