[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nufw-devel] [PATCH 4 of 5] plaintext: do not add a port range when the
From: |
Mikael Berthe |
Subject: |
[Nufw-devel] [PATCH 4 of 5] plaintext: do not add a port range when the range is bad |
Date: |
Tue, 25 Oct 2005 19:56:06 +0200 |
# HG changeset patch
# User Mikael Berthe <address@hidden>
# Node ID fec60a5ba83d9499d41f2a577cac9a431a07d30c
# Parent 033d2becb056050a947c608d44b9b9e1950bbde0
plaintext: do not add a port range when the range is bad
Could happen with a bad configuration file.
diff -r 033d2becb056 -r fec60a5ba83d src/nuauth/modules/plaintext/plaintext.c
--- a/src/nuauth/modules/plaintext/plaintext.c Sun Oct 23 19:15:49 2005 +0200
+++ b/src/nuauth/modules/plaintext/plaintext.c Sun Oct 23 19:15:55 2005 +0200
@@ -146,24 +146,27 @@
struct T_ports *this_port;
// One port or ports range to add...
if (n == 2) { // That's a range
- if (lastport >= fport)
+ if (lastport >= fport) {
ports.nbports = lastport - fport;
- else {
+ } else {
+ ports.nbports = -1;
if (DEBUG_OR_NOT(DEBUG_LEVEL_WARNING,DEBUG_AREA_MAIN))
g_message("%s parse_ports: Malformed line", prefix);
}
} else
ports.nbports = 0;
- this_port = g_new0(struct T_ports, 1);
- this_port->firstport = ports.firstport;
- this_port->nbports = ports.nbports;
- portslist = g_slist_prepend(portslist, this_port);
-#ifdef DEBUG_ENABLE
- if (DEBUG_OR_NOT(DEBUG_LEVEL_VERBOSE_DEBUG,DEBUG_AREA_MAIN))
- g_message("%s Adding Port = %d, number = %d", prefix,
- ports.firstport, ports.nbports);
-#endif
+ if (ports.nbports >= 0) {
+ this_port = g_new0(struct T_ports, 1);
+ this_port->firstport = ports.firstport;
+ this_port->nbports = ports.nbports;
+ portslist = g_slist_prepend(portslist, this_port);
+#ifdef DEBUG_ENABLE
+ if (DEBUG_OR_NOT(DEBUG_LEVEL_VERBOSE_DEBUG,DEBUG_AREA_MAIN))
+ g_message("%s Adding Port = %d, number = %d", prefix,
+ ports.firstport, ports.nbports);
+#endif
+ }
}
if ((p_ports = p_nextports))
p_ports++;