dovecot-1.2: dict sql: If pattern, table or value_field is unset...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jun 28 05:16:54 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/e67c9b3e88b0
changeset: 9175:e67c9b3e88b0
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jun 27 22:16:49 2009 -0400
description:
dict sql: If pattern, table or value_field is unset, fail early with an error.

diffstat:

1 file changed, 12 insertions(+)
src/lib-dict/dict-sql-settings.c |   12 ++++++++++++

diffs (22 lines):

diff -r eed86bcc33aa -r e67c9b3e88b0 src/lib-dict/dict-sql-settings.c
--- a/src/lib-dict/dict-sql-settings.c	Sat Jun 27 22:08:33 2009 -0400
+++ b/src/lib-dict/dict-sql-settings.c	Sat Jun 27 22:16:49 2009 -0400
@@ -120,6 +120,18 @@ static const char *dict_sql_fields_map(s
 
 static const char *dict_sql_map_finish(struct setting_parser_ctx *ctx)
 {
+	if (ctx->cur_map.pattern == NULL)
+		return "Missing setting: pattern";
+	if (ctx->cur_map.table == NULL)
+		return "Missing setting: table";
+	if (ctx->cur_map.value_field == NULL)
+		return "Missing setting: value_field";
+
+	if (ctx->cur_map.username_field == NULL) {
+		/* not all queries require this */
+		ctx->cur_map.username_field = "'username_field not set'";
+	}
+
 	if (!array_is_created(&ctx->cur_map.sql_fields)) {
 		/* no fields besides value. allocate the array anyway. */
 		p_array_init(&ctx->cur_map.sql_fields, ctx->pool, 1);


More information about the dovecot-cvs mailing list