Stupid me :-(
Try this new patch, remove previous patch befora applying this one.
Jean-Louis
Marc Muehlfeld wrote:
Hi Jean-Louis,
> It's a bug that can only be seen with the bsd auth.
> Attached patch fix it, can you try it?
thanks for the patch. I applied it to the client and server (both
3.2.0) and tried a restore a file without umlauts on the client:
...
Continue [?/Y/n]? y
amrecover: bad header
Extractor child exited with status 1
I attached all logfiles that were created for that try (2 from the
server, 1 from the client)
diff --git a/common-src/fileheader.c b/common-src/fileheader.c
index 32bce0d..5193837 100644
--- a/common-src/fileheader.c
+++ b/common-src/fileheader.c
@@ -132,7 +132,7 @@ parse_file_header(
tok = strtok_r(line1, " ", &saveptr);
if (tok == NULL) {
- g_debug("Empty amanda header: buflen=%zu lsize=%zu", buflen, lsize);
+ g_debug("Empty amanda header: buflen=%zu lsize=%zu buf='%s'", buflen, lsize, buf);
strange_header(file, buffer, buflen, _("<Non-empty line>"), tok);
goto out;
}
diff --git a/recover-src/extract_list.c b/recover-src/extract_list.c
index baac507..958686a 100644
--- a/recover-src/extract_list.c
+++ b/recover-src/extract_list.c
@@ -96,6 +96,9 @@ static char *dump_device_name = NULL;
static char *errstr;
static char *amidxtaped_line = NULL;
extern char *localhost;
+static char header_buf[32768];
+static int header_size = 0;
+
/* global pid storage for interrupt handler */
pid_t extract_restore_child_pid = -1;
@@ -2106,6 +2109,7 @@ writer_intermediary(
ctl_data.bsu = NULL;
ctl_data.bytes_read = 0;
+ header_size = 0;
security_stream_read(amidxtaped_streams[DATAFD].fd,
read_amidxtaped_data, &ctl_data);
@@ -2687,10 +2691,24 @@ read_amidxtaped_data(
GPtrArray *errarray;
g_option_t g_options;
data_path_t data_path_set = DATA_PATH_AMANDA;
+ int to_move;
+
+ to_move = MIN(32768-header_size, size);
+ memcpy(header_buf+header_size, buf, to_move);
+ header_size += to_move;
+ g_debug("read header %zd => %d", size, header_size);
+ if (header_size < 32768) {
+ security_stream_read(amidxtaped_streams[DATAFD].fd,
+ read_amidxtaped_data, cookie);
+ return;
+ } else if (header_size > 32768) {
+ error("header_size is %d\n", header_size);
+ }
+ assert (to_move == size);
/* parse the file header */
fh_init(&ctl_data->file);
- parse_file_header(buf, &ctl_data->file, (size_t)size);
+ parse_file_header(header_buf, &ctl_data->file, (size_t)header_size);
/* call backup_support_option */
g_options.config = get_config_name();