]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't crash if auth settings don't contain any sockets.
authorTimo Sirainen <tss@iki.fi>
Wed, 22 Apr 2009 18:26:31 +0000 (14:26 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 22 Apr 2009 18:26:31 +0000 (14:26 -0400)
--HG--
branch : HEAD

src/auth/main.c
src/master/master-settings.c

index 27c611e59466bdb5c5de95f25ac629e8322d46f7..ddf263d0ffc0ec4db81ec6b15b910c24179c23f9 100644 (file)
@@ -167,6 +167,9 @@ static void add_extra_listeners(struct auth *auth)
        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)
index 8ece3b46069ee56abfa86d5dfaa8086f30dcbf07..845c7732bac62cdf86051c4a43cb7c2a1e6dac80 100644 (file)
@@ -499,7 +499,12 @@ static bool auth_settings_verify(struct master_settings *set,
                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_sockets(struct master_settings *set)
 
        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;