View | Details | Raw Unified | Return to bug 2335 | Differences between
and this patch

Collapse All | Expand All

(-)a/misc.c (-1 / +1 lines)
Lines 466-472 put_host_port(const char *host, u_short port) Link Here
466
 * The delimiter char, if present, is stored in delim.
466
 * The delimiter char, if present, is stored in delim.
467
 * If this is the last field, *cp is set to NULL.
467
 * If this is the last field, *cp is set to NULL.
468
 */
468
 */
469
static char *
469
char *
470
hpdelim2(char **cp, char *delim)
470
hpdelim2(char **cp, char *delim)
471
{
471
{
472
	char *s, *old;
472
	char *s, *old;
(-)a/misc.h (+1 lines)
Lines 54-59 int set_rdomain(int, const char *); Link Here
54
int	 a2port(const char *);
54
int	 a2port(const char *);
55
int	 a2tun(const char *, int *);
55
int	 a2tun(const char *, int *);
56
char	*put_host_port(const char *, u_short);
56
char	*put_host_port(const char *, u_short);
57
char	*hpdelim2(char **, char *);
57
char	*hpdelim(char **);
58
char	*hpdelim(char **);
58
char	*cleanhostname(char *);
59
char	*cleanhostname(char *);
59
char	*colon(char *);
60
char	*colon(char *);
(-)a/servconf.c (-7 / +10 lines)
Lines 821-827 process_permitopen(struct ssh *ssh, ServerOptions *options) Link Here
821
{
821
{
822
	u_int i;
822
	u_int i;
823
	int port;
823
	int port;
824
	char *host, *arg, *oarg;
824
	char *host, *arg, *oarg, ch;
825
825
826
	channel_clear_adm_permitted_opens(ssh);
826
	channel_clear_adm_permitted_opens(ssh);
827
	if (options->num_permitted_opens == 0)
827
	if (options->num_permitted_opens == 0)
Lines 839-846 process_permitopen(struct ssh *ssh, ServerOptions *options) Link Here
839
	/* Otherwise treat it as a list of permitted host:port */
839
	/* Otherwise treat it as a list of permitted host:port */
840
	for (i = 0; i < options->num_permitted_opens; i++) {
840
	for (i = 0; i < options->num_permitted_opens; i++) {
841
		oarg = arg = xstrdup(options->permitted_opens[i]);
841
		oarg = arg = xstrdup(options->permitted_opens[i]);
842
		host = hpdelim(&arg);
842
		host = hpdelim2(&arg, &ch);
843
		if (host == NULL)
843
		if (host == NULL || ch == '/')
844
			fatal("%s: missing host in PermitOpen", __func__);
844
			fatal("%s: missing host in PermitOpen", __func__);
845
		host = cleanhostname(host);
845
		host = cleanhostname(host);
846
		if (arg == NULL || ((port = permitopen_port(arg)) < 0))
846
		if (arg == NULL || ((port = permitopen_port(arg)) < 0))
Lines 1244-1251 process_server_config_line(ServerOptions *options, char *line, Link Here
1244
			port = 0;
1244
			port = 0;
1245
			p = arg;
1245
			p = arg;
1246
		} else {
1246
		} else {
1247
			p = hpdelim(&arg);
1247
			char ch;
1248
			if (p == NULL)
1248
			arg2 = NULL;
1249
			p = hpdelim2(&arg, &ch);
1250
			if (p == NULL || ch == '/')
1249
				fatal("%s line %d: bad address:port usage",
1251
				fatal("%s line %d: bad address:port usage",
1250
				    filename, linenum);
1252
				    filename, linenum);
1251
			p = cleanhostname(p);
1253
			p = cleanhostname(p);
Lines 1815-1823 process_server_config_line(ServerOptions *options, char *line, Link Here
1815
			break;
1817
			break;
1816
		}
1818
		}
1817
		for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) {
1819
		for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) {
1820
			char ch;
1818
			arg2 = xstrdup(arg);
1821
			arg2 = xstrdup(arg);
1819
			p = hpdelim(&arg);
1822
			p = hpdelim2(&arg, &ch);
1820
			if (p == NULL)
1823
			if (p == NULL || ch == '/')
1821
				fatal("%s line %d: missing host in PermitOpen",
1824
				fatal("%s line %d: missing host in PermitOpen",
1822
				    filename, linenum);
1825
				    filename, linenum);
1823
			p = cleanhostname(p);
1826
			p = cleanhostname(p);

Return to bug 2335