dovecot-1.1: Changed all config file readers to not ignore the l...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 19 16:30:43 EET 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/1d26ddce09e6
changeset: 8014:1d26ddce09e6
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 19 16:30:40 2008 +0200
description:
Changed all config file readers to not ignore the last line if it's missing LF.
diffstat:
5 files changed, 6 insertions(+), 14 deletions(-)
src/auth/db-passwd-file.c | 1 +
src/deliver/deliver.c | 1 +
src/lib-settings/settings.c | 16 ++--------------
src/plugins/acl/acl-backend-vfile.c | 1 +
src/plugins/trash/trash-plugin.c | 1 +
diffs (70 lines):
diff -r d94c516dfdd2 -r 1d26ddce09e6 src/auth/db-passwd-file.c
--- a/src/auth/db-passwd-file.c Wed Nov 19 16:28:22 2008 +0200
+++ b/src/auth/db-passwd-file.c Wed Nov 19 16:30:40 2008 +0200
@@ -183,6 +183,7 @@ static bool passwd_file_open(struct pass
str_hash, (hash_cmp_callback_t *)strcmp);
input = i_stream_create_fd(pw->fd, 4096, FALSE);
+ i_stream_set_return_partial_line(input, TRUE);
while ((line = i_stream_read_next_line(input)) != NULL) {
if (*line == '\0' || *line == ':' || *line == '#')
continue; /* no username or comment */
diff -r d94c516dfdd2 -r 1d26ddce09e6 src/deliver/deliver.c
--- a/src/deliver/deliver.c Wed Nov 19 16:28:22 2008 +0200
+++ b/src/deliver/deliver.c Wed Nov 19 16:30:40 2008 +0200
@@ -328,6 +328,7 @@ static void config_file_init(const char
i_fatal_status(EX_CONFIG, "open(%s) failed: %m", path);
input = i_stream_create_fd(fd, 1024, TRUE);
+ i_stream_set_return_partial_line(input, TRUE);
while ((line = i_stream_read_next_line(input)) != NULL) {
/* @UNSAFE: line is modified */
diff -r d94c516dfdd2 -r 1d26ddce09e6 src/lib-settings/settings.c
--- a/src/lib-settings/settings.c Wed Nov 19 16:28:22 2008 +0200
+++ b/src/lib-settings/settings.c Wed Nov 19 16:30:40 2008 +0200
@@ -93,20 +93,8 @@ settings_read_real(const char *path, con
full_line = t_str_new(512);
linenum = 0; sections = 0; root_section = 0; errormsg = NULL;
input = i_stream_create_fd(fd, 2048, TRUE);
- for (;;) {
- line = i_stream_read_next_line(input);
- if (line == NULL) {
- /* EOF. Also handle the last line even if it doesn't
- contain LF. */
- const unsigned char *data;
- size_t size;
-
- data = i_stream_get_data(input, &size);
- if (size == 0)
- break;
- line = t_strdup_noconst(t_strndup(data, size));
- i_stream_skip(input, size);
- }
+ i_stream_set_return_partial_line(input, TRUE);
+ while ((line = i_stream_read_next_line(input)) != NULL) {
linenum++;
/* @UNSAFE: line is modified */
diff -r d94c516dfdd2 -r 1d26ddce09e6 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c Wed Nov 19 16:28:22 2008 +0200
+++ b/src/plugins/acl/acl-backend-vfile.c Wed Nov 19 16:30:40 2008 +0200
@@ -459,6 +459,7 @@ acl_backend_vfile_read(struct acl_object
i_info("acl vfile: reading file %s", path);
input = i_stream_create_fd(fd, 4096, FALSE);
+ i_stream_set_return_partial_line(input, TRUE);
if (!array_is_created(&aclobj->rights)) {
aclobj->rights_pool =
diff -r d94c516dfdd2 -r 1d26ddce09e6 src/plugins/trash/trash-plugin.c
--- a/src/plugins/trash/trash-plugin.c Wed Nov 19 16:28:22 2008 +0200
+++ b/src/plugins/trash/trash-plugin.c Wed Nov 19 16:30:40 2008 +0200
@@ -253,6 +253,7 @@ static int read_configuration(const char
p_array_init(&trash_boxes, config_pool, INIT_TRASH_MAILBOX_COUNT);
input = i_stream_create_fd(fd, (size_t)-1, FALSE);
+ i_stream_set_return_partial_line(input, TRUE);
while ((line = i_stream_read_next_line(input)) != NULL) {
/* <priority> <mailbox name> */
name = strchr(line, ' ');
More information about the dovecot-cvs
mailing list