[dovecot-cvs] dovecot/src/auth db-ldap.c, 1.43, 1.44 password-scheme.c, 1.22, 1.23

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


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

Modified Files:
	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.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- db-ldap.c	8 Jun 2006 17:01:30 -0000	1.43
+++ db-ldap.c	17 Jun 2006 16:01:14 -0000	1.44
@@ -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.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- password-scheme.c	16 Jun 2006 10:28:53 -0000	1.22
+++ password-scheme.c	17 Jun 2006 16:01:14 -0000	1.23
@@ -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