[dovecot-cvs] dovecot/src/auth db-ldap.c,1.41.2.15,1.41.2.16

tss at dovecot.org tss at dovecot.org
Tue Jan 16 13:26:10 UTC 2007


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv18962

Modified Files:
      Tag: branch_1_0
	db-ldap.c 
Log Message:
Last change for making ldap_bind() error handling better was actually broken.



Index: db-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.41.2.15
retrieving revision 1.41.2.16
diff -u -d -r1.41.2.15 -r1.41.2.16
--- db-ldap.c	9 Jan 2007 11:40:06 -0000	1.41.2.15
+++ db-ldap.c	16 Jan 2007 13:25:38 -0000	1.41.2.16
@@ -127,7 +127,7 @@
 	i_fatal("LDAP: Unknown scope option '%s'", str);
 }
 
-const char *ldap_get_error(struct ldap_connection *conn)
+static int ldap_get_errno(struct ldap_connection *conn)
 {
 	int ret, err;
 
@@ -135,10 +135,15 @@
 	if (ret != LDAP_SUCCESS) {
 		i_error("LDAP: Can't get error number: %s",
 			ldap_err2string(ret));
-		return "??";
+		return -1;
 	}
 
-	return ldap_err2string(err);
+	return err;
+}
+
+const char *ldap_get_error(struct ldap_connection *conn)
+{
+	return ldap_err2string(ldap_get_errno(conn));
 }
 
 void db_ldap_add_delayed_request(struct ldap_connection *conn,
@@ -411,7 +416,7 @@
 	msgid = ldap_bind(conn->ld, conn->set.dn, conn->set.dnpass,
 			  LDAP_AUTH_SIMPLE);
 	if (msgid == -1) {
-		db_ldap_connect_finish(conn, ldap_get_error(conn));
+		db_ldap_connect_finish(conn, ldap_get_errno(conn));
 		i_free(ldap_request);
 		return -1;
 	}



More information about the dovecot-cvs mailing list