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