Mercurial > dovecot > core-2.2
changeset 9153:f8508e7aca6c HEAD
Don't crash if auth settings don't contain any sockets.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 22 Apr 2009 14:26:31 -0400 |
parents | fa66e66850fa |
children | 213c2f313bc1 |
files | src/auth/main.c src/master/master-settings.c |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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)
--- 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 @@ 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 @@ 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;