*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,6 +41,7 @@
** 09.08.2006 H.Kiehl Created
** 02.12.2009 H.Kiehl Added support for NOAA type HTML file listing.
** 15.03.2011 H.Kiehl Added HTML list type listing.
+ ** 10.09.2017 H.Kiehl Added support for nginx HTML listing.
**
*/
DESCR__E_M3
@@ -68,10 +69,10 @@
#include "fddefs.h"
-#define STORE_HTML_STRING(html_str, str_len, max_str_length) \
+#define STORE_HTML_STRING(html_str, str_len, max_str_length, end_char)\
{ \
str_len = 0; \
- while ((*ptr != '<') && (*ptr != '\n') && (*ptr != '\r') &&\
+ while ((*ptr != end_char) && (*ptr != '\n') && (*ptr != '\r') &&\
(*ptr != '\0') && (str_len < ((max_str_length) - 1)))\
{ \
if (*ptr == '&') \
@@ -86,6 +87,14 @@
break; \
case 'A': (html_str)[str_len++] = 196; \
break; \
+ case 'e': (html_str)[str_len++] = 235; \
+ break; \
+ case 'E': (html_str)[str_len++] = 203; \
+ break; \
+ case 'i': (html_str)[str_len++] = 239; \
+ break; \
+ case 'I': (html_str)[str_len++] = 207; \
+ break; \
case 'o': (html_str)[str_len++] = 246; \
break; \
case 'O': (html_str)[str_len++] = 214; \
@@ -96,25 +105,65 @@
break; \
case 's': (html_str)[str_len++] = 223; \
break; \
+ case 'y': (html_str)[str_len++] = 255; \
+ break; \
+ case 'Y': (html_str)[str_len++] = 195; \
+ break; \
default : /* Just ignore it. */ \
break; \
} \
ptr += 5; \
continue; \
} \
- else \
- { \
- while ((*ptr != ';') && (*ptr != '<') && \
- (*ptr != '\n') && (*ptr != '\r') && \
- (*ptr != '\0')) \
- { \
- ptr++; \
- } \
- if (*ptr != ';') \
- { \
- break; \
- } \
- } \
+ else if ((*ptr == 's') && (*(ptr + 1) == 'z') && \
+ (*(ptr + 2) == 'l') && (*(ptr + 3) == 'i') &&\
+ (*(ptr + 4) == 'g') && (*(ptr + 5) == ';'))\
+ { \
+ (html_str)[str_len++] = 223; \
+ ptr += 6; \
+ continue; \
+ } \
+ else if ((*ptr == 'a') && (*(ptr + 1) == 'm') && \
+ (*(ptr + 2) == 'p') && (*(ptr + 3) == ';'))\
+ { \
+ (html_str)[str_len++] = 38; \
+ ptr += 4; \
+ continue; \
+ } \
+ else if ((*ptr == 'd') && (*(ptr + 1) == 'e') && \
+ (*(ptr + 2) == 'g') && (*(ptr + 3) == ';'))\
+ { \
+ (html_str)[str_len++] = 176; \
+ ptr += 4; \
+ continue; \
+ } \
+ else if ((*ptr == 'g') && (*(ptr + 1) == 't') && \
+ (*(ptr + 2) == ';')) \
+ { \
+ (html_str)[str_len++] = '>'; \
+ ptr += 3; \
+ continue; \
+ } \
+ else if ((*ptr == 'l') && (*(ptr + 1) == 't') && \
+ (*(ptr + 2) == ';')) \
+ { \
+ (html_str)[str_len++] = '<'; \
+ ptr += 3; \
+ continue; \
+ } \
+ else \
+ { \
+ while ((*ptr != ';') && (*ptr != '<') && \
+ (*ptr != '\n') && (*ptr != '\r') &&\
+ (*ptr != '\0')) \
+ { \
+ ptr++; \
+ } \
+ if (*ptr != ';') \
+ { \
+ break; \
+ } \
+ } \
} \
(html_str)[str_len] = *ptr; \
str_len++; ptr++; \
@@ -936,7 +985,7 @@
{
/* Store file name. */
STORE_HTML_STRING(file_name, file_name_length,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
if (*ptr == '<')
{
@@ -997,7 +1046,7 @@
/* Store size string. */
STORE_HTML_STRING(size_str, str_len,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
exact_size = convert_size(size_str,
&file_size);
}
@@ -1076,11 +1125,19 @@
{
ptr++;
}
+ while ((*ptr == ' ') || (*ptr == '\t'))
+ {
+ ptr++;
+ }
if (*ptr == '<')
{
/* Table type listing. */
- if ((*(ptr + 1) == 't') && (*(ptr + 6) == '>'))
+ if ((*(ptr + 1) == 't') && (*(ptr + 2) == 'a') &&
+ (*(ptr + 3) == 'b') && (*(ptr + 4) == 'l') &&
+ (*(ptr + 5) == 'e') && (*(ptr + 6) == '>'))
{
+ ptr += 7;
+
/* Ignore the two heading lines. */
while ((*ptr != '\n') && (*ptr != '\r') && (*ptr != '\0'))
{
@@ -1098,6 +1155,31 @@
{
ptr++;
}
+ if ((*ptr == ' ') && (*(ptr + 1) == ' ') &&
+ (*(ptr + 2) == ' ') && (*(ptr + 3) == '<') &&
+ (*(ptr + 4) == 't') && (*(ptr + 5) == 'r') &&
+ (*(ptr + 6) == '>'))
+ {
+ ptr += 7;
+
+ /* Ignore the two heading lines. */
+ while ((*ptr != '\n') && (*ptr != '\r') && (*ptr != '\0'))
+ {
+ ptr++;
+ }
+ while ((*ptr == '\n') || (*ptr == '\r'))
+ {
+ ptr++;
+ }
+ while ((*ptr != '\n') && (*ptr != '\r') && (*ptr != '\0'))
+ {
+ ptr++;
+ }
+ while ((*ptr == '\n') || (*ptr == '\r'))
+ {
+ ptr++;
+ }
+ }
if ((*ptr == '<') && (*(ptr + 1) == 't') &&
(*(ptr + 2) == 'r') && (*(ptr + 3) == '>') &&
@@ -1133,7 +1215,7 @@
{
/* Store file name. */
STORE_HTML_STRING(file_name, file_name_length,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
while (*ptr == '<')
{
@@ -1160,7 +1242,7 @@
/* Store date string. */
STORE_HTML_STRING(date_str, str_len,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
file_mtime = datestr2unixtime(date_str);
while (*ptr == '<')
@@ -1181,7 +1263,7 @@
{
/* Store size string. */
STORE_HTML_STRING(size_str, str_len,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
exact_size = convert_size(size_str,
&file_size);
}
@@ -1244,27 +1326,47 @@
}
}
/* Pre type listing. */
- else if ((*(ptr + 1) == 'p') && (*(ptr + 4) == '>'))
+ else if (((*(ptr + 1) == 'p') && (*(ptr + 4) == '>')) || /* */
+ ((*(ptr + 1) == 'a') && (*(ptr + 2) == ' ') && /* '))
{
- ptr++;
+ /* Ignore heading line. */
+ while ((*ptr != '\n') && (*ptr != '\r') &&
+ (*ptr != '\0'))
+ {
+ ptr++;
+ }
+ while ((*ptr == '\n') || (*ptr == '\r'))
+ {
+ ptr++;
+ }
}
while (*ptr == '<')
{
+ file_name[0] = '\0';
+ file_name_length = 0;
while (*ptr == '<')
{
ptr++;
- while ((*ptr != '>') && (*ptr != '\n') &&
- (*ptr != '\r') && (*ptr != '\0'))
+ if ((*ptr == 'a') && (*(ptr + 1) == ' ') &&
+ (*(ptr + 2) == 'h') && (*(ptr + 3) == 'r') &&
+ (*(ptr + 4) == 'e') && (*(ptr + 5) == 'f') &&
+ (*(ptr + 6) == '=') && (*(ptr + 7) == '"'))
{
- ptr++;
+ ptr += 8;
+ STORE_HTML_STRING(file_name, file_name_length,
+ MAX_FILENAME_LENGTH, '"');
+ }
+ else
+ {
+ while ((*ptr != '>') && (*ptr != '\n') &&
+ (*ptr != '\r') && (*ptr != '\0'))
+ {
+ ptr++;
+ }
}
if (*ptr == '>')
{
@@ -1278,9 +1380,21 @@
if ((*ptr != '\n') && (*ptr != '\r') && (*ptr != '\0'))
{
- /* Store file name. */
- STORE_HTML_STRING(file_name, file_name_length,
- MAX_FILENAME_LENGTH);
+ if (file_name[0] == '\0')
+ {
+ /* Store file name. */
+ STORE_HTML_STRING(file_name, file_name_length,
+ MAX_FILENAME_LENGTH, '<');
+ }
+ else
+ {
+ /* Away with the shown, maybe cut off filename. */
+ while ((*ptr != '<') && (*ptr != '\n') &&
+ (*ptr != '\r') && (*ptr != '\0'))
+ {
+ ptr++;
+ }
+ }
if (*ptr == '<')
{
@@ -1341,7 +1455,7 @@
/* Store size string. */
STORE_HTML_STRING(size_str, str_len,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
exact_size = convert_size(size_str,
&file_size);
}
@@ -1431,7 +1545,7 @@
{
/* Store file name. */
STORE_HTML_STRING(file_name, file_name_length,
- MAX_FILENAME_LENGTH);
+ MAX_FILENAME_LENGTH, '<');
if (check_name(file_name, file_name_length,
-1, -1) == YES)
diff -u --recursive afd-1.4.7-10/src/fd/gf_ftp.c afd-1.4.7-11/src/fd/gf_ftp.c
--- afd-1.4.7-10/src/fd/gf_ftp.c 2015-10-21 16:07:26.000000000 +0200
+++ afd-1.4.7-11/src/fd/gf_ftp.c 2018-12-10 15:54:44.541950761 +0100
@@ -165,7 +165,7 @@
unsigned int ftp_options,
loop_counter;
#ifdef _WITH_BURST_2
- int cb2_ret,
+ int cb2_ret = NO,
in_burst_loop = NO,
disconnect = NO;
unsigned int values_changed = 0;
@@ -177,7 +177,7 @@
clock_t clktck;
time_t connected,
end_transfer_time_file,
- start_transfer_time_file;
+ start_transfer_time_file = 0;
#ifdef SA_FULLDUMP
struct sigaction sact;
#endif
diff -u --recursive afd-1.4.7-10/src/fd/gf_http.c afd-1.4.7-11/src/fd/gf_http.c
--- afd-1.4.7-10/src/fd/gf_http.c 2015-09-29 16:40:13.000000000 +0200
+++ afd-1.4.7-11/src/fd/gf_http.c 2018-12-10 15:55:36.898594784 +0100
@@ -167,7 +167,7 @@
status;
unsigned int loop_counter;
#ifdef _WITH_BURST_2
- int cb2_ret;
+ int cb2_ret = NO;
unsigned int values_changed = 0;
#endif
off_t bytes_done,
@@ -178,13 +178,13 @@
clock_t clktck;
time_t connected,
end_transfer_time_file,
- start_transfer_time_file;
- char *buffer,
+ start_transfer_time_file = 0;
+ char *buffer = NULL,
*chunkbuffer = NULL,
local_file[MAX_PATH_LENGTH],
local_tmp_file[MAX_PATH_LENGTH],
- *p_local_file,
- *p_local_tmp_file;
+ *p_local_file = NULL,
+ *p_local_tmp_file = NULL;
struct stat stat_buf;
#ifdef SA_FULLDUMP
struct sigaction sact;
diff -u --recursive afd-1.4.7-10/src/fd/gf_sftp.c afd-1.4.7-11/src/fd/gf_sftp.c
--- afd-1.4.7-10/src/fd/gf_sftp.c 2015-09-29 16:42:51.000000000 +0200
+++ afd-1.4.7-11/src/fd/gf_sftp.c 2018-12-10 22:07:10.000000000 +0100
@@ -161,7 +161,7 @@
unsigned int loop_counter;
mode_t dir_mode = 0;
#ifdef _WITH_BURST_2
- int cb2_ret;
+ int cb2_ret = NO;
unsigned int values_changed = 0;
#endif
char *created_path = NULL;
@@ -170,7 +170,7 @@
clock_t clktck;
time_t connected,
end_transfer_time_file,
- start_transfer_time_file;
+ start_transfer_time_file = 0;
#ifdef SA_FULLDUMP
struct sigaction sact;
#endif
@@ -573,6 +573,7 @@
if ((rl[i].retrieved == NO) &&
(rl[i].assigned == ((unsigned char)db.job_no + 1)))
{
+ int prev_download_exists = NO;
off_t offset;
if (rl[i].file_name[0] != '.')
@@ -592,6 +593,7 @@
else
{
offset = stat_buf.st_size;
+ prev_download_exists = YES;
}
}
else
@@ -620,6 +622,8 @@
}
else /* status == SUCCESS */
{
+ int current_max_pending_reads;
+
if (fsa->debug > NORMAL_MODE)
{
trans_db_log(INFO_SIGN, __FILE__, __LINE__, NULL,
@@ -627,7 +631,7 @@
rl[i].file_name, fra[db.fra_pos].dir_alias);
}
- if (offset > 0)
+ if (prev_download_exists == YES)
{
#ifdef O_LARGEFILE
fd = open(local_tmp_file, O_WRONLY | O_APPEND | O_LARGEFILE);
@@ -677,8 +681,44 @@
(void)strcpy(fsa->job_status[(int)db.job_no].file_name_in_use,
rl[i].file_name);
}
+ else if (db.fsa_pos == INCORRECT)
+ {
+ /*
+ * Looks as if this host is no longer in our
+ * database. Lets exit.
+ */
+ trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Database changed, exiting.");
+ (void)sftp_close_file();
+ (void)sftp_quit();
+ (void)close(fd);
+ if (prev_download_exists != YES)
+ {
+ (void)unlink(local_tmp_file);
+ }
+ reset_values(files_retrieved, file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ exit(TRANSFER_SUCCESS);
+ }
- bytes_done = 0;
+ if ((current_max_pending_reads = sftp_multi_read_init(blocksize - buffer_offset,
+ rl[i].size - offset)) == INCORRECT)
+ {
+ reset_values(files_retrieved, file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ (void)sftp_close_file();
+ sftp_quit();
+ (void)close(fd);
+ if (prev_download_exists != YES)
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(ALLOC_ERROR);
+ }
if (fsa->trl_per_process > 0)
{
init_limit_transfer_rate();
@@ -688,73 +728,283 @@
start_transfer_time_file = time(NULL);
}
- do
+ bytes_done = 0;
+ status = 0;
+ if (current_max_pending_reads > 0)
{
- if ((status = sftp_read(buffer,
- blocksize - buffer_offset)) == INCORRECT)
+ do
{
- trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
- "Failed to read from remote file `%s' in %s",
- rl[i].file_name, fra[db.fra_pos].dir_alias);
- reset_values(files_retrieved, file_size_retrieved,
- files_to_retrieve, file_size_to_retrieve,
- (struct job *)&db);
- sftp_quit();
- exit(eval_timeout(READ_REMOTE_ERROR));
- }
+ if (sftp_multi_read_dispatch() == INCORRECT)
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Failed to dispatch reads from remote file `%s' in %s",
+ rl[i].file_name, fra[db.fra_pos].dir_alias);
+ reset_values(files_retrieved, file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ sftp_multi_read_discard(NO);
+ (void)sftp_close_file();
+ sftp_quit();
+ (void)close(fd);
+ if ((bytes_done == 0) &&
+ (prev_download_exists != YES))
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(eval_timeout(READ_REMOTE_ERROR));
+ }
- if (fsa->trl_per_process > 0)
- {
- limit_transfer_rate(status, fsa->trl_per_process, clktck);
- }
- if (status > 0)
- {
- if (write(fd, buffer, status) != status)
+ if ((status = sftp_multi_read_catch(buffer)) == INCORRECT)
{
trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
- "Failed to write() to file `%s' : %s",
- local_tmp_file, strerror(errno));
+ "Failed to read from remote file `%s' in %s",
+ rl[i].file_name, fra[db.fra_pos].dir_alias);
+ reset_values(files_retrieved, file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ sftp_multi_read_discard(NO);
+ (void)sftp_close_file();
sftp_quit();
+ (void)close(fd);
+ if ((bytes_done == 0) &&
+ (prev_download_exists != YES))
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(eval_timeout(READ_REMOTE_ERROR));
+ }
+ else if (status == SFTP_DO_SINGLE_READS)
+ {
+ sftp_multi_read_discard(NO);
+ break;
+ }
+ else if (status == SFTP_EOF)
+ {
+ status = 0;
+ }
+
+ if (fsa->trl_per_process > 0)
+ {
+ limit_transfer_rate(status, fsa->trl_per_process,
+ clktck);
+ }
+ if (status > 0)
+ {
+ if (write(fd, buffer, status) != status)
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Failed to write() to file `%s' : %s",
+ local_tmp_file, strerror(errno));
+ reset_values(files_retrieved,
+ file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ sftp_multi_read_discard(NO);
+ (void)sftp_close_file();
+ sftp_quit();
+ (void)close(fd);
+ if ((bytes_done == 0) &&
+ (prev_download_exists != YES))
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(WRITE_LOCAL_ERROR);
+ }
+ bytes_done += status;
+
+ if (gsf_check_fsa((struct job *)&db) != NEITHER)
+ {
+ fsa->job_status[(int)db.job_no].file_size_in_use_done = bytes_done;
+ fsa->job_status[(int)db.job_no].file_size_done += status;
+ fsa->job_status[(int)db.job_no].bytes_send += status;
+ if (fsa->protocol_options & TIMEOUT_TRANSFER)
+ {
+ end_transfer_time_file = time(NULL);
+ if (end_transfer_time_file < start_transfer_time_file)
+ {
+ start_transfer_time_file = end_transfer_time_file;
+ }
+ else
+ {
+ if ((end_transfer_time_file - start_transfer_time_file) > transfer_timeout)
+ {
+ trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
+#if SIZEOF_TIME_T == 4
+ "Transfer timeout reached for `%s' in %s after %ld seconds.",
+#else
+ "Transfer timeout reached for `%s' in %s after %lld seconds.",
+#endif
+ fsa->job_status[(int)db.job_no].file_name_in_use,
+ fra[db.fra_pos].dir_alias,
+ (pri_time_t)(end_transfer_time_file - start_transfer_time_file));
+ sftp_multi_read_discard(NO);
+ (void)sftp_close_file();
+ sftp_quit();
+ (void)close(fd);
+ if ((bytes_done == 0) &&
+ (prev_download_exists != YES))
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(STILL_FILES_TO_SEND);
+ }
+ }
+ }
+ }
+ else if (db.fsa_pos == INCORRECT)
+ {
+ /*
+ * Looks as if this host is no longer in our
+ * database. Lets exit.
+ */
+ trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Database changed, exiting.");
+ reset_values(files_retrieved,
+ file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ sftp_multi_read_discard(NO);
+ (void)sftp_close_file();
+ (void)sftp_quit();
+ (void)close(fd);
+ if ((bytes_done == 0) &&
+ (prev_download_exists != YES))
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(TRANSFER_SUCCESS);
+ }
+ } /* if (status > 0) */
+ } while ((status > 0) &&
+ (sftp_multi_read_eof() == NO));
+
+ /* Check if we must discard some unknown reads */
+ /* in the queue. */
+ sftp_multi_read_discard(YES);
+ } /* if (current_max_pending_reads > 0) */
+
+ if ((bytes_done != rl[i].size) &&
+ (status != (blocksize - buffer_offset)))
+ {
+ int tmp_status;
+
+ do
+ {
+ if ((status = sftp_read(buffer,
+ blocksize - buffer_offset)) == INCORRECT)
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Failed to read from remote file `%s' in %s",
+ rl[i].file_name, fra[db.fra_pos].dir_alias);
reset_values(files_retrieved, file_size_retrieved,
files_to_retrieve, file_size_to_retrieve,
(struct job *)&db);
- exit(eval_timeout(WRITE_LOCAL_ERROR));
+ sftp_quit();
+ if (bytes_done == 0)
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(eval_timeout(READ_REMOTE_ERROR));
}
- bytes_done += status;
- }
+ else if (status == SFTP_EOF)
+ {
+ status = 0;
+ }
- if (gsf_check_fsa((struct job *)&db) != NEITHER)
- {
- fsa->job_status[(int)db.job_no].file_size_in_use_done = bytes_done;
- fsa->job_status[(int)db.job_no].file_size_done += status;
- fsa->job_status[(int)db.job_no].bytes_send += status;
- if (fsa->protocol_options & TIMEOUT_TRANSFER)
+ if (fsa->trl_per_process > 0)
{
- end_transfer_time_file = time(NULL);
- if (end_transfer_time_file < start_transfer_time_file)
+ limit_transfer_rate(status, fsa->trl_per_process, clktck);
+ }
+ if (status > 0)
+ {
+ if (write(fd, buffer, status) != status)
{
- start_transfer_time_file = end_transfer_time_file;
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Failed to write() to file `%s' : %s",
+ local_tmp_file, strerror(errno));
+ sftp_quit();
+ reset_values(files_retrieved, file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ if (bytes_done == 0)
+ {
+ (void)unlink(local_tmp_file);
+ }
+ exit(WRITE_LOCAL_ERROR);
}
- else
+ bytes_done += status;
+ tmp_status = status;
+
+ /* See if we can save a read, ie. no need to */
+ /* catch an EOF. */
+ if ((bytes_done == rl[i].size) &&
+ (status < (blocksize - buffer_offset)))
{
- if ((end_transfer_time_file - start_transfer_time_file) > transfer_timeout)
+ status = 0;
+ }
+ }
+ else
+ {
+ tmp_status = 0;
+ }
+
+ if (gsf_check_fsa((struct job *)&db) != NEITHER)
+ {
+ fsa->job_status[(int)db.job_no].file_size_in_use_done = bytes_done;
+ fsa->job_status[(int)db.job_no].file_size_done += tmp_status;
+ fsa->job_status[(int)db.job_no].bytes_send += tmp_status;
+ if (fsa->protocol_options & TIMEOUT_TRANSFER)
+ {
+ end_transfer_time_file = time(NULL);
+ if (end_transfer_time_file < start_transfer_time_file)
+ {
+ start_transfer_time_file = end_transfer_time_file;
+ }
+ else
{
- trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
+ if ((end_transfer_time_file - start_transfer_time_file) > transfer_timeout)
+ {
+ trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
#if SIZEOF_TIME_T == 4
- "Transfer timeout reached for `%s' in %s after %ld seconds.",
+ "Transfer timeout reached for `%s' in %s after %ld seconds.",
#else
- "Transfer timeout reached for `%s' in %s after %lld seconds.",
+ "Transfer timeout reached for `%s' in %s after %lld seconds.",
#endif
- fsa->job_status[(int)db.job_no].file_name_in_use,
- fra[db.fra_pos].dir_alias,
- (pri_time_t)(end_transfer_time_file - start_transfer_time_file));
- sftp_quit();
- exit(STILL_FILES_TO_SEND);
+ fsa->job_status[(int)db.job_no].file_name_in_use,
+ fra[db.fra_pos].dir_alias,
+ (pri_time_t)(end_transfer_time_file - start_transfer_time_file));
+ sftp_quit();
+ exit(STILL_FILES_TO_SEND);
+ }
}
}
}
- }
- } while (status != 0);
+ else if (db.fsa_pos == INCORRECT)
+ {
+ /*
+ * Looks as if this host is no longer in our
+ * database. Lets exit.
+ */
+ trans_log(INFO_SIGN, __FILE__, __LINE__, NULL, NULL,
+ "Database changed, exiting.");
+ (void)sftp_close_file();
+ (void)sftp_quit();
+ (void)close(fd);
+ (void)unlink(local_tmp_file);
+ reset_values(files_retrieved,
+ file_size_retrieved,
+ files_to_retrieve,
+ file_size_to_retrieve,
+ (struct job *)&db);
+ exit(TRANSFER_SUCCESS);
+ }
+ } while (status != 0);
+ }
/* Close remote file. */
if ((status = sftp_close_file()) != SUCCESS)
@@ -835,6 +1085,19 @@
"Closed local file `%s'.", local_tmp_file);
}
}
+#ifdef WITH_ERROR_QUEUE
+ if (fsa->host_status & ERROR_QUEUE_SET)
+ {
+ remove_from_error_queue(db.id.dir, fsa, db.fsa_pos,
+ fsa_fd);
+ }
+#endif
+
+ if (fsa->host_status & HOST_ACTION_SUCCESS)
+ {
+ error_action(fsa->host_alias, "start",
+ HOST_SUCCESS_ACTION);
+ }
/* Check if remote file is to be deleted. */
if (fra[db.fra_pos].remove == YES)
@@ -910,8 +1173,8 @@
fsa->total_file_size += (bytes_done + offset - rl[i].size);
rl[i].size = bytes_done + offset;
}
- fsa->total_file_size -= rl[i].size;
- file_size_to_retrieve_shown -= rl[i].size;
+ fsa->total_file_size -= (rl[i].size - offset);
+ file_size_to_retrieve_shown -= (rl[i].size - offset);
#ifdef _VERIFY_FSA
if (fsa->total_file_size < 0)
{
@@ -1197,7 +1460,7 @@
ol_file_name[*ol_file_name_length] = SEPARATOR_CHAR;
ol_file_name[*ol_file_name_length + 1] = '\0';
(*ol_file_name_length)++;
- *ol_file_size = rl[i].size;
+ *ol_file_size = bytes_done;
*ol_job_number = db.id.dir;
*ol_retries = db.retries;
*ol_unl = 0;
@@ -1216,20 +1479,6 @@
file_size_retrieved += bytes_done;
}
-#ifdef WITH_ERROR_QUEUE
- if (fsa->host_status & ERROR_QUEUE_SET)
- {
- remove_from_error_queue(db.id.dir, fsa, db.fsa_pos,
- fsa_fd);
- }
-#endif
-
- if (fsa->host_status & HOST_ACTION_SUCCESS)
- {
- error_action(fsa->host_alias, "start",
- HOST_SUCCESS_ACTION);
- }
-
if (db.fra_pos == INCORRECT)
{
/* We must stop here if fra_pos is INCORRECT */
diff -u --recursive afd-1.4.7-10/src/fd/handle_delete_fifo.c afd-1.4.7-11/src/fd/handle_delete_fifo.c
--- afd-1.4.7-10/src/fd/handle_delete_fifo.c 2014-11-13 12:36:45.000000000 +0100
+++ afd-1.4.7-11/src/fd/handle_delete_fifo.c 2018-12-10 13:12:09.724252740 +0100
@@ -562,6 +562,8 @@
lock_region_w(fsa_fd, lock_offset + LOCK_EC);
# endif
fsa[mdb[qb[i].pos].fsa_pos].error_counter = 0;
+ fsa[mdb[qb[i].pos].fsa_pos].error_history[0] = 0;
+ fsa[mdb[qb[i].pos].fsa_pos].error_history[1] = 0;
# ifdef LOCK_DEBUG
unlock_region(fsa_fd, lock_offset + LOCK_EC, __FILE__, __LINE__);
# else
diff -u --recursive afd-1.4.7-10/src/fd/init_gf.c afd-1.4.7-11/src/fd/init_gf.c
--- afd-1.4.7-10/src/fd/init_gf.c 2014-11-15 14:31:04.000000000 +0100
+++ afd-1.4.7-11/src/fd/init_gf.c 2018-12-09 21:32:46.000000000 +0100
@@ -1,6 +1,6 @@
/*
* init_gf.c - Part of AFD, an automatic file distribution program.
- * Copyright (c) 2000 - 2014 Holger Kiehl
+ * Copyright (c) 2000 - 2015 Holger Kiehl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -397,6 +397,7 @@
fsa->job_status[(int)db.job_no].file_size_done = 0;
fsa->job_status[(int)db.job_no].connect_status = CONNECTING;
fsa->job_status[(int)db.job_no].job_id = db.id.dir;
+ fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2;
#ifdef LOCK_DEBUG
unlock_region(fsa_fd, db.lock_offset, __FILE__, __LINE__);
#else
diff -u --recursive afd-1.4.7-10/src/fd/init_msg_buffer.c afd-1.4.7-11/src/fd/init_msg_buffer.c
--- afd-1.4.7-10/src/fd/init_msg_buffer.c 2015-09-09 11:25:49.000000000 +0200
+++ afd-1.4.7-11/src/fd/init_msg_buffer.c 2018-12-10 14:06:10.943092129 +0100
@@ -279,7 +279,7 @@
* get the time to fill all data into the JID structure.
*/
sleep_counter = 0;
- while ((p_afd_status->amg_jobs & WRITTING_JID_STRUCT) == 1)
+ while (p_afd_status->amg_jobs & WRITTING_JID_STRUCT)
{
(void)my_usleep(100000L);
sleep_counter++;
diff -u --recursive afd-1.4.7-10/src/fd/init_sf.c afd-1.4.7-11/src/fd/init_sf.c
--- afd-1.4.7-10/src/fd/init_sf.c 2014-11-15 14:30:28.000000000 +0100
+++ afd-1.4.7-11/src/fd/init_sf.c 2018-12-09 21:32:46.000000000 +0100
@@ -482,6 +482,7 @@
fsa->job_status[(int)db.job_no].file_size_done = 0;
fsa->job_status[(int)db.job_no].connect_status = CONNECTING;
fsa->job_status[(int)db.job_no].job_id = db.id.job;
+ fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2;
#ifdef LOCK_DEBUG
unlock_region(fsa_fd, db.lock_offset, __FILE__, __LINE__);
#else
diff -u --recursive afd-1.4.7-10/src/fd/Makefile.am afd-1.4.7-11/src/fd/Makefile.am
--- afd-1.4.7-10/src/fd/Makefile.am 2015-07-01 15:25:05.000000000 +0200
+++ afd-1.4.7-11/src/fd/Makefile.am 2018-12-10 10:41:28.946327163 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2015 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -489,3 +489,6 @@
gf_http_trace_SOURCES = $(gf_http_SOURCES) trace_log.c
gf_http_trace_LDADD = @EXTRA_SOCKET_LIBS@ ../protocols/libtraceprotocols.a\
../common/libafd.a @AFD_SSL_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/fd/read_current_msg_list.c afd-1.4.7-11/src/fd/read_current_msg_list.c
--- afd-1.4.7-10/src/fd/read_current_msg_list.c 2008-02-21 15:18:08.000000000 +0100
+++ afd-1.4.7-11/src/fd/read_current_msg_list.c 2018-12-10 14:06:46.513209938 +0100
@@ -138,7 +138,7 @@
* get the time to fill all data into the current_msg_list_file.
*/
sleep_counter = 0;
- while ((p_afd_status->amg_jobs & WRITTING_JID_STRUCT) == 1)
+ while (p_afd_status->amg_jobs & WRITTING_JID_STRUCT)
{
(void)my_usleep(100000L);
sleep_counter++;
diff -u --recursive afd-1.4.7-10/src/fd/remove_connection.c afd-1.4.7-11/src/fd/remove_connection.c
--- afd-1.4.7-10/src/fd/remove_connection.c 2014-10-18 15:03:50.000000000 +0200
+++ afd-1.4.7-11/src/fd/remove_connection.c 2018-12-09 21:32:46.000000000 +0100
@@ -1,6 +1,6 @@
/*
* remove_connection.c - Part of AFD, an automatic file distribution program.
- * Copyright (c) 2001 - 2014 Holger Kiehl
+ * Copyright (c) 2001 - 2015 Holger Kiehl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -244,6 +244,7 @@
* Reset all values of connection structure.
*/
p_con->hostname[0] = '\0';
+ p_con->dir_alias[0] = '\0';
p_con->host_id = 0;
p_con->job_no = -1;
p_con->fsa_pos = -1;
diff -u --recursive afd-1.4.7-10/src/fd/sf_ftp.c afd-1.4.7-11/src/fd/sf_ftp.c
--- afd-1.4.7-10/src/fd/sf_ftp.c 2015-09-29 16:17:37.000000000 +0200
+++ afd-1.4.7-11/src/fd/sf_ftp.c 2018-12-10 15:46:28.992390223 +0100
@@ -225,12 +225,12 @@
clock_t clktck;
time_t connected,
end_transfer_time_file,
- start_transfer_time_file,
+ start_transfer_time_file = 0,
last_update_time,
now,
*p_file_mtime_buffer;
#ifdef _WITH_BURST_2
- int cb2_ret,
+ int cb2_ret = NO,
disconnect = NO,
reconnected = NO;
unsigned int values_changed = 0;
@@ -241,20 +241,20 @@
struct tms tmsdummy;
#endif
#ifdef FTP_CTRL_KEEP_ALIVE_INTERVAL
- time_t keep_alive_time;
+ time_t keep_alive_time = 0;
#endif
char *ptr,
*ascii_buffer = NULL,
*p_file_name_buffer,
append_count = 0,
- *buffer,
+ *buffer = NULL,
*created_path = NULL,
final_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
initial_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
remote_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
fullname[MAX_PATH_LENGTH],
- *p_final_filename,
- *p_remote_filename,
+ *p_final_filename = NULL,
+ *p_remote_filename = NULL,
*p_fullname,
file_path[MAX_PATH_LENGTH];
struct job *p_db;
@@ -535,8 +535,8 @@
{
if ((disconnect == YES) ||
((burst_2_counter > 0) &&
- ((status == 331) || (status == 500) || (status == 503) ||
- (status == 530))))
+ ((status == 331) || (status == 500) || (status == 501) ||
+ (status == 503) || (status == 530))))
{
/*
* Aaargghh..., we need to logout again! The server is
@@ -626,7 +626,14 @@
* Since we did a new connect we must set the transfer type
* again. Or else we will transfer files in ASCII mode.
*/
- values_changed |= TYPE_CHANGED;
+ if ((fsa->protocol_options & FTP_FAST_CD) == 0)
+ {
+ values_changed |= (TYPE_CHANGED | TARGET_DIR_CHANGED);
+ }
+ else
+ {
+ values_changed |= TYPE_CHANGED;
+ }
disconnect = YES;
reconnected = YES;
}
@@ -846,7 +853,8 @@
* directory is not the absolute path.
*/
if ((burst_2_counter > 0) && (db.target_dir[0] != '/') &&
- ((fsa->protocol_options & FTP_FAST_CD) == 0) && (reconnected == NO))
+ ((fsa->protocol_options & FTP_FAST_CD) == 0) &&
+ (reconnected == NO))
{
if ((status = ftp_cd("", NO, "", NULL)) != SUCCESS)
{
diff -u --recursive afd-1.4.7-10/src/fd/sf_sftp.c afd-1.4.7-11/src/fd/sf_sftp.c
--- afd-1.4.7-10/src/fd/sf_sftp.c 2015-09-29 16:29:34.000000000 +0200
+++ afd-1.4.7-11/src/fd/sf_sftp.c 2018-12-10 15:48:27.495111278 +0100
@@ -200,12 +200,12 @@
clock_t clktck;
time_t connected,
end_transfer_time_file,
- start_transfer_time_file,
+ start_transfer_time_file = 0,
now,
last_update_time,
*p_file_mtime_buffer;
#ifdef _WITH_BURST_2
- int cb2_ret;
+ int cb2_ret = NO;
unsigned int values_changed = 0;
#endif
#ifdef _OUTPUT_LOG
@@ -216,14 +216,14 @@
char *ptr,
*p_file_name_buffer,
append_count = 0,
- *buffer,
+ *buffer = NULL,
*created_path = NULL,
final_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
initial_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
remote_filename[MAX_RECIPIENT_LENGTH + MAX_FILENAME_LENGTH],
fullname[MAX_PATH_LENGTH],
- *p_final_filename,
- *p_remote_filename,
+ *p_final_filename = NULL,
+ *p_remote_filename = NULL,
*p_fullname,
file_path[MAX_PATH_LENGTH];
struct job *p_db;
diff -u --recursive afd-1.4.7-10/src/fd/trans_log.c afd-1.4.7-11/src/fd/trans_log.c
--- afd-1.4.7-10/src/fd/trans_log.c 2014-11-23 17:50:42.000000000 +0100
+++ afd-1.4.7-11/src/fd/trans_log.c 2018-12-10 11:20:33.231830792 +0100
@@ -45,6 +45,7 @@
** 08.07.2000 H.Kiehl Revised to reduce code size in sf_xxx().
** 21.03.2009 H.Kiehl Added function parameter.
** 10.08.2012 H.Kiehl Added some more length checking.
+ ** 17.08.2018 H.Kiehl Do not show empty lines.
**
*/
DESCR__E_M3
@@ -244,6 +245,10 @@
{
*end_ptr = '\0';
end_ptr++;
+ while ((*end_ptr == '\n') || (*end_ptr == '\r'))
+ {
+ end_ptr++;
+ }
}
length += snprintf(&buf[length],
(MAX_LINE_LENGTH + MAX_LINE_LENGTH) - length,
diff -u --recursive afd-1.4.7-10/src/init_afd/Makefile.am afd-1.4.7-11/src/init_afd/Makefile.am
--- afd-1.4.7-10/src/init_afd/Makefile.am 2013-09-11 08:37:33.000000000 +0200
+++ afd-1.4.7-11/src/init_afd/Makefile.am 2018-12-10 10:41:28.946327163 +0100
@@ -49,3 +49,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/log/alda/Makefile.am afd-1.4.7-11/src/log/alda/Makefile.am
--- afd-1.4.7-10/src/log/alda/Makefile.am 2014-03-23 11:58:13.000000000 +0100
+++ afd-1.4.7-11/src/log/alda/Makefile.am 2018-12-10 10:41:28.947327194 +0100
@@ -104,3 +104,6 @@
aldad_LDADD = ../../common/libafd.a
check_alda_cache_SOURCES = check_alda_cache.c
check_alda_cache_LDADD = ../../common/libafd.a
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/log/Makefile.am afd-1.4.7-11/src/log/Makefile.am
--- afd-1.4.7-10/src/log/Makefile.am 2014-11-02 08:45:38.000000000 +0100
+++ afd-1.4.7-11/src/log/Makefile.am 2018-12-10 10:47:32.165687715 +0100
@@ -132,3 +132,6 @@
production_log_SOURCES = production_log.c\
open_log_file.c
production_log_LDADD = ../common/libafd.a
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/misc/Makefile.am afd-1.4.7-11/src/misc/Makefile.am
--- afd-1.4.7-10/src/misc/Makefile.am 2013-07-22 16:17:11.000000000 +0200
+++ afd-1.4.7-11/src/misc/Makefile.am 2018-12-10 10:48:58.042378430 +0100
@@ -44,3 +44,6 @@
EXTRA_PROGRAMS = create_eumetsat_name todos
create_eumetsat_name_SOURCES = create_eumetsat_name.c
todos_SOURCES = todos.c
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/protocols/common.c afd-1.4.7-11/src/protocols/common.c
--- afd-1.4.7-10/src/protocols/common.c 2014-10-13 09:35:38.000000000 +0200
+++ afd-1.4.7-11/src/protocols/common.c 2018-12-10 14:03:32.437111018 +0100
@@ -41,6 +41,7 @@
** 10.03.2004 H.Kiehl Created
** 26.06.2005 H.Kiehl Don't show password during a trace.
** 27.02.2013 H.Kiehl Added function connect_with_timeout().
+ ** 03.11.2018 H.Kiehl Implemented ServerNameIndication for TLS.
*/
DESCR__E_M3
@@ -202,7 +203,7 @@
#ifdef WITH_SSL
/*############################ ssl_connect() ############################*/
int
-ssl_connect(int sock_fd, char *func_name)
+ssl_connect(int sock_fd, char *hostname, char *func_name)
{
int reply;
char *p_env,
@@ -243,6 +244,15 @@
ssl_con = (SSL *)SSL_new(ssl_ctx);
SSL_set_connect_state(ssl_con);
SSL_set_fd(ssl_con, sock_fd);
+ if (!SSL_set_tlsext_host_name(ssl_con, hostname))
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_ssl_auth", NULL,
+ _("SSL_set_tlsext_host_name() failed to enable ServerNameIndication for %s"),
+ hostname);
+ (void)close(sock_fd);
+ sock_fd = -1;
+ return(INCORRECT);
+ }
/*
* NOTE: Because we have set SSL_MODE_AUTO_RETRY, a SSL_read() can
@@ -309,7 +319,7 @@
}
else
{
- char *ssl_version;
+ const char *ssl_version;
int length,
ssl_bits;
const SSL_CIPHER *ssl_cipher;
diff -u --recursive afd-1.4.7-10/src/protocols/commondefs.h afd-1.4.7-11/src/protocols/commondefs.h
--- afd-1.4.7-10/src/protocols/commondefs.h 2014-10-10 17:56:14.000000000 +0200
+++ afd-1.4.7-11/src/protocols/commondefs.h 2018-12-10 11:06:41.690750960 +0100
@@ -31,7 +31,7 @@
extern int command(int, char *, ...),
connect_with_timeout(int, const struct sockaddr *, socklen_t);
#ifdef WITH_SSL
-extern int ssl_connect(int, char *);
+extern int ssl_connect(int, char *, char *);
extern ssize_t ssl_write(SSL *, const char *, size_t);
extern char *ssl_error_msg(char *, SSL *, int *, int, char *);
#endif
diff -u --recursive afd-1.4.7-10/src/protocols/ftpcmd.c afd-1.4.7-11/src/protocols/ftpcmd.c
--- afd-1.4.7-10/src/protocols/ftpcmd.c 2015-09-25 11:14:16.000000000 +0200
+++ afd-1.4.7-11/src/protocols/ftpcmd.c 2018-12-10 22:41:28.000000000 +0100
@@ -208,6 +208,7 @@
** support IPv6.
** 06.02.2014 H.Kiehl Added CCC comand to end encryption.
** 10.09.2014 H.Kiehl Added simulation mode.
+ ** 03.11.2018 H.Kiehl Implemented ServerNameIndication for TLS.
*/
DESCR__E_M3
@@ -294,6 +295,7 @@
#ifdef WITH_SSL
static SSL *ssl_data = NULL;
static SSL_CTX *ssl_ctx = NULL;
+static char connected_hostname[MAX_REAL_HOSTNAME_LENGTH];
#endif
static sigjmp_buf env_alrm;
static struct sockaddr_in ctrl,
@@ -360,7 +362,7 @@
#if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
char str_port[MAX_INT_LENGTH];
struct addrinfo hints,
- *result,
+ *result = NULL,
*rp;
(void)memset((struct addrinfo *) &hints, 0, sizeof(struct addrinfo));
@@ -385,6 +387,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
ip_str, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -396,6 +399,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
hostname, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
# ifdef WITH_IP_DB
}
@@ -473,6 +477,7 @@
(void)close(control_fd);
trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_connect", NULL,
_("Failed to connect() to %s"), hostname);
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -493,6 +498,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_connect", NULL,
_("Failed to connect() to %s"), hostname);
}
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -505,6 +511,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_connect", NULL,
_("malloc() error : %s"), strerror(errno));
(void)close(control_fd);
+ freeaddrinfo(result);
return(INCORRECT);
}
(void)memcpy(ai_addr, rp->ai_addr, rp->ai_addrlen);
@@ -762,6 +769,9 @@
return(reply);
}
}
+#ifdef WITH_SSL
+ (void)memcpy(connected_hostname, hostname, MAX_REAL_HOSTNAME_LENGTH);
+#endif
return(SUCCESS);
}
@@ -819,6 +829,15 @@
ssl_con = (SSL *)SSL_new(ssl_ctx);
SSL_set_connect_state(ssl_con);
SSL_set_fd(ssl_con, control_fd);
+ if (!SSL_set_tlsext_host_name(ssl_con, connected_hostname))
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "ftp_ssl_auth", NULL,
+ _("SSL_set_tlsext_host_name() failed to enable ServerNameIndication for %s"),
+ connected_hostname);
+ (void)close(control_fd);
+ control_fd = -1;
+ return(INCORRECT);
+ }
if ((reply = SSL_connect(ssl_con)) <= 0)
{
@@ -859,7 +878,7 @@
}
else
{
- char *ssl_version;
+ const char *ssl_version;
int length,
ssl_bits;
const SSL_CIPHER *ssl_cipher;
@@ -3284,37 +3303,37 @@
if ((reply != 150) && (reply != 125))
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
else
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
else
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
else
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
else
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
else
{
(void)close(new_sock_fd);
- return(reply);
+ return(-reply);
}
}
}
@@ -3813,7 +3832,8 @@
return(1);
}
- else if (((reply == 550) || (reply == 553)) && (create_dir == YES))
+ else if (((reply == 550) || (reply == 553)) && (create_dir == YES) &&
+ (*retries < MAX_DATA_CONNECT_RETRIES))
{
char *ptr,
to_dir[MAX_PATH_LENGTH];
@@ -3923,7 +3943,7 @@
}
else
{
- char *ssl_version;
+ const char *ssl_version;
int length,
ssl_bits;
const SSL_CIPHER *ssl_cipher;
diff -u --recursive afd-1.4.7-10/src/protocols/httpcmd.c afd-1.4.7-11/src/protocols/httpcmd.c
--- afd-1.4.7-10/src/protocols/httpcmd.c 2015-11-20 21:09:51.000000000 +0100
+++ afd-1.4.7-11/src/protocols/httpcmd.c 2018-12-10 22:40:30.000000000 +0100
@@ -63,6 +63,7 @@
** 12.08.2012 H.Kiehl Use getaddrinfo() instead of gethostname() to
** support IPv6.
** 11.09.2014 H.Kiehl Added simulation mode.
+ ** 03.11.2018 H.Kiehl Implemented ServerNameIndication for TLS.
*/
DESCR__E_M3
@@ -230,7 +231,7 @@
int reply;
char str_port[MAX_INT_LENGTH];
struct addrinfo hints,
- *result,
+ *result = NULL,
*rp;
if (http_proxy[0] == '\0')
@@ -263,6 +264,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "http_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
ip_str, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -274,6 +276,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "http_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
p_hostname, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
# ifdef WITH_IP_DB
}
@@ -380,6 +383,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "http_connect", NULL,
_("Failed to connect() to %s at port %d"),
hostname, port);
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -403,6 +407,7 @@
}
(void)close(http_fd);
http_fd = -1;
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -735,6 +740,15 @@
ssl_con = (SSL *)SSL_new(ssl_ctx);
SSL_set_connect_state(ssl_con);
SSL_set_fd(ssl_con, http_fd);
+ if (!SSL_set_tlsext_host_name(ssl_con, hostname))
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "http_connect", NULL,
+ _("SSL_set_tlsext_host_name() failed to enable ServerNameIndication for %s"),
+ hostname);
+ (void)close(http_fd);
+ http_fd = -1;
+ return(INCORRECT);
+ }
/*
* NOTE: Because we have set SSL_MODE_AUTO_RETRY, a SSL_read() can
@@ -808,7 +822,7 @@
}
else
{
- char *ssl_version;
+ const char *ssl_version;
int length,
ssl_bits;
const SSL_CIPHER *ssl_cipher;
@@ -2717,16 +2731,39 @@
}
else
{
- if ((hmr.bytes_read = SSL_read(ssl_con,
- &msg_str[bytes_buffered],
- (MAX_RET_MSG_LENGTH - bytes_buffered))) < 1)
+ int tmp_errno;
+
+ /*
+ * Remember we have set SSL_MODE_AUTO_RETRY. This
+ * means the SSL lib may do several read() calls. We
+ * just assured one read() with select(). So lets
+ * set an an alarm since we might block on subsequent
+ * calls to read(). It might be better when we
+ * reimplement this without SSL_MODE_AUTO_RETRY
+ * and handle SSL_ERROR_WANT_READ ourself.
+ */
+ if (sigsetjmp(env_alrm, 1) != 0)
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
+ _("SSL_read() timeout (%ld)"),
+ transfer_timeout);
+ timeout_flag = ON;
+ return(INCORRECT);
+ }
+ (void)alarm(transfer_timeout);
+ hmr.bytes_read = SSL_read(ssl_con,
+ &msg_str[bytes_buffered],
+ (MAX_RET_MSG_LENGTH - bytes_buffered));
+ tmp_errno = errno;
+ (void)alarm(0);
+ if (hmr.bytes_read < 1)
{
if (hmr.bytes_read == 0)
{
-#ifdef WITH_TRACE
+# ifdef WITH_TRACE
trace_log(__FILE__, __LINE__, R_TRACE, NULL, 0,
"read_msg(): 0 bytes read");
-#endif
+# endif
return(0);
}
else
@@ -2734,13 +2771,13 @@
if ((status = SSL_get_error(ssl_con,
hmr.bytes_read)) == SSL_ERROR_SYSCALL)
{
- if (errno == ECONNRESET)
+ if (tmp_errno == ECONNRESET)
{
timeout_flag = CON_RESET;
}
trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
_("SSL_read() error (after reading %d bytes) : %s"),
- bytes_buffered, strerror(errno));
+ bytes_buffered, strerror(tmp_errno));
}
else
{
diff -u --recursive afd-1.4.7-10/src/protocols/Makefile.am afd-1.4.7-11/src/protocols/Makefile.am
--- afd-1.4.7-10/src/protocols/Makefile.am 2014-05-26 19:45:37.000000000 +0200
+++ afd-1.4.7-11/src/protocols/Makefile.am 2018-12-10 10:41:28.948327225 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2014 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -79,3 +79,6 @@
$(WMOCMD)
libtraceprotocols_a_SOURCES = $(libprotocols_a_SOURCES)
libtraceprotocols_a_CFLAGS = -DWITH_TRACE
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/protocols/sftpcmd.c afd-1.4.7-11/src/protocols/sftpcmd.c
--- afd-1.4.7-10/src/protocols/sftpcmd.c 2015-08-19 16:35:30.000000000 +0200
+++ afd-1.4.7-11/src/protocols/sftpcmd.c 2018-12-10 13:37:47.258567267 +0100
@@ -1,6 +1,6 @@
/*
* sftpcmd.c - Part of AFD, an automatic file distribution program.
- * Copyright (c) 2005 - 2015 Holger Kiehl
+ * Copyright (c) 2005 - 2016 Holger Kiehl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -86,6 +86,8 @@
** 07.03.2013 H.Kiehl Added function sftp_chmod().
** 11.09.2014 H.Kiehl Added simulation mode.
** 16.04.2015 H.Kiehl Added function sftp_nocd().
+ ** 23.04.2018 H.Kiehl Show better error message when remote server just
+ ** closes connection.
**
*/
DESCR__E_M3
@@ -1723,11 +1725,11 @@
{
if (msg[0] == SSH_FXP_STATUS)
{
- if (get_xfer_uint(&msg[5]) != SSH_FX_OK)
+ if (get_xfer_uint(&msg[5]) == SSH_FX_OK)
{
/* Some error has occured. */
get_msg_str(&msg[9]);
- trans_log(DEBUG_SIGN, __FILE__, __LINE__, "sftp_write", NULL,
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "sftp_write", NULL,
"%s", error_2_str(&msg[5]));
status = INCORRECT;
}
@@ -1814,7 +1816,11 @@
}
else if (msg[0] == SSH_FXP_STATUS)
{
- if (get_xfer_uint(&msg[5]) != SSH_FX_EOF)
+ if (get_xfer_uint(&msg[5]) == SSH_FX_EOF)
+ {
+ status = SFTP_EOF;
+ }
+ else
{
/* Some error has occured. */
get_msg_str(&msg[9]);
@@ -1842,6 +1848,404 @@
}
+/*####################### sftp_multi_read_init() ########################*/
+int
+sftp_multi_read_init(int blocksize, off_t expected_size)
+{
+ scd.reads_todo = expected_size / blocksize;
+ if ((expected_size % blocksize) != 0)
+ {
+ scd.reads_todo++;
+ }
+ scd.reads_done = 0;
+ scd.reads_queued = 0;
+ scd.reads_low_water_mark = 0;
+ scd.pending_id_read_pos = 0;
+ scd.pending_id_end_pos = 0;
+ scd.blocksize = blocksize;
+ if (scd.reads_todo > MAX_PENDING_READS)
+ {
+ scd.max_pending_reads = MAX_PENDING_READS;
+ }
+ else
+ {
+ scd.max_pending_reads = scd.reads_todo;
+ }
+ if (scd.max_pending_reads > 1)
+ {
+ scd.current_max_pending_reads = SFTP_READ_STEP_SIZE;
+ }
+ else
+ {
+ scd.current_max_pending_reads = 0;
+ }
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ int length;
+
+ length = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+# if SIZEOF_OFF_T == 4
+ _("sftp_multi_read_init() max_pending_reads=%d current_max_pending_reads=%d expected_size=%ld bytes blocksize=%d reads_todo=%u"),
+# else
+ _("sftp_multi_read_init() max_pending_reads=%d current_max_pending_reads=%d expected_size=%lld bytes blocksize=%d reads_todo=%u"),
+# endif
+ scd.max_pending_reads, scd.current_max_pending_reads,
+ (pri_off_t)expected_size, blocksize, scd.reads_todo);
+ trace_log(NULL, 0, C_TRACE, msg_str, length, NULL);
+ }
+#endif
+
+ return(scd.current_max_pending_reads);
+}
+
+
+/*##################### sftp_multi_read_dispatch() ######################*/
+int
+sftp_multi_read_dispatch(void)
+{
+ int status = SUCCESS,
+ todo = scd.reads_todo - (scd.reads_done + scd.reads_queued);
+
+ if ((todo > scd.reads_queued) &&
+ (scd.reads_queued <= scd.reads_low_water_mark) &&
+ (scd.reads_queued < scd.current_max_pending_reads))
+ {
+ int i,
+ rest;
+
+ if (todo > (scd.current_max_pending_reads - scd.reads_queued))
+ {
+ todo = scd.current_max_pending_reads - scd.reads_queued;
+ }
+
+ if ((scd.pending_id_end_pos + todo) > MAX_PENDING_READS)
+ {
+ rest = (scd.pending_id_end_pos + todo) - MAX_PENDING_READS;
+ todo = MAX_PENDING_READS;
+ }
+ else
+ {
+ todo = scd.pending_id_end_pos + todo;
+ rest = 0;
+ }
+ for (i = scd.pending_id_end_pos; i < todo; i++)
+ {
+ /*
+ * byte SSH_FXP_READ
+ * uint32 request_id
+ * string handle
+ * uint64 offset
+ * uint32 length
+ */
+ msg[4] = SSH_FXP_READ;
+ scd.request_id++;
+ set_xfer_uint(&msg[4 + 1], scd.request_id);
+ set_xfer_str(&msg[4 + 1 + 4], scd.file_handle, scd.file_handle_length);
+ set_xfer_uint64(&msg[4 + 1 + 4 + 4 + scd.file_handle_length],
+ scd.file_offset);
+ set_xfer_uint(&msg[4 + 1 + 4 + 4 + scd.file_handle_length + 8],
+ scd.blocksize);
+ set_xfer_uint(msg, (1 + 4 + 4 + scd.file_handle_length + 8 + 4)); /* Write message length at start. */
+ if ((status = write_msg(msg, (4 + 1 + 4 + 4 + scd.file_handle_length +
+ 8 + 4), __LINE__)) == SUCCESS)
+ {
+ scd.pending_read_id[i] = scd.request_id;
+ scd.file_offset += scd.blocksize;
+ scd.reads_queued++;
+ scd.pending_id_end_pos++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ if (rest > 0)
+ {
+ scd.pending_id_end_pos = 0;
+ for (i = 0; i < rest; i++)
+ {
+ /*
+ * byte SSH_FXP_READ
+ * uint32 request_id
+ * string handle
+ * uint64 offset
+ * uint32 length
+ */
+ msg[4] = SSH_FXP_READ;
+ scd.request_id++;
+ set_xfer_uint(&msg[4 + 1], scd.request_id);
+ set_xfer_str(&msg[4 + 1 + 4], scd.file_handle, scd.file_handle_length);
+ set_xfer_uint64(&msg[4 + 1 + 4 + 4 + scd.file_handle_length],
+ scd.file_offset);
+ set_xfer_uint(&msg[4 + 1 + 4 + 4 + scd.file_handle_length + 8],
+ scd.blocksize);
+ set_xfer_uint(msg, (1 + 4 + 4 + scd.file_handle_length + 8 + 4)); /* Write message length at start. */
+ if ((status = write_msg(msg, (4 + 1 + 4 + 4 + scd.file_handle_length +
+ 8 + 4), __LINE__)) == SUCCESS)
+ {
+ scd.pending_read_id[i] = scd.request_id;
+ scd.file_offset += scd.blocksize;
+ scd.reads_queued++;
+ scd.pending_id_end_pos++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ if (status == SUCCESS)
+ {
+ status = scd.reads_queued;
+ }
+
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ i = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+ _("sftp_multi_read_dispatch() reads_queued=%d pending_id_read_pos=%d pending_id_end_pos=%d reads_low_water_mark=%d (todo=%d rest=%d)"),
+ scd.reads_queued, scd.pending_id_read_pos,
+ scd.pending_id_end_pos, scd.reads_low_water_mark,
+ todo, rest);
+ trace_log(NULL, 0, C_TRACE, msg_str, i, NULL);
+ }
+#endif
+ }
+
+ return(status);
+}
+
+
+/*####################### sftp_multi_read_catch() #######################*/
+int
+sftp_multi_read_catch(char *buffer)
+{
+ int status;
+
+ if ((status = get_reply(scd.pending_read_id[scd.pending_id_read_pos],
+ __LINE__)) == SUCCESS)
+ {
+ if (msg[0] == SSH_FXP_DATA)
+ {
+ unsigned int ui_var;
+
+ if (*(char *)&byte_order == 1)
+ {
+ /* little-endian */
+ ((char *)&ui_var)[3] = msg[5];
+ ((char *)&ui_var)[2] = msg[6];
+ ((char *)&ui_var)[1] = msg[7];
+ ((char *)&ui_var)[0] = msg[8];
+ }
+ else
+ {
+ /* big-endian */
+ ((char *)&ui_var)[0] = msg[5];
+ ((char *)&ui_var)[1] = msg[6];
+ ((char *)&ui_var)[2] = msg[7];
+ ((char *)&ui_var)[3] = msg[8];
+ }
+ if ((ui_var > scd.blocksize) ||
+ ((ui_var < scd.blocksize) &&
+ (scd.reads_todo != (scd.reads_done + 1))))
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "sftp_multi_read_catch", NULL,
+ _("Expecting %d bytes, but received %u bytes. (reads_todo=%d reads_done=%d)"),
+ scd.blocksize, ui_var, scd.reads_todo, scd.reads_done);
+ scd.file_offset -= scd.blocksize;
+ status = SFTP_DO_SINGLE_READS;
+ }
+ else
+ {
+ (void)memcpy(buffer, &msg[9], ui_var);
+ status = ui_var;
+ if ((scd.reads_todo != (scd.reads_done + 1)) &&
+ (scd.reads_queued == (scd.current_max_pending_reads - 1)))
+ {
+ if (scd.current_max_pending_reads < MAX_PENDING_READS)
+ {
+ scd.current_max_pending_reads += SFTP_READ_STEP_SIZE;
+ if (scd.current_max_pending_reads > MAX_PENDING_READS)
+ {
+ scd.current_max_pending_reads = MAX_PENDING_READS;
+ }
+ scd.reads_low_water_mark = scd.current_max_pending_reads / 2;
+ }
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ int length;
+
+ length = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+ _("sftp_multi_read_catch() current_max_pending_reads=%d pending_id_read_pos=%d reads_low_water_mark=%d"),
+ scd.current_max_pending_reads,
+ scd.pending_id_read_pos,
+ scd.reads_low_water_mark);
+ trace_log(NULL, 0, C_TRACE, msg_str, length, NULL);
+ }
+#endif
+ }
+ }
+ }
+ else if (msg[0] == SSH_FXP_STATUS)
+ {
+ if (get_xfer_uint(&msg[5]) != SSH_FX_EOF)
+ {
+ status = SFTP_EOF;
+ }
+ else
+ {
+ /* Some error has occured. */
+ get_msg_str(&msg[9]);
+ trans_log(DEBUG_SIGN, __FILE__, __LINE__, "sftp_multi_read_catch", NULL,
+ "%s", error_2_str(&msg[5]));
+ status = INCORRECT;
+ }
+ }
+ else
+ {
+ trans_log(ERROR_SIGN, __FILE__, __LINE__, "sftp_multi_read_catch", NULL,
+ _("Expecting %d (SSH_FXP_DATA) but got %d (%s) as reply."),
+ SSH_FXP_DATA, (int)msg[0], response_2_str(msg[0]));
+ msg_str[0] = '\0';
+ status = INCORRECT;
+ }
+
+ scd.pending_id_read_pos++;
+ if (scd.pending_id_read_pos >= MAX_PENDING_READS)
+ {
+ scd.pending_id_read_pos = 0;
+ }
+ scd.reads_queued--;
+ scd.reads_done++;
+ }
+ else if (status == SIMULATION)
+ {
+ status = SUCCESS;
+ scd.pending_id_read_pos++;
+ if (scd.pending_id_read_pos >= MAX_PENDING_READS)
+ {
+ scd.pending_id_read_pos = 0;
+ }
+ scd.reads_queued--;
+ scd.reads_done++;
+ }
+
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ int length;
+
+ length = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+ _("sftp_multi_read_catch() reads_done=%u reads_todo=%u left=%d pending_id_read_pos=%d"),
+ scd.reads_done, scd.reads_todo,
+ (scd.reads_todo - scd.reads_done),
+ scd.pending_id_read_pos);
+ trace_log(NULL, 0, C_TRACE, msg_str, length, NULL);
+ }
+#endif
+
+ return(status);
+}
+
+
+/*######################### sftp_multi_read_eof() ##########################*/
+int
+sftp_multi_read_eof(void)
+{
+ if (scd.reads_todo > scd.reads_done)
+ {
+ return(NO);
+ }
+ else
+ {
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ int length;
+
+ length = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+ _("sftp_multi_read_eof() reads_done=%u reads_todo=%u left=%d pending_id_read_pos=%d"),
+ scd.reads_done, scd.reads_todo,
+ (scd.reads_todo - scd.reads_done),
+ scd.pending_id_read_pos);
+ trace_log(NULL, 0, C_TRACE, msg_str, length, NULL);
+ }
+#endif
+ return(YES);
+ }
+}
+
+
+/*####################### sftp_multi_read_discard() ########################*/
+void
+sftp_multi_read_discard(int report_pending_reads)
+{
+ if (scd.reads_queued != 0)
+ {
+ int i,
+ rest,
+ status = SUCCESS,
+ todo;
+
+ if (report_pending_reads == YES)
+ {
+ trans_log(DEBUG_SIGN, __FILE__, __LINE__, "sftp_multi_read_discard", NULL,
+ "Pending read counter is still %d!?",
+ scd.reads_queued);
+ }
+
+ if ((scd.pending_id_read_pos + scd.reads_queued) >= MAX_PENDING_READS)
+ {
+ todo = MAX_PENDING_READS;
+ rest = scd.reads_queued - (MAX_PENDING_READS - scd.pending_id_read_pos);
+ }
+ else
+ {
+ todo = scd.pending_id_read_pos + scd.reads_queued;
+ rest = 0;
+ }
+#ifdef WITH_TRACE
+ if ((scd.debug == TRACE_MODE) || (scd.debug == FULL_TRACE_MODE))
+ {
+ int length;
+
+ length = snprintf(msg_str, MAX_RET_MSG_LENGTH,
+ _("sftp_multi_read_discard() discarding %d reads (todo=%d rest=%d)"),
+ scd.reads_queued, todo, rest);
+ trace_log(NULL, 0, C_TRACE, msg_str, length, NULL);
+ }
+#endif
+
+ /* Read all pending requests and ignore the data. */
+ for (i = scd.pending_id_read_pos; i < todo; i++)
+ {
+ if (status == SUCCESS)
+ {
+ status = get_reply(scd.pending_read_id[i], __LINE__);
+ }
+ scd.file_offset -= scd.blocksize;
+ }
+ if (rest > 0)
+ {
+ for (i = 0; i < rest; i++)
+ {
+ if (status == SUCCESS)
+ {
+ status = get_reply(scd.pending_read_id[i], __LINE__);
+ }
+ scd.file_offset -= scd.blocksize;
+ }
+ }
+ scd.reads_queued = 0;
+ }
+
+ return;
+}
+
+
/*############################ sftp_readdir() ###########################*/
int
sftp_readdir(char *name, struct stat *p_stat_buf)
@@ -2691,6 +3095,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
_("Failed to set signal handler [%d] : %s"),
line, strerror(errno));
+ msg_str[0] = '\0';
return(INCORRECT);
}
if (sigsetjmp(env_alrm, 1) != 0)
@@ -2713,12 +3118,14 @@
}
trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
_("read() error [%d] : %s"), line, strerror(tmp_errno));
+ msg_str[0] = '\0';
return(INCORRECT);
}
else if (bytes_read == 0)
{
trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
_("Pipe has been closed! [%d]"), line);
+ (void)strcpy(msg_str, "Connection closed");
return(INCORRECT);
}
else
@@ -2777,6 +3184,7 @@
{
trans_log(ERROR_SIGN, __FILE__, __LINE__, "read_msg", NULL,
_("select() error [%d] : %s"), line, strerror(errno));
+ msg_str[0] = '\0';
return(INCORRECT);
}
} while (total_read < blocksize);
diff -u --recursive afd-1.4.7-10/src/protocols/sftpdefs.h afd-1.4.7-11/src/protocols/sftpdefs.h
--- afd-1.4.7-10/src/protocols/sftpdefs.h 2015-04-21 12:04:45.000000000 +0200
+++ afd-1.4.7-11/src/protocols/sftpdefs.h 2018-12-10 13:34:37.627621396 +0100
@@ -1,6 +1,6 @@
/*
* sftpdefs.h - Part of AFD, an automatic file distribution program.
- * Copyright (c) 2005 - 2015 Holger Kiehl
+ * Copyright (c) 2005 - 2017 Holger Kiehl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,13 +20,17 @@
#ifndef __sftpdefs_h
#define __sftpdefs_h
-#define MAX_SFTP_REPLY_BUFFER 10
+#define MAX_SFTP_MSG_LENGTH MAX_TRANSFER_BLOCKSIZE
#define MAX_PENDING_WRITE_BUFFER 786432 /* 768 KBytes */
#define MAX_PENDING_WRITES (MAX_PENDING_WRITE_BUFFER / 16384)
-#define MAX_SFTP_MSG_LENGTH MAX_TRANSFER_BLOCKSIZE
+#define MAX_PENDING_READS 64
+#define MAX_SFTP_REPLY_BUFFER MAX_PENDING_READS + 10
+#define SFTP_READ_STEP_SIZE 4
#define SFTP_WRITE_FILE 1 /* Open file for reading. */
#define SFTP_READ_FILE 2 /* Open file for writting. */
+#define SFTP_DO_SINGLE_READS -4
+#define SFTP_EOF -5
#define SSH_FILEXFER_VERSION 6
@@ -219,11 +223,22 @@
unsigned int dir_handle_length;
unsigned int stat_flag;
unsigned int pending_write_id[MAX_PENDING_WRITES];
+ unsigned int pending_read_id[MAX_PENDING_READS];
+ unsigned int reads_todo;
+ unsigned int reads_done;
unsigned int nl_pos; /* Name list position. */
unsigned int nl_length; /* Name list length. */
int pending_write_counter;
int max_pending_writes;
+ int max_pending_reads;
+ int current_max_pending_reads;
+ int pending_id_read_pos;
+ int pending_id_end_pos;
+ int reads_queued;
+ int reads_low_water_mark;
+ int blocksize;
off_t file_offset;
+ off_t bytes_to_do;
char *cwd; /* Current working dir. */
char *file_handle;
char *dir_handle;
@@ -255,16 +270,21 @@
sftp_flush(void),
sftp_mkdir(char *, mode_t),
sftp_move(char *, char *, int, mode_t, char *),
+ sftp_multi_read_catch(char *),
+ sftp_multi_read_dispatch(void),
+ sftp_multi_read_eof(void),
+ sftp_multi_read_init(int, off_t),
sftp_noop(void),
sftp_open_dir(char *, char),
- sftp_open_file(int, char *, off_t, mode_t *, int, int *,
- char),
+ sftp_open_file(int, char *, off_t, mode_t *, int,
+ int *, char),
sftp_pwd(void),
sftp_read(char *, int),
sftp_readdir(char *, struct stat *),
sftp_set_file_time(char *, time_t, time_t),
sftp_stat(char *, struct stat *),
sftp_write(char *, int);
-extern void sftp_quit(void);
+extern void sftp_multi_read_discard(int),
+ sftp_quit(void);
#endif /* __sftpdefs_h */
diff -u --recursive afd-1.4.7-10/src/protocols/smtpcmd.c afd-1.4.7-11/src/protocols/smtpcmd.c
--- afd-1.4.7-10/src/protocols/smtpcmd.c 2015-09-29 09:28:28.000000000 +0200
+++ afd-1.4.7-11/src/protocols/smtpcmd.c 2018-12-10 22:42:13.000000000 +0100
@@ -160,6 +160,9 @@
/* Local global variables. */
static int smtp_fd;
+#ifdef WITH_SSL
+static char connected_hostname[MAX_REAL_HOSTNAME_LENGTH];
+#endif
static struct timeval timeout;
static struct smtp_server_capabilities ssc;
@@ -210,7 +213,7 @@
#if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
char str_port[MAX_INT_LENGTH];
struct addrinfo hints,
- *result,
+ *result = NULL,
*rp;
(void)memset((struct addrinfo *) &hints, 0, sizeof(struct addrinfo));
@@ -225,6 +228,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "smtp_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
hostname, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -308,6 +312,7 @@
(void)close(smtp_fd);
trans_log(ERROR_SIGN, __FILE__, __LINE__, "smtp_connect", NULL,
_("Failed to connect() to %s"), hostname);
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -328,6 +333,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "smtp_connect", NULL,
_("Failed to connect() to %s"), hostname);
}
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -477,6 +483,9 @@
return(reply);
}
}
+#ifdef WITH_SSL
+ (void)memcpy(connected_hostname, hostname, MAX_REAL_HOSTNAME_LENGTH);
+#endif
return(SUCCESS);
}
@@ -546,7 +555,8 @@
}
else
{
- if ((reply = ssl_connect(smtp_fd, "smtp_smarttls")) == SUCCESS)
+ if ((reply = ssl_connect(smtp_fd, connected_hostname,
+ "smtp_smarttls")) == SUCCESS)
{
ssc.ssl_enabled = YES;
}
diff -u --recursive afd-1.4.7-10/src/protocols/ssh_common.c afd-1.4.7-11/src/protocols/ssh_common.c
--- afd-1.4.7-10/src/protocols/ssh_common.c 2015-08-19 16:42:07.000000000 +0200
+++ afd-1.4.7-11/src/protocols/ssh_common.c 2018-12-10 15:23:07.674354642 +0100
@@ -1330,6 +1330,7 @@
_("Timeout while waiting for password responce."));
timeout_flag = ON;
status = INCORRECT;
+ msg_str[0] = '\0';
}
else if (FD_ISSET(fd, &rset))
{
@@ -1337,6 +1338,7 @@
{
trans_log(ERROR_SIGN, __FILE__, __LINE__, "get_passwd_reply", NULL,
_("read() error : %s"), strerror(errno));
+ msg_str[0] = '\0';
}
#ifdef WITH_TRACE
else
@@ -1350,6 +1352,7 @@
msg_str[0] = '\0';
trans_log(ERROR_SIGN, __FILE__, __LINE__, "get_passwd_reply", NULL,
_("select() error : %s"), strerror(errno));
+ status = INCORRECT;
}
return(status);
diff -u --recursive afd-1.4.7-10/src/protocols/wmocmd.c afd-1.4.7-11/src/protocols/wmocmd.c
--- afd-1.4.7-10/src/protocols/wmocmd.c 2014-09-23 21:29:02.000000000 +0200
+++ afd-1.4.7-11/src/protocols/wmocmd.c 2018-12-10 22:43:08.000000000 +0100
@@ -134,7 +134,7 @@
#if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
char str_port[MAX_INT_LENGTH];
struct addrinfo hints,
- *result,
+ *result = NULL,
*rp;
(void)memset((struct addrinfo *) &hints, 0, sizeof(struct addrinfo));
@@ -149,6 +149,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "wmo_connect", NULL,
_("Failed to getaddrinfo() %s : %s"),
hostname, gai_strerror(reply));
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -224,6 +225,7 @@
(void)close(wmo_fd);
trans_log(ERROR_SIGN, __FILE__, __LINE__, "wmo_connect", NULL,
_("Failed to connect() to %s"), hostname);
+ freeaddrinfo(result);
return(INCORRECT);
}
@@ -244,6 +246,7 @@
trans_log(ERROR_SIGN, __FILE__, __LINE__, "wmo_connect", NULL,
_("Failed to connect() to %s"), hostname);
}
+ freeaddrinfo(result);
return(INCORRECT);
}
diff -u --recursive afd-1.4.7-10/src/servers/Makefile.am afd-1.4.7-11/src/servers/Makefile.am
--- afd-1.4.7-10/src/servers/Makefile.am 2013-07-22 16:27:06.000000000 +0200
+++ afd-1.4.7-11/src/servers/Makefile.am 2018-12-10 14:35:05.049629971 +0100
@@ -27,3 +27,6 @@
trans_log.c\
wmod.c
wmod_LDADD = ../common/libafd.a
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/statistics/Makefile.am afd-1.4.7-11/src/statistics/Makefile.am
--- afd-1.4.7-10/src/statistics/Makefile.am 2013-07-22 16:26:03.000000000 +0200
+++ afd-1.4.7-11/src/statistics/Makefile.am 2018-12-10 10:42:01.216336129 +0100
@@ -40,3 +40,6 @@
show_istat_LDADD = ../common/libafd.a
show_bench_stat_SOURCES = show_bench_stat.c
show_bench_stat_LDADD = ../common/libafd.a
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/test/filter/Makefile.am afd-1.4.7-11/src/test/filter/Makefile.am
--- afd-1.4.7-10/src/test/filter/Makefile.am 2013-07-22 16:26:21.000000000 +0200
+++ afd-1.4.7-11/src/test/filter/Makefile.am 2018-12-10 10:42:01.217336161 +0100
@@ -29,3 +29,6 @@
tfilter3_SOURCES = tfilter.c\
filter3.c
EXTRA_DIST = match.c match2.c sfilter.c pmatch.data
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/test/Makefile.am afd-1.4.7-11/src/test/Makefile.am
--- afd-1.4.7-10/src/test/Makefile.am 2013-07-22 16:26:33.000000000 +0200
+++ afd-1.4.7-11/src/test/Makefile.am 2018-12-10 10:43:58.103991280 +0100
@@ -45,3 +45,6 @@
ascp_LDADD = ../protocols/libprotocols.a ../common/libafd.a
url_check_SOURCES = url_check.c
url_check_LDADD = ../common/libafd.a
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/tools/Makefile.am afd-1.4.7-11/src/tools/Makefile.am
--- afd-1.4.7-10/src/tools/Makefile.am 2014-04-25 12:47:38.000000000 +0200
+++ afd-1.4.7-11/src/tools/Makefile.am 2018-12-10 10:42:01.217336161 +0100
@@ -167,3 +167,6 @@
uninstall-local:
cd $(DESTDIR)$(bindir) && rm -f uhc
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/common/Makefile.am afd-1.4.7-11/src/UI/common/Makefile.am
--- afd-1.4.7-10/src/UI/common/Makefile.am 2014-10-13 15:13:42.000000000 +0200
+++ afd-1.4.7-11/src/UI/common/Makefile.am 2018-12-10 10:41:28.943327069 +0100
@@ -37,3 +37,6 @@
view_data.c\
view_data_no_filter.c\
window_id.c
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Gtk+/common/Makefile.am afd-1.4.7-11/src/UI/Gtk+/common/Makefile.am
--- afd-1.4.7-10/src/UI/Gtk+/common/Makefile.am 2013-07-22 16:19:02.000000000 +0200
+++ afd-1.4.7-11/src/UI/Gtk+/common/Makefile.am 2018-12-10 10:41:05.535595192 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2007 - 2013 Holger Kiehl
+## Copyright (C) 2007 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -30,3 +30,6 @@
update_time.c\
wait_visible.c\
xrec.c
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Gtk+/gafd_ctrl/Makefile.am afd-1.4.7-11/src/UI/Gtk+/gafd_ctrl/Makefile.am
--- afd-1.4.7-10/src/UI/Gtk+/gafd_ctrl/Makefile.am 2013-07-22 16:19:37.000000000 +0200
+++ afd-1.4.7-11/src/UI/Gtk+/gafd_ctrl/Makefile.am 2018-12-10 10:41:05.536595223 +0100
@@ -65,3 +65,6 @@
uninstall-local:
cd $(DESTDIR)$(bindir) && rm -f afd_ctrl
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Gtk+/gshow_log/Makefile.am afd-1.4.7-11/src/UI/Gtk+/gshow_log/Makefile.am
--- afd-1.4.7-10/src/UI/Gtk+/gshow_log/Makefile.am 2013-07-22 16:19:21.000000000 +0200
+++ afd-1.4.7-11/src/UI/Gtk+/gshow_log/Makefile.am 2018-12-10 10:41:05.536595223 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2008 - 2013 Holger Kiehl
+## Copyright (C) 2008 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -36,3 +36,6 @@
uninstall-local:
cd $(DESTDIR)$(bindir) && rm -f show_log
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/afd_info/Makefile.am afd-1.4.7-11/src/UI/Motif/afd_info/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/afd_info/Makefile.am 2013-07-22 16:22:24.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/afd_info/Makefile.am 2018-12-10 10:41:24.910200966 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -27,3 +27,6 @@
update_info.c
afd_info_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/afd_load/Makefile.am afd-1.4.7-11/src/UI/Motif/afd_load/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/afd_load/Makefile.am 2013-07-22 16:21:06.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/afd_load/Makefile.am 2018-12-10 10:41:24.910200966 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -27,3 +27,6 @@
afd_load_callbacks.c
afd_load_LDADD = ../common/libmotifafd.a ../../../common/libafd.a\
@AFD_MOTIF_LIBS@ @AFD_XAW_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/common/Makefile.am afd-1.4.7-11/src/UI/Motif/common/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/common/Makefile.am 2014-11-30 12:28:24.000000000 +0100
+++ afd-1.4.7-11/src/UI/Motif/common/Makefile.am 2018-12-10 10:41:24.911200998 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -40,3 +40,6 @@
update_time.c\
wait_visible.c\
xrec.c
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/common/show_info.c afd-1.4.7-11/src/UI/Motif/common/show_info.c
--- afd-1.4.7-10/src/UI/Motif/common/show_info.c 2014-03-07 11:07:18.000000000 +0100
+++ afd-1.4.7-11/src/UI/Motif/common/show_info.c 2018-12-09 22:09:46.000000000 +0100
@@ -414,6 +414,8 @@
last_pos = 0;
}
}
+ XtFree(text_str);
+ XtFree(search_str);
return;
}
diff -u --recursive afd-1.4.7-10/src/UI/Motif/dir_ctrl/Makefile.am afd-1.4.7-11/src/UI/Motif/dir_ctrl/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/dir_ctrl/Makefile.am 2013-07-22 16:22:59.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/dir_ctrl/Makefile.am 2018-12-10 10:41:24.911200998 +0100
@@ -45,3 +45,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/dir_info/Makefile.am afd-1.4.7-11/src/UI/Motif/dir_info/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/dir_info/Makefile.am 2013-07-22 16:23:34.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/dir_info/Makefile.am 2018-12-10 10:41:24.911200998 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -27,3 +27,6 @@
update_info.c
dir_info_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/edit_hc/Makefile.am afd-1.4.7-11/src/UI/Motif/edit_hc/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/edit_hc/Makefile.am 2013-07-22 16:23:13.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/edit_hc/Makefile.am 2018-12-10 10:41:24.912201029 +0100
@@ -42,3 +42,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/handle_event/Makefile.am afd-1.4.7-11/src/UI/Motif/handle_event/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/handle_event/Makefile.am 2013-07-22 16:24:51.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/handle_event/Makefile.am 2018-12-10 10:41:24.912201029 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2007 - 2013 Holger Kiehl
+## Copyright (C) 2007 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -26,3 +26,6 @@
handle_event.c
handle_event_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/mafd_ctrl/Makefile.am afd-1.4.7-11/src/UI/Motif/mafd_ctrl/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/mafd_ctrl/Makefile.am 2013-07-22 16:24:11.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/mafd_ctrl/Makefile.am 2018-12-10 10:41:24.912201029 +0100
@@ -66,3 +66,6 @@
uninstall-local:
cd $(DESTDIR)$(bindir) && rm -f afd_ctrl
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/mon_ctrl/Makefile.am afd-1.4.7-11/src/UI/Motif/mon_ctrl/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/mon_ctrl/Makefile.am 2013-07-22 16:20:32.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/mon_ctrl/Makefile.am 2018-12-10 10:41:24.912201029 +0100
@@ -49,3 +49,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/mon_info/Makefile.am afd-1.4.7-11/src/UI/Motif/mon_info/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/mon_info/Makefile.am 2013-07-22 16:22:47.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/mon_info/Makefile.am 2018-12-10 10:41:24.913201060 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -28,3 +28,6 @@
update_info.c
mon_info_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/mshow_log/log_callbacks.c afd-1.4.7-11/src/UI/Motif/mshow_log/log_callbacks.c
--- afd-1.4.7-10/src/UI/Motif/mshow_log/log_callbacks.c 2014-11-08 13:52:05.000000000 +0100
+++ afd-1.4.7-11/src/UI/Motif/mshow_log/log_callbacks.c 2018-12-09 22:08:34.000000000 +0100
@@ -277,6 +277,8 @@
last_pos = 0;
}
}
+ XtFree(text_str);
+ XtFree(search_str);
return;
}
diff -u --recursive afd-1.4.7-10/src/UI/Motif/mshow_log/Makefile.am afd-1.4.7-11/src/UI/Motif/mshow_log/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/mshow_log/Makefile.am 2013-07-22 16:22:34.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/mshow_log/Makefile.am 2018-12-10 10:41:24.913201060 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -37,3 +37,6 @@
uninstall-local:
cd $(DESTDIR)$(bindir) && rm -f show_log
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_cmd/Makefile.am afd-1.4.7-11/src/UI/Motif/show_cmd/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_cmd/Makefile.am 2013-07-22 16:23:21.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_cmd/Makefile.am 2018-12-10 10:41:24.913201060 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -29,3 +29,6 @@
show_cmd.c
show_cmd_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_dlog/format_info.c afd-1.4.7-11/src/UI/Motif/show_dlog/format_info.c
--- afd-1.4.7-10/src/UI/Motif/show_dlog/format_info.c 2013-07-09 12:50:30.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_dlog/format_info.c 2018-12-10 14:10:42.959641501 +0100
@@ -219,7 +219,7 @@
max_x = count;
}
max_y++;
- if (id.d_o.dir_alias != '\0')
+ if (id.d_o.dir_alias[0] != '\0')
{
count = sprintf(*text + length, "Dir_Alias : %s\n", id.d_o.dir_alias);
length += count;
@@ -574,7 +574,7 @@
max_x = count;
}
max_y++;
- if (id.d_o.dir_alias != '\0')
+ if (id.d_o.dir_alias[0] != '\0')
{
count = sprintf(*text + length, "Dir_Alias : %s\n", id.d_o.dir_alias);
length += count;
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_dlog/Makefile.am afd-1.4.7-11/src/UI/Motif/show_dlog/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_dlog/Makefile.am 2013-07-22 16:20:56.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_dlog/Makefile.am 2018-12-10 10:41:24.913201060 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -33,3 +33,6 @@
show_dlog.c
show_dlog_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_elog/Makefile.am afd-1.4.7-11/src/UI/Motif/show_elog/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_elog/Makefile.am 2013-07-22 16:24:27.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_elog/Makefile.am 2018-12-10 10:41:24.913201060 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2007 - 2013 Holger Kiehl
+## Copyright (C) 2007 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -30,3 +30,6 @@
show_elog.c
show_elog_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_ilog/Makefile.am afd-1.4.7-11/src/UI/Motif/show_ilog/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_ilog/Makefile.am 2014-10-13 13:14:06.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_ilog/Makefile.am 2018-12-10 10:41:24.914201091 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2014 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -32,3 +32,6 @@
show_ilog.c
show_ilog_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_olog/Makefile.am afd-1.4.7-11/src/UI/Motif/show_olog/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_olog/Makefile.am 2013-07-22 16:22:08.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_olog/Makefile.am 2018-12-10 10:41:24.914201091 +0100
@@ -45,3 +45,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/show_queue/Makefile.am afd-1.4.7-11/src/UI/Motif/show_queue/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/show_queue/Makefile.am 2013-07-22 16:21:44.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/show_queue/Makefile.am 2018-12-10 10:41:28.943327069 +0100
@@ -44,3 +44,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/view_dc/callbacks.c afd-1.4.7-11/src/UI/Motif/view_dc/callbacks.c
--- afd-1.4.7-10/src/UI/Motif/view_dc/callbacks.c 2011-01-05 12:40:41.000000000 +0100
+++ afd-1.4.7-11/src/UI/Motif/view_dc/callbacks.c 2018-12-09 22:10:33.000000000 +0100
@@ -141,6 +141,8 @@
last_pos = 0;
}
}
+ XtFree(text_str);
+ XtFree(search_str);
return;
}
diff -u --recursive afd-1.4.7-10/src/UI/Motif/view_dc/Makefile.am afd-1.4.7-11/src/UI/Motif/view_dc/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/view_dc/Makefile.am 2013-07-22 16:20:07.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/view_dc/Makefile.am 2018-12-10 10:41:28.943327069 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2001 - 2013 Holger Kiehl
+## Copyright (C) 2001 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -26,3 +26,6 @@
view_dc.c
view_dc_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/xsend_file/Makefile.am afd-1.4.7-11/src/UI/Motif/xsend_file/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/xsend_file/Makefile.am 2013-07-22 16:20:45.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/xsend_file/Makefile.am 2018-12-10 10:41:28.943327069 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2005 - 2013 Holger Kiehl
+## Copyright (C) 2005 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -29,3 +29,6 @@
xsend_file.c
xsend_file_LDADD = ../common/libmotifafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/Motif/xshow_stat/Makefile.am afd-1.4.7-11/src/UI/Motif/xshow_stat/Makefile.am
--- afd-1.4.7-10/src/UI/Motif/xshow_stat/Makefile.am 2013-07-22 16:21:30.000000000 +0200
+++ afd-1.4.7-11/src/UI/Motif/xshow_stat/Makefile.am 2018-12-10 10:41:28.943327069 +0100
@@ -1,5 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
-## Copyright (C) 2002 - 2013 Holger Kiehl
+## Copyright (C) 2002 - 2018 Holger Kiehl
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -32,3 +32,6 @@
window_size.c
xshow_stat_LDADD = ../common/libmotifafd.a ../../common/libuiafd.a\
../../../common/libafd.a @AFD_MOTIF_LIBS@
+
+clean-local:
+ -rm -rf .deps
diff -u --recursive afd-1.4.7-10/src/UI/nCurses/nafd_ctrl/Makefile.am afd-1.4.7-11/src/UI/nCurses/nafd_ctrl/Makefile.am
--- afd-1.4.7-10/src/UI/nCurses/nafd_ctrl/Makefile.am 2013-07-22 16:25:09.000000000 +0200
+++ afd-1.4.7-11/src/UI/nCurses/nafd_ctrl/Makefile.am 2018-12-10 10:41:28.944327100 +0100
@@ -35,3 +35,6 @@
else
install-exec-local:
endif
+
+clean-local:
+ -rm -rf .deps