Group :: System/Kernel and hardware
RPM: iptables
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: iptables-1.3.7-alt-parse_port.patch
Download
Download
diff -upk.orig iptables-1.3.7.orig/extensions/libipt_MASQUERADE.c iptables-1.3.7/extensions/libipt_MASQUERADE.c
--- iptables-1.3.7.orig/extensions/libipt_MASQUERADE.c 2006-12-04 11:15:19 +0000
+++ iptables-1.3.7/extensions/libipt_MASQUERADE.c 2006-12-09 15:51:37 +0000
@@ -57,7 +57,7 @@ parse_ports(const char *arg, struct ip_n
int maxport;
maxport = atoi(dash + 1);
- if (maxport == 0 || maxport > 65535)
+ if (maxport <= 0 || maxport > 65535)
exit_error(PARAMETER_PROBLEM,
"Port `%s' not valid\n", dash+1);
if (maxport < port)
diff -upk.orig iptables-1.3.7.orig/extensions/libipt_REDIRECT.c iptables-1.3.7/extensions/libipt_REDIRECT.c
--- iptables-1.3.7.orig/extensions/libipt_REDIRECT.c 2006-12-04 11:15:19 +0000
+++ iptables-1.3.7/extensions/libipt_REDIRECT.c 2006-12-09 15:51:37 +0000
@@ -48,7 +48,7 @@ parse_ports(const char *arg, struct ip_n
exit_error(PARAMETER_PROBLEM, "IP address not permitted\n");
port = atoi(arg);
- if (port == 0 || port > 65535)
+ if (port <= 0 || port > 65535)
exit_error(PARAMETER_PROBLEM, "Port `%s' not valid\n", arg);
dash = strchr(arg, '-');
@@ -60,7 +60,7 @@ parse_ports(const char *arg, struct ip_n
int maxport;
maxport = atoi(dash + 1);
- if (maxport == 0 || maxport > 65535)
+ if (maxport <= 0 || maxport > 65535)
exit_error(PARAMETER_PROBLEM,
"Port `%s' not valid\n", dash+1);
if (maxport < port)
diff -upk.orig iptables-1.3.7.orig/ip6tables.c iptables-1.3.7/ip6tables.c
--- iptables-1.3.7.orig/ip6tables.c 2006-12-04 11:15:20 +0000
+++ iptables-1.3.7/ip6tables.c 2006-12-09 15:46:53 +0000
@@ -252,7 +252,7 @@ service_to_port(const char *name, const
{
struct servent *service;
- if ((service = getservbyname(name, proto)) != NULL)
+ if (proto && (service = getservbyname(name, proto)) != NULL)
return ntohs((unsigned short) service->s_port);
return -1;
@@ -267,8 +267,13 @@ parse_port(const char *port, const char
(portnum = service_to_port(port, proto)) != -1)
return (u_int16_t)portnum;
- exit_error(PARAMETER_PROBLEM,
- "invalid port/service `%s' specified", port);
+ if (proto)
+ exit_error(PARAMETER_PROBLEM,
+ "invalid %s port/service `%s' specified",
+ proto, port);
+ else
+ exit_error(PARAMETER_PROBLEM,
+ "invalid port `%s' specified", port);
}
static void
diff -upk.orig iptables-1.3.7.orig/iptables.c iptables-1.3.7/iptables.c
--- iptables-1.3.7.orig/iptables.c 2006-12-04 11:15:20 +0000
+++ iptables-1.3.7/iptables.c 2006-12-09 15:50:35 +0000
@@ -256,7 +256,7 @@ service_to_port(const char *name, const
{
struct servent *service;
- if ((service = getservbyname(name, proto)) != NULL)
+ if (proto && (service = getservbyname(name, proto)) != NULL)
return ntohs((unsigned short) service->s_port);
return -1;
@@ -271,8 +271,13 @@ parse_port(const char *port, const char
(portnum = service_to_port(port, proto)) != -1)
return (u_int16_t)portnum;
- exit_error(PARAMETER_PROBLEM,
- "invalid port/service `%s' specified", port);
+ if (proto)
+ exit_error(PARAMETER_PROBLEM,
+ "invalid %s port/service `%s' specified",
+ proto, port);
+ else
+ exit_error(PARAMETER_PROBLEM,
+ "invalid port `%s' specified", port);
}
enum {