@@ -0,0 +1,193 @@
+diff -ru nfsen-1.3.8/ChangeLog nfsen-1.3.8-rmnet-20190305/ChangeLog
+--- nfsen-1.3.8/ChangeLog 2017-01-19 17:16:21.000000000 +0100
++++ nfsen-1.3.8-rmnet-20190305/ChangeLog 2019-03-05 13:34:47.269764558 +0100
+@@ -1,3 +1,18 @@
++2019-03-05-rmnet
++- Use Email::Sender::Simple->try_to_send to avoid seemingly uncatchable dies.
++
++2019-01-14-rmnet
++- Replace Mail::Header + Mail::Internet with Email::Simple + Email::Sender
++ to avoid nfsend PANIC nfsend (libexec/NfAlert.pm)
++- Apply fix for missing socket argument in calls to DoRebuild
++ https://sourceforge.net/p/nfsen/mailman/message/35850749/
++ install.pl:556, libexec/NfProfile.pm:3444
++- Extend (still) too short limits from textareas from 10240 to 102400
++ html/alerting.php:154, libexec/Nfcomm.pm:959,
++ html/details.php:1384
++- Compensate for potentially missing $_SESSION['profileinfo']['tstart']
++ html/details.php:1326
++
+ 2017-01-19
+ - Fix Security Vulenrability - which may execute arbitrary commands from the web interface.
+ - Support rrdtools 1.6
+diff -ru nfsen-1.3.8/html/alerting.php nfsen-1.3.8-rmnet-20190305/html/alerting.php
+--- nfsen-1.3.8/html/alerting.php 2014-06-23 21:27:50.000000000 +0200
++++ nfsen-1.3.8-rmnet-20190305/html/alerting.php 2019-01-14 18:15:13.541056085 +0100
+@@ -151,7 +151,7 @@
+ </td>
+ <td>
+ <textarea name="filter" id="filter" multiline="true" wrap="phisical" rows="4" cols="70"
+- maxlength="10240" style="width:100%" <?php echo $disabled?>><?php
++ maxlength="102400" style="width:100%" <?php echo $disabled?>><?php
+ foreach ( $alert['filter'] as $line ) {
+ print htmlspecialchars(stripslashes($line)) . "\n";
+ }
+diff -ru nfsen-1.3.8/html/details.php nfsen-1.3.8-rmnet-20190305/html/details.php
+--- nfsen-1.3.8/html/details.php 2017-01-19 17:16:21.000000000 +0100
++++ nfsen-1.3.8-rmnet-20190305/html/details.php 2019-01-24 13:44:15.173040614 +0100
+@@ -1323,9 +1323,9 @@
+ GMToffset = <?php echo $GMToffset;?> + curdate.getTimezoneOffset() * 60;
+ CursorMode = <?php echo $detail_opts['cursor_mode'];?>;
+ if ( CursorMode == 0 )
+- SlotSelectInit(<?php echo $_SESSION['tstart'] . ", " . $_SESSION['tend']. ", " . $_SESSION['profileinfo']['tstart'] . ", " . $_SESSION['tleft']. ",576, $RRDoffset" ?>);
++ SlotSelectInit(<?php echo $_SESSION['tstart'] . ", " . $_SESSION['tend']. ", " . ($_SESSION['profileinfo']['tstart'] || $_SESSION['tstart']) . ", " . $_SESSION['tleft']. ",576, $RRDoffset" ?>);
+ else
+- WSelectInit(<?php echo $_SESSION['tstart'] . ", " . $_SESSION['tend']. ", " . $_SESSION['profileinfo']['tstart'] . ", " . $_SESSION['tleft'] . ", " . $_SESSION['tright'] . ",576, $RRDoffset" ?>);
++ WSelectInit(<?php echo $_SESSION['tstart'] . ", " . $_SESSION['tend']. ", " . ($_SESSION['profileinfo']['tstart'] || $_SESSION['tstart']) . ", " . $_SESSION['tleft'] . ", " . $_SESSION['tright'] . ",576, $RRDoffset" ?>);
+ <?php
+ if ( array_key_exists('anchor', $_SESSION) ) {
+ print "location.hash='" . $_SESSION['anchor'] . "';";
+@@ -1381,7 +1381,7 @@
+ <INPUT TYPE="button" NAME="JSbutton2" Value="All Sources" onClick="SelectAllSources()">
+ </TD>
+ <td style="vertical-align:top;">
+- <textarea name="filter" id="filter" multiline="true" wrap="phisical" rows="6" cols="50" maxlength="10240"><?php
++ <textarea name="filter" id="filter" multiline="true" wrap="phisical" rows="6" cols="50" maxlength="102400"><?php
+ $display_filter = array_key_exists('editfilter', $process_form) ? $process_form['editfilter'] : $process_form['filter'];
+ foreach ( $display_filter as $line ) {
+ print htmlspecialchars(stripslashes($line)) . "\n";
+diff -ru nfsen-1.3.8/install.pl nfsen-1.3.8-rmnet-20190305/install.pl
+--- nfsen-1.3.8/install.pl 2017-01-19 17:16:21.000000000 +0100
++++ nfsen-1.3.8-rmnet-20190305/install.pl 2019-01-14 15:14:09.747589485 +0100
+@@ -553,7 +553,7 @@
+ if( ! -f "$NfConf::PROFILEDATADIR/$profilepath/$channel/.nfstat") {
+ # no shadow profile, but missing channel stat
+ print "Rebuilding profile stats for '$profilegroup/$profilename'\n";
+- NfProfile::DoRebuild(\%profileinfo, $profilename, $profilegroup, $profilepath, 1, 0);
++ NfProfile::DoRebuild(*STDOUT, \%profileinfo, $profilename, $profilegroup, $profilepath, 1, 0);
+ NfProfile::WriteProfile(\%profileinfo);
+ }
+ # make sure it's own by nfsen_uid after the rebuild
+diff -ru nfsen-1.3.8/libexec/NfAlert.pm nfsen-1.3.8-rmnet-20190305/libexec/NfAlert.pm
+--- nfsen-1.3.8/libexec/NfAlert.pm 2014-06-23 21:27:50.000000000 +0200
++++ nfsen-1.3.8-rmnet-20190305/libexec/NfAlert.pm 2019-03-05 13:33:55.129674052 +0100
+@@ -1,4 +1,4 @@
+-#!%%PERL%%
++#!/bin/perl
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
+ # All rights reserved.
+ #
+@@ -41,8 +41,9 @@
+ use Storable qw(lock_store lock_retrieve);
+ use POSIX ":sys_wait_h";
+ use POSIX 'strftime';
+-use Mail::Header;
+-use Mail::Internet;
++use Email::Sender::Simple;
++use Email::Simple;
++use Email::Simple::Creator;
+
+ use NfSen;
+ use NfSenRRD;
+@@ -842,53 +843,29 @@
+ if ( ($$alertref{'action_type'} & 1) > 0 ) {
+ syslog('debug', "alert '$alert' Send email to: $$alertref{'action_email'}");
+
+- my @header = (
+- "From: $NfConf::MAIL_FROM",
+- "To: $$alertref{'action_email'}",
+- "Subject: $$alertref{'action_subject'}"
+- );
+-
+- my $mail_header = new Mail::Header( \@header ) ;
+-
+ my $mail_body_string = $NfConf::MAIL_BODY;
+ # substitute all vars
+- my %replace = (
+- 'alert' => $alert,
+- 'timeslot' => $timeslot,
++ my %replace = (
++ 'alert' => $alert,
++ 'timeslot' => $timeslot,
+ );
+ foreach my $key ( keys %replace ) {
+ $mail_body_string =~ s/\@$key\@/$replace{$key}/g;
+ }
+
+- my @mail_body = split /\n/, $mail_body_string;
+-
+- my $mail = new Mail::Internet(
+- Header => $mail_header,
+- Body => \@mail_body,
+- );
+-
+- my @sent_to = $mail->smtpsend(
+- Host => $NfConf::SMTP_SERVER ,
+- Hello => $NfConf::SMTP_SERVER,
+- MailFrom => $NfConf::MAIL_FROM
++ my $mail = Email::Simple->create(
++ 'header' => [
++ "From" => $NfConf::MAIL_FROM,
++ "To" => $$alertref{'action_email'},
++ "Subject" => $$alertref{'action_subject'},
++ ],
++ 'body' => $mail_body_string,
+ );
+-
+- # Do we have failed receipients?
+- my %_tmp;
+- my @_recv = split /\s*,\s*/, $$alertref{'action_email'};
+- @_tmp{@_recv} = 1;
+- delete @_tmp{@sent_to};
+- my @Failed = keys %_tmp;
+-
+- foreach my $rcpt ( @sent_to ) {
+- syslog('info', "alert '$alert' : Successful sent mail to: '$rcpt'");
+- }
+- if ( scalar @Failed > 0 ) {
+- foreach my $rcpt ( @Failed ) {
+- syslog('err', "alert '$alert' : Failed to send alert email to: $rcpt");
+- }
+- }
+-
++ if (Email::Sender::Simple->try_to_send($mail)) {
++ syslog('info', "alert '$alert' : Successfully sent alert mail");
++ } else {
++ syslog('err', "alert '$alert' : Failed to send alert email!");
++ }
+ }
+
+ # execute system command
+diff -ru nfsen-1.3.8/libexec/Nfcomm.pm nfsen-1.3.8-rmnet-20190305/libexec/Nfcomm.pm
+--- nfsen-1.3.8/libexec/Nfcomm.pm 2017-01-19 17:16:21.000000000 +0100
++++ nfsen-1.3.8-rmnet-20190305/libexec/Nfcomm.pm 2019-01-14 18:15:06.030046717 +0100
+@@ -957,7 +957,7 @@
+ syslog('err', "Key format error for '$arg'");
+ return "key format error";
+ }
+- if ( length($value) > 10240 ) {
++ if ( length($value) > 102400 ) {
+ syslog('err', "Argument too long - length check failed.");
+ return "value too long.";
+ }
+diff -ru nfsen-1.3.8/libexec/NfProfile.pm nfsen-1.3.8-rmnet-20190305/libexec/NfProfile.pm
+--- nfsen-1.3.8/libexec/NfProfile.pm 2014-06-23 21:27:50.000000000 +0200
++++ nfsen-1.3.8-rmnet-20190305/libexec/NfProfile.pm 2019-01-14 15:14:44.738643606 +0100
+@@ -3441,7 +3441,7 @@
+ } else {
+ $profileinfo{'type'} = 1;
+ }
+- my $status = DoRebuild(\%profileinfo, $profile, $profilegroup, $profilepath, 0, 0);
++ my $status = DoRebuild(*STDOUT, \%profileinfo, $profile, $profilegroup, $profilepath, 0, 0);
+ syslog('err', "Rebuilded profile '$profile' in group '$profilegroup': $status ");
+ }
+ if ( -f "$NfConf::PROFILESTATDIR/$profilepath/.CANCELED" ) {
+@@ -3453,7 +3453,7 @@
+ } else {
+ $profileinfo{'type'} = 1;
+ }
+- my $status = DoRebuild(\%profileinfo, $profile, $profilegroup, $profilepath, 0, 0);
++ my $status = DoRebuild(*STDOUT, \%profileinfo, $profile, $profilegroup, $profilepath, 0, 0);
+ syslog('err', "Rebuilded profile '$profile' in group '$profilegroup': $status ");
+ }
+ if ( $profileinfo{'locked'} ) {
|