From e2ba2c102942d03ae7165cd20896fe5eb331b464 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 22 Apr 2009 14:26:31 -0400 Subject: [PATCH] Don't crash if auth settings don't contain any sockets. --HG-- branch : HEAD --- src/auth/main.c | 3 +++ src/master/master-settings.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/auth/main.c b/src/auth/main.c index 27c611e594..ddf263d0ff 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -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) diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 8ece3b4606..845c7732ba 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -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; -- 2.47.3