[dovecot-cvs] dovecot/src/auth db-ldap.c, 1.41.2.2, 1.41.2.3 password-scheme.c, 1.21.2.1, 1.21.2.2

cras at dovecot.org cras at dovecot.org
Sat Jun 17 19:01:15 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	db-ldap.c password-scheme.c 
Log Message:
Compiler warning fixes and some coding style cleanups.



Index: db-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.41.2.2
retrieving revision 1.41.2.3
diff -u -d -r1.41.2.2 -r1.41.2.3
--- db-ldap.c	31 May 2006 11:03:50 -0000	1.41.2.2
+++ db-ldap.c	17 Jun 2006 16:01:12 -0000	1.41.2.3
@@ -224,35 +224,35 @@
 	}
 }
 
-static int sasl_interact(LDAP *ld, unsigned flags, void *defaults,
-		   	 void *interact)
+static int
+sasl_interact(LDAP *ld __attr_unused__, unsigned flags __attr_unused__,
+	      void *defaults, void *interact)
 {
+	struct sasl_bind_context *context = defaults;
 	sasl_interact_t *in;
-	struct sasl_bind_context *context;
-	const char *p;
+	const char *str;
 
-	context = (struct sasl_bind_context *) defaults;
-	for (in=interact; in->id != SASL_CB_LIST_END; in++)
-	{
-		p = NULL;
-		switch (in->id)
-		{
+	for (in = interact; in->id != SASL_CB_LIST_END; in++) {
+		switch (in->id) {
 		case SASL_CB_GETREALM:
-			p = context->realm;
+			str = context->realm;
 			break;
 		case SASL_CB_AUTHNAME:
-			p = context->authcid;
+			str = context->authcid;
 			break;
 		case SASL_CB_USER:
-			p = context->authzid;
+			str = context->authzid;
 			break;
 		case SASL_CB_PASS:
-			p = context->passwd;
+			str = context->passwd;
+			break;
+		default:
+			str = NULL;
 			break;
 		}
-		if (p) {
-			in->len = strlen(p);
-			in->result = p;
+		if (str != NULL) {
+			in->len = strlen(str);
+			in->result = str;
 		}
 		
 	}
@@ -300,36 +300,29 @@
 
 	/* FIXME: we shouldn't use blocking bind */
 	if (conn->set.sasl_bind) {
-
 		context.authcid = conn->set.dn;
 		context.passwd = conn->set.dnpass;
 		context.realm = conn->set.sasl_realm;
 		context.authzid = conn->set.sasl_authz_id;
 
-		ret = ldap_sasl_interactive_bind_s(conn->ld, NULL, conn->set.sasl_mech,
+		ret = ldap_sasl_interactive_bind_s(conn->ld, NULL,
+						   conn->set.sasl_mech,
 						   NULL, NULL, LDAP_SASL_QUIET,
 						   sasl_interact, &context);
-		if (ret == LDAP_SERVER_DOWN) {
-			i_error("LDAP: Can't connect to server: %s", conn->set.hosts);
-			return FALSE;
-		}
-		if (ret != LDAP_SUCCESS) {
-			i_error("LDAP: ldap_sasl_interactive_bind_s() failed: %s",
-				ldap_get_error(conn));
-			return FALSE;
-		}
 	} else {
-		ret = ldap_simple_bind_s(conn->ld, conn->set.dn, conn->set.dnpass);
-		if (ret == LDAP_SERVER_DOWN) {
-			i_error("LDAP: Can't connect to server: %s", conn->set.hosts);
-			return FALSE;
-		}
-		if (ret != LDAP_SUCCESS) {
-			i_error("LDAP: ldap_simple_bind_s() failed (dn %s): %s",
-				conn->set.dn == NULL ? "(none)" : conn->set.dn,
-				ldap_get_error(conn));
-			return FALSE;
-		}
+		ret = ldap_simple_bind_s(conn->ld, conn->set.dn,
+					 conn->set.dnpass);
+	}
+	if (ret == LDAP_SERVER_DOWN) {
+		i_error("LDAP: Can't connect to server: %s",
+			conn->set.hosts);
+		return FALSE;
+	}
+	if (ret != LDAP_SUCCESS) {
+		i_error("LDAP: binding failed (dn %s): %s",
+			conn->set.dn == NULL ? "(none)" : conn->set.dn,
+			ldap_get_error(conn));
+		return FALSE;
 	}
 
 	conn->connected = TRUE;

Index: password-scheme.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/password-scheme.c,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -u -d -r1.21.2.1 -r1.21.2.2
--- password-scheme.c	16 Jun 2006 10:28:53 -0000	1.21.2.1
+++ password-scheme.c	17 Jun 2006 16:01:12 -0000	1.21.2.2
@@ -4,6 +4,7 @@
 #include "buffer.h"
 #include "base64.h"
 #include "hex-binary.h"
+#include "md4.h"
 #include "md5.h"
 #include "module-dir.h"
 #include "mycrypt.h"



More information about the dovecot-cvs mailing list