Mercurial > dovecot > core-2.2
changeset 3639:35a6bc4876e4 HEAD
Don't crash if there are keys without =value part in static userdb template.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 05 Oct 2005 22:24:34 +0300 |
parents | 4e55969a6a93 |
children | e06617e148fc |
files | src/auth/userdb-static.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/userdb-static.c Wed Oct 05 22:16:32 2005 +0300 +++ b/src/auth/userdb-static.c Wed Oct 05 22:24:34 2005 +0300 @@ -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);