]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Check that key is not empty in passdb or userdb template
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 22 Nov 2017 08:49:49 +0000 (10:49 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 24 Nov 2017 06:54:09 +0000 (08:54 +0200)
Prevents nasty crash later on if template has 'key = value'

dovecot: auth: Panic: file auth-request.c: line 1746 (auth_request_set_field): assertion failed: (*name != '\0')

src/auth/passdb-template.c
src/auth/userdb-template.c

index a229af1fc7687710ac1d4753689f14376c3b632e..ade424a6a5edc3284ccc1decb8152e3f320a4b98 100644 (file)
@@ -27,6 +27,10 @@ struct passdb_template *passdb_template_build(pool_t pool, const char *args)
                else
                        key = t_strdup_until(*tmp, value++);
 
+               if (*key == '\0')
+                       i_fatal("Invalid passdb template %s - key must not be empty",
+                               args);
+
                key = p_strdup(pool, key);
                value = p_strdup(pool, value);
                array_append(&tmpl->args, &key, 1);
index 71f1dd741821d137e4f7e8a0cc55e5a94f10115e..1c1ce9c8ea33b478368d87da52aab455a385e9e4 100644 (file)
@@ -30,6 +30,11 @@ userdb_template_build(pool_t pool, const char *userdb_name, const char *args)
                else
                        key = t_strdup_until(*tmp, value++);
 
+
+               if (*key == '\0')
+                       i_fatal("Invalid userdb template %s - key must not be empty",
+                               args);
+
                nonull_value = value == NULL ? "" : value;
                if (strcasecmp(key, "uid") == 0) {
                        uid = userdb_parse_uid(NULL, nonull_value);