dovecot-1.3: Don't crash if auth settings don't contain any sock...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 22 21:31:34 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/f8508e7aca6c
changeset: 9153:f8508e7aca6c
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 22 14:26:31 2009 -0400
description:
Don't crash if auth settings don't contain any sockets.

diffstat:

2 files changed, 11 insertions(+), 1 deletion(-)
src/auth/main.c              |    3 +++
src/master/master-settings.c |    9 ++++++++-

diffs (39 lines):

diff -r fa66e66850fa -r f8508e7aca6c src/auth/main.c
--- a/src/auth/main.c	Wed Apr 22 12:28:22 2009 -0400
+++ b/src/auth/main.c	Wed Apr 22 14:26:31 2009 -0400
@@ -167,6 +167,9 @@ static void add_extra_listeners(struct a
 	struct auth_socket_unix_settings *const *unix_sockets;
 	unsigned int i, count, count2;
 
+	if (!array_is_created(&auth->set->sockets))
+		return;
+
 	sockets = array_get(&auth->set->sockets, &count);
 	for (i = 0; i < count; i++) {
 		if (strcmp(sockets[i]->type, "listen") != 0)
diff -r fa66e66850fa -r f8508e7aca6c src/master/master-settings.c
--- a/src/master/master-settings.c	Wed Apr 22 12:28:22 2009 -0400
+++ b/src/master/master-settings.c	Wed Apr 22 14:26:31 2009 -0400
@@ -499,7 +499,12 @@ static bool auth_settings_verify(struct 
 		return FALSE;
 	}
 
-	sockets = array_get(&auth->sockets, &count);
+	if (array_is_created(&auth->sockets))
+		sockets = array_get(&auth->sockets, &count);
+	else {
+		sockets = NULL;
+		count = 0;
+	}
 	for (i = 0; i < count; i++) {
 		if (auth->count > 1 &&
 		    strcmp(sockets[i]->type, "listen") == 0) {
@@ -551,6 +556,8 @@ static bool settings_have_connect_socket
 
 	auths = array_get(&set->auths, &count);
 	for (i = 0; i < count; i++) {
+		if (!array_is_created(&auths[i]->sockets))
+			continue;
 		sockets = array_get(&auths[i]->sockets, &count2);
 		if (count2 > 0 && strcmp(sockets[0]->type, "connect") == 0)
 			return TRUE;


More information about the dovecot-cvs mailing list