dovecot-2.2: auth: Fixed crash for some lookups that didn't spec...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 10 09:43:34 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/aff54366b1b6
changeset: 16592:aff54366b1b6
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 10 09:43:19 2013 +0300
description:
auth: Fixed crash for some lookups that didn't specify service name.

diffstat:

 src/auth/auth.c |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (30 lines):

diff -r 24d6708cea76 -r aff54366b1b6 src/auth/auth.c
--- a/src/auth/auth.c	Wed Jul 10 09:37:06 2013 +0300
+++ b/src/auth/auth.c	Wed Jul 10 09:43:19 2013 +0300
@@ -268,15 +268,17 @@
 	unsigned int i, count;
 
 	a = array_get(&auths, &count);
-	for (i = 1; i < count; i++) {
-		if (strcmp(a[i]->service, name) == 0)
-			return a[i];
-	}
-	/* not found. maybe we can instead find a !service */
-	for (i = 1; i < count; i++) {
-		if (a[i]->service[0] == '!' &&
-		    strcmp(a[i]->service + 1, name) != 0)
-			return a[i];
+	if (name != NULL) {
+		for (i = 1; i < count; i++) {
+			if (strcmp(a[i]->service, name) == 0)
+				return a[i];
+		}
+		/* not found. maybe we can instead find a !service */
+		for (i = 1; i < count; i++) {
+			if (a[i]->service[0] == '!' &&
+			    strcmp(a[i]->service + 1, name) != 0)
+				return a[i];
+		}
 	}
 	return a[0];
 }


More information about the dovecot-cvs mailing list