-/* $OpenBSD: auth-options.c,v 1.97 2021/07/24 01:55:19 djm Exp $ */
+/* $OpenBSD: auth-options.c,v 1.98 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org>
*
}
cp = tmp;
/* validate syntax before recording it. */
- host = hpdelim(&cp);
+ host = hpdelim2(&cp, NULL);
if (host == NULL || strlen(host) >= NI_MAXHOST) {
free(tmp);
free(opt);
-/* $OpenBSD: misc.c,v 1.172 2022/01/08 07:32:45 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.173 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
return old;
}
+/* The common case: only accept colon as delimiter. */
char *
hpdelim(char **cp)
{
- return hpdelim2(cp, NULL);
+ char *r, delim;
+
+ r = hpdelim2(cp, &delim);
+ if (delim == '/')
+ return NULL;
+ return r;
}
char *
-/* $OpenBSD: readconf.c,v 1.365 2022/02/04 02:49:17 dtucker Exp $ */
+/* $OpenBSD: readconf.c,v 1.366 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
const char *original_host, char *line, const char *filename,
int linenum, int *activep, int flags, int *want_final_pass, int depth)
{
- char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p, ch;
+ char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p;
char **cpptr, ***cppptr, fwdarg[256];
u_int i, *uintptr, uvalue, max_entries = 0;
int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0;
}
while ((arg = argv_next(&ac, &av)) != NULL) {
arg2 = xstrdup(arg);
- ch = '\0';
- p = hpdelim2(&arg, &ch);
- if (p == NULL || ch == '/') {
+ p = hpdelim(&arg);
+ if (p == NULL) {
fatal("%s line %d: missing host in %s",
filename, linenum,
lookup_opcode_name(opcode));
-/* $OpenBSD: servconf.c,v 1.382 2021/09/06 00:36:01 millert Exp $ */
+/* $OpenBSD: servconf.c,v 1.383 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
{
u_int i;
int port;
- char *host, *arg, *oarg, ch;
+ char *host, *arg, *oarg;
int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE;
const char *what = lookup_opcode_name(opcode);
/* Otherwise treat it as a list of permitted host:port */
for (i = 0; i < num_opens; i++) {
oarg = arg = xstrdup(opens[i]);
- ch = '\0';
- host = hpdelim2(&arg, &ch);
- if (host == NULL || ch == '/')
+ host = hpdelim(&arg);
+ if (host == NULL)
fatal_f("missing host in %s", what);
host = cleanhostname(host);
if (arg == NULL || ((port = permitopen_port(arg)) < 0))
struct connection_info *connectinfo, int *inc_flags, int depth,
struct include_list *includes)
{
- char ch, *str, ***chararrayptr, **charptr, *arg, *arg2, *p, *keyword;
+ char *str, ***chararrayptr, **charptr, *arg, *arg2, *p, *keyword;
int cmdline = 0, *intptr, value, value2, n, port, oactive, r, found;
SyslogFacility *log_facility_ptr;
LogLevel *log_level_ptr;
p = arg;
} else {
arg2 = NULL;
- ch = '\0';
- p = hpdelim2(&arg, &ch);
- if (p == NULL || ch == '/')
+ p = hpdelim(&arg);
+ if (p == NULL)
fatal("%s line %d: bad address:port usage",
filename, linenum);
p = cleanhostname(p);
xasprintf(&arg2, "*:%s", arg);
} else {
arg2 = xstrdup(arg);
- ch = '\0';
- p = hpdelim2(&arg, &ch);
- if (p == NULL || ch == '/') {
+ p = hpdelim(&arg);
+ if (p == NULL) {
fatal("%s line %d: %s missing host",
filename, linenum, keyword);
}
-/* $OpenBSD: session.c,v 1.329 2021/08/11 05:20:17 djm Exp $ */
+/* $OpenBSD: session.c,v 1.330 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
for (i = 0; i < auth_opts->npermitopen; i++) {
tmp = cp = xstrdup(auth_opts->permitopen[i]);
/* This shouldn't fail as it has already been checked */
- if ((host = hpdelim(&cp)) == NULL)
+ if ((host = hpdelim2(&cp, NULL)) == NULL)
fatal_f("internal error: hpdelim");
host = cleanhostname(host);
if (cp == NULL || (port = permitopen_port(cp)) < 0)
-/* $OpenBSD: ssh.c,v 1.572 2022/01/06 22:04:20 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.573 2022/02/08 08:59:12 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
{
u_int i;
int port;
- char *addr, *arg, *oarg, ch;
+ char *addr, *arg, *oarg;
int where = FORWARD_LOCAL;
channel_clear_permission(ssh, FORWARD_ADM, where);
/* Otherwise treat it as a list of permitted host:port */
for (i = 0; i < num_opens; i++) {
oarg = arg = xstrdup(opens[i]);
- ch = '\0';
- addr = hpdelim2(&arg, &ch);
- if (addr == NULL || ch == '/')
+ addr = hpdelim(&arg);
+ if (addr == NULL)
fatal_f("missing host in %s", what);
addr = cleanhostname(addr);
if (arg == NULL || ((port = permitopen_port(arg)) < 0))