]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Empty lines and comments in dovecot-acl files weren't handled correctly.
authorTimo Sirainen <tss@iki.fi>
Wed, 9 Dec 2015 15:36:49 +0000 (17:36 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 9 Dec 2015 16:52:32 +0000 (18:52 +0200)
src/plugins/acl/acl-api.c
src/plugins/acl/acl-backend-vfile.c

index 280ca288055e2a20a662766b57befe406f0403ea..0122421944273f947b07ad5bced6e8f941677a05 100644 (file)
@@ -388,9 +388,6 @@ int acl_rights_parse_line(const char *line, pool_t pool,
 {
        const char *id_str, *const *right_names, *error = NULL;
 
-       if (*line == '\0' || *line == '#')
-               return 0;
-
        /* <id> [<imap acls>] [:<named acls>] */
        if (*line == '"') {
                line++;
index b8c4e128e1827ba87f918e2252de6399fc7032e0..5aae34f3db21ffb38690c5e980fa28b5c85c53a8 100644 (file)
@@ -366,8 +366,11 @@ acl_backend_vfile_read(struct acl_object *aclobj, bool global, const char *path,
 
        input = i_stream_create_fd(fd, (size_t)-1, FALSE);
        i_stream_set_return_partial_line(input, TRUE);
-       linenum = 1;
+       linenum = 0;
        while ((line = i_stream_read_next_line(input)) != NULL) {
+               linenum++;
+               if (line[0] == '\0' || line[0] == '#')
+                       continue;
                T_BEGIN {
                        ret = acl_rights_parse_line(line, aclobj->rights_pool,
                                                    &rights, &error);
@@ -381,7 +384,6 @@ acl_backend_vfile_read(struct acl_object *aclobj, bool global, const char *path,
                } T_END;
                if (ret < 0)
                        break;
-               linenum++;
        }
 
        if (ret < 0) {