diff -u --recursive afd-1.4.7-10/configure.ac afd-1.4.7-11/configure.ac --- afd-1.4.7-10/configure.ac 2015-09-29 15:59:07.000000000 +0200 +++ afd-1.4.7-11/configure.ac 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.59]) -AC_INIT([afd], [1.4.7-10], [Holger.Kiehl@dwd.de]) +AC_INIT([afd], [1.4.7-11], [Holger.Kiehl@dwd.de]) AC_CONFIG_SRCDIR(src/init_afd/afd.c) AC_CONFIG_AUX_DIR(ac-tools) dnl# AC_PREFIX_DEFAULT("/usr/local/afd") diff -u --recursive afd-1.4.7-10/doc/FAQ afd-1.4.7-11/doc/FAQ --- afd-1.4.7-10/doc/FAQ 2012-06-03 20:39:05.000000000 +0200 +++ afd-1.4.7-11/doc/FAQ 2018-12-12 12:54:23.474785909 +0100 @@ -2,7 +2,7 @@ Author : Holger Kiehl email : Holger.Kiehl@dwd.de Version : 0.2 - Last Updated: 06 August 2005 + Last Updated: 12 December 2018 Copyright : GPL ====================================================================== @@ -117,13 +117,16 @@ 1.2 Where can I get AFD? You can get information from the following locations: - http://www.dwd.de/AFD - Homepage - ftp://ftp.dwd.de/pub/afd - directory containing the stable - releasese of AFD - ftp://ftp.dwd.de/pub/afd/development - directory with unstable - releases of AFD - ftp://ftp.dwd.de/pub/afd/bin - here you will find precompiled - binaries + https://download.dwd.de/pub/afd/stable/doc - Homepage + https://download.dwd.de/pub/afd - directory containing + the stable release of + AFD + https://download.dwd.de/pub/afd/development - directory with unstable + releases of AFD + https://download.dwd.de/pub/afd/RPMS - pre compiled RPMS for + some Linux Distributions + https://github.com/holger24/AFD - get or follow the lattest + development of AFD 1.3 Will AFD run with Windows XXX? @@ -133,12 +136,12 @@ 1.4 What is the history of AFD? - In 1995 the German Weater Service (Deutscher Wetterdienst (DWD)) was + In 1995 the German Weather Service (Deutscher Wetterdienst (DWD)) was doing its international file exchange via scripts. It was soon realized that this did cause a very high cpu load and was not very flexible. For this reason it was decided to develop a file distribution system that was to be very portable and easy to handle by a single person. - Here follow some important millestones of the AFD: + Here follow some important milestones of the AFD: - 04.02.1996 First release and first operational use at DWD (only for distributing files to international partners). @@ -192,7 +195,7 @@ 2.2.1 Single user - This is the default and you need to set no addititional flags + This is the default and you need to set no additional flags with configure. Here only the user that has started the AFD may have access and may control it. @@ -209,7 +212,7 @@ To allow any user to have access you must set the flag --enable-setuid_progs in configure. This will set the setuid flag for some binaries. The access can be further restricted in the - $AFD_WORK_DIR/etc/afd.users file. It is not recommendet to set + $AFD_WORK_DIR/etc/afd.users file. It is not recommended to set this if you install the binaries as root. 2.3 I get the following error when compiling: @@ -218,7 +221,7 @@ HPUX for example does not include the Xaw libraries and headers. You can either install these on your system or in - src/UI/Motif/Makefile.am comment out all occurance of afd_load. Then + src/UI/Motif/Makefile.am comment out all occurrence of afd_load. Then AFD will compile without the dialog afd_load, which is not required for running AFD. @@ -343,7 +346,7 @@ a lot of jobs queue up and it will start them again as soon as the network comes back. If unsure you can stop AMG so no more jobs will be generated for FD. FD will still continue to try and distribute - files at regular intervalls. + files at regular interval's. 5.2.2 The connection to one host is down and the job queue counter is constantly increasing. What action is necessary? @@ -402,7 +405,7 @@ permission, ie. AFD must have read permission for those files. - Ensure that the input queue or transfer is NOT stopped - in the afd_ctrl dialog. The two leds next to the hostname + in the afd_ctrl dialog. The two LED's next to the hostname and debug led must be green. @@ -457,12 +460,12 @@ 6.1.8 Failed to connect() to XXXXX : Connection refused. Here we do reach the remote host via the network but there is no - FTP daemon running or listining at the expected port. + FTP daemon running or listening at the expected port. 6.1.9 421-Service not available, closing control connection. This error message can appear after we connected to the remote - host. It means that it is currently being shuttown and not able + host. It means that it is currently being shutdown and not able to handle any further requests. 6.1.10 Remote hang up. @@ -474,7 +477,7 @@ If this error appears in conjunction with another error message, for example: Failed to change directory to YYYY. Then the remote host has just cut the connection, either because it is being - shuttdown or has a very high load. + shutdown or has a very high load. diff -u --recursive afd-1.4.7-10/doc/html-en/download.html afd-1.4.7-11/doc/html-en/download.html --- afd-1.4.7-10/doc/html-en/download.html 2014-12-03 12:50:56.000000000 +0100 +++ afd-1.4.7-11/doc/html-en/download.html 2018-12-12 17:08:59.145651774 +0100 @@ -12,7 +12,7 @@ (or higher). The AFD has so far been ported to the following systems:

It is distributed under the GNU General Public License - see the -accompanying COPYING file for more details. +accompanying LICENSE file for more details.

Please read the INSTALL file in the src directory, before compiling.

There is a mailing list at gafd-users@lists.sourceforge.net, for more -information on how to register see -gafd-users. An archive of this list can be found +information on how to register see +gafd-users. An archive of this list can be found here. Or contact me (Holger.Kiehl@dwd.de) directly if you do have questions, found a bug or just want to give your comment about this software.

