Blame SOURCES/openssh-7.8p1-ip-port-config-parser.patch

f5835d
diff -up openssh/misc.c.config openssh/misc.c
f5835d
--- openssh/misc.c.config	2018-08-22 13:58:54.922807799 +0200
f5835d
+++ openssh/misc.c	2018-08-22 13:58:55.000808428 +0200
f5835d
@@ -485,7 +485,7 @@ put_host_port(const char *host, u_short
f5835d
  * The delimiter char, if present, is stored in delim.
f5835d
  * If this is the last field, *cp is set to NULL.
f5835d
  */
f5835d
-static char *
f5835d
+char *
f5835d
 hpdelim2(char **cp, char *delim)
f5835d
 {
f5835d
 	char *s, *old;
f5835d
diff -up openssh/misc.h.config openssh/misc.h
f5835d
--- openssh/misc.h.config	2018-08-20 07:57:29.000000000 +0200
f5835d
+++ openssh/misc.h	2018-08-22 13:58:55.001808436 +0200
f5835d
@@ -54,6 +54,7 @@ int	 set_rdomain(int, const char *);
f5835d
 int	 a2port(const char *);
f5835d
 int	 a2tun(const char *, int *);
f5835d
 char	*put_host_port(const char *, u_short);
f5835d
+char	*hpdelim2(char **, char *);
f5835d
 char	*hpdelim(char **);
f5835d
 char	*cleanhostname(char *);
f5835d
 char	*colon(char *);
f5835d
diff -up openssh/servconf.c.config openssh/servconf.c
f5835d
--- openssh/servconf.c.config	2018-08-22 13:58:54.989808340 +0200
f5835d
+++ openssh/servconf.c	2018-08-22 14:18:49.235443937 +0200
f5835d
@@ -886,7 +886,7 @@ process_permitopen_list(struct ssh *ssh,
f5835d
 {
f5835d
 	u_int i;
f5835d
 	int port;
f5835d
-	char *host, *arg, *oarg;
f5835d
+	char *host, *arg, *oarg, ch;
f5835d
 	int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE;
f5835d
 	const char *what = lookup_opcode_name(opcode);
f5835d
 
f5835d
@@ -904,8 +904,8 @@ process_permitopen_list(struct ssh *ssh,
f5835d
 	/* Otherwise treat it as a list of permitted host:port */
f5835d
 	for (i = 0; i < num_opens; i++) {
f5835d
 		oarg = arg = xstrdup(opens[i]);
f5835d
-		host = hpdelim(&arg;;
f5835d
-		if (host == NULL)
f5835d
+		host = hpdelim2(&arg, &ch);
f5835d
+		if (host == NULL || ch == '/')
f5835d
 			fatal("%s: missing host in %s", __func__, what);
f5835d
 		host = cleanhostname(host);
f5835d
 		if (arg == NULL || ((port = permitopen_port(arg)) < 0))
f5835d
@@ -1323,8 +1323,10 @@ process_server_config_line(ServerOptions
f5835d
 			port = 0;
f5835d
 			p = arg;
f5835d
 		} else {
f5835d
-			p = hpdelim(&arg;;
f5835d
-			if (p == NULL)
f5835d
+			char ch;
f5835d
+			arg2 = NULL;
f5835d
+			p = hpdelim2(&arg, &ch);
f5835d
+			if (p == NULL || ch == '/')
f5835d
 				fatal("%s line %d: bad address:port usage",
f5835d
 				    filename, linenum);
f5835d
 			p = cleanhostname(p);
f5835d
@@ -1965,9 +1967,10 @@ process_server_config_line(ServerOptions
f5835d
 				 */
f5835d
 				xasprintf(&arg2, "*:%s", arg);
f5835d
 			} else {
f5835d
+				char ch;
f5835d
 				arg2 = xstrdup(arg);
f5835d
-				p = hpdelim(&arg;;
f5835d
-				if (p == NULL) {
f5835d
+				p = hpdelim2(&arg, &ch);
f5835d
+				if (p == NULL || ch == '/') {
f5835d
 					fatal("%s line %d: missing host in %s",
f5835d
 					    filename, linenum,
f5835d
 					    lookup_opcode_name(opcode));