changeset 8441:6d5ca089bd1e HEAD

Don't crash if acl_dict setting is missing.
author Timo Sirainen <tss@iki.fi>
date Wed, 19 Nov 2008 16:41:47 +0200
parents a3feb99907af
children 944a13d1fe83
files src/plugins/acl/acl-lookup-dict.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-lookup-dict.c	Wed Nov 19 16:34:19 2008 +0200
+++ b/src/plugins/acl/acl-lookup-dict.c	Wed Nov 19 16:41:47 2008 +0200
@@ -220,6 +220,9 @@
 	unsigned int i, dest, count;
 	int ret = 0;
 
+	if (acl_dict == NULL)
+		return 0;
+
 	/* get all ACL identifiers with a positive lookup right */
 	t_array_init(&ids_arr, 128);
 	for (ns = dict->user->namespaces; ns != NULL; ns = ns->next) {
@@ -292,7 +295,8 @@
 
 	/* iterate through all identifiers that match us, start with the
 	   first one */
-	acl_lookup_dict_iterate_start(iter);
+	if (acl_dict != NULL)
+		acl_lookup_dict_iterate_start(iter);
 	return iter;
 }
 
@@ -302,6 +306,9 @@
 	const char *key, *value;
 	int ret;
 
+	if (iter->dict_iter == NULL)
+		return 0;
+
 	ret = dict_iterate(iter->dict_iter, &key, &value);
 	if (ret > 0) {
 		i_assert(iter->prefix_len < strlen(key));