@@ -51,9 +53,9 @@ diff -u --recursive afd-1.4.7-10/doc/html-en/installation.html afd-1.4.7-11/doc/html-en/installation.html --- afd-1.4.7-10/doc/html-en/installation.html 2013-11-23 09:58:44.000000000 +0100 +++ afd-1.4.7-11/doc/html-en/installation.html 2018-12-12 12:42:02.037742277 +0100 @@ -9,7 +9,7 @@

If you install want to install from source, please read Compiling AFD. But it is easier to just -download the RPM from here. +download the RPM from here. To install the RPM you must ensure that you have the following packets installed:

+
  • RedHat/CentOS/Scientific Linux as of 7.x
  • +
  • Fedora up to Version 17
  • -
  • Fedora as of Version 18
  • +
  • Fedora Version 18 - 21
  • +
  • Fedora as of Version 22
  • +
  • Ubuntu
  • -
  • SuSE
  • +
  • SLES up to 11
  • +
  • SLES as of 12 and openSUSE
  • +

    @@ -66,9 +87,9 @@

    - Copyright © 2000 - 2014 by H.Kiehl
    + Copyright © 2000 - 2018 by H.Kiehl
    Holger.Kiehl@dwd.de
    - Last updated: 02.12.2014 + Last updated: 12.12.2018
    [red dot]Index [red dot]Home
    diff -u --recursive afd-1.4.7-10/doc/html-en/what-is-afd.html afd-1.4.7-11/doc/html-en/what-is-afd.html --- afd-1.4.7-10/doc/html-en/what-is-afd.html 2013-11-24 10:46:30.000000000 +0100 +++ afd-1.4.7-11/doc/html-en/what-is-afd.html 2018-12-12 17:16:01.630169140 +0100 @@ -65,7 +65,7 @@ has been ported to the following systems:

    - Copyright © 2013 by H.Kiehl
    + Copyright © 2013 - 2018 by H.Kiehl
    Holger.Kiehl@dwd.de
    - Last updated: 23.11.2013 + Last updated: 12.12.2018
    [red dot]Index [red dot]Home
    diff -u --recursive afd-1.4.7-10/FAQ afd-1.4.7-11/FAQ --- afd-1.4.7-10/FAQ 2012-06-03 20:39:05.000000000 +0200 +++ afd-1.4.7-11/FAQ 2018-12-12 12:54:23.474785909 +0100 @@ -2,7 +2,7 @@ Author : Holger Kiehl email : Holger.Kiehl@dwd.de Version : 0.2 - Last Updated: 06 August 2005 + Last Updated: 12 December 2018 Copyright : GPL ====================================================================== @@ -117,13 +117,16 @@ 1.2 Where can I get AFD? You can get information from the following locations: - http://www.dwd.de/AFD - Homepage - ftp://ftp.dwd.de/pub/afd - directory containing the stable - releasese of AFD - ftp://ftp.dwd.de/pub/afd/development - directory with unstable - releases of AFD - ftp://ftp.dwd.de/pub/afd/bin - here you will find precompiled - binaries + https://download.dwd.de/pub/afd/stable/doc - Homepage + https://download.dwd.de/pub/afd - directory containing + the stable release of + AFD + https://download.dwd.de/pub/afd/development - directory with unstable + releases of AFD + https://download.dwd.de/pub/afd/RPMS - pre compiled RPMS for + some Linux Distributions + https://github.com/holger24/AFD - get or follow the lattest + development of AFD 1.3 Will AFD run with Windows XXX? @@ -133,12 +136,12 @@ 1.4 What is the history of AFD? - In 1995 the German Weater Service (Deutscher Wetterdienst (DWD)) was + In 1995 the German Weather Service (Deutscher Wetterdienst (DWD)) was doing its international file exchange via scripts. It was soon realized that this did cause a very high cpu load and was not very flexible. For this reason it was decided to develop a file distribution system that was to be very portable and easy to handle by a single person. - Here follow some important millestones of the AFD: + Here follow some important milestones of the AFD: - 04.02.1996 First release and first operational use at DWD (only for distributing files to international partners). @@ -192,7 +195,7 @@ 2.2.1 Single user - This is the default and you need to set no addititional flags + This is the default and you need to set no additional flags with configure. Here only the user that has started the AFD may have access and may control it. @@ -209,7 +212,7 @@ To allow any user to have access you must set the flag --enable-setuid_progs in configure. This will set the setuid flag for some binaries. The access can be further restricted in the - $AFD_WORK_DIR/etc/afd.users file. It is not recommendet to set + $AFD_WORK_DIR/etc/afd.users file. It is not recommended to set this if you install the binaries as root. 2.3 I get the following error when compiling: @@ -218,7 +221,7 @@ HPUX for example does not include the Xaw libraries and headers. You can either install these on your system or in - src/UI/Motif/Makefile.am comment out all occurance of afd_load. Then + src/UI/Motif/Makefile.am comment out all occurrence of afd_load. Then AFD will compile without the dialog afd_load, which is not required for running AFD. @@ -343,7 +346,7 @@ a lot of jobs queue up and it will start them again as soon as the network comes back. If unsure you can stop AMG so no more jobs will be generated for FD. FD will still continue to try and distribute - files at regular intervalls. + files at regular interval's. 5.2.2 The connection to one host is down and the job queue counter is constantly increasing. What action is necessary? @@ -402,7 +405,7 @@ permission, ie. AFD must have read permission for those files. - Ensure that the input queue or transfer is NOT stopped - in the afd_ctrl dialog. The two leds next to the hostname + in the afd_ctrl dialog. The two LED's next to the hostname and debug led must be green. @@ -457,12 +460,12 @@ 6.1.8 Failed to connect() to XXXXX : Connection refused. Here we do reach the remote host via the network but there is no - FTP daemon running or listining at the expected port. + FTP daemon running or listening at the expected port. 6.1.9 421-Service not available, closing control connection. This error message can appear after we connected to the remote - host. It means that it is currently being shuttown and not able + host. It means that it is currently being shutdown and not able to handle any further requests. 6.1.10 Remote hang up. @@ -474,7 +477,7 @@ If this error appears in conjunction with another error message, for example: Failed to change directory to YYYY. Then the remote host has just cut the connection, either because it is being - shuttdown or has a very high load. + shutdown or has a very high load. diff -u --recursive afd-1.4.7-10/README.configure afd-1.4.7-11/README.configure --- afd-1.4.7-10/README.configure 2014-11-03 09:54:03.000000000 +0100 +++ afd-1.4.7-11/README.configure 2018-12-09 21:32:46.000000000 +0100 @@ -255,7 +255,7 @@ --with-gui=motif|none - Compile AFD with a certain graphical user interface. [Default: motif] ---enable-ditro-rpm - Enables distribution style RPMS. +--enable-distro-rpm - Enables distribution style RPMS. [Default: disabled] --with-initdir=INITDIR - Directory where to put init/rc script to start/stop AFD. It is strongly diff -u --recursive afd-1.4.7-10/src/afdd/Makefile.am afd-1.4.7-11/src/afdd/Makefile.am --- afd-1.4.7-10/src/afdd/Makefile.am 2013-07-22 16:17:19.000000000 +0200 +++ afd-1.4.7-11/src/afdd/Makefile.am 2018-12-10 10:44:57.290842805 +0100 @@ -33,3 +33,6 @@ show_job_list.c\ show_summary_stat.c afdd_LDADD = ../common/libafd.a @EXTRA_SOCKET_LIBS@ + +clean-local: + -rm -rf .deps diff -u --recursive afd-1.4.7-10/src/afd_mon/Makefile.am afd-1.4.7-11/src/afd_mon/Makefile.am --- afd-1.4.7-10/src/afd_mon/Makefile.am 2013-07-22 16:17:53.000000000 +0200 +++ afd-1.4.7-11/src/afd_mon/Makefile.am 2018-12-10 10:41:28.944327100 +0100 @@ -68,3 +68,6 @@ else install-exec-local: endif + +clean-local: + -rm -rf .deps diff -u --recursive afd-1.4.7-10/src/amg/check_inotify_files.c afd-1.4.7-11/src/amg/check_inotify_files.c --- afd-1.4.7-10/src/amg/check_inotify_files.c 2015-10-14 08:17:54.000000000 +0200 +++ afd-1.4.7-11/src/amg/check_inotify_files.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * check_inotify_files.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 2013 - 2015 Holger Kiehl + * Copyright (c) 2013 - 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 @@ -176,14 +176,15 @@ if (((fra[p_de->fra_pos].ignore_size == -1) || ((fra[p_de->fra_pos].gt_lt_sign & ISIZE_EQUAL) && - (fra[p_de->fra_pos].ignore_size == stat_buf.st_size)) || + (fra[p_de->fra_pos].ignore_size != stat_buf.st_size)) || ((fra[p_de->fra_pos].gt_lt_sign & ISIZE_LESS_THEN) && (fra[p_de->fra_pos].ignore_size < stat_buf.st_size)) || ((fra[p_de->fra_pos].gt_lt_sign & ISIZE_GREATER_THEN) && (fra[p_de->fra_pos].ignore_size > stat_buf.st_size))) && ((fra[p_de->fra_pos].ignore_file_time == 0) || + (fra[p_de->fra_pos].fsa_pos != -1) || /* Time+size check only local dirs! */ ((fra[p_de->fra_pos].gt_lt_sign & IFTIME_EQUAL) && - (fra[p_de->fra_pos].ignore_file_time == diff_time)) || + (fra[p_de->fra_pos].ignore_file_time != diff_time)) || ((fra[p_de->fra_pos].gt_lt_sign & IFTIME_LESS_THEN) && (fra[p_de->fra_pos].ignore_file_time < diff_time)) || ((fra[p_de->fra_pos].gt_lt_sign & IFTIME_GREATER_THEN) && diff -u --recursive afd-1.4.7-10/src/amg/dir_check.c afd-1.4.7-11/src/amg/dir_check.c --- afd-1.4.7-10/src/amg/dir_check.c 2015-11-12 19:35:21.000000000 +0100 +++ afd-1.4.7-11/src/amg/dir_check.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * dir_check.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 1995 - 2015 Holger Kiehl + * Copyright (c) 1995 - 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 @@ -2941,14 +2941,15 @@ if (*no_of_process >= max_process) { system_log(DEBUG_SIGN, __FILE__, __LINE__, - "Unable to handle directory %s since maximum number of process (%d) for process dir_check reached.", - de[dir_pos].dir, max_process); + "Unable to handle directory %s since maximum number of process (%d) for process dir_check reached. @%x", + de[dir_pos].dir, max_process, de[dir_pos].dir_id); } else if (fra[de[dir_pos].fra_pos].no_of_process >= fra[de[dir_pos].fra_pos].max_process) { system_log(DEBUG_SIGN, __FILE__, __LINE__, - "Unable to handle directory since maximum number of process (%d) reached for directory %s", - fra[de[dir_pos].fra_pos].max_process, de[dir_pos].dir); + "Unable to handle directory since maximum number of process (%d) reached for directory %s @%x", + fra[de[dir_pos].fra_pos].max_process, de[dir_pos].dir, + de[dir_pos].dir_id); } return(NO); } diff -u --recursive afd-1.4.7-10/src/amg/eval_dir_config.c afd-1.4.7-11/src/amg/eval_dir_config.c --- afd-1.4.7-10/src/amg/eval_dir_config.c 2015-11-02 15:52:57.000000000 +0100 +++ afd-1.4.7-11/src/amg/eval_dir_config.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * eval_dir_config.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 1995 - 2014 Deutscher Wetterdienst (DWD), + * Copyright (c) 1995 - 2016 Deutscher Wetterdienst (DWD), * Holger Kiehl * * This program is free software; you can redistribute it and/or modify @@ -521,7 +521,10 @@ } } dir->alias[i] = '\0'; - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } ptr = search_ptr; @@ -571,7 +574,8 @@ i = 0; while ((*ptr != '\n') && (*ptr != '\0') && (i < (MAX_PATH_LENGTH - 2))) { - if ((*ptr == '\\') && ((*(ptr + 1) == '#') || (*(ptr + 1) == ' '))) + if ((*ptr == '\\') && ((*(ptr + 1) == '#') || (*(ptr + 1) == ' ') || + (*(ptr + 1) == '\t'))) { dir->location[i] = *(ptr + 1); i++; @@ -960,7 +964,10 @@ { search_ptr++; } - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } while (*search_ptr == '#') { @@ -968,7 +975,10 @@ { search_ptr++; } - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } ptr = search_ptr; @@ -1226,7 +1236,10 @@ total_length += i + 1; dir->file[dir->fgc].fc++; } - ptr++; + if (*ptr == '\n') + { + ptr++; + } /* Check for a dummy empty line. */ if (*ptr != '\n') @@ -1382,7 +1395,10 @@ { search_ptr++; } - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } while (*search_ptr == '#') { @@ -1390,7 +1406,10 @@ { search_ptr++; } - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } ptr = search_ptr; @@ -1480,7 +1499,10 @@ rec[dir->file[dir->fgc].\ dest[dir->file[dir->fgc].dgc].rc].\ recipient[i] = '\0'; - ptr++; + if (*ptr == '\n') + { + ptr++; + } /* Make sure that we did read a line. */ if (i != 0) @@ -1657,7 +1679,10 @@ { search_ptr++; } - search_ptr++; + if (*search_ptr == '\n') + { + search_ptr++; + } } ptr = search_ptr; @@ -1726,7 +1751,10 @@ } } } - ptr++; + if (*ptr == '\n') + { + ptr++; + } /* Check for a dummy empty line. */ if (*ptr != '\n') diff -u --recursive afd-1.4.7-10/src/amg/eval_dir_options.c afd-1.4.7-11/src/amg/eval_dir_options.c --- afd-1.4.7-10/src/amg/eval_dir_options.c 2014-07-22 13:13:42.000000000 +0200 +++ afd-1.4.7-11/src/amg/eval_dir_options.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,7 +1,7 @@ /* * eval_dir_options.c - Part of AFD, an automatic file distribution * program. - * Copyright (c) 2000 - 2014 Holger Kiehl + * Copyright (c) 2000 - 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 @@ -420,7 +420,7 @@ { used |= DIRECTORY_PRIORITY_FLAG; ptr += PRIORITY_ID_LENGTH; - while ((*ptr == ' ') || (*ptr == '\n')) + while ((*ptr == ' ') || (*ptr == '\t') || (*ptr == '\n')) { ptr++; } @@ -664,7 +664,7 @@ { used |= STORE_RETRIEVE_LIST_FLAG; ptr += STORE_RETRIEVE_LIST_ID_LENGTH; - while (*ptr == ' ') + while ((*ptr == ' ') || (*ptr == '\t')) { ptr++; } @@ -689,7 +689,7 @@ { used |= STORE_RETRIEVE_LIST_FLAG; ptr += STORE_REMOTE_LIST_LENGTH; - while (*ptr == ' ') + while ((*ptr == ' ') || (*ptr == '\t')) { ptr++; } @@ -1308,7 +1308,7 @@ ptr++; } while ((*ptr != '\n') && (*ptr != '\0') && (*ptr != ' ') && - (length < MAX_WAIT_FOR_LENGTH)) + (*ptr != '\t') && (length < MAX_WAIT_FOR_LENGTH)) { if (*ptr == '\\') { diff -u --recursive afd-1.4.7-10/src/amg/Makefile.am afd-1.4.7-11/src/amg/Makefile.am --- afd-1.4.7-10/src/amg/Makefile.am 2015-11-02 15:33:44.000000000 +0100 +++ afd-1.4.7-11/src/amg/Makefile.am 2018-12-10 10:41:28.945327131 +0100 @@ -119,3 +119,6 @@ test_in_time_LDADD = ../common/libafd.a show_amg_data_SOURCES = show_amg_data.c show_amg_data_LDADD = ../common/libafd.a + +clean-local: + -rm -rf .deps diff -u --recursive afd-1.4.7-10/src/archive_watch/Makefile.am afd-1.4.7-11/src/archive_watch/Makefile.am --- afd-1.4.7-10/src/archive_watch/Makefile.am 2013-07-22 16:25:47.000000000 +0200 +++ afd-1.4.7-11/src/archive_watch/Makefile.am 2018-12-10 10:41:28.945327131 +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 @@ -24,3 +24,6 @@ archive_watch_SOURCES = archive_watch.c\ inspect_archive.c archive_watch_LDADD = ../common/libafd.a + +clean-local: + -rm -rf .deps diff -u --recursive afd-1.4.7-10/src/cmdline/Makefile.am afd-1.4.7-11/src/cmdline/Makefile.am --- afd-1.4.7-10/src/cmdline/Makefile.am 2014-10-13 09:42:06.000000000 +0200 +++ afd-1.4.7-11/src/cmdline/Makefile.am 2018-12-10 10:45:39.678168798 +0100 @@ -70,3 +70,6 @@ uninstall-local: cd $(DESTDIR)$(bindir) && rm -f raftp + +clean-local: + -rm -rf .deps diff -u --recursive afd-1.4.7-10/src/common/calc_next_time.c afd-1.4.7-11/src/common/calc_next_time.c --- afd-1.4.7-10/src/common/calc_next_time.c 2014-06-18 13:46:18.000000000 +0200 +++ afd-1.4.7-11/src/common/calc_next_time.c 2018-12-09 22:29:36.000000000 +0100 @@ -133,6 +133,7 @@ #ifdef WITH_TIMEZONE int reset_env; char *p_env; + time_t new_time; #endif struct tm *bd_time; /* Broken-down time */ @@ -454,10 +455,13 @@ } bd_time->tm_sec = 0; #ifdef WITH_TIMEZONE + new_time = mktime(bd_time); reset_environment(timezone, p_env, reset_env); -#endif + return(new_time); +#else return(mktime(bd_time)); +#endif } diff -u --recursive afd-1.4.7-10/src/common/get_log_number.c afd-1.4.7-11/src/common/get_log_number.c --- afd-1.4.7-10/src/common/get_log_number.c 2014-09-23 14:24:19.000000000 +0200 +++ afd-1.4.7-11/src/common/get_log_number.c 2018-12-10 14:13:25.176740622 +0100 @@ -79,7 +79,7 @@ tmp_number; char *ptr, str_number[MAX_INT_LENGTH], - fullname[MAX_PATH_LENGTH], + fullname[MAX_PATH_LENGTH + 256], log_dir[MAX_PATH_LENGTH]; struct stat stat_buf; struct dirent *p_dir; @@ -113,7 +113,7 @@ if (strncmp(p_dir->d_name, log_name, log_name_length) == 0) { - (void)snprintf(fullname, MAX_PATH_LENGTH, "%s/%s", + (void)snprintf(fullname, MAX_PATH_LENGTH + 256, "%s/%s", log_dir, p_dir->d_name); if (stat(fullname, &stat_buf) < 0) { diff -u --recursive afd-1.4.7-10/src/common/handle_error_queue.c afd-1.4.7-11/src/common/handle_error_queue.c --- afd-1.4.7-10/src/common/handle_error_queue.c 2014-09-21 20:25:34.000000000 +0200 +++ afd-1.4.7-11/src/common/handle_error_queue.c 2018-12-10 13:12:09.723252709 +0100 @@ -670,6 +670,8 @@ lock_region_w(fsa_fd, lock_offset + LOCK_EC); #endif fsa[j].error_counter = 0; + fsa[j].error_history[0] = 0; + fsa[j].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/common/Makefile.am afd-1.4.7-11/src/common/Makefile.am --- afd-1.4.7-10/src/common/Makefile.am 2014-11-02 09:39:50.000000000 +0100 +++ afd-1.4.7-11/src/common/Makefile.am 2018-12-10 10:41:28.946327163 +0100 @@ -220,3 +220,7 @@ ../init_afd/afddefs.h\ ../afdsetup.h\ ../../config.h + +clean-local: + -rm -rf .deps + diff -u --recursive afd-1.4.7-10/src/common/remove_job_files.c afd-1.4.7-11/src/common/remove_job_files.c --- afd-1.4.7-10/src/common/remove_job_files.c 2014-09-21 20:34:10.000000000 +0200 +++ afd-1.4.7-11/src/common/remove_job_files.c 2018-12-09 21:32:46.000000000 +0100 @@ -194,8 +194,19 @@ else { system_log(DEBUG_SIGN, __FILE__, __LINE__, - _("UUUPS! A directory [%s]! Whats that doing here?"), - del_dir); + _("UUUPS! A directory [%s]! Whats that doing here? Deleted %d files. [host_alias=%s]"), + del_dir, number_deleted, + (fsa_pos > -1) ? p_fsa->host_alias : "-"); + + /* Lets bail out. If del_dir contains garbage we should stop */ + /* the deleting of files. */ + if (closedir(dp) == -1) + { + system_log(ERROR_SIGN, __FILE__, __LINE__, + _("Could not closedir() `%s' : %s"), + del_dir, strerror(errno)); + } + return; } } errno = 0; diff -u --recursive afd-1.4.7-10/src/fd/check_burst_gf.c afd-1.4.7-11/src/fd/check_burst_gf.c --- afd-1.4.7-10/src/fd/check_burst_gf.c 2014-11-15 14:44:50.000000000 +0100 +++ afd-1.4.7-11/src/fd/check_burst_gf.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * check_burst_gf.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 2014 Holger Kiehl + * Copyright (c) 2014, 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 @@ -75,7 +75,7 @@ extern struct job db; /* Local variables. */ -static sig_atomic_t alarm_triggered; +static sig_atomic_t signal_caught; /* Local function prototypes. */ static void sig_alarm(int); @@ -148,6 +148,7 @@ int diff_no_of_files_done; #endif + signal_caught = 0; newact.sa_handler = sig_alarm; sigemptyset(&newact.sa_mask); newact.sa_flags = 0; @@ -170,6 +171,9 @@ } fsa->job_status[(int)db.job_no].unique_name[2] = 5; + /* Indicate to FD that signal handler is in place. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 1; + #ifndef AFDBENCH_CONFIG diff_no_of_files_done = fsa->job_status[(int)db.job_no].no_of_files_done - prev_no_of_files_done; @@ -213,10 +217,16 @@ (void)alarm(0); if (gsf_check_fsa((struct job *)&db) != NEITHER) { - if (fsa->job_status[(int)db.job_no].unique_name[2] == 5) + if (signal_caught != 2) { - fsa->job_status[(int)db.job_no].unique_name[2] = 0; + if (fsa->job_status[(int)db.job_no].unique_name[2] == 5) + { + fsa->job_status[(int)db.job_no].unique_name[2] = 0; + } } + + /* Indicate FD we no longer want any signals. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; } /* @@ -292,7 +302,7 @@ generic_fifo, strerror(errno)); return(NO); } - alarm_triggered = NO; + signal_caught = 0; pid = -db.my_pid; newact.sa_handler = sig_alarm; @@ -318,11 +328,15 @@ fsa->job_status[(int)db.job_no].unique_name[2] = 4; + /* Indicate to FD that signal handler is in place. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 1; + if (write(fd, &pid, sizeof(pid_t)) != sizeof(pid_t)) { int tmp_errno = errno; fsa->job_status[(int)db.job_no].unique_name[2] = 0; + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; if ((sigaction(SIGUSR1, &oldact_usr1, NULL) < 0) || (sigaction(SIGALRM, &oldact_alrm, NULL) < 0)) { @@ -356,10 +370,16 @@ (void)alarm(0); if (gsf_check_fsa((struct job *)&db) != NEITHER) { - if (fsa->job_status[(int)db.job_no].unique_name[2] == 4) + if (signal_caught != 2) { - fsa->job_status[(int)db.job_no].unique_name[2] = 0; + if (fsa->job_status[(int)db.job_no].unique_name[2] == 4) + { + fsa->job_status[(int)db.job_no].unique_name[2] = 0; + } } + + /* Indicate FD we no longer want any signals. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; } /* @@ -408,7 +428,7 @@ "close() error : %s", strerror(errno)); } - if ((alarm_triggered == YES) && + if ((signal_caught == 1) && (fsa->job_status[(int)db.job_no].unique_name[1] == '\0')) { if (gsf_check_fsa((struct job *)&db) != NEITHER) @@ -953,8 +973,12 @@ { if (signo == SIGALRM) { - alarm_triggered = YES; + signal_caught = 1; } + else if (signo == SIGUSR1) + { + signal_caught = 2; + } return; /* Return to wakeup sigsuspend(). */ } diff -u --recursive afd-1.4.7-10/src/fd/check_burst_sf.c afd-1.4.7-11/src/fd/check_burst_sf.c --- afd-1.4.7-10/src/fd/check_burst_sf.c 2015-03-17 13:45:03.000000000 +0100 +++ afd-1.4.7-11/src/fd/check_burst_sf.c 2018-12-09 21:32:46.000000000 +0100 @@ -94,7 +94,7 @@ extern struct job db; /* Local variables. */ -static sig_atomic_t alarm_triggered; +static sig_atomic_t signal_caught; /* Local function prototypes. */ static void sig_alarm(int); @@ -181,6 +181,7 @@ int diff_no_of_files_done; #endif + signal_caught = 0; newact.sa_handler = sig_alarm; sigemptyset(&newact.sa_mask); newact.sa_flags = 0; @@ -202,6 +203,10 @@ "sigprocmask() error : %s", strerror(errno)); } fsa->job_status[(int)db.job_no].unique_name[2] = 5; + + /* Indicate to FD that signal handler is in place. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 1; + #ifdef _WITH_INTERRUPT_JOB if (interrupt == YES) { @@ -331,10 +336,16 @@ (void)alarm(0); if (gsf_check_fsa((struct job *)&db) != NEITHER) { - if (fsa->job_status[(int)db.job_no].unique_name[2] == 5) + if (signal_caught != 2) { - fsa->job_status[(int)db.job_no].unique_name[2] = 0; + if (fsa->job_status[(int)db.job_no].unique_name[2] == 5) + { + fsa->job_status[(int)db.job_no].unique_name[2] = 0; + } } + + /* Indicate FD we no longer want any signals. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; } /* @@ -414,7 +425,7 @@ generic_fifo, strerror(errno)); return(NO); } - alarm_triggered = NO; + signal_caught = 0; pid = -db.my_pid; newact.sa_handler = sig_alarm; @@ -439,6 +450,10 @@ } fsa->job_status[(int)db.job_no].unique_name[2] = 4; + + /* Indicate to FD that signal handler is in place. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 1; + #ifdef _WITH_INTERRUPT_JOB if (interrupt == YES) { @@ -451,6 +466,7 @@ int tmp_errno = errno; fsa->job_status[(int)db.job_no].unique_name[2] = 0; + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; if ((sigaction(SIGUSR1, &oldact_usr1, NULL) < 0) || (sigaction(SIGALRM, &oldact_alrm, NULL) < 0)) { @@ -484,10 +500,16 @@ (void)alarm(0); if (gsf_check_fsa((struct job *)&db) != NEITHER) { - if (fsa->job_status[(int)db.job_no].unique_name[2] == 4) + if (signal_caught != 2) { - fsa->job_status[(int)db.job_no].unique_name[2] = 0; + if (fsa->job_status[(int)db.job_no].unique_name[2] == 4) + { + fsa->job_status[(int)db.job_no].unique_name[2] = 0; + } } + + /* Indicate FD we no longer want any signals. */ + fsa->job_status[(int)db.job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] = 2; } /* @@ -536,7 +558,7 @@ "close() error : %s", strerror(errno)); } - if ((alarm_triggered == YES) && + if ((signal_caught == 1) && (fsa->job_status[(int)db.job_no].unique_name[1] == '\0')) { if (gsf_check_fsa((struct job *)&db) != NEITHER) @@ -999,8 +1021,12 @@ { if (signo == SIGALRM) { - alarm_triggered = YES; + signal_caught = 1; } + else if (signo == SIGUSR1) + { + signal_caught = 2; + } return; /* Return to wakeup sigsuspend(). */ } diff -u --recursive afd-1.4.7-10/src/fd/fd.c afd-1.4.7-11/src/fd/fd.c --- afd-1.4.7-10/src/fd/fd.c 2015-10-02 09:51:20.000000000 +0200 +++ afd-1.4.7-11/src/fd/fd.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * fd.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 1995 - 2015 Deutscher Wetterdienst (DWD), + * Copyright (c) 1995 - 2016 Deutscher Wetterdienst (DWD), * Holger Kiehl * * This program is free software; you can redistribute it and/or modify @@ -253,7 +253,8 @@ sig_exit(int), sig_segv(int), sig_bus(int); -static int check_local_interface_names(char *), +static int check_dir_in_use(int), + check_local_interface_names(char *), get_free_connection(void), get_free_disp_pos(int), zombie_check(struct connection *, time_t, int *, int); @@ -962,6 +963,9 @@ for (i = 0; i < no_of_retrieves; i++) { if ((fra[retrieve_list[i]].queued == 0) && + ((fsa[fra[retrieve_list[i]].fsa_pos].keep_connected == 0) || + (fsa[fra[retrieve_list[i]].fsa_pos].protocol_options & KEEP_CON_NO_FETCH_2) || + (check_dir_in_use(retrieve_list[i]) == NO)) && ((fra[retrieve_list[i]].dir_flag & DIR_DISABLED) == 0) && ((fsa[fra[retrieve_list[i]].fsa_pos].special_flag & HOST_DISABLED) == 0) && ((fsa[fra[retrieve_list[i]].fsa_pos].host_status & STOP_TRANSFER_STAT) == 0) && @@ -1305,7 +1309,8 @@ * a new one. */ if (((fsa[fsa_pos].protocol_options & DISABLE_BURSTING) == 0) && - (fsa[fsa_pos].job_status[connection[qb[qb_pos].connect_pos].job_no].unique_name[2] == 4)) + (fsa[fsa_pos].job_status[connection[qb[qb_pos].connect_pos].job_no].unique_name[2] == 4) && + (fsa[fsa_pos].job_status[connection[qb[qb_pos].connect_pos].job_no].file_name_in_use[MAX_FILENAME_LENGTH - 1] == 1)) { start_new_process = NO; } @@ -2236,26 +2241,35 @@ (current_time > qb[qb_pos].creation_time) && ((current_time - qb[qb_pos].creation_time) > mdb[qb[qb_pos].pos].age_limit)) { - char del_dir[MAX_PATH_LENGTH]; - -#ifdef WITH_ERROR_QUEUE - if (fsa[fsa_pos].host_status & ERROR_QUEUE_SET) + if (qb[qb_pos].msg_name[0] == '\0') { - remove_from_error_queue(mdb[qb[qb_pos].pos].job_id, &fsa[fsa_pos], - fsa_pos, fsa_fd); + system_log(WARN_SIGN, __FILE__, __LINE__, + "No msg_name. Cannot remove job! [qb_pos=%d]", + qb_pos); } + else + { + char del_dir[MAX_PATH_LENGTH]; + +#ifdef WITH_ERROR_QUEUE + if (fsa[fsa_pos].host_status & ERROR_QUEUE_SET) + { + remove_from_error_queue(mdb[qb[qb_pos].pos].job_id, &fsa[fsa_pos], + fsa_pos, fsa_fd); + } #endif - (void)snprintf(del_dir, MAX_PATH_LENGTH, "%s%s%s/%s", - p_work_dir, AFD_FILE_DIR, - OUTGOING_DIR, qb[qb_pos].msg_name); + (void)snprintf(del_dir, MAX_PATH_LENGTH, "%s%s%s/%s", + p_work_dir, AFD_FILE_DIR, + OUTGOING_DIR, qb[qb_pos].msg_name); #ifdef _DELETE_LOG - extract_cus(qb[qb_pos].msg_name, dl.input_time, dl.split_job_counter, - dl.unique_number); - remove_job_files(del_dir, fsa_pos, mdb[qb[qb_pos].pos].job_id, - FD, AGE_OUTPUT, -1); + extract_cus(qb[qb_pos].msg_name, dl.input_time, dl.split_job_counter, + dl.unique_number); + remove_job_files(del_dir, fsa_pos, mdb[qb[qb_pos].pos].job_id, + FD, AGE_OUTPUT, -1); #else - remove_job_files(del_dir, fsa_pos, -1); + remove_job_files(del_dir, fsa_pos, -1); #endif + } ABS_REDUCE(fsa_pos); pid = REMOVED; } @@ -2319,7 +2333,8 @@ for (i = 0; i < fsa[fsa_pos].allowed_transfers; i++) { if ((fsa[fsa_pos].job_status[i].proc_id != -1) && - (fsa[fsa_pos].job_status[i].unique_name[2] == 5)) + (fsa[fsa_pos].job_status[i].unique_name[2] == 5) && + (fsa[fsa_pos].job_status[i].file_name_in_use[MAX_FILENAME_LENGTH - 1] == 1)) { int exec_qb_pos; @@ -2403,64 +2418,82 @@ connection[qb[exec_qb_pos].connect_pos].job_no = i; if (qb[exec_qb_pos].pid > 0) { - if (kill(qb[exec_qb_pos].pid, SIGUSR1) == -1) + if (fsa[fsa_pos].job_status[i].file_name_in_use[MAX_FILENAME_LENGTH - 1] == 1) { - system_log(DEBUG_SIGN, __FILE__, __LINE__, + if (kill(qb[exec_qb_pos].pid, SIGUSR1) == -1) + { + system_log(DEBUG_SIGN, __FILE__, __LINE__, #if SIZEOF_PID_T == 4 - "Failed to send SIGUSR1 to %d : %s", + "Failed to send SIGUSR1 to %d : %s", #else - "Failed to send SIGUSR1 to %lld : %s", + "Failed to send SIGUSR1 to %lld : %s", #endif - (pri_pid_t)qb[exec_qb_pos].pid, strerror(errno)); - } - p_afd_status->burst2_counter++; -#ifdef HAVE_SETPRIORITY - if (add_afd_priority == YES) - { - int sched_priority; - - sched_priority = current_priority + qb[qb_pos].msg_name[MAX_MSG_NAME_LENGTH - 1]; - if (sched_priority > min_sched_priority) - { - sched_priority = min_sched_priority; + (pri_pid_t)qb[exec_qb_pos].pid, strerror(errno)); } - else if (sched_priority < max_sched_priority) - { - sched_priority = max_sched_priority; - } - if (euid != ruid) + p_afd_status->burst2_counter++; +#ifdef HAVE_SETPRIORITY + if (add_afd_priority == YES) { - if (seteuid(euid) == -1) + int sched_priority; + + sched_priority = current_priority + qb[qb_pos].msg_name[MAX_MSG_NAME_LENGTH - 1]; + if (sched_priority > min_sched_priority) { - system_log(WARN_SIGN, __FILE__, __LINE__, - "Failed to set the effective user ID : %s", - strerror(errno)); + sched_priority = min_sched_priority; } - } - if (setpriority(PRIO_PROCESS, qb[qb_pos].pid, - sched_priority) == -1) - { - system_log(DEBUG_SIGN, __FILE__, __LINE__, + else if (sched_priority < max_sched_priority) + { + sched_priority = max_sched_priority; + } + if (euid != ruid) + { + if (seteuid(euid) == -1) + { + system_log(WARN_SIGN, __FILE__, __LINE__, + "Failed to set the effective user ID : %s", + strerror(errno)); + } + } + if (setpriority(PRIO_PROCESS, qb[qb_pos].pid, + sched_priority) == -1) + { + system_log(DEBUG_SIGN, __FILE__, __LINE__, # if SIZEOF_PID_T == 4 - "Failed to setpriority() to %d of process %d : %s", + "Failed to setpriority() to %d of process %d : %s", # else - "Failed to setpriority() to %d of process %lld : %s", + "Failed to setpriority() to %d of process %lld : %s", # endif - sched_priority, - (pri_pid_t)qb[qb_pos].pid, - strerror(errno)); - } - if (euid != ruid) - { - if (seteuid(ruid) == -1) - { - system_log(WARN_SIGN, __FILE__, __LINE__, - "Failed to set back to the real user ID : %s", + sched_priority, + (pri_pid_t)qb[qb_pos].pid, strerror(errno)); } + if (euid != ruid) + { + if (seteuid(ruid) == -1) + { + system_log(WARN_SIGN, __FILE__, __LINE__, + "Failed to set back to the real user ID : %s", + strerror(errno)); + } + } } - } #endif /* HAVE_SETPRIORITY */ + } + else + { + /* Process is no longer ready to receive a signal. */ + /* Restore everything and lets just continue. */ + qb[qb_pos].pid = PENDING; + qb[qb_pos].connect_pos = -1; + connection[qb[exec_qb_pos].connect_pos].job_no = -1; + connection[qb[exec_qb_pos].connect_pos].msg_name[0] = '\0'; + connection[qb[exec_qb_pos].connect_pos].fra_pos = -1; + connection[qb[exec_qb_pos].connect_pos].dir_alias[0] = '\0'; + fsa[fsa_pos].job_status[i].job_id = NO_ID; + fsa[fsa_pos].job_status[i].unique_name[0] = '\0'; + + continue; + } } else { @@ -2506,7 +2539,8 @@ { for (i = 0; i < wait_counter; i++) { - if (fsa[fsa_pos].job_status[other_job_wait_pos[i]].unique_name[2] == 5) + if ((fsa[fsa_pos].job_status[other_job_wait_pos[i]].unique_name[2] == 5) && + (fsa[fsa_pos].job_status[other_job_wait_pos[i]].file_name_in_use[MAX_FILENAME_LENGTH -1] == 1)) { if (qb[other_qb_pos[i]].pid > 0) { @@ -4060,6 +4094,24 @@ } +/*+++++++++++++++++++++++++ check_dir_in_use() ++++++++++++++++++++++++++*/ +static int +check_dir_in_use(int fra_pos) +{ + register int i; + + for (i = 0; i < fsa[fra[fra_pos].fsa_pos].allowed_transfers; i++) + { + if (fsa[fra[fra_pos].fsa_pos].job_status[i].job_id == fra[fra_pos].dir_id) + { + return(YES); + } + } + + return(NO); +} + + /*+++++++++++++++++++++++++ get_afd_config_value() ++++++++++++++++++++++*/ static void get_afd_config_value(void) diff -u --recursive afd-1.4.7-10/src/fd/fd_check_fsa.c afd-1.4.7-11/src/fd/fd_check_fsa.c --- afd-1.4.7-10/src/fd/fd_check_fsa.c 2014-09-22 09:20:06.000000000 +0200 +++ afd-1.4.7-11/src/fd/fd_check_fsa.c 2018-12-09 21:32:46.000000000 +0100 @@ -1,6 +1,6 @@ /* * fd_check_fsa.c - Part of AFD, an automatic file distribution program. - * Copyright (c) 2002 - 2014 Holger Kiehl + * Copyright (c) 2002 - 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 @@ -80,9 +80,11 @@ { if (fsa != NULL) { +#ifdef _IS_THIS_STILL_NEEDED #ifdef _WITH_BURST_2 int i, j; #endif +#endif int gotcha = NO, loops = 0; char *ptr; @@ -98,6 +100,7 @@ gotcha = YES; break; } +#ifdef _IS_THIS_STILL_NEEDED #ifdef _WITH_BURST_2 else { @@ -124,6 +127,7 @@ } } #endif +#endif (void)my_usleep(100000L); } while (loops++ < WAIT_LOOPS); p_afd_status->amg_jobs ^= FD_WAITING; diff -u --recursive afd-1.4.7-10/src/fd/get_remote_file_names_http.c afd-1.4.7-11/src/fd/get_remote_file_names_http.c --- afd-1.4.7-10/src/fd/get_remote_file_names_http.c 2015-11-05 11:28:04.000000000 +0100 +++ afd-1.4.7-11/src/fd/get_remote_file_names_http.c 2018-12-09 21:55:24.000000000 +0100 @@ -1,7 +1,7 @@ /* * get_remote_file_names_http.c - Part of AFD, an automatic file distribution * program. - * Copyright (c) 2006 - 2015 Holger Kiehl + * Copyright (c) 2006 - 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 @@ -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
    
    - Copyright © 1997 - 2013 by H.Kiehl
    + Copyright © 1997 - 2018 by H.Kiehl
    Holger.Kiehl@dwd.de
    - Last updated: 24.11.2013 + Last updated: 12.12.2018
    [red dot]Home