[dovecot-cvs] dovecot/src/auth userdb-static.c,1.15,1.16

cras at dovecot.org cras at dovecot.org
Wed Oct 5 22:24:37 EEST 2005


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv12748

Modified Files:
	userdb-static.c 
Log Message:
Don't crash if there are keys without =value part in static userdb template.



Index: userdb-static.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-static.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- userdb-static.c	14 Aug 2005 18:24:51 -0000	1.15
+++ userdb-static.c	5 Oct 2005 19:24:34 -0000	1.16
@@ -20,7 +20,7 @@
         const struct var_expand_table *table;
 	struct auth_stream_reply *reply;
 	string_t *str;
-	const char *const *args;
+	const char *const *args, *value;
 	unsigned int i, count;
 
 	t_push();
@@ -33,9 +33,14 @@
 	args = array_get(&static_template, &count);
 	i_assert((count % 2) == 0);
 	for (i = 0; i < count; i += 2) {
-		str_truncate(str, 0);
-		var_expand(str, args[i+1], table);
-		auth_stream_reply_add(reply, args[i], str_c(str));
+		if (args[i+1] == NULL)
+			value = NULL;
+		else {
+			str_truncate(str, 0);
+			var_expand(str, args[i+1], table);
+			value = str_c(str);
+		}
+		auth_stream_reply_add(reply, args[i], value);
 	}
 
 	callback(reply, auth_request);



More information about the dovecot-cvs mailing list