From nobody Mon Feb 6 16:39:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P9X5x1Qg5z3mvnZ; Mon, 6 Feb 2023 16:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P9X5x0vPdz4Lx1; Mon, 6 Feb 2023 16:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675701557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X1e4ntNdfK/A2SHqi/VQsi4bl0i+1Y4M93KD3S6pe4M=; b=q/fxwGjB/b3qEA3mQIZVcQnVK26wjNw4E9/9GOlV/C5xoLdXYem+o7wSfatTPBym2VOi5E fZ1GiXELTv024bKgMcEJJSfnivHtrTrsQMlOpCXfxix6oi4hrneaMszO9tyRW7G6bA0ZnQ YIMbL6qXGN5ptrAmfx47X8pQrGtG3TOutYdDVVljrleNB65PRfLh+IbidhJldkSiW/c3Rv HxpzCvIosfzUaUhFLAVjp39fhVyckpOyoetnPU1/5xc4vPoHPeSAaPhocrekoBfa1ey0SJ HLUZgaGaYT/qzWKTEgrgC9rq6TyNmTXO1ABXzYqPyyvBwcU4XOz1goU7CUbctw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675701557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X1e4ntNdfK/A2SHqi/VQsi4bl0i+1Y4M93KD3S6pe4M=; b=pGQqQ36Md/zh6N21qb0J8bs8pALtlWEEf73aW4BA+Ytp+ZCrd9Nw6EShG0d9nFVwJvFW8e n8AftWAOe/7vtwCk3aJX9voXdcaOAjB1YgG+2NPTIcS6Mc7aSWyLdXMPvR2x6DGqPdX9Ek ADAUg3bmv6ZB5fgBbzzABet+v9KETGvyv+380fSizOwuS9+pfF6uH+KOCuFNr5a5vajnmC 6sq+pSUScKW2ejAhn0CHeNg4MBee8RW4hjiFMnFUGjcGO6vXsVPzOuXWEOBhan08a4G1Ji fGGCUzsXncpiGUnNXiP3Ddz69USkKj4dzEDvGl3Sfc+BqO8ufWlvSZ5V0ko1xA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675701557; a=rsa-sha256; cv=none; b=xBD1e8dNX31L7RxU7+wUZPTjksYmQ97f0IGiTBY36oofCBR8/Om3XhqEj9pulXgNVKc4IW F72BrQvQfXlk6uLVi33Z5zvovsyf6ce74H5myJkU35KTgTX7vhAxVfn3rl/y5VGqKcuwH3 fLYeE8/g1qtAzs/w3Hpbboa0bV0/a10+/K/rQVIo8bvfh/x+eQm2WIQLOACevKTO/y3Lsw tJKODvaGZzauhPIXgPgPH8HtYmKkBsWubRJRn2TaZggvRvMuKW38zPY7Rp0t3rS4dJXTK+ CXrEDkJw+gBpUQgeEZTuixr97vNF2fRTJ/INoiRfOTizwypjVJyNZJA9N3UZbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P9X5w73mRzhLB; Mon, 6 Feb 2023 16:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 316GdGwn059142; Mon, 6 Feb 2023 16:39:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316GdGTs059141; Mon, 6 Feb 2023 16:39:16 GMT (envelope-from git) Date: Mon, 6 Feb 2023 16:39:16 GMT Message-Id: <202302061639.316GdGTs059141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 94e21add4534 - main - ssh: fix bug in PermitRemoteOpen which caused it to ignore... List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94e21add45344f0669f910ea77db499e8c892c90 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=94e21add45344f0669f910ea77db499e8c892c90 commit 94e21add45344f0669f910ea77db499e8c892c90 Author: Ed Maste AuthorDate: 2023-02-06 16:33:38 +0000 Commit: Ed Maste CommitDate: 2023-02-06 16:33:38 +0000 ssh: fix bug in PermitRemoteOpen which caused it to ignore... its first argument unless it was one of the special keywords "any" or "none". Obtained from: OpenSSH-portable commit b3daa8dc5823 Sponsored by: The FreeBSD Foundation --- crypto/openssh/readconf.c | 62 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/crypto/openssh/readconf.c b/crypto/openssh/readconf.c index d262e6b6ed2c..6562c2a73db9 100644 --- a/crypto/openssh/readconf.c +++ b/crypto/openssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.369 2022/09/17 10:33:18 djm Exp $ */ +/* $OpenBSD: readconf.c,v 1.371 2023/01/02 07:03:30 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1574,37 +1574,37 @@ parse_pubkey_algos: case oPermitRemoteOpen: uintptr = &options->num_permitted_remote_opens; cppptr = &options->permitted_remote_opens; - arg = argv_next(&ac, &av); - if (!arg || *arg == '\0') - fatal("%s line %d: missing %s specification", - filename, linenum, lookup_opcode_name(opcode)); uvalue = *uintptr; /* modified later */ - if (strcmp(arg, "any") == 0 || strcmp(arg, "none") == 0) { - if (*activep && uvalue == 0) { - *uintptr = 1; - *cppptr = xcalloc(1, sizeof(**cppptr)); - (*cppptr)[0] = xstrdup(arg); - } - break; - } + i = 0; while ((arg = argv_next(&ac, &av)) != NULL) { arg2 = xstrdup(arg); - p = hpdelim(&arg); - if (p == NULL) { - fatal("%s line %d: missing host in %s", - filename, linenum, - lookup_opcode_name(opcode)); - } - p = cleanhostname(p); - /* - * don't want to use permitopen_port to avoid - * dependency on channels.[ch] here. - */ - if (arg == NULL || - (strcmp(arg, "*") != 0 && a2port(arg) <= 0)) { - fatal("%s line %d: bad port number in %s", - filename, linenum, - lookup_opcode_name(opcode)); + /* Allow any/none only in first position */ + if (strcasecmp(arg, "none") == 0 || + strcasecmp(arg, "any") == 0) { + if (i > 0 || ac > 0) { + error("%s line %d: keyword %s \"%s\" " + "argument must appear alone.", + filename, linenum, keyword, arg); + goto out; + } + } else { + p = hpdelim(&arg); + if (p == NULL) { + fatal("%s line %d: missing host in %s", + filename, linenum, + lookup_opcode_name(opcode)); + } + p = cleanhostname(p); + /* + * don't want to use permitopen_port to avoid + * dependency on channels.[ch] here. + */ + if (arg == NULL || (strcmp(arg, "*") != 0 && + a2port(arg) <= 0)) { + fatal("%s line %d: bad port number " + "in %s", filename, linenum, + lookup_opcode_name(opcode)); + } } if (*activep && uvalue == 0) { opt_array_append(filename, linenum, @@ -1612,7 +1612,11 @@ parse_pubkey_algos: cppptr, uintptr, arg2); } free(arg2); + i++; } + if (i == 0) + fatal("%s line %d: missing %s specification", + filename, linenum, lookup_opcode_name(opcode)); break; case oClearAllForwardings: