]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict sql: If pattern, table or value_field is unset, fail early with an error.
authorTimo Sirainen <tss@iki.fi>
Sun, 28 Jun 2009 02:16:40 +0000 (22:16 -0400)
committerTimo Sirainen <tss@iki.fi>
Sun, 28 Jun 2009 02:16:40 +0000 (22:16 -0400)
--HG--
branch : HEAD

src/lib-dict/dict-sql-settings.c

index 0afa36218936a748e30e7571f125c5dd2817d0ac..c9a16e68335144a130fb6dcd39c6ebb0157fffc3 100644 (file)
@@ -120,6 +120,18 @@ static const char *dict_sql_fields_map(struct setting_parser_ctx *ctx)
 
 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);