1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
Description: Detection of empty strings for mailer.
The source code tries to detect an empty string in
a defective manner. This can be used to crash the
program at first attempt to send a mail notification.
.
The configuration parameters are checked in order to
disable the mainling service in case of misused strings.
program abortion.
.
The sample configuration is updated to display the correct
MTA-string, the value already hardcoded into the program.
Author: Mats Erik Andersson <debian@gisladisker.se>
Forwarded: yes
Last-Update: 2015-07-07
diff -Naur ipband-0.8.1.debian/init.c ipband-0.8.1/init.c
--- ipband-0.8.1.debian/init.c 2011-03-22 15:00:21.000000000 +0100
+++ ipband-0.8.1/init.c 2011-03-22 17:15:05.000000000 +0100
@@ -31,7 +31,7 @@
printf(" -b kBps - Default bandwidth threshold in kBytes.\n");
printf(" per sec. Default is 7 kBps i.e 56 kbps.\n");
printf(" -c filename - Read configuration file. Default is ");
- printf( "/etc/ipaband.conf.\n");
+ printf( "/etc/ipband.conf.\n");
printf(" -C - Ignore configuration file\n");
printf(" -d level - Debug level: 0 - no debuging; 1 - summary;\n");
printf(" 2 - subnet stats; 3 - all packets captured.\n");
@@ -585,4 +585,13 @@
if( (top_m < 0) )
err_quit("ERROR: negative per-host connection report limit\n");
+ if( mailto_m && mtastring_m &&
+ (strlen(mailto_m) == 0 || strlen(mtastring_m) == 0) ) {
+ /* Remove these obviously faked values,
+ * thus disabling any reports by the mailer. */
+ FREE(mailto_m);
+ FREE(mtastring_m);
+ err_msg("ERROR: Misconfigured `mtastring_m` was left empty.");
+ err_msg(" Program is continuing wothout mailing any reports.");
+ }
}
diff -Naur ipband-0.8.1.debian/ipband.sample.conf ipband-0.8.1/ipband.sample.conf
--- ipband-0.8.1.debian/ipband.sample.conf 2008-06-17 19:23:19.000000000 +0200
+++ ipband-0.8.1/ipband.sample.conf 2011-03-22 15:35:58.000000000 +0100
@@ -58,10 +58,11 @@
# ASCII file to use as e-mail report footer.
#mailfoot /etc/ipband.foot
-# MTA string. Default is "/usr/sbin/sendmail -t -ba". Change it to
-# whatever runs MTA of your choice. Note that the stringis tokenized and
-# passed to exec(), so that shell's metacharacters are not interpreted.
-#mtastring "/usr/sbin/sendmail -t -ba"
+# MTA string. Default is "/usr/sbin/sendmail -t -oi". Change it
+# to whatever runs the MTA of your choice. Note that the string
+# is tokenized and passed to exec(), so that shell's metacharacters
+# are not interpreted.
+#mtastring "/usr/sbin/sendmail -t -oi"
# Default number of subnet mask bits.
#maskbits 24
diff -Naur ipband-0.8.1.debian/popen.c ipband-0.8.1/popen.c
--- ipband-0.8.1.debian/popen.c 2008-06-17 19:23:19.000000000 +0200
+++ ipband-0.8.1/popen.c 2011-03-22 15:17:12.000000000 +0100
@@ -35,7 +35,7 @@
pid_t pid;
FILE *fp;
- if(cmd == NULL || cmd == "")
+ if(cmd == NULL || *cmd == '\0')
return(NULL);
if ((type[0] != 'r' && type[0] != 'w') || type[1] != 0) {
diff -Naur ipband-0.8.1.debian/reports.c ipband-0.8.1/reports.c
--- ipband-0.8.1.debian/reports.c 2011-03-22 15:00:21.000000000 +0100
+++ ipband-0.8.1/reports.c 2015-07-07 23:34:52.000000000 +0200
@@ -302,7 +302,7 @@
}
/* Sendmail headers */
fprintf(sendmail,"To: %s\n",mailto_m);
- fprintf(sendmail,"From: IP bandwdth watchdog <>\n");
+ fprintf(sendmail,"From: IP bandwidth watchdog <ipband>\n");
}
}
|