|
Jakub Jelen |
b9d68e |
diff --git a/misc.c b/misc.c
|
|
Jakub Jelen |
3cd489 |
index 874dcc8a..7b7f7a58 100644
|
|
Jakub Jelen |
b9d68e |
--- a/misc.c
|
|
Jakub Jelen |
b9d68e |
+++ b/misc.c
|
|
Jakub Jelen |
3cd489 |
@@ -466,7 +466,7 @@ put_host_port(const char *host, u_short port)
|
|
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 |
3cd489 |
diff --git a/misc.h b/misc.h
|
|
Jakub Jelen |
3cd489 |
index cdafea73..cf9c8f28 100644
|
|
Jakub Jelen |
3cd489 |
--- a/misc.h
|
|
Jakub Jelen |
3cd489 |
+++ b/misc.h
|
|
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 |
3cd489 |
diff --git a/servconf.c b/servconf.c
|
|
Jakub Jelen |
3cd489 |
index 0f0d0906..1679181e 100644
|
|
Jakub Jelen |
3cd489 |
--- a/servconf.c
|
|
Jakub Jelen |
3cd489 |
+++ b/servconf.c
|
|
Jakub Jelen |
3cd489 |
@@ -821,7 +821,7 @@ process_permitopen(struct ssh *ssh, ServerOptions *options)
|
|
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 |
b9d68e |
|
|
Jakub Jelen |
3cd489 |
channel_clear_adm_permitted_opens(ssh);
|
|
Jakub Jelen |
3cd489 |
if (options->num_permitted_opens == 0)
|
|
Jakub Jelen |
3cd489 |
@@ -839,8 +839,8 @@ process_permitopen(struct ssh *ssh, ServerOptions *options)
|
|
Jakub Jelen |
3cd489 |
/* Otherwise treat it as a list of permitted host:port */
|
|
Jakub Jelen |
3cd489 |
for (i = 0; i < options->num_permitted_opens; i++) {
|
|
Jakub Jelen |
3cd489 |
oarg = arg = xstrdup(options->permitted_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 |
3cd489 |
fatal("%s: missing host in PermitOpen", __func__);
|
|
Jakub Jelen |
3cd489 |
host = cleanhostname(host);
|
|
Jakub Jelen |
3cd489 |
if (arg == NULL || ((port = permitopen_port(arg)) < 0))
|
|
Jakub Jelen |
3cd489 |
@@ -1244,8 +1244,10 @@ process_server_config_line(ServerOptions *options, char *line,
|
|
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 |
3cd489 |
@@ -1815,9 +1817,10 @@ process_server_config_line(ServerOptions *options, char *line,
|
|
Jakub Jelen |
3cd489 |
break;
|
|
Jakub Jelen |
3cd489 |
}
|
|
Jakub Jelen |
3cd489 |
for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) {
|
|
Jakub Jelen |
3cd489 |
+ char ch;
|
|
Jakub Jelen |
3cd489 |
arg2 = xstrdup(arg);
|
|
Jakub Jelen |
3cd489 |
- p = hpdelim(&arg;;
|
|
Jakub Jelen |
3cd489 |
- if (p == NULL)
|
|
Jakub Jelen |
3cd489 |
+ p = hpdelim2(&arg, &ch);
|
|
Jakub Jelen |
3cd489 |
+ if (p == NULL || ch == '/')
|
|
Jakub Jelen |
3cd489 |
fatal("%s line %d: missing host in PermitOpen",
|
|
Jakub Jelen |
3cd489 |
filename, linenum);
|
|
Jakub Jelen |
3cd489 |
p = cleanhostname(p);
|