This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree".
The branch, next has been updated via c242db4e5563770e8bd1c8277019c35b4d153b49 (commit) via 616de0b48c411937697424fdbb881ffad27583b0 (commit) via 708f2b7368cc8fbd54a06ca66337ebdcc26b58b4 (commit) via f81fe763540ab588a1dc23cd61390f155d53bf22 (commit) via c8055deb127bc9b6f8f4d5338b602f15f3bc3d23 (commit) via 186c0ddd91ee5bfb3de2e5190b33af78b2e714be (commit) via 3a684078b503fbdc41062c3fb24630f4e20bc461 (commit) via b10612e8baa3e0484310201165a26685c343d9ec (commit) via 7b54c0fb7b53ba16fd5489828826e19363b8b344 (commit) via 25932be3e3c99b13fdb27b85dece9ca499ad5212 (commit) via e1cc1e6cb97b16f18230c8e45f8d69c8f1691377 (commit) via 0f195a5305b1bfb2ea650e4a5079b446bb8ccc74 (commit) via c7d55d7fbda744ba8c187585f1aa271829648695 (commit) via 1242cb0134ee9008b613a56957dbf7fe3f4b6b3d (commit) via d5b6023c32b35333ceb427ed19814b02fe65d8e7 (commit) via 896e882cf32a6f372ce2a1a33043c0b207abb150 (commit) via 86153838235fd78863c51793b5285661710bd583 (commit) via c5f85b115248d828b2f3421e28544b00c2bf419d (commit) via 6317d55c4ae85338b847ffe4e276fd75a076fb1c (commit) via 70e1d5874580cd07a8e38050b80d190ce0805a09 (commit) via 3e10b3de4af03caa2f34f2bfbb50a07f85ec5426 (commit) via 289d7c83748e5724dc34819dda3f6b65855aef0e (commit) via b347830644489c83e476b5e530b6f96db935bd26 (commit) via 480afae717cd44e3d221449cbc681fca443054cf (commit) from 2d85c1fe862d57f5850ec73ee6a9ee5e156ca3e0 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit c242db4e5563770e8bd1c8277019c35b4d153b49 Author: Arne Fitzenreiter arne_f@ipfire.org Date: Fri May 1 19:28:08 2020 +0000
core145: add open vpn changes
Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 616de0b48c411937697424fdbb881ffad27583b0 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Apr 13 11:50:18 2020 +0000
openvpn: Store connection times in ASCII timestamps
This format seems to be a lot easier to handle in SQLite queries.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 708f2b7368cc8fbd54a06ca66337ebdcc26b58b4 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Apr 13 11:50:17 2020 +0000
openvpn: Add metrics script
This script is called when an OpenVPN Roadwarrior client connects or disconnect and logs the start and duration of the session.
This can be used to monitor session duration and data transfer.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit f81fe763540ab588a1dc23cd61390f155d53bf22 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:49 2020 +0200
Langs/en.pl: Add duration.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit c8055deb127bc9b6f8f4d5338b602f15f3bc3d23 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:48 2020 +0200
Add ovpnclients page to log menu.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 186c0ddd91ee5bfb3de2e5190b33af78b2e714be Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Apr 13 09:45:47 2020 +0200
OpenVPN Log: Add connection duration
Signed-off-by: Michael Tremer michael.tremer@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 3a684078b503fbdc41062c3fb24630f4e20bc461 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Apr 13 09:45:46 2020 +0200
OpenVPN: Capitalise some headings and labels
Signed-off-by: Michael Tremer michael.tremer@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit b10612e8baa3e0484310201165a26685c343d9ec Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:45 2020 +0200
ovpnclients.dat: Align traffic values to the right side.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 7b54c0fb7b53ba16fd5489828826e19363b8b344 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:44 2020 +0200
ovpnclients.dat: Fix type in received.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 25932be3e3c99b13fdb27b85dece9ca499ad5212 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:43 2020 +0200
general-functions.pl: formatBytes() Fix computing the correct unit.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit e1cc1e6cb97b16f18230c8e45f8d69c8f1691377 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:42 2020 +0200
ovpnclients.dat: Do not perform DB actions if there is an error message.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 0f195a5305b1bfb2ea650e4a5079b446bb8ccc74 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:41 2020 +0200
ovpnclients.dat: Display error when the to date is not later than the from date.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit c7d55d7fbda744ba8c187585f1aa271829648695 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:40 2020 +0200
ovpnclients.dat: Display a notice if there are no entries.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 1242cb0134ee9008b613a56957dbf7fe3f4b6b3d Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:39 2020 +0200
ovpnclients.dat: Convert timestamps into localtime.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit d5b6023c32b35333ceb427ed19814b02fe65d8e7 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:38 2020 +0200
ovpnclients.dat: Add table header.
The header will be dynamically generated, according the items which will be displayed.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 896e882cf32a6f372ce2a1a33043c0b207abb150 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:37 2020 +0200
Langs: Add strings for disconnect, sent and recieved.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 86153838235fd78863c51793b5285661710bd583 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:36 2020 +0200
ovpnclients.dat: Display traffic details in a human-readable format.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit c5f85b115248d828b2f3421e28544b00c2bf419d Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:35 2020 +0200
general-functions.pl: Add formatBytes() function.
This function can be used to convert an amount of bytes to a humand-readable format.
For example "3221225472" will become "3MB".
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 6317d55c4ae85338b847ffe4e276fd75a076fb1c Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:34 2020 +0200
ovpnclients.dat: Fix hard coded language string
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 70e1d5874580cd07a8e38050b80d190ce0805a09 Author: Michael Tremer michael.tremer@ipfire.org Date: Mon Apr 13 09:45:33 2020 +0200
OpenVPN: Fix query when selecting sessions only
Previously some sessions were selected which did not qualify for the search.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 3e10b3de4af03caa2f34f2bfbb50a07f85ec5426 Author: Stefan Schantl stefan.schantl@ipfire.org Date: Mon Apr 13 09:45:32 2020 +0200
openvpn: Add WUI page for client usage statistics
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 289d7c83748e5724dc34819dda3f6b65855aef0e Author: Arne Fitzenreiter arne_f@ipfire.org Date: Fri May 1 19:10:17 2020 +0000
core145: add coreutils
Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit b347830644489c83e476b5e530b6f96db935bd26 Author: Peter Müller peter.mueller@ipfire.org Date: Sat Apr 11 19:22:58 2020 +0200
coreutils: update to 8.32
Cc: Arne Fitzenreiter arne.fitzenreiter@ipfire.org Signed-off-by: Peter Müller peter.mueller@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
commit 480afae717cd44e3d221449cbc681fca443054cf Author: Peter Müller peter.mueller@ipfire.org Date: Sat Apr 11 19:22:12 2020 +0200
automake: update to 1.16.2
This is required in order to build coreutils 8.32.
Signed-off-by: Peter Müller peter.mueller@ipfire.org Signed-off-by: Arne Fitzenreiter arne_f@ipfire.org
-----------------------------------------------------------------------
Summary of changes: config/cfgroot/general-functions.pl | 25 ++ config/menu/70-log.menu | 6 + config/rootfiles/common/aarch64/stage2 | 1 + config/rootfiles/common/automake | 236 +++++----- config/rootfiles/common/coreutils | 5 +- config/rootfiles/common/stage2 | 1 + config/rootfiles/common/x86_64/stage2 | 1 + .../{oldcore/103 => core/145}/filelists/coreutils | 0 config/rootfiles/core/145/filelists/files | 7 +- html/cgi-bin/logs.cgi/ovpnclients.dat | 374 ++++++++++++++++ html/cgi-bin/ovpnmain.cgi | 5 + langs/en/cgi-bin/en.pl | 10 +- lfs/automake | 7 +- lfs/coreutils | 6 +- lfs/stage2 | 1 + src/patches/automake-1.15_perl_warning.patch | 10 - ...27-i18n-1.patch => coreutils-8.32-i18n-1.patch} | 475 +++++++++------------ src/scripts/openvpn-metrics | 172 ++++++++ 18 files changed, 930 insertions(+), 412 deletions(-) copy config/rootfiles/{oldcore/103 => core/145}/filelists/coreutils (100%) create mode 100755 html/cgi-bin/logs.cgi/ovpnclients.dat delete mode 100644 src/patches/automake-1.15_perl_warning.patch rename src/patches/{coreutils-8.27-i18n-1.patch => coreutils-8.32-i18n-1.patch} (91%) create mode 100755 src/scripts/openvpn-metrics
Difference in files: diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 41a0eac2d..4c7cf09a8 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1261,4 +1261,29 @@ sub get_nameservers () { return &uniq(@nameservers); }
+# Function to format a string containing the amount of bytes to +# something human-readable. +sub formatBytes { + # Private array which contains the units. + my @units = qw(B KB MB GB TB PB); + + my $bytes = shift; + my $unit; + + # Loop through the array of units. + foreach my $element (@units) { + # Assign current processed element to unit. + $unit = $element; + + # Break loop if the bytes are less than the next unit. + last if $bytes < 1024; + + # Divide bytes amount with 1024. + $bytes /= 1024; + } + + # Return the divided and rounded bytes count and the unit. + return sprintf("%.2f %s", $bytes, $unit); +} + 1; diff --git a/config/menu/70-log.menu b/config/menu/70-log.menu index 08973de5a..48c23ccc2 100644 --- a/config/menu/70-log.menu +++ b/config/menu/70-log.menu @@ -43,6 +43,12 @@ 'title' => "$Lang::tr{'ids logs'}", 'enabled' => 1 }; + $sublogs->{'55.ovpnclients'} = { + 'caption' => $Lang::tr{'ovpn rw connection log'}, + 'uri' => '/cgi-bin/logs.cgi/ovpnclients.dat', + 'title' => "$Lang::tr{'ovpn rw connection log'}, + 'enabled' => 1, + }; $sublogs->{'60.urlfilter'} = { 'caption' => $Lang::tr{'urlfilter logs'}, 'uri' => '/cgi-bin/logs.cgi/urlfilter.dat', diff --git a/config/rootfiles/common/aarch64/stage2 b/config/rootfiles/common/aarch64/stage2 index 82e2c20d0..77c8e97b9 100644 --- a/config/rootfiles/common/aarch64/stage2 +++ b/config/rootfiles/common/aarch64/stage2 @@ -132,6 +132,7 @@ usr/local/bin/xt_geoip_update #usr/local/share/zoneinfo #usr/local/src #usr/sbin +usr/sbin/openvpn-metrics usr/sbin/ovpn-ccd-convert usr/sbin/ovpn-collectd-convert #usr/share diff --git a/config/rootfiles/common/automake b/config/rootfiles/common/automake index 21a6720ad..595eaf396 100644 --- a/config/rootfiles/common/automake +++ b/config/rootfiles/common/automake @@ -1,130 +1,130 @@ #usr/bin/aclocal -#usr/bin/aclocal-1.15 +#usr/bin/aclocal-1.16 #usr/bin/automake -#usr/bin/automake-1.15 +#usr/bin/automake-1.16 #usr/share/aclocal -#usr/share/aclocal-1.15 -#usr/share/aclocal-1.15/amversion.m4 -#usr/share/aclocal-1.15/ar-lib.m4 -#usr/share/aclocal-1.15/as.m4 -#usr/share/aclocal-1.15/auxdir.m4 -#usr/share/aclocal-1.15/cond-if.m4 -#usr/share/aclocal-1.15/cond.m4 -#usr/share/aclocal-1.15/depend.m4 -#usr/share/aclocal-1.15/depout.m4 -#usr/share/aclocal-1.15/dmalloc.m4 -#usr/share/aclocal-1.15/extra-recurs.m4 -#usr/share/aclocal-1.15/gcj.m4 -#usr/share/aclocal-1.15/init.m4 -#usr/share/aclocal-1.15/install-sh.m4 -#usr/share/aclocal-1.15/internal -#usr/share/aclocal-1.15/internal/ac-config-macro-dirs.m4 -#usr/share/aclocal-1.15/lead-dot.m4 -#usr/share/aclocal-1.15/lex.m4 -#usr/share/aclocal-1.15/lispdir.m4 -#usr/share/aclocal-1.15/maintainer.m4 -#usr/share/aclocal-1.15/make.m4 -#usr/share/aclocal-1.15/missing.m4 -#usr/share/aclocal-1.15/mkdirp.m4 -#usr/share/aclocal-1.15/obsolete.m4 -#usr/share/aclocal-1.15/options.m4 -#usr/share/aclocal-1.15/prog-cc-c-o.m4 -#usr/share/aclocal-1.15/python.m4 -#usr/share/aclocal-1.15/runlog.m4 -#usr/share/aclocal-1.15/sanity.m4 -#usr/share/aclocal-1.15/silent.m4 -#usr/share/aclocal-1.15/strip.m4 -#usr/share/aclocal-1.15/substnot.m4 -#usr/share/aclocal-1.15/tar.m4 -#usr/share/aclocal-1.15/upc.m4 -#usr/share/aclocal-1.15/vala.m4 +#usr/share/aclocal-1.16 +#usr/share/aclocal-1.16/amversion.m4 +#usr/share/aclocal-1.16/ar-lib.m4 +#usr/share/aclocal-1.16/as.m4 +#usr/share/aclocal-1.16/auxdir.m4 +#usr/share/aclocal-1.16/cond-if.m4 +#usr/share/aclocal-1.16/cond.m4 +#usr/share/aclocal-1.16/depend.m4 +#usr/share/aclocal-1.16/depout.m4 +#usr/share/aclocal-1.16/dmalloc.m4 +#usr/share/aclocal-1.16/extra-recurs.m4 +#usr/share/aclocal-1.16/gcj.m4 +#usr/share/aclocal-1.16/init.m4 +#usr/share/aclocal-1.16/install-sh.m4 +#usr/share/aclocal-1.16/internal +#usr/share/aclocal-1.16/internal/ac-config-macro-dirs.m4 +#usr/share/aclocal-1.16/lead-dot.m4 +#usr/share/aclocal-1.16/lex.m4 +#usr/share/aclocal-1.16/lispdir.m4 +#usr/share/aclocal-1.16/maintainer.m4 +#usr/share/aclocal-1.16/make.m4 +#usr/share/aclocal-1.16/missing.m4 +#usr/share/aclocal-1.16/mkdirp.m4 +#usr/share/aclocal-1.16/obsolete.m4 +#usr/share/aclocal-1.16/options.m4 +#usr/share/aclocal-1.16/prog-cc-c-o.m4 +#usr/share/aclocal-1.16/python.m4 +#usr/share/aclocal-1.16/runlog.m4 +#usr/share/aclocal-1.16/sanity.m4 +#usr/share/aclocal-1.16/silent.m4 +#usr/share/aclocal-1.16/strip.m4 +#usr/share/aclocal-1.16/substnot.m4 +#usr/share/aclocal-1.16/tar.m4 +#usr/share/aclocal-1.16/upc.m4 +#usr/share/aclocal-1.16/vala.m4 #usr/share/aclocal/README -#usr/share/automake-1.15 -#usr/share/automake-1.15/Automake -#usr/share/automake-1.15/Automake/ChannelDefs.pm -#usr/share/automake-1.15/Automake/Channels.pm -#usr/share/automake-1.15/Automake/Condition.pm -#usr/share/automake-1.15/Automake/Config.pm -#usr/share/automake-1.15/Automake/Configure_ac.pm -#usr/share/automake-1.15/Automake/DisjConditions.pm -#usr/share/automake-1.15/Automake/FileUtils.pm -#usr/share/automake-1.15/Automake/General.pm -#usr/share/automake-1.15/Automake/Getopt.pm -#usr/share/automake-1.15/Automake/Item.pm -#usr/share/automake-1.15/Automake/ItemDef.pm -#usr/share/automake-1.15/Automake/Language.pm -#usr/share/automake-1.15/Automake/Location.pm -#usr/share/automake-1.15/Automake/Options.pm -#usr/share/automake-1.15/Automake/Rule.pm -#usr/share/automake-1.15/Automake/RuleDef.pm -#usr/share/automake-1.15/Automake/VarDef.pm -#usr/share/automake-1.15/Automake/Variable.pm -#usr/share/automake-1.15/Automake/Version.pm -#usr/share/automake-1.15/Automake/Wrap.pm -#usr/share/automake-1.15/Automake/XFile.pm -#usr/share/automake-1.15/COPYING -#usr/share/automake-1.15/INSTALL -#usr/share/automake-1.15/am -#usr/share/automake-1.15/am/check.am -#usr/share/automake-1.15/am/check2.am -#usr/share/automake-1.15/am/clean-hdr.am -#usr/share/automake-1.15/am/clean.am -#usr/share/automake-1.15/am/compile.am -#usr/share/automake-1.15/am/configure.am -#usr/share/automake-1.15/am/data.am -#usr/share/automake-1.15/am/dejagnu.am -#usr/share/automake-1.15/am/depend.am -#usr/share/automake-1.15/am/depend2.am -#usr/share/automake-1.15/am/distdir.am -#usr/share/automake-1.15/am/footer.am -#usr/share/automake-1.15/am/header-vars.am -#usr/share/automake-1.15/am/header.am -#usr/share/automake-1.15/am/inst-vars.am -#usr/share/automake-1.15/am/install.am -#usr/share/automake-1.15/am/java.am -#usr/share/automake-1.15/am/lang-compile.am -#usr/share/automake-1.15/am/lex.am -#usr/share/automake-1.15/am/library.am -#usr/share/automake-1.15/am/libs.am -#usr/share/automake-1.15/am/libtool.am -#usr/share/automake-1.15/am/lisp.am -#usr/share/automake-1.15/am/ltlib.am -#usr/share/automake-1.15/am/ltlibrary.am -#usr/share/automake-1.15/am/mans-vars.am -#usr/share/automake-1.15/am/mans.am -#usr/share/automake-1.15/am/program.am -#usr/share/automake-1.15/am/progs.am -#usr/share/automake-1.15/am/python.am -#usr/share/automake-1.15/am/remake-hdr.am -#usr/share/automake-1.15/am/scripts.am -#usr/share/automake-1.15/am/subdirs.am -#usr/share/automake-1.15/am/tags.am -#usr/share/automake-1.15/am/texi-vers.am -#usr/share/automake-1.15/am/texibuild.am -#usr/share/automake-1.15/am/texinfos.am -#usr/share/automake-1.15/am/vala.am -#usr/share/automake-1.15/am/yacc.am -#usr/share/automake-1.15/ar-lib -#usr/share/automake-1.15/compile -#usr/share/automake-1.15/config.guess -#usr/share/automake-1.15/config.sub -#usr/share/automake-1.15/depcomp -#usr/share/automake-1.15/install-sh -#usr/share/automake-1.15/mdate-sh -#usr/share/automake-1.15/missing -#usr/share/automake-1.15/mkinstalldirs -#usr/share/automake-1.15/py-compile -#usr/share/automake-1.15/tap-driver.sh -#usr/share/automake-1.15/test-driver -#usr/share/automake-1.15/texinfo.tex -#usr/share/automake-1.15/ylwrap +#usr/share/automake-1.16 +#usr/share/automake-1.16/Automake +#usr/share/automake-1.16/Automake/ChannelDefs.pm +#usr/share/automake-1.16/Automake/Channels.pm +#usr/share/automake-1.16/Automake/Condition.pm +#usr/share/automake-1.16/Automake/Config.pm +#usr/share/automake-1.16/Automake/Configure_ac.pm +#usr/share/automake-1.16/Automake/DisjConditions.pm +#usr/share/automake-1.16/Automake/FileUtils.pm +#usr/share/automake-1.16/Automake/General.pm +#usr/share/automake-1.16/Automake/Getopt.pm +#usr/share/automake-1.16/Automake/Item.pm +#usr/share/automake-1.16/Automake/ItemDef.pm +#usr/share/automake-1.16/Automake/Language.pm +#usr/share/automake-1.16/Automake/Location.pm +#usr/share/automake-1.16/Automake/Options.pm +#usr/share/automake-1.16/Automake/Rule.pm +#usr/share/automake-1.16/Automake/RuleDef.pm +#usr/share/automake-1.16/Automake/VarDef.pm +#usr/share/automake-1.16/Automake/Variable.pm +#usr/share/automake-1.16/Automake/Version.pm +#usr/share/automake-1.16/Automake/Wrap.pm +#usr/share/automake-1.16/Automake/XFile.pm +#usr/share/automake-1.16/COPYING +#usr/share/automake-1.16/INSTALL +#usr/share/automake-1.16/am +#usr/share/automake-1.16/am/check.am +#usr/share/automake-1.16/am/check2.am +#usr/share/automake-1.16/am/clean-hdr.am +#usr/share/automake-1.16/am/clean.am +#usr/share/automake-1.16/am/compile.am +#usr/share/automake-1.16/am/configure.am +#usr/share/automake-1.16/am/data.am +#usr/share/automake-1.16/am/dejagnu.am +#usr/share/automake-1.16/am/depend.am +#usr/share/automake-1.16/am/depend2.am +#usr/share/automake-1.16/am/distdir.am +#usr/share/automake-1.16/am/footer.am +#usr/share/automake-1.16/am/header-vars.am +#usr/share/automake-1.16/am/header.am +#usr/share/automake-1.16/am/inst-vars.am +#usr/share/automake-1.16/am/install.am +#usr/share/automake-1.16/am/java.am +#usr/share/automake-1.16/am/lang-compile.am +#usr/share/automake-1.16/am/lex.am +#usr/share/automake-1.16/am/library.am +#usr/share/automake-1.16/am/libs.am +#usr/share/automake-1.16/am/libtool.am +#usr/share/automake-1.16/am/lisp.am +#usr/share/automake-1.16/am/ltlib.am +#usr/share/automake-1.16/am/ltlibrary.am +#usr/share/automake-1.16/am/mans-vars.am +#usr/share/automake-1.16/am/mans.am +#usr/share/automake-1.16/am/program.am +#usr/share/automake-1.16/am/progs.am +#usr/share/automake-1.16/am/python.am +#usr/share/automake-1.16/am/remake-hdr.am +#usr/share/automake-1.16/am/scripts.am +#usr/share/automake-1.16/am/subdirs.am +#usr/share/automake-1.16/am/tags.am +#usr/share/automake-1.16/am/texi-vers.am +#usr/share/automake-1.16/am/texibuild.am +#usr/share/automake-1.16/am/texinfos.am +#usr/share/automake-1.16/am/vala.am +#usr/share/automake-1.16/am/yacc.am +#usr/share/automake-1.16/ar-lib +#usr/share/automake-1.16/compile +#usr/share/automake-1.16/config.guess +#usr/share/automake-1.16/config.sub +#usr/share/automake-1.16/depcomp +#usr/share/automake-1.16/install-sh +#usr/share/automake-1.16/mdate-sh +#usr/share/automake-1.16/missing +#usr/share/automake-1.16/mkinstalldirs +#usr/share/automake-1.16/py-compile +#usr/share/automake-1.16/tap-driver.sh +#usr/share/automake-1.16/test-driver +#usr/share/automake-1.16/texinfo.tex +#usr/share/automake-1.16/ylwrap #usr/share/doc/automake #usr/share/doc/automake/amhello-1.0.tar.gz #usr/share/info/automake-history.info #usr/share/info/automake.info #usr/share/info/automake.info-1 #usr/share/info/automake.info-2 -#usr/share/man/man1/aclocal-1.15.1 +#usr/share/man/man1/aclocal-1.16.1 #usr/share/man/man1/aclocal.1 -#usr/share/man/man1/automake-1.15.1 +#usr/share/man/man1/automake-1.16.1 #usr/share/man/man1/automake.1 diff --git a/config/rootfiles/common/coreutils b/config/rootfiles/common/coreutils index da86e9b7e..d764f7bd5 100644 --- a/config/rootfiles/common/coreutils +++ b/config/rootfiles/common/coreutils @@ -271,13 +271,10 @@ usr/sbin/chroot #usr/share/man/man1/head.1 #usr/share/man/man1/hostid.1 #usr/share/man/man1/id.1 -#usr/share/man/man1/install.1 #usr/share/man/man1/join.1 #usr/share/man/man1/link.1 #usr/share/man/man1/logname.1 -#usr/share/man/man1/ls.1 #usr/share/man/man1/md5sum.1 -#usr/share/man/man1/mknod.1 #usr/share/man/man1/mktemp.1 #usr/share/man/man1/nice.1 #usr/share/man/man1/nl.1 @@ -295,7 +292,6 @@ usr/sbin/chroot #usr/share/man/man1/pwd.1 #usr/share/man/man1/readlink.1 #usr/share/man/man1/realpath.1 -#usr/share/man/man1/rm.1 #usr/share/man/man1/runcon.1 #usr/share/man/man1/seq.1 #usr/share/man/man1/sha1sum.1 @@ -329,6 +325,7 @@ usr/sbin/chroot #usr/share/man/man1/unlink.1 #usr/share/man/man1/uptime.1 #usr/share/man/man1/users.1 +#usr/share/man/man1/vdir.1 #usr/share/man/man1/wc.1 #usr/share/man/man1/who.1 #usr/share/man/man1/whoami.1 diff --git a/config/rootfiles/common/stage2 b/config/rootfiles/common/stage2 index 8067df39b..f56439335 100644 --- a/config/rootfiles/common/stage2 +++ b/config/rootfiles/common/stage2 @@ -132,6 +132,7 @@ usr/local/bin/xt_geoip_update #usr/local/share/zoneinfo #usr/local/src #usr/sbin +usr/sbin/openvpn-metrics usr/sbin/ovpn-ccd-convert usr/sbin/ovpn-collectd-convert #usr/share diff --git a/config/rootfiles/common/x86_64/stage2 b/config/rootfiles/common/x86_64/stage2 index 026532b8f..2197ac4ac 100644 --- a/config/rootfiles/common/x86_64/stage2 +++ b/config/rootfiles/common/x86_64/stage2 @@ -134,6 +134,7 @@ usr/local/bin/xt_geoip_update #usr/local/share/zoneinfo #usr/local/src #usr/sbin +usr/sbin/openvpn-metrics usr/sbin/ovpn-ccd-convert usr/sbin/ovpn-collectd-convert #usr/share diff --git a/config/rootfiles/core/145/filelists/coreutils b/config/rootfiles/core/145/filelists/coreutils new file mode 120000 index 000000000..7351ed2cf --- /dev/null +++ b/config/rootfiles/core/145/filelists/coreutils @@ -0,0 +1 @@ +../../../common/coreutils \ No newline at end of file diff --git a/config/rootfiles/core/145/filelists/files b/config/rootfiles/core/145/filelists/files index e9bb2f47c..9fdd1ea25 100644 --- a/config/rootfiles/core/145/filelists/files +++ b/config/rootfiles/core/145/filelists/files @@ -6,6 +6,11 @@ var/ipfire/langs etc/rc.d/init.d/firewall etc/rc.d/init.d/vnstat opt/pakfire/lib/functions.pl -usr/local/bin/makegraphs +srv/web/ipfire/cgi-bin/logs.cgi/ovpnclients.dat +srv/web/ipfire/cgi-bin/ovpnmain.cgi srv/web/ipfire/cgi-bin/system.cgi srv/web/ipfire/cgi-bin/traffic.cgi +usr/local/bin/makegraphs +usr/sbin/openvpn-metrics +var/ipfire/menu.d/70-log.menu +var/ipfire/general-functions.pl diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat new file mode 100755 index 000000000..2009990ec --- /dev/null +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -0,0 +1,374 @@ +#!/usr/bin/perl +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2020 IPFire Team info@ipfire.org # +# # +# 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 # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see http://www.gnu.org/licenses/. # +# # +############################################################################### + +use strict; +use POSIX(); +use DBI; + +# enable only the following on debugging purpose +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", %mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", %color); + +# Path and file of the OVPN connections database. +my $database = "/var/ipfire/ovpn/clients.db"; + +my %cgiparams=(); +my %logsettings=(); +my %ovpnsettings=(); + +my $errormessage=''; + +# Hash wich contains the month numbers and the translated names for easy access. +my %monthhash = ( + "1" => "$Lang::tr{'january'}", + "2" => "$Lang::tr{'february'}", + "3" => "$Lang::tr{'march'}", + "4" => "$Lang::tr{'april'}", + "5" => "$Lang::tr{'may'}", + "6" => "$Lang::tr{'june'}", + "7" => "$Lang::tr{'july'}", + "8" => "$Lang::tr{'august'}", + "9" => "$Lang::tr{'september'}", + "10" => "$Lang::tr{'october'}", + "11" => "$Lang::tr{'november'}", + "12" => "$Lang::tr{'december'}" +); + +# Get current time. +my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime(time); + +# Adjust month, because Jan starts as month "0". +$month = $month+1; + +# Adjust year number. +$year = $year+1900; + +# Assign default vaules. +$cgiparams{'FROM_DAY'} = $mday; +$cgiparams{'FROM_MONTH'} = $month; +$cgiparams{'FROM_YEAR'} = $year; +$cgiparams{'TO_DAY'} = $mday; +$cgiparams{'TO_MONTH'} = $month; +$cgiparams{'TO_YEAR'} = $year; + +&Header::getcgihash(%cgiparams); + +# Read-in OpenVPN settings and connections. +&General::readhasharray("${General::swroot}/ovpn/ovpnconfig", %ovpnsettings); + +# Init DB Module and connect to the database. +my $database_handle = DBI->connect("DBI:SQLite:dbname=$database", "", "", { RaiseError => 1 }); + +# Generate datestrings for SQL queries. +my $from_datestring = sprintf '%04d-%02d-%02d', ($cgiparams{"FROM_YEAR"}, $cgiparams{"FROM_MONTH"}, $cgiparams{"FROM_DAY"}); +my $to_datestring = sprintf '%04d-%02d-%02d', ($cgiparams{"TO_YEAR"}, $cgiparams{"TO_MONTH"}, $cgiparams{"TO_DAY"}); + +# Check if the to datestring is later than the from datestring. +unless ($to_datestring ge $from_datestring) { + $errormessage = "$Lang::tr{'error the to date has to be later than the from date'}"; +} + +my $database_query = qq( + SELECT + common_name, SUM( + STRFTIME('%s', ( + CASE + WHEN DATETIME(COALESCE(disconnected_at, CURRENT_TIMESTAMP), 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds') + THEN DATETIME(COALESCE(disconnected_at, CURRENT_TIMESTAMP), 'localtime') + ELSE DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds') + END + ), 'utc') - + STRFTIME('%s', ( + CASE + WHEN DATETIME(connected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day') + THEN DATETIME(connected_at, 'localtime') + ELSE DATETIME('$from_datestring', 'localtime', 'start of day') + END + ), 'utc') + ) AS duration + FROM sessions + WHERE + ( + disconnected_at IS NULL + OR + DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day') + ) + AND + DATETIME(connected_at, 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds') + GROUP BY common_name + ORDER BY common_name, duration DESC; +); + +if ($cgiparams{'CONNECTION_NAME'}) { + $database_query = qq( + SELECT common_name, DATETIME(connected_at, 'localtime'), DATETIME(disconnected_at, 'localtime'), bytes_received, bytes_sent, + STRFTIME('%s', DATETIME(disconnected_at)) - STRFTIME('%s', DATETIME(connected_at)) AS duration FROM sessions + WHERE + common_name = '$cgiparams{"CONNECTION_NAME"}' + AND ( + DATETIME(disconnected_at, 'localtime') > DATETIME('$from_datestring', 'localtime', 'start of day') + AND + DATETIME(connected_at, 'localtime') < DATETIME('$to_datestring', 'localtime', 'start of day', '+86399 seconds') + ) + ORDER BY connected_at; + ); +} + +my $statement_handle; +my $database_return_value; + +# Only process SQL actions if there is no error message. +unless ($errormessage) { + # Prepare SQL statement. + $statement_handle = $database_handle->prepare($database_query); + + # Execute SQL statement and get retun value if any error happened. + $database_return_value = $statement_handle->execute(); +} + +# If an error has been returned, assign it to the errorstring value for displaying. +if($database_return_value < 0) { + $errormessage = "$DBI::errstr"; +} + +&Header::showhttpheaders(); + +&Header::openpage($Lang::tr{'ovpn rw connection log'}, 1, ''); + +&Header::openbigbox('100%', 'left', '', $errormessage); + +if ($errormessage) { + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "<font class='base'>$errormessage </font>\n"; + &Header::closebox(); +} + +&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:"); + +print "<form method='post' action="$ENV{'SCRIPT_NAME'}">\n"; +print "<table width='100%'>\n"; + print "<tr>\n"; + print "<td class='base' colspan='2'><b>$Lang::tr{'from'}:</b></td>\n"; + print "</tr>\n"; + + print "<tr>\n"; + print "<td class='base'>$Lang::tr{'day'}: \n"; + &generate_select("FROM_DAY", "days"); + print "</td>\n"; + + print "<td class='base'>$Lang::tr{'month'}: \n"; + &generate_select("FROM_MONTH", "months"); + print "</td>\n"; + + print "<td class='base'>$Lang::tr{'year'}: \n"; + &generate_select("FROM_YEAR", "years"); + print "</td>\n"; + print "</tr>\n"; + + print "<tr><td><br></td></tr>\n"; + + print "<tr>\n"; + print "<td class='base' colspan='2'><b>$Lang::tr{'to'}:</b></td>\n"; + print "</tr>\n"; + + print "<tr>\n"; + print "<td class='base'>$Lang::tr{'day'}: \n"; + &generate_select("TO_DAY", "days"); + print "</td>\n"; + + print "<td class='base'>$Lang::tr{'month'}: \n"; + &generate_select("TO_MONTH", "months"); + print "</td>\n"; + + print "<td class='base'>$Lang::tr{'year'}: \n"; + &generate_select("TO_YEAR", "years"); + print "</td>\n"; + print "</tr>\n"; + + print "<tr><td><br></td></tr>\n"; + + print "<tr>\n"; + print "<td class='base'>$Lang::tr{'ovpn connection name'}:</td>\n"; + print "<td class='base' colspan='2'>\n"; + + print "<select name='CONNECTION_NAME' size='1'>\n"; + print "<option value=''>$Lang::tr{'all'}</option>\n"; + + # Loop through all configured OpenVPN connections and sort them by name. + foreach my $key (sort { $ovpnsettings{$a}[2] cmp $ovpnsettings{$b}[2] } keys %ovpnsettings) { + my $connection_name = $ovpnsettings{$key}[2]; + my $selected; + + # Skip all non roadwarrior connections. + next unless ($ovpnsettings{"$key"}[3] eq "host"); + + # Check and mark the selected one. + if ($connection_name eq "$cgiparams{'CONNECTION_NAME'}") { + $selected = "selected"; + } + + print "<option value='$connection_name' $selected>$connection_name</option>\n"; + } + + print "</select>\n"; + print "</td>\n"; + print "</tr>\n"; + + print "<tr>\n"; + print "<td width='100%' align='right' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'update'}'></td>\n"; + print "</tr>\n"; +print "</table>\n"; +print "</form>\n"; + +&Header::closebox(); + +&Header::openbox('100%', 'left', $Lang::tr{'log'}); + +my $lines = 0; + +print "<table width='100%' class='tbl'>"; + +my $col = "bgcolor='$color{'color20'}'"; + + print "<tr>\n"; + print "<td width='40%' $col><b>$Lang::tr{'ovpn connection name'}</b></td>\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "<td width='15%' $col><b>$Lang::tr{'connected'}</b></td>\n"; + print "<td width='15%' $col><b>$Lang::tr{'disconnected'}</b></td>\n"; + print "<td width='10%' align='right' $col><b>$Lang::tr{'duration'}</b></td>\n"; + print "<td width='10%' align='right' $col><b>$Lang::tr{'received'}</b></td>\n"; + print "<td width='10%' align='right' $col><b>$Lang::tr{'sent'}</b></td>\n"; + } else { + print "<td $col><b>$Lang::tr{'total connection time'}</b>\n"; + } + + print "</tr>\n"; + +# Only try to fetch the DB items if there is no error message. +unless ($errormessage) { + while(my @row = $statement_handle->fetchrow_array()) { + # Assign some nice to read variable names for the DB fields. + my $connection_name = $row[0]; + my $connection_open_time = $row[1]; + my $connection_close_time = $row[2]; + my $connection_bytes_recieved = &General::formatBytes($row[3]); + my $connection_bytes_sent = &General::formatBytes($row[4]); + my $duration = &General::format_time($row[5]); + + # Colorize columns. + if ($lines % 2) { + $col="bgcolor='$color{'color20'}'"; + } else { + $col="bgcolor='$color{'color22'}'"; + } + + print "<tr>\n"; + print "<td width='40%' $col>$connection_name</td>\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "<td width='15%' $col>$connection_open_time</td>\n"; + print "<td width='15%' $col>$connection_close_time</td>\n"; + print "<td width='10%' align='right' $col>$duration</td>\n"; + print "<td width='10%' align='right' $col>$connection_bytes_recieved</td>\n"; + print "<td width='10%' align='right' $col>$connection_bytes_sent</td>\n"; + } else { + # Convert total connection time into human-readable format. + my $total_time = &General::format_time($row[1]); + + print "<td $col>$total_time</td>\n"; + } + + print "</tr>\n"; + + # Increase lines count. + $lines++; + } +} + +# If nothing has been fetched, the amount of lines is still zero. +# In this case display a hint about no data. +unless ($lines) { + print "<tr><td bgcolor='$color{'color22'}' colspan='6' align='center'>$Lang::tr{'no entries'}</td></tr>\n"; +} + +print "</table><br>\n"; + +&Header::closebox(); + +# Close database connection. +$database_handle->disconnect(); + +&Header::closebigbox(); + +&Header::closepage(); + +# +## Function for easy select generation. +# +sub generate_select($$) { + my ($name, $type) = @_; + + my $start = 1; + my $stop; + + # Adjust start and stop by the given type. + if ($type eq "days") { + $stop = 31; + } elsif ($type eq "months") { + $stop = 12; + } elsif ($type = "years") { + $stop = $year; + $start = $stop - 10; + } + + # Print select HTML tag. + print "<select name='$name' size='1'>\n"; + + # Loop through the range. + for ( my $i = $start; $i <= $stop; $i++) { + print "\t<option "; + + # Check and select the current processed item. + if ($i == $cgiparams{$name}) { + print 'selected="selected" '; + } + + # Check if months are processed and display the corresponding names. + if ($type eq "months") { + print "value='$i'>$monthhash{$i}</option>\n"; + } else { + print "value='$i'>$i</option>\n"; + } + } + + # Close select HTML tag. + print "</select>\n\n"; +} diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 00ecd77a0..734cc0bfa 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -372,6 +372,11 @@ sub writeserverconf { } else { print CONF "verb 3\n"; } + + print CONF "# Log clients connecting/disconnecting\n"; + print CONF "client-connect "/usr/sbin/openvpn-metrics client-connect"\n"; + print CONF "client-disconnect "/usr/sbin/openvpn-metrics client-disconnect"\n"; + # Print server.conf.local if entries exist to server.conf if ( !-z $local_serverconf && $sovpnsettings{'ADDITIONAL_CONFIGS'} eq 'on') { open (LSC, "$local_serverconf"); diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index fb911b914..bb918138a 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -821,6 +821,7 @@ 'directory writeable' => 'directory writeable', 'disabled' => 'disabled', 'disconnect' => 'OVPN Stop / Disconnect', +'disconnected' => 'Disconnected', 'disconnects' => 'Disconnects', 'disk access per' => 'Disk Access per', 'disk usage' => 'Disk usage', @@ -936,6 +937,7 @@ 'duplicate ip bold' => 'Duplicate addresses are in <b>bold</b>', 'duplicate mac' => 'Duplicate MAC address entered', 'duplicate name' => 'That name is already being used, please choose another.', +'duration' => 'Duration', 'dyn dns source choice' => 'Dynamic DNS provider(s) will receive an IP address for this IPFire from:', 'dynamic dns' => 'Dynamic DNS', 'dynamic dns client' => 'Dynamic DNS Client', @@ -1014,6 +1016,7 @@ 'error config' => 'Could not open /var/ipfire/ovpn/config/ZERINA.ovpn !', 'error external access' => 'Could not open /var/ipfire/xtaccess/config (external acccess could not be granted)!', 'error messages' => 'Error messages', +'error the to date has to be later than the from date' => 'The to date has to be later than the from date!', 'esp encryption' => 'ESP Encryption:', 'esp grouptype' => 'ESP Grouptype:', 'esp integrity' => 'ESP Integrity:', @@ -1803,6 +1806,7 @@ 'no alcatelusb firmware' => 'No Alcatel USB firmware. Please upload.', 'no cfg upload' => 'No data was uploaded', 'no dhcp lease' => 'No DHCP lease has been acquired', +'no entries' => 'No entries at the moment.', 'no eciadsl synch.bin file' => 'No ECI ADSL synch.bin file. Please upload.', 'no filter pass' => 'Enter the standard class for non-filtered packets.', 'no fritzdsl driver' => 'No Fritz!DSL driver. Please upload.', @@ -1919,6 +1923,7 @@ 'ovpn' => 'OpenVPN', 'ovpn add conf' => 'Additional configuration', 'ovpn con stat' => 'OpenVPN Connection Statistics', +'ovpn connection name' => 'Connection Name', 'ovpn config' => 'OVPN-Config', 'ovpn crypt options' => 'Cryptographic options', 'ovpn device' => 'OpenVPN device:', @@ -1951,6 +1956,7 @@ 'ovpn reneg sec' => 'Session key lifetime:', 'ovpn routes push' => 'Routes (one per line) e.g. 192.168.10.0/255.255.255.0 192.168.20.0/24', 'ovpn routes push options' => 'Route push options', +'ovpn rw connection log' => 'OpenVPN Roadwarrior Connections Log', 'ovpn server status' => 'Current OpenVPN server status:', 'ovpn subnet' => 'OpenVPN subnet:', 'ovpn subnet is invalid' => 'OpenVPN subnet is invalid.', @@ -2105,6 +2111,7 @@ 'reboot sure' => 'Are you sure that you want to reboot?', 'rebooting' => 'Rebooting', 'rebooting ipfire' => 'Rebooting IPFire', +'received' => 'Received', 'reconnect' => 'Reconnect', 'reconnection' => 'Reconnection', 'red' => 'Internet', @@ -2191,6 +2198,7 @@ 'send cr' => 'ISP requires Carriage Return:', 'send email notification' => 'Enabled, send e-mail notification', 'send test mail' => 'Send Teste-mail', +'sent' => 'Sent', 'september' => 'September', 'serial' => 'Serial', 'server reserved' => 'The connection name server is reserved and not allowed', @@ -2443,7 +2451,7 @@ 'tor traffic limit soft' => 'Traffic limit almost reached. Not accepting any new connections.', 'tor traffic read written' => 'Total traffic (read/written)', 'tor use exit nodes' => 'Use only these exit nodes (one per line)', -'total connection time' => 'Total connection time', +'total connection time' => 'Total Connection Time', 'total hits for log section' => 'Total hits for log section', 'traffic back' => 'Back', 'traffic calc time' => 'Time of calculation', diff --git a/lfs/automake b/lfs/automake index 26d17f540..0dcb58983 100644 --- a/lfs/automake +++ b/lfs/automake @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # +# Copyright (C) 2007-2020 IPFire Team info@ipfire.org # # # # 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,7 +24,7 @@
include Config
-VER = 1.15 +VER = 1.16.2
THISAPP = automake-$(VER) DL_FILE = $(THISAPP).tar.xz @@ -48,7 +48,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 9a1ddb0e053474d9d1105cfe39b0c48d +$(DL_FILE)_MD5 = 6cb234c86f3f984df29ce758e6d0d1d7
install : $(TARGET)
@@ -78,7 +78,6 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar Jxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/automake-1.15_perl_warning.patch cd $(DIR_APP) && ./configure --prefix=$(PREFIX) cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install diff --git a/lfs/coreutils b/lfs/coreutils index 90af0cc87..1289a8108 100644 --- a/lfs/coreutils +++ b/lfs/coreutils @@ -24,7 +24,7 @@
include Config
-VER = 8.31 +VER = 8.32
THISAPP = coreutils-$(VER) DL_FILE = $(THISAPP).tar.xz @@ -63,7 +63,7 @@ objects =$(DL_FILE)
$(DL_FILE)= $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 0009a224d8e288e8ec406ef0161f9293 +$(DL_FILE)_MD5 = 022042695b7d5bcf1a93559a9735e668
install : $(TARGET)
@@ -94,7 +94,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/coreutils-8.27-uname-1.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/coreutils-8.27-i18n-1.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/coreutils-8.32-i18n-1.patch cd $(DIR_APP) && FORCE_UNSAFE_CONFIGURE=1 && ./configure $(CONFIGURE_OPTIONS) cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install diff --git a/lfs/stage2 b/lfs/stage2 index d6012b85e..2863d6b69 100644 --- a/lfs/stage2 +++ b/lfs/stage2 @@ -105,6 +105,7 @@ endif done
# Move script to correct place. + mv -vf /usr/local/bin/openvpn-metrics /usr/sbin/ mv -vf /usr/local/bin/ovpn-ccd-convert /usr/sbin/ mv -vf /usr/local/bin/ovpn-collectd-convert /usr/sbin/ mv -vf /usr/local/bin/captive-cleanup /usr/bin/ diff --git a/src/patches/automake-1.15_perl_warning.patch b/src/patches/automake-1.15_perl_warning.patch deleted file mode 100644 index 9a031e8da..000000000 --- a/src/patches/automake-1.15_perl_warning.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- automake-1.15/bin/automake.in -+++ automake-1.15/bin/automake.in -@@ -3878,7 +3878,7 @@ - sub substitute_ac_subst_variables - { - my ($text) = @_; -- $text =~ s/${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; -+ $text =~ s/${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; - return $text; - } diff --git a/src/patches/coreutils-8.27-i18n-1.patch b/src/patches/coreutils-8.32-i18n-1.patch similarity index 91% rename from src/patches/coreutils-8.27-i18n-1.patch rename to src/patches/coreutils-8.32-i18n-1.patch index 4318905c6..63ebb46ce 100644 --- a/src/patches/coreutils-8.27-i18n-1.patch +++ b/src/patches/coreutils-8.32-i18n-1.patch @@ -1,15 +1,15 @@ -Submitted by: DJ Lucas (dj_AT_linuxfromscratch_DOT_org) -Date: 2017-03-12 -Initial Package Version: 8.27 +Submitted by: Xi Ruoyao xry111@mengyan1223.wang +Date: 2020-03-08 +Initial Package Version: 8.32 Upstream Status: Rejected Origin: Based on Fedora's i18n patches at - http://pkgs.fedoraproject.org/cgit/rpms/coreutils.git/tree/ + https://src.fedoraproject.org/rpms/coreutils/ Description: Fixes i18n issues with various Coreutils programs
-diff -Naurp coreutils-8.27-orig/bootstrap.conf coreutils-8.27/bootstrap.conf ---- coreutils-8.27-orig/bootstrap.conf 2017-03-07 23:34:06.000000000 -0600 -+++ coreutils-8.27/bootstrap.conf 2017-03-11 23:47:38.068058445 -0600 -@@ -152,6 +152,7 @@ gnulib_modules=" +diff -Naurp coreutils-8.32.orig/bootstrap.conf coreutils-8.32/bootstrap.conf +--- coreutils-8.32.orig/bootstrap.conf 2020-02-25 22:25:43.000000000 +0800 ++++ coreutils-8.32/bootstrap.conf 2020-03-08 12:10:27.733236560 +0800 +@@ -154,6 +154,7 @@ gnulib_modules=" maintainer-makefile malloc-gnu manywarnings @@ -17,10 +17,10 @@ diff -Naurp coreutils-8.27-orig/bootstrap.conf coreutils-8.27/bootstrap.conf mbrlen mbrtowc mbsalign -diff -Naurp coreutils-8.27-orig/configure.ac coreutils-8.27/configure.ac ---- coreutils-8.27-orig/configure.ac 2017-02-26 08:52:29.000000000 -0600 -+++ coreutils-8.27/configure.ac 2017-03-11 23:47:38.068058445 -0600 -@@ -429,6 +429,8 @@ fi +diff -Naurp coreutils-8.32.orig/configure.ac coreutils-8.32/configure.ac +--- coreutils-8.32.orig/configure.ac 2020-02-28 05:45:34.000000000 +0800 ++++ coreutils-8.32/configure.ac 2020-03-08 12:10:27.733236560 +0800 +@@ -446,6 +446,8 @@ fi # I'm leaving it here for now. This whole thing needs to be modernized... gl_WINSIZE_IN_PTEM
@@ -29,9 +29,9 @@ diff -Naurp coreutils-8.27-orig/configure.ac coreutils-8.27/configure.ac gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ -diff -Naurp coreutils-8.27-orig/lib/linebuffer.h coreutils-8.27/lib/linebuffer.h ---- coreutils-8.27-orig/lib/linebuffer.h 2017-01-01 16:35:38.000000000 -0600 -+++ coreutils-8.27/lib/linebuffer.h 2017-03-11 23:47:13.089286391 -0600 +diff -Naurp coreutils-8.32.orig/lib/linebuffer.h coreutils-8.32/lib/linebuffer.h +--- coreutils-8.32.orig/lib/linebuffer.h 2020-01-01 22:14:23.000000000 +0800 ++++ coreutils-8.32/lib/linebuffer.h 2020-03-08 12:10:27.733236560 +0800 @@ -21,6 +21,11 @@
# include <stdio.h> @@ -54,19 +54,19 @@ diff -Naurp coreutils-8.27-orig/lib/linebuffer.h coreutils-8.27/lib/linebuffer.h };
/* Initialize linebuffer LINEBUFFER for use. */ -diff -Naurp coreutils-8.27-orig/lib/mbfile.c coreutils-8.27/lib/mbfile.c ---- coreutils-8.27-orig/lib/mbfile.c 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/lib/mbfile.c 2017-03-11 23:47:38.069058397 -0600 +diff -Naurp coreutils-8.32.orig/lib/mbfile.c coreutils-8.32/lib/mbfile.c +--- coreutils-8.32.orig/lib/mbfile.c 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/lib/mbfile.c 2020-03-08 12:10:27.733236560 +0800 @@ -0,0 +1,3 @@ +#include <config.h> +#define MBFILE_INLINE _GL_EXTERN_INLINE +#include "mbfile.h" -diff -Naurp coreutils-8.27-orig/lib/mbfile.h coreutils-8.27/lib/mbfile.h ---- coreutils-8.27-orig/lib/mbfile.h 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/lib/mbfile.h 2017-03-11 23:47:38.069058397 -0600 +diff -Naurp coreutils-8.32.orig/lib/mbfile.h coreutils-8.32/lib/mbfile.h +--- coreutils-8.32.orig/lib/mbfile.h 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/lib/mbfile.h 2020-03-08 12:10:27.734236560 +0800 @@ -0,0 +1,255 @@ +/* Multibyte character I/O: macros for multi-byte encodings. -+ Copyright (C) 2001, 2005, 2009-2017 Free Software Foundation, Inc. ++ Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc. + + 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 @@ -320,12 +320,12 @@ diff -Naurp coreutils-8.27-orig/lib/mbfile.h coreutils-8.27/lib/mbfile.h +_GL_INLINE_HEADER_BEGIN + +#endif /* _MBFILE_H */ -diff -Naurp coreutils-8.27-orig/m4/mbfile.m4 coreutils-8.27/m4/mbfile.m4 ---- coreutils-8.27-orig/m4/mbfile.m4 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/m4/mbfile.m4 2017-03-11 23:47:38.070058349 -0600 +diff -Naurp coreutils-8.32.orig/m4/mbfile.m4 coreutils-8.32/m4/mbfile.m4 +--- coreutils-8.32.orig/m4/mbfile.m4 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/m4/mbfile.m4 2020-03-08 12:10:27.734236560 +0800 @@ -0,0 +1,14 @@ +# mbfile.m4 serial 7 -+dnl Copyright (C) 2005, 2008-2017 Free Software Foundation, Inc. ++dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. @@ -338,9 +338,9 @@ diff -Naurp coreutils-8.27-orig/m4/mbfile.m4 coreutils-8.27/m4/mbfile.m4 + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) -diff -Naurp coreutils-8.27-orig/src/cut.c coreutils-8.27/src/cut.c ---- coreutils-8.27-orig/src/cut.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/cut.c 2017-03-11 23:47:59.526048471 -0600 +diff -Naurp coreutils-8.32.orig/src/cut.c coreutils-8.32/src/cut.c +--- coreutils-8.32.orig/src/cut.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/cut.c 2020-03-08 12:10:27.734236560 +0800 @@ -28,6 +28,11 @@ #include <assert.h> #include <getopt.h> @@ -497,7 +497,7 @@ diff -Naurp coreutils-8.27-orig/src/cut.c coreutils-8.27/src/cut.c +static void +cut_characters_or_cut_bytes_no_split (FILE *stream) +{ -+ size_t idx; /* number of bytes or characters in the line so far. */ ++ uintmax_t idx; /* number of bytes or characters in the line so far. */ + char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ + char *bufpos; /* Next read position of BUF. */ + size_t buflen; /* The length of the byte sequence in buf. */ @@ -573,7 +573,7 @@ diff -Naurp coreutils-8.27-orig/src/cut.c coreutils-8.27/src/cut.c +cut_fields_mb (FILE *stream) +{ + int c; -+ size_t field_idx; ++ uintmax_t field_idx; + int found_any_selected_field; + int buffer_first_field; + int empty_input; @@ -902,9 +902,9 @@ diff -Naurp coreutils-8.27-orig/src/cut.c coreutils-8.27/src/cut.c }
if (optind == argc) -diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c ---- coreutils-8.27-orig/src/expand.c 2017-02-26 15:42:25.000000000 -0600 -+++ coreutils-8.27/src/expand.c 2017-03-11 23:49:06.758133530 -0600 +diff -Naurp coreutils-8.32.orig/src/expand.c coreutils-8.32/src/expand.c +--- coreutils-8.32.orig/src/expand.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/expand.c 2020-03-08 12:10:27.735236560 +0800 @@ -37,6 +37,9 @@ #include <stdio.h> #include <getopt.h> @@ -915,7 +915,7 @@ diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c #include "system.h" #include "die.h" #include "xstrndup.h" -@@ -100,19 +103,41 @@ expand (void) +@@ -98,19 +101,41 @@ expand (void) { /* Input stream. */ FILE *fp = next_file (NULL); @@ -961,7 +961,7 @@ diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c /* The following variables have valid values only when CONVERT is true: */
-@@ -122,17 +147,48 @@ expand (void) +@@ -120,17 +145,48 @@ expand (void) /* Index in TAB_LIST of next tab stop to examine. */ size_t tab_index = 0;
@@ -993,7 +993,7 @@ diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c + if(using_utf_locale==false && found_bom==true) + { + /*First file conatined BOM header - locale was switched to UTF -+ /*all subsequent files should contain BOM. */ ++ *all subsequent files should contain BOM. */ + error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); + } + } @@ -1014,7 +1014,7 @@ diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c { /* Column the next input tab stop is on. */ uintmax_t next_tab_column; -@@ -151,32 +207,34 @@ expand (void) +@@ -149,32 +205,34 @@ expand (void) if (putchar (' ') < 0) die (EXIT_FAILURE, errno, _("write error"));
@@ -1057,18 +1057,18 @@ diff -Naurp coreutils-8.27-orig/src/expand.c coreutils-8.27/src/expand.c } }
-diff -Naurp coreutils-8.27-orig/src/expand-common.c coreutils-8.27/src/expand-common.c ---- coreutils-8.27-orig/src/expand-common.c 2017-03-01 11:22:55.000000000 -0600 -+++ coreutils-8.27/src/expand-common.c 2017-03-11 23:49:06.757133570 -0600 -@@ -18,6 +18,7 @@ - +diff -Naurp coreutils-8.32.orig/src/expand-common.c coreutils-8.32/src/expand-common.c +--- coreutils-8.32.orig/src/expand-common.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/expand-common.c 2020-03-08 12:10:27.735236560 +0800 +@@ -19,6 +19,7 @@ + #include <assert.h> #include <stdio.h> #include <sys/types.h> +#include <mbfile.h> #include "system.h" #include "die.h" #include "error.h" -@@ -105,6 +106,119 @@ set_extend_size (uintmax_t tabval) +@@ -126,6 +127,119 @@ set_increment_size (uintmax_t tabval) return ok; }
@@ -1188,9 +1188,9 @@ diff -Naurp coreutils-8.27-orig/src/expand-common.c coreutils-8.27/src/expand-co /* Add the comma or blank separated list of tab stops STOPS to the list of tab stops. */ extern void -diff -Naurp coreutils-8.27-orig/src/expand-common.h coreutils-8.27/src/expand-common.h ---- coreutils-8.27-orig/src/expand-common.h 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/expand-common.h 2017-03-11 23:49:06.758133530 -0600 +diff -Naurp coreutils-8.32.orig/src/expand-common.h coreutils-8.32/src/expand-common.h +--- coreutils-8.32.orig/src/expand-common.h 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/expand-common.h 2020-03-08 12:10:27.735236560 +0800 @@ -34,6 +34,18 @@ extern size_t max_column_width; /* The desired exit status. */ extern int exit_status; @@ -1210,9 +1210,9 @@ diff -Naurp coreutils-8.27-orig/src/expand-common.h coreutils-8.27/src/expand-co /* Add tab stop TABVAL to the end of 'tab_list'. */ extern void add_tab_stop (uintmax_t tabval); -diff -Naurp coreutils-8.27-orig/src/fold.c coreutils-8.27/src/fold.c ---- coreutils-8.27-orig/src/fold.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/fold.c 2017-03-11 23:49:30.982169404 -0600 +diff -Naurp coreutils-8.32.orig/src/fold.c coreutils-8.32/src/fold.c +--- coreutils-8.32.orig/src/fold.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/fold.c 2020-03-08 12:10:27.736236560 +0800 @@ -22,12 +22,34 @@ #include <getopt.h> #include <sys/types.h> @@ -1609,9 +1609,9 @@ diff -Naurp coreutils-8.27-orig/src/fold.c coreutils-8.27/src/fold.c break;
case 's': /* Break at word boundaries. */ -diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c ---- coreutils-8.27-orig/src/join.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/join.c 2017-03-11 23:47:13.091286290 -0600 +diff -Naurp coreutils-8.32.orig/src/join.c coreutils-8.32/src/join.c +--- coreutils-8.32.orig/src/join.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/join.c 2020-03-08 12:10:27.736236560 +0800 @@ -22,19 +22,33 @@ #include <sys/types.h> #include <getopt.h> @@ -1999,7 +1999,7 @@ diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c xfields (line);
if (prevline[which - 1]) -@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *li +@@ -563,21 +803,28 @@ prfield (size_t n, struct line const *li
/* Output all the fields in line, other than the join field. */
@@ -2031,7 +2031,7 @@ diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c prfield (i, line); } } -@@ -592,7 +839,6 @@ static void +@@ -588,7 +835,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -2039,7 +2039,7 @@ diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c size_t field; struct line const *line;
-@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct +@@ -622,7 +868,7 @@ prjoin (struct line const *line1, struct o = o->next; if (o == NULL) break; @@ -2048,7 +2048,7 @@ diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c } putchar (eolchar); } -@@ -1104,20 +1350,43 @@ main (int argc, char **argv) +@@ -1098,20 +1344,43 @@ main (int argc, char **argv)
case 't': { @@ -2101,9 +2101,9 @@ diff -Naurp coreutils-8.27-orig/src/join.c coreutils-8.27/src/join.c } break;
-diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c ---- coreutils-8.27-orig/src/pr.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/pr.c 2017-03-11 23:47:13.094286139 -0600 +diff -Naurp coreutils-8.32.orig/src/pr.c coreutils-8.32/src/pr.c +--- coreutils-8.32.orig/src/pr.c 2020-01-01 22:33:18.000000000 +0800 ++++ coreutils-8.32/src/pr.c 2020-03-08 12:10:27.737236560 +0800 @@ -311,6 +311,24 @@
#include <getopt.h> @@ -2129,8 +2129,8 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c #include "system.h" #include "die.h" #include "error.h" -@@ -324,6 +342,18 @@ - #include "xstrtol.h" +@@ -325,6 +343,18 @@ + #include "xstrtol-error.h" #include "xdectoint.h"
+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ @@ -2148,7 +2148,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "pr"
-@@ -416,7 +446,20 @@ struct COLUMN +@@ -417,7 +447,20 @@ struct COLUMN
typedef struct COLUMN COLUMN;
@@ -2170,7 +2170,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c static bool read_line (COLUMN *p); static bool print_page (void); static bool print_stored (COLUMN *p); -@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p); +@@ -429,6 +472,7 @@ static void add_line_number (COLUMN *p); static void getoptnum (const char *n_str, int min, int *num, const char *errfmt); static void getoptarg (char *arg, char switch_char, char *character, @@ -2178,7 +2178,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c int *number); static void print_files (int number_of_files, char **av); static void init_parameters (int number_of_files); -@@ -441,7 +485,6 @@ static void store_char (char c); +@@ -442,7 +486,6 @@ static void store_char (char c); static void pad_down (unsigned int lines); static void read_rest_of_line (COLUMN *p); static void skip_read (COLUMN *p, int column_number); @@ -2186,7 +2186,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c static void cleanup (void); static void print_sep_string (void); static void separator_string (const char *optarg_S); -@@ -453,7 +496,7 @@ static COLUMN *column_vector; +@@ -454,7 +497,7 @@ static COLUMN *column_vector; we store the leftmost columns contiguously in buff. To print a line from buff, get the index of the first character from line_vector[i], and print up to line_vector[i + 1]. */ @@ -2195,7 +2195,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
/* Index of the position in buff where the next character will be stored. */ -@@ -557,7 +600,7 @@ static int chars_per_column; +@@ -558,7 +601,7 @@ static int chars_per_column; static bool untabify_input = false;
/* (-e) The input tab character. */ @@ -2204,7 +2204,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... where the leftmost column is 1. */ -@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8; +@@ -568,7 +611,10 @@ static int chars_per_input_tab = 8; static bool tabify_output = false;
/* (-i) The output tab character. */ @@ -2216,7 +2216,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
/* (-i) The width of the output tab. */ static int chars_per_output_tab = 8; -@@ -637,7 +683,13 @@ static int line_number; +@@ -638,7 +684,13 @@ static int line_number; static bool numbered_lines = false;
/* (-n) Character which follows each line number. */ @@ -2231,7 +2231,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
/* (-n) line counting starts with 1st line of input file (not with 1st line of 1st page printed). */ -@@ -690,6 +742,7 @@ static bool use_col_separator = false; +@@ -691,6 +743,7 @@ static bool use_col_separator = false; -a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */ static char const *col_sep_string = ""; static int col_sep_length = 0; @@ -2239,7 +2239,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c static char *column_separator = (char *) " "; static char *line_separator = (char *) "\t";
-@@ -851,6 +904,13 @@ separator_string (const char *optarg_S) +@@ -852,6 +905,13 @@ separator_string (const char *optarg_S) integer_overflow (); col_sep_length = len; col_sep_string = optarg_S; @@ -2253,7 +2253,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c }
int -@@ -875,6 +935,21 @@ main (int argc, char **argv) +@@ -876,6 +936,21 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -2275,7 +2275,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c n_files = 0; file_names = (argc > 1 ? xnmalloc (argc - 1, sizeof (char *)) -@@ -951,8 +1026,12 @@ main (int argc, char **argv) +@@ -952,8 +1027,12 @@ main (int argc, char **argv) break; case 'e': if (optarg) @@ -2290,7 +2290,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* Could check tab width > 0. */ untabify_input = true; break; -@@ -965,8 +1044,12 @@ main (int argc, char **argv) +@@ -966,8 +1045,12 @@ main (int argc, char **argv) break; case 'i': if (optarg) @@ -2305,7 +2305,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* Could check tab width > 0. */ tabify_output = true; break; -@@ -984,8 +1067,8 @@ main (int argc, char **argv) +@@ -985,8 +1068,8 @@ main (int argc, char **argv) case 'n': numbered_lines = true; if (optarg) @@ -2316,7 +2316,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c break; case 'N': skip_count = false; -@@ -1010,6 +1093,7 @@ main (int argc, char **argv) +@@ -1011,6 +1094,7 @@ main (int argc, char **argv) /* Reset an additional input of -s, -S dominates -s */ col_sep_string = ""; col_sep_length = 0; @@ -2425,7 +2425,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c }
/* Open the necessary files, -@@ -1402,7 +1526,7 @@ init_funcs (void) +@@ -1400,7 +1524,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of padding_not_printed with all columns. */ @@ -2434,7 +2434,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
/* This loop takes care of all but the rightmost column. */
-@@ -1436,7 +1560,7 @@ init_funcs (void) +@@ -1434,7 +1558,7 @@ init_funcs (void) } else { @@ -2443,7 +2443,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c h_next = h + chars_per_column; } } -@@ -1727,9 +1851,9 @@ static void +@@ -1725,9 +1849,9 @@ static void align_column (COLUMN *p) { padding_not_printed = p->start_position; @@ -2455,7 +2455,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c padding_not_printed = ANYWHERE; }
-@@ -2004,13 +2128,13 @@ store_char (char c) +@@ -2002,13 +2126,13 @@ store_char (char c) /* May be too generous. */ buff = X2REALLOC (buff, &buff_allocated); } @@ -2471,7 +2471,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c char *s; int num_width;
-@@ -2027,22 +2151,24 @@ add_line_number (COLUMN *p) +@@ -2025,22 +2149,24 @@ add_line_number (COLUMN *p) /* Tabification is assumed for multiple columns, also for n-separators, but 'default n-separator = TAB' hasn't been given priority over equal column_width also specified by POSIX. */ @@ -2500,7 +2500,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c output_position = POS_AFTER_TAB (chars_per_output_tab, output_position); } -@@ -2203,7 +2329,7 @@ print_white_space (void) +@@ -2199,7 +2325,7 @@ print_white_space (void) while (goal - h_old > 1 && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) { @@ -2509,7 +2509,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c h_old = h_new; } while (++h_old <= goal) -@@ -2223,6 +2349,7 @@ print_sep_string (void) +@@ -2219,6 +2345,7 @@ print_sep_string (void) { char const *s = col_sep_string; int l = col_sep_length; @@ -2517,7 +2517,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
if (separators_not_printed <= 0) { -@@ -2234,6 +2361,7 @@ print_sep_string (void) +@@ -2230,6 +2357,7 @@ print_sep_string (void) { for (; separators_not_printed > 0; --separators_not_printed) { @@ -2525,7 +2525,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c while (l-- > 0) { /* 3 types of sep_strings: spaces only, spaces and chars, -@@ -2247,12 +2375,15 @@ print_sep_string (void) +@@ -2243,12 +2371,15 @@ print_sep_string (void) } else { @@ -2542,7 +2542,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2280,7 +2411,7 @@ print_clump (COLUMN *p, int n, char *clu +@@ -2276,7 +2407,7 @@ print_clump (COLUMN *p, int n, char *clu required number of tabs and spaces. */
static void @@ -2551,7 +2551,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c { if (tabify_output) { -@@ -2304,6 +2435,74 @@ print_char (char c) +@@ -2300,6 +2431,74 @@ print_char (char c) putchar (c); }
@@ -2626,7 +2626,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* Skip to page PAGE before printing. PAGE may be larger than total number of pages. */
-@@ -2483,9 +2682,9 @@ read_line (COLUMN *p) +@@ -2477,9 +2676,9 @@ read_line (COLUMN *p) align_empty_cols = false; }
@@ -2638,8 +2638,8 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c padding_not_printed = ANYWHERE; }
-@@ -2555,7 +2754,7 @@ print_stored (COLUMN *p) - int i; +@@ -2548,7 +2747,7 @@ print_stored (COLUMN *p) + COLUMN *q;
int line = p->current_line++; - char *first = &buff[line_vector[line]]; @@ -2647,7 +2647,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* FIXME UMR: Uninitialized memory read: * This is occurring while in: -@@ -2567,7 +2766,7 @@ print_stored (COLUMN *p) +@@ -2560,7 +2759,7 @@ print_stored (COLUMN *p) xmalloc [xmalloc.c:94] init_store_cols [pr.c:1648] */ @@ -2656,7 +2656,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c
pad_vertically = true;
-@@ -2586,9 +2785,9 @@ print_stored (COLUMN *p) +@@ -2580,9 +2779,9 @@ print_stored (COLUMN *p) } }
@@ -2668,7 +2668,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c padding_not_printed = ANYWHERE; }
-@@ -2601,8 +2800,8 @@ print_stored (COLUMN *p) +@@ -2595,8 +2794,8 @@ print_stored (COLUMN *p) if (spaces_not_printed == 0) { output_position = p->start_position + end_vector[line]; @@ -2679,7 +2679,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c }
return true; -@@ -2621,7 +2820,7 @@ print_stored (COLUMN *p) +@@ -2615,7 +2814,7 @@ print_stored (COLUMN *p) number of characters is 1.) */
static int @@ -2688,7 +2688,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c { unsigned char uc = c; char *s = clump_buff; -@@ -2631,10 +2830,10 @@ char_to_clump (char c) +@@ -2625,10 +2824,10 @@ char_to_clump (char c) int chars; int chars_per_c = 8;
@@ -2701,7 +2701,7 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c { width = TAB_WIDTH (chars_per_c, input_position);
-@@ -2715,6 +2914,164 @@ char_to_clump (char c) +@@ -2709,6 +2908,164 @@ char_to_clump (char c) return chars; }
@@ -2866,9 +2866,9 @@ diff -Naurp coreutils-8.27-orig/src/pr.c coreutils-8.27/src/pr.c /* We've just printed some files and need to clean up things before looking for more options and printing the next batch of files.
-diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c ---- coreutils-8.27-orig/src/sort.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/sort.c 2017-03-11 23:49:22.416505389 -0600 +diff -Naurp coreutils-8.32.orig/src/sort.c coreutils-8.32/src/sort.c +--- coreutils-8.32.orig/src/sort.c 2020-01-01 22:33:34.000000000 +0800 ++++ coreutils-8.32/src/sort.c 2020-03-08 12:10:27.738236560 +0800 @@ -29,6 +29,14 @@ #include <sys/wait.h> #include <signal.h> @@ -2884,7 +2884,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c #include "system.h" #include "argmatch.h" #include "die.h" -@@ -165,14 +173,39 @@ static int decimal_point; +@@ -157,14 +165,39 @@ static int decimal_point; /* Thousands separator; if -1, then there isn't one. */ static int thousands_sep;
@@ -2925,7 +2925,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both };
-@@ -346,13 +379,11 @@ static bool reverse; +@@ -338,13 +371,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable;
@@ -2942,7 +2942,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c
/* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -811,6 +842,46 @@ reap_all (void) +@@ -802,6 +833,46 @@ reap_all (void) reap (-1); }
@@ -2989,7 +2989,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* Clean up any remaining temporary files. */
static void -@@ -1255,7 +1326,7 @@ zaptemp (char const *name) +@@ -1270,7 +1341,7 @@ zaptemp (char const *name) free (node); }
@@ -2998,7 +2998,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c
static int struct_month_cmp (void const *m1, void const *m2) -@@ -1270,7 +1341,7 @@ struct_month_cmp (void const *m1, void c +@@ -1285,7 +1356,7 @@ struct_month_cmp (void const *m1, void c /* Initialize the character class tables. */
static void @@ -3007,7 +3007,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { size_t i;
-@@ -1282,7 +1353,7 @@ inittables (void) +@@ -1297,7 +1368,7 @@ inittables (void) fold_toupper[i] = toupper (i); }
@@ -3016,7 +3016,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1364,6 +1435,84 @@ specify_nmerge (int oi, char c, char con +@@ -1379,6 +1450,84 @@ specify_nmerge (int oi, char c, char con xstrtol_fatal (e, oi, c, long_options, s); }
@@ -3101,7 +3101,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf +@@ -1610,7 +1759,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */
static char * @@ -3110,7 +3110,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struc +@@ -1619,10 +1768,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */
@@ -3123,7 +3123,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struc +@@ -1648,11 +1797,70 @@ begfield (struct line const *line, struc return ptr; }
@@ -3195,7 +3195,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1654,10 +1862,10 @@ limfield (struct line const *line, struc +@@ -1667,10 +1875,10 @@ limfield (struct line const *line, struc 'beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first 'blank' character after the preceding field. */ @@ -3208,7 +3208,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struc +@@ -1716,10 +1924,10 @@ limfield (struct line const *line, struc */
/* Make LIM point to the end of (one byte past) the current field. */ @@ -3221,7 +3221,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c if (newlim) lim = newlim; } -@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struc +@@ -1750,6 +1958,130 @@ limfield (struct line const *line, struc return ptr; }
@@ -3352,7 +3352,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* Fill BUF reading from FP, moving buf->left bytes from the end of buf->buf to the beginning first. If EOF is reached and the file wasn't terminated by a newline, supply one. Set up BUF's line -@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1836,8 +2168,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) @@ -3377,7 +3377,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c line->keybeg = line_start; } } -@@ -1958,12 +2304,10 @@ find_unit_order (char const *number) +@@ -1971,12 +2317,10 @@ find_unit_order (char const *number) <none/unknown> < K/k < M < G < T < P < E < Z < Y */
static int @@ -3393,7 +3393,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c
int diff = find_unit_order (a) - find_unit_order (b); return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); -@@ -1974,7 +2318,7 @@ human_numcompare (char const *a, char co +@@ -1987,7 +2331,7 @@ human_numcompare (char const *a, char co hideously fast. */
static int @@ -3402,7 +3402,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1984,6 +2328,25 @@ numcompare (char const *a, char const *b +@@ -1997,6 +2341,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); }
@@ -3427,8 +3427,8 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c + /* Work around a problem whereby the long double value returned by glibc's strtold ("NaN", ...) contains uninitialized bits: clear all bytes of - A and B before calling strtold. FIXME: remove this function once -@@ -2034,7 +2397,7 @@ general_numcompare (char const *sa, char + A and B before calling strtold. FIXME: remove this function if +@@ -2047,7 +2410,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */
static int @@ -3437,7 +3437,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2310,15 +2673,14 @@ debug_key (struct line const *line, stru +@@ -2323,15 +2686,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0';
@@ -3455,7 +3455,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2452,7 +2814,7 @@ key_warnings (struct keyfield const *gke +@@ -2465,7 +2827,7 @@ key_warnings (struct keyfield const *gke /* Warn about significant leading blanks. */ bool implicit_skip = key_numeric (key) || key->month; bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ @@ -3464,7 +3464,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c && ((!key->skipsblanks && !implicit_skip) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2510,11 +2872,87 @@ key_warnings (struct keyfield const *gke +@@ -2523,11 +2885,87 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); }
@@ -3553,7 +3553,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c { struct keyfield *key = keylist;
-@@ -2599,7 +3037,7 @@ keycompare (struct line const *a, struct +@@ -2612,7 +3050,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3562,7 +3562,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2715,6 +3153,211 @@ keycompare (struct line const *a, struct +@@ -2728,6 +3166,211 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; }
@@ -3774,16 +3774,16 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */
-@@ -2742,7 +3385,7 @@ compare (struct line const *a, struct li +@@ -2755,7 +3398,7 @@ compare (struct line const *a, struct li diff = - NONZERO (blen); else if (blen == 0) diff = 1; - else if (hard_LC_COLLATE) + else if (hard_LC_COLLATE && !folding) { - /* Note xmemcoll0 is a performance enhancement as + /* xmemcoll0 is a performance enhancement as it will not unconditionally write '\0' after the -@@ -4139,6 +4782,7 @@ set_ordering (char const *s, struct keyf +@@ -4145,6 +4788,7 @@ set_ordering (char const *s, struct keyf break; case 'f': key->translate = fold_toupper; @@ -3791,7 +3791,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c break; case 'g': key->general_numeric = true; -@@ -4218,7 +4862,7 @@ main (int argc, char **argv) +@@ -4224,7 +4868,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3800,7 +3800,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif
-@@ -4239,6 +4883,29 @@ main (int argc, char **argv) +@@ -4245,6 +4889,29 @@ main (int argc, char **argv) thousands_sep = -1; }
@@ -3830,7 +3830,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c have_read_stdin = false; inittables ();
-@@ -4513,13 +5180,34 @@ main (int argc, char **argv) +@@ -4519,13 +5186,34 @@ main (int argc, char **argv)
case 't': { @@ -3869,7 +3869,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4530,9 +5218,11 @@ main (int argc, char **argv) +@@ -4536,9 +5224,11 @@ main (int argc, char **argv) quote (optarg)); } } @@ -3883,7 +3883,7 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c } break;
-@@ -4770,12 +5460,10 @@ main (int argc, char **argv) +@@ -4767,12 +5457,10 @@ main (int argc, char **argv) sort (files, nfiles, outfile, nthreads); }
@@ -3896,9 +3896,9 @@ diff -Naurp coreutils-8.27-orig/src/sort.c coreutils-8.27/src/sort.c
if (have_read_stdin && fclose (stdin) == EOF) sort_die (_("close failed"), "-"); -diff -Naurp coreutils-8.27-orig/src/unexpand.c coreutils-8.27/src/unexpand.c ---- coreutils-8.27-orig/src/unexpand.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/unexpand.c 2017-03-11 23:49:06.758133530 -0600 +diff -Naurp coreutils-8.32.orig/src/unexpand.c coreutils-8.32/src/unexpand.c +--- coreutils-8.32.orig/src/unexpand.c 2020-01-01 22:13:12.000000000 +0800 ++++ coreutils-8.32/src/unexpand.c 2020-03-08 12:10:27.738236560 +0800 @@ -38,6 +38,9 @@ #include <stdio.h> #include <getopt.h> @@ -3987,7 +3987,7 @@ diff -Naurp coreutils-8.27-orig/src/unexpand.c coreutils-8.27/src/unexpand.c + if(using_utf_locale==false && found_bom==true) + { + /*First file conatined BOM header - locale was switched to UTF -+ /*all subsequent files should contain BOM. */ ++ *all subsequent files should contain BOM. */ + error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); + } + } @@ -4101,9 +4101,9 @@ diff -Naurp coreutils-8.27-orig/src/unexpand.c coreutils-8.27/src/unexpand.c } }
-diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c ---- coreutils-8.27-orig/src/uniq.c 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/src/uniq.c 2017-03-11 23:47:13.098285938 -0600 +diff -Naurp coreutils-8.32.orig/src/uniq.c coreutils-8.32/src/uniq.c +--- coreutils-8.32.orig/src/uniq.c 2020-02-25 07:18:16.000000000 +0800 ++++ coreutils-8.32/src/uniq.c 2020-03-08 12:10:35.436236531 +0800 @@ -21,6 +21,17 @@ #include <getopt.h> #include <sys/types.h> @@ -4122,12 +4122,8 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c #include "system.h" #include "argmatch.h" #include "linebuffer.h" -@@ -32,9 +43,21 @@ - #include "stdio--.h" - #include "xmemcoll.h" - #include "xstrtol.h" --#include "memcasecmp.h" -+#include "xmemcoll.h" +@@ -33,6 +44,18 @@ + #include "memcasecmp.h" #include "quote.h"
+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC @@ -4145,7 +4141,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "uniq"
-@@ -144,6 +167,10 @@ enum +@@ -139,6 +162,10 @@ enum GROUP_OPTION = CHAR_MAX + 1 };
@@ -4156,7 +4152,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -260,7 +287,7 @@ size_opt (char const *opt, char const *m +@@ -253,7 +280,7 @@ size_opt (char const *opt, char const *m return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE @@ -4165,7 +4161,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c { size_t count; char const *lp = line->buffer; -@@ -280,6 +307,83 @@ find_field (struct linebuffer const *lin +@@ -273,6 +300,83 @@ find_field (struct linebuffer const *lin return line->buffer + i; }
@@ -4249,49 +4245,10 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c /* Return false if two strings OLD and NEW match, true if not. OLD and NEW point not to the beginnings of the lines but rather to the beginnings of the fields to compare. -@@ -288,6 +392,8 @@ find_field (struct linebuffer const *lin - static bool - different (char *old, char *new, size_t oldlen, size_t newlen) - { -+ char *copy_old, *copy_new; -+ - if (check_chars < oldlen) - oldlen = check_chars; - if (check_chars < newlen) -@@ -295,14 +401,103 @@ different (char *old, char *new, size_t +@@ -292,6 +396,79 @@ different (char *old, char *new, size_t + return oldlen != newlen || memcmp (old, new, oldlen); + }
- if (ignore_case) - { -- /* FIXME: This should invoke strcoll somehow. */ -- return oldlen != newlen || memcasecmp (old, new, oldlen); -+ size_t i; -+ -+ copy_old = xmalloc (oldlen + 1); -+ copy_new = xmalloc (oldlen + 1); -+ -+ for (i = 0; i < oldlen; i++) -+ { -+ copy_old[i] = toupper (old[i]); -+ copy_new[i] = toupper (new[i]); -+ } -+ bool rc = xmemcoll (copy_old, oldlen, copy_new, newlen); -+ free (copy_old); -+ free (copy_new); -+ return rc; - } -- else if (hard_LC_COLLATE) -- return xmemcoll (old, oldlen, new, newlen) != 0; - else -- return oldlen != newlen || memcmp (old, new, oldlen); -+ { -+ copy_old = (char *)old; -+ copy_new = (char *)new; -+ } -+ -+ return xmemcoll (copy_old, oldlen, copy_new, newlen); -+ -+} -+ +#if HAVE_MBRTOWC +static int +different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) @@ -4357,17 +4314,18 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c + copy[i][j] = '\0'; + len[i] = j; + } -+ int rc = xmemcoll (copy[0], len[0], copy[1], len[1]); ++ int rc = len[0] != len[1] || memcmp(copy[0], copy[1], len[0]); + free (copy[0]); + free (copy[1]); + return rc; + - } ++} +#endif - ++ /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. -@@ -367,19 +562,38 @@ check_file (const char *infile, const ch + MATCH is true if the line matches the previous line. +@@ -355,19 +532,38 @@ check_file (const char *infile, const ch char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); bool first_group_printed = false; @@ -4406,7 +4364,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c new_group = (prevline->length == 0 || different (thisfield, prevfield, thislen, prevlen));
-@@ -397,6 +611,10 @@ check_file (const char *infile, const ch +@@ -385,6 +581,10 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4417,7 +4375,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c first_group_printed = true; } } -@@ -409,17 +627,26 @@ check_file (const char *infile, const ch +@@ -397,17 +597,26 @@ check_file (const char *infile, const ch size_t prevlen; uintmax_t match_count = 0; bool first_delimiter = true; @@ -4444,7 +4402,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) { if (ferror (stdin)) -@@ -428,6 +655,14 @@ check_file (const char *infile, const ch +@@ -416,6 +625,14 @@ check_file (const char *infile, const ch } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -4459,7 +4417,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c match = !different (thisfield, prevfield, thislen, prevlen); match_count += match;
-@@ -460,6 +695,9 @@ check_file (const char *infile, const ch +@@ -448,6 +665,9 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4469,7 +4427,7 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c if (!match) match_count = 0; } -@@ -506,6 +744,19 @@ main (int argc, char **argv) +@@ -493,6 +713,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@@ -4489,13 +4447,13 @@ diff -Naurp coreutils-8.27-orig/src/uniq.c coreutils-8.27/src/uniq.c skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -diff -Naurp coreutils-8.27-orig/tests/expand/mb.sh coreutils-8.27/tests/expand/mb.sh ---- coreutils-8.27-orig/tests/expand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/tests/expand/mb.sh 2017-03-11 23:49:06.759133489 -0600 +diff -Naurp coreutils-8.32.orig/tests/expand/mb.sh coreutils-8.32/tests/expand/mb.sh +--- coreutils-8.32.orig/tests/expand/mb.sh 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/tests/expand/mb.sh 2020-03-08 12:10:27.738236560 +0800 @@ -0,0 +1,183 @@ +#!/bin/sh + -+# Copyright (C) 2012-2017 Free Software Foundation, Inc. ++# Copyright (C) 2012-2015 Free Software Foundation, Inc. + +# 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 @@ -4676,9 +4634,9 @@ diff -Naurp coreutils-8.27-orig/tests/expand/mb.sh coreutils-8.27/tests/expand/m +compare exp out > /dev/null 2>&1 || fail=1 + +exit $fail -diff -Naurp coreutils-8.27-orig/tests/i18n/sort.sh coreutils-8.27/tests/i18n/sort.sh ---- coreutils-8.27-orig/tests/i18n/sort.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/tests/i18n/sort.sh 2017-03-11 23:47:13.100285838 -0600 +diff -Naurp coreutils-8.32.orig/tests/i18n/sort.sh coreutils-8.32/tests/i18n/sort.sh +--- coreutils-8.32.orig/tests/i18n/sort.sh 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/tests/i18n/sort.sh 2020-03-08 12:10:27.738236560 +0800 @@ -0,0 +1,29 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4709,10 +4667,10 @@ diff -Naurp coreutils-8.27-orig/tests/i18n/sort.sh coreutils-8.27/tests/i18n/sor + + +Exit $fail -diff -Naurp coreutils-8.27-orig/tests/local.mk coreutils-8.27/tests/local.mk ---- coreutils-8.27-orig/tests/local.mk 2017-02-28 22:25:37.000000000 -0600 -+++ coreutils-8.27/tests/local.mk 2017-03-11 23:47:38.072058253 -0600 -@@ -352,6 +352,8 @@ all_tests = \ +diff -Naurp coreutils-8.32.orig/tests/local.mk coreutils-8.32/tests/local.mk +--- coreutils-8.32.orig/tests/local.mk 2020-03-02 07:25:03.000000000 +0800 ++++ coreutils-8.32/tests/local.mk 2020-03-08 12:10:27.738236560 +0800 +@@ -369,6 +369,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -4721,7 +4679,7 @@ diff -Naurp coreutils-8.27-orig/tests/local.mk coreutils-8.27/tests/local.mk tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ -@@ -544,6 +546,7 @@ all_tests = \ +@@ -567,6 +569,7 @@ all_tests = \ tests/du/threshold.sh \ tests/du/trailing-slash.sh \ tests/du/two-args.sh \ @@ -4729,7 +4687,7 @@ diff -Naurp coreutils-8.27-orig/tests/local.mk coreutils-8.27/tests/local.mk tests/id/gnu-zero-uids.sh \ tests/id/no-context.sh \ tests/id/context.sh \ -@@ -684,6 +687,7 @@ all_tests = \ +@@ -714,6 +717,7 @@ all_tests = \ tests/touch/read-only.sh \ tests/touch/relative.sh \ tests/touch/trailing-slash.sh \ @@ -4737,34 +4695,9 @@ diff -Naurp coreutils-8.27-orig/tests/local.mk coreutils-8.27/tests/local.mk $(all_root_tests)
# See tests/factor/create-test.sh. -diff -Naurp coreutils-8.27-orig/tests/misc/cut.pl coreutils-8.27/tests/misc/cut.pl ---- coreutils-8.27-orig/tests/misc/cut.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/cut.pl 2017-03-11 23:47:13.100285838 -0600 -@@ -23,9 +23,11 @@ use strict; - # Turn off localization of executable's output. - @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; - --my $mb_locale = $ENV{LOCALE_FR_UTF8}; -+my $mb_locale; -+# uncommented enable multibyte paths -+$mb_locale = $ENV{LOCALE_FR_UTF8}; - ! defined $mb_locale || $mb_locale eq 'none' -- and $mb_locale = 'C'; -+ and $mb_locale = 'C'; - - my $prog = 'cut'; - my $try = "Try '$prog --help' for more information.\n"; -@@ -240,6 +242,7 @@ if ($mb_locale ne 'C') - my @new_t = @$t; - my $test_name = shift @new_t; - -+ next if ($test_name =~ "newline-[12][0-9]"); - push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; - } - push @Tests, @new; -diff -Naurp coreutils-8.27-orig/tests/misc/expand.pl coreutils-8.27/tests/misc/expand.pl ---- coreutils-8.27-orig/tests/misc/expand.pl 2017-03-01 11:16:46.000000000 -0600 -+++ coreutils-8.27/tests/misc/expand.pl 2017-03-11 23:47:13.101285788 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/expand.pl coreutils-8.32/tests/misc/expand.pl +--- coreutils-8.32.orig/tests/misc/expand.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/expand.pl 2020-03-08 12:10:27.738236560 +0800 @@ -27,6 +27,15 @@ my $prog = 'expand'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4781,8 +4714,8 @@ diff -Naurp coreutils-8.27-orig/tests/misc/expand.pl coreutils-8.27/tests/misc/e my @Tests = ( ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], -@@ -152,6 +161,8 @@ my @Tests = - ['trail9', '--tab=1,2 -t/5',{IN=>"\ta\tb\tc"}, {OUT=>" a b c"}], +@@ -168,6 +177,8 @@ my @Tests = +
# Test errors + # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES @@ -4790,7 +4723,7 @@ diff -Naurp coreutils-8.27-orig/tests/misc/expand.pl coreutils-8.27/tests/misc/e ['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR => "$prog: tab size contains invalid character(s): 'a'\n"}], ['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1}, -@@ -168,6 +179,37 @@ my @Tests = +@@ -184,6 +195,37 @@ my @Tests = {ERR => "$prog: '/' specifier not at start of number: '/'\n"}], );
@@ -4828,9 +4761,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/expand.pl coreutils-8.27/tests/misc/e my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};
-diff -Naurp coreutils-8.27-orig/tests/misc/fold.pl coreutils-8.27/tests/misc/fold.pl ---- coreutils-8.27-orig/tests/misc/fold.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/fold.pl 2017-03-11 23:47:13.101285788 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/fold.pl coreutils-8.32/tests/misc/fold.pl +--- coreutils-8.32.orig/tests/misc/fold.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/fold.pl 2020-03-08 12:10:27.738236560 +0800 @@ -20,9 +20,18 @@ use strict;
(my $program_name = $0) =~ s|.*/||; @@ -4900,9 +4833,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/fold.pl coreutils-8.27/tests/misc/fol -my $prog = 'fold'; my $fail = run_tests ($program_name, $prog, @Tests, $save_temps, $verbose); exit $fail; -diff -Naurp coreutils-8.27-orig/tests/misc/join.pl coreutils-8.27/tests/misc/join.pl ---- coreutils-8.27-orig/tests/misc/join.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/join.pl 2017-03-11 23:47:13.102285737 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/join.pl coreutils-8.32/tests/misc/join.pl +--- coreutils-8.32.orig/tests/misc/join.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/join.pl 2020-03-08 12:10:27.738236560 +0800 @@ -25,6 +25,15 @@ my $limits = getlimits ();
my $prog = 'join'; @@ -4919,7 +4852,7 @@ diff -Naurp coreutils-8.27-orig/tests/misc/join.pl coreutils-8.27/tests/misc/joi my $delim = chr 0247; sub t_subst ($) { -@@ -329,8 +338,49 @@ foreach my $t (@tv) +@@ -333,8 +342,49 @@ foreach my $t (@tv) push @Tests, $new_ent; }
@@ -4969,9 +4902,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/join.pl coreutils-8.27/tests/misc/joi my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};
-diff -Naurp coreutils-8.27-orig/tests/misc/sort-mb-tests.sh coreutils-8.27/tests/misc/sort-mb-tests.sh ---- coreutils-8.27-orig/tests/misc/sort-mb-tests.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/tests/misc/sort-mb-tests.sh 2017-03-11 23:47:13.102285737 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/sort-mb-tests.sh coreutils-8.32/tests/misc/sort-mb-tests.sh +--- coreutils-8.32.orig/tests/misc/sort-mb-tests.sh 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/tests/misc/sort-mb-tests.sh 2020-03-08 12:10:27.739236560 +0800 @@ -0,0 +1,45 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -5018,9 +4951,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/sort-mb-tests.sh coreutils-8.27/tests +compare exp out || { fail=1; cat out; } + +Exit $fail -diff -Naurp coreutils-8.27-orig/tests/misc/sort-merge.pl coreutils-8.27/tests/misc/sort-merge.pl ---- coreutils-8.27-orig/tests/misc/sort-merge.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/sort-merge.pl 2017-03-11 23:47:13.102285737 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/sort-merge.pl coreutils-8.32/tests/misc/sort-merge.pl +--- coreutils-8.32.orig/tests/misc/sort-merge.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/sort-merge.pl 2020-03-08 12:10:27.739236560 +0800 @@ -26,6 +26,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5077,9 +5010,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/sort-merge.pl coreutils-8.27/tests/mi my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};
-diff -Naurp coreutils-8.27-orig/tests/misc/sort.pl coreutils-8.27/tests/misc/sort.pl ---- coreutils-8.27-orig/tests/misc/sort.pl 2017-01-21 08:53:43.000000000 -0600 -+++ coreutils-8.27/tests/misc/sort.pl 2017-03-11 23:47:13.103285687 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/sort.pl coreutils-8.32/tests/misc/sort.pl +--- coreutils-8.32.orig/tests/misc/sort.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/sort.pl 2020-03-08 12:10:27.739236560 +0800 @@ -24,10 +24,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5144,9 +5077,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/sort.pl coreutils-8.27/tests/misc/sor
my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.27-orig/tests/misc/unexpand.pl coreutils-8.27/tests/misc/unexpand.pl ---- coreutils-8.27-orig/tests/misc/unexpand.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/unexpand.pl 2017-03-11 23:47:13.103285687 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/unexpand.pl coreutils-8.32/tests/misc/unexpand.pl +--- coreutils-8.32.orig/tests/misc/unexpand.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/unexpand.pl 2020-03-08 12:10:27.739236560 +0800 @@ -27,6 +27,14 @@ my $limits = getlimits ();
my $prog = 'unexpand'; @@ -5200,9 +5133,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/unexpand.pl coreutils-8.27/tests/misc my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};
-diff -Naurp coreutils-8.27-orig/tests/misc/uniq.pl coreutils-8.27/tests/misc/uniq.pl ---- coreutils-8.27-orig/tests/misc/uniq.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/misc/uniq.pl 2017-03-11 23:47:13.103285687 -0600 +diff -Naurp coreutils-8.32.orig/tests/misc/uniq.pl coreutils-8.32/tests/misc/uniq.pl +--- coreutils-8.32.orig/tests/misc/uniq.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/misc/uniq.pl 2020-03-08 12:10:27.739236560 +0800 @@ -23,9 +23,17 @@ my $limits = getlimits (); my $prog = 'uniq'; my $try = "Try '$prog --help' for more information.\n"; @@ -5275,9 +5208,9 @@ diff -Naurp coreutils-8.27-orig/tests/misc/uniq.pl coreutils-8.27/tests/misc/uni @Tests = add_z_variants @Tests; @Tests = triple_test @Tests;
-diff -Naurp coreutils-8.27-orig/tests/pr/pr-tests.pl coreutils-8.27/tests/pr/pr-tests.pl ---- coreutils-8.27-orig/tests/pr/pr-tests.pl 2017-01-01 16:34:24.000000000 -0600 -+++ coreutils-8.27/tests/pr/pr-tests.pl 2017-03-11 23:47:13.103285687 -0600 +diff -Naurp coreutils-8.32.orig/tests/pr/pr-tests.pl coreutils-8.32/tests/pr/pr-tests.pl +--- coreutils-8.32.orig/tests/pr/pr-tests.pl 2020-01-01 22:13:13.000000000 +0800 ++++ coreutils-8.32/tests/pr/pr-tests.pl 2020-03-08 12:10:27.739236560 +0800 @@ -24,6 +24,15 @@ use strict; my $prog = 'pr'; my $normalize_strerror = "s/': .*/'/"; @@ -5343,13 +5276,13 @@ diff -Naurp coreutils-8.27-orig/tests/pr/pr-tests.pl coreutils-8.27/tests/pr/pr- my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE};
-diff -Naurp coreutils-8.27-orig/tests/unexpand/mb.sh coreutils-8.27/tests/unexpand/mb.sh ---- coreutils-8.27-orig/tests/unexpand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.27/tests/unexpand/mb.sh 2017-03-11 23:49:06.759133489 -0600 +diff -Naurp coreutils-8.32.orig/tests/unexpand/mb.sh coreutils-8.32/tests/unexpand/mb.sh +--- coreutils-8.32.orig/tests/unexpand/mb.sh 1970-01-01 08:00:00.000000000 +0800 ++++ coreutils-8.32/tests/unexpand/mb.sh 2020-03-08 12:10:27.739236560 +0800 @@ -0,0 +1,172 @@ +#!/bin/sh + -+# Copyright (C) 2012-2017 Free Software Foundation, Inc. ++# Copyright (C) 2012-2015 Free Software Foundation, Inc. + +# 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 diff --git a/src/scripts/openvpn-metrics b/src/scripts/openvpn-metrics new file mode 100755 index 000000000..ac0cab909 --- /dev/null +++ b/src/scripts/openvpn-metrics @@ -0,0 +1,172 @@ +#!/usr/bin/python3 +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007-2020 IPFire Team info@ipfire.org. # +# # +############################################################################ + +import argparse +import logging +import logging.handlers +import os +import sqlite3 +import sys + +_ = lambda x: x + +DEFAULT_DATABASE_PATH = "/var/ipfire/ovpn/clients.db" + +def setup_logging(level=logging.INFO): + l = logging.getLogger("openvpn-metrics") + l.setLevel(level) + + # Log to console + h = logging.StreamHandler() + h.setLevel(logging.DEBUG) + l.addHandler(h) + + # Log to syslog + h = logging.handlers.SysLogHandler(address="/dev/log", + facility=logging.handlers.SysLogHandler.LOG_DAEMON) + h.setLevel(logging.INFO) + l.addHandler(h) + + # Format syslog messages + formatter = logging.Formatter("openvpn-metrics[%(process)d]: %(message)s") + h.setFormatter(formatter) + + return l + +# Initialise logging +log = setup_logging() + +class OpenVPNMetrics(object): + def __init__(self): + self.db = self._open_database() + + def parse_cli(self): + parser = argparse.ArgumentParser( + description=_("Tool that collects metrics of OpenVPN Clients"), + ) + subparsers = parser.add_subparsers() + + # client-connect + client_connect = subparsers.add_parser("client-connect", + help=_("Called when a client connects"), + ) + client_connect.add_argument("file", nargs="?", + help=_("Configuration file") + ) + client_connect.set_defaults(func=self.client_connect) + + # client-disconnect + client_disconnect = subparsers.add_parser("client-disconnect", + help=_("Called when a client disconnects"), + ) + client_disconnect.add_argument("file", nargs="?", + help=_("Configuration file") + ) + client_disconnect.set_defaults(func=self.client_disconnect) + + # Parse CLI + args = parser.parse_args() + + # Print usage if no action was given + if not "func" in args: + parser.print_usage() + sys.exit(2) + + return args + + def __call__(self): + # Parse command line arguments + args = self.parse_cli() + + # Call function + try: + ret = args.func(args) + except Exception as e: + log.critical(e) + + # Return with exit code + sys.exit(ret or 0) + + def _open_database(self, path=DEFAULT_DATABASE_PATH): + db = sqlite3.connect(path) + + # Create schema if it doesn't exist already + db.executescript(""" + CREATE TABLE IF NOT EXISTS sessions( + common_name TEXT NOT NULL, + connected_at TEXT NOT NULL, + disconnected_at TEXT, + bytes_received INTEGER, + bytes_sent INTEGER + ); + + -- Create index for speeding up searches + CREATE INDEX IF NOT EXISTS sessions_common_name ON sessions(common_name); + """) + + return db + + def _get_environ(self, key): + if not key in os.environ: + sys.stderr.write("%s missing from environment\n" % key) + raise SystemExit(1) + + return os.environ.get(key) + + def client_connect(self, args): + common_name = self._get_environ("common_name") + + # Time + time_ascii = self._get_environ("time_ascii") + time_unix = self._get_environ("time_unix") + + log.info("Opening session for %s at %s" % (common_name, time_ascii)) + + c = self.db.cursor() + c.execute("INSERT INTO sessions(common_name, connected_at) \ + VALUES(?, DATETIME(?, 'unixepoch'))", (common_name, time_unix)) + self.db.commit() + + def client_disconnect(self, args): + common_name = self._get_environ("common_name") + duration = self._get_environ("time_duration") + + # Collect some usage statistics + bytes_received = self._get_environ("bytes_received") + bytes_sent = self._get_environ("bytes_sent") + + log.info("Closing session for %s after %ss and receiving/sending %s/%s bytes" \ + % (common_name, duration, bytes_received, bytes_sent)) + + c = self.db.cursor() + c.execute("UPDATE sessions SET disconnected_at = DATETIME(connected_at, '+' || ? || ' seconds'), \ + bytes_received = ?, bytes_sent = ? \ + WHERE common_name = ? AND disconnected_at IS NULL", + (duration, bytes_received, bytes_sent, common_name)) + self.db.commit() + +def main(): + m = OpenVPNMetrics() + m() + +main()
hooks/post-receive -- IPFire 2.x development tree