[dovecot-cvs] dovecot/src/auth db-ldap.c, 1.49, 1.50 db-ldap.h, 1.25, 1.26 passdb-ldap.c, 1.48, 1.49
tss at dovecot.org
tss at dovecot.org
Sat Nov 4 15:09:30 UTC 2006
- Previous message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.48, 1.49 db-ldap.h, 1.24, 1.25 passdb-ldap.c, 1.47, 1.48 userdb-ldap.c, 1.40, 1.41
- Next message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.41.2.8, 1.41.2.9 db-ldap.h, 1.20.2.5, 1.20.2.6 passdb-ldap.c, 1.44.2.4, 1.44.2.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv21803
Modified Files:
db-ldap.c db-ldap.h passdb-ldap.c
Log Message:
Crashfixes
Index: db-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- db-ldap.c 4 Nov 2006 15:00:32 -0000 1.49
+++ db-ldap.c 4 Nov 2006 15:09:26 -0000 1.50
@@ -142,11 +142,9 @@
{
int msgid;
- if (!conn->connected && !conn->connecting) {
- if (db_ldap_connect(conn) < 0) {
- request->callback(conn, request, NULL);
- return;
- }
+ if (db_ldap_connect(conn) < 0) {
+ request->callback(conn, request, NULL);
+ return;
}
if (conn->last_auth_bind) {
@@ -370,6 +368,7 @@
if (msgid == -1) {
i_error("ldap_bind(%s) failed: %s",
conn->set.dn, ldap_get_error(conn));
+ i_free(ldap_request);
return -1;
}
hash_insert(conn->requests, POINTER_CAST(msgid), ldap_request);
@@ -380,13 +379,26 @@
return 0;
}
+static void db_ldap_get_fd(struct ldap_connection *conn)
+{
+ int ret;
+
+ /* get the connection's fd */
+ ret = ldap_get_option(conn->ld, LDAP_OPT_DESC, (void *)&conn->fd);
+ if (ret != LDAP_SUCCESS) {
+ i_fatal("LDAP: Can't get connection fd: %s",
+ ldap_err2string(ret));
+ }
+ i_assert(conn->fd != -1);
+ net_set_nonblock(conn->fd, TRUE);
+}
+
int db_ldap_connect(struct ldap_connection *conn)
{
unsigned int ldap_version;
int ret;
- i_assert(!conn->connecting);
- if (conn->connected)
+ if (conn->connected || conn->connecting)
return 0;
if (conn->ld == NULL) {
@@ -423,17 +435,7 @@
i_fatal("LDAP: Can't set protocol version %u: %s",
ldap_version, ldap_err2string(ret));
}
-
- /* get the connection's fd */
- ret = ldap_get_option(conn->ld, LDAP_OPT_DESC,
- (void *)&conn->fd);
- if (ret != LDAP_SUCCESS) {
- i_fatal("LDAP: Can't get connection fd: %s",
- ldap_err2string(ret));
- }
- net_set_nonblock(conn->fd, TRUE);
}
- i_assert(conn->fd != -1);
if (conn->set.tls) {
#ifdef LDAP_HAVE_START_TLS_S
@@ -469,9 +471,11 @@
#endif
if (db_ldap_connect_finish(conn, ret) < 0)
return -1;
+ db_ldap_get_fd(conn);
} else {
if (db_ldap_bind(conn) < 0)
return -1;
+ db_ldap_get_fd(conn);
}
conn->io = io_add(conn->fd, IO_READ, ldap_input, conn);
Index: db-ldap.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- db-ldap.h 4 Nov 2006 15:00:32 -0000 1.25
+++ db-ldap.h 4 Nov 2006 15:09:27 -0000 1.26
@@ -56,7 +56,7 @@
struct ldap_settings set;
LDAP *ld;
- int fd; /* only set when ld is not NULL */
+ int fd; /* only set when connected/connecting */
struct io *io;
struct hash_table *requests;
Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- passdb-ldap.c 4 Nov 2006 15:00:32 -0000 1.48
+++ passdb-ldap.c 4 Nov 2006 15:09:27 -0000 1.49
@@ -439,11 +439,9 @@
/* reconnect if needed. this is also done by db_ldap_search(), but
with auth binds we'll have to do it ourself */
- if (!conn->connected && !conn->connecting) {
- if (db_ldap_connect(conn)< 0) {
- callback(PASSDB_RESULT_INTERNAL_FAILURE, request);
- return;
- }
+ if (db_ldap_connect(conn)< 0) {
+ callback(PASSDB_RESULT_INTERNAL_FAILURE, request);
+ return;
}
ldap_request = p_new(request->pool, struct passdb_ldap_request, 1);
- Previous message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.48, 1.49 db-ldap.h, 1.24, 1.25 passdb-ldap.c, 1.47, 1.48 userdb-ldap.c, 1.40, 1.41
- Next message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.41.2.8, 1.41.2.9 db-ldap.h, 1.20.2.5, 1.20.2.6 passdb-ldap.c, 1.44.2.4, 1.44.2.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list