From nobody Wed Feb 8 21:05:52 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 4PBswc6WHrz3pK8q; Wed, 8 Feb 2023 21:05:52 +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 4PBswc3rwgz3jlW; Wed, 8 Feb 2023 21:05:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675890352; 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=0uiVxbSi1m5tW+c4gmj1vyybpwRxvj/0MK20JTt7Llg=; b=ePO8isdVlvXaFMC72QfAk89CNTA0o4madwl0VifDZbG42vtXIC62kBBqgbE0jTVLgFkoYC jNvO/mF4FOsifBM4HaXdBgaUsSvYyEDw0Ja2kMZSmzKVCwAEgGnUYKAJv990Pu+/KGviac exwktIxKF8KkLPAvqGaZIxHOxEPwAwO1YjemXLMZ7go3moRq/1DxnbBfyOBXRr5qqDRIW9 ngjWSLS7K/TgJrtFWJ1GgB64JLkI56X07+alNTC6kGe7pZlbyBsL+y5QzyXKvuCb+CPouX SSYb+L6/EHRpwd6wmZVpEmkPAAxUW2aMLjwBIVv2dFYrsFs+Q+4oPZnTn846iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675890352; 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=0uiVxbSi1m5tW+c4gmj1vyybpwRxvj/0MK20JTt7Llg=; b=fCNj/PVKonIPIDuIuj1rTe5cG4lfwIJiHE3Q4Oi9aQbGQtJdRxSbpLECw+NpTSVdxBFU0p Wn5sfuR66eVd5CvPw4s2H3yNroq4zR1ECQw61Ojug0+SqjDJ65pybdxpMOZ+MD9QAxR8Am etc34x7JrvkqSpzIPka9dgloL2tiERW+J+WZ/ZNU0ZVyeBpMIyyR/50FOk6OxUAn/vOcOX l0LReS2LTmXPcM4uaMTejD1ioimWcciNGZnoNOWutB4nlAjgl75R62/8oyVWw/oJ0JElPU k7mGrfaLfFvGG81dxgFikVPCGAMIsFouC35kGak9K7zTn5n/9s6eUtguYrcCBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675890352; a=rsa-sha256; cv=none; b=ySIoDjXlFuuTIVJSQLHd5jeaXQhXiCvQMyUEKYcgALPQCbbCkxaESZJUVV2GjB5X815rNq soAdgp6CDwLg83jg0bi23XlhJus8cfCaFGWfi4T33jV+4zjVfvaRCkqMXnTcx4Umcfarvw SPHXwEB2FLL3xC/PHWk0wB/ICu+MPIx6I7vXFVlhqUYOS3/oHEoaz61EhBCGXBHjyHdtHs b+2VLbVk7K2LgfxTijpU2VGaHOznCGUH6yLhMdEsn6MYp/0ef2acAT9w+5v/IsOgGpcUiv D3CGdV7jz4+BJUhGTZjwcmizhYt7mBFd3HR3hMPKeKewpncovzyKtmufidGlqA== 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 4PBswc2hXHz1BDZ; Wed, 8 Feb 2023 21:05:52 +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 318L5qDo067843; Wed, 8 Feb 2023 21:05:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 318L5qCY067842; Wed, 8 Feb 2023 21:05:52 GMT (envelope-from git) Date: Wed, 8 Feb 2023 21:05:52 GMT Message-Id: <202302082105.318L5qCY067842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 375bb3704d13 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 375bb3704d1371dec08f49cf8767f7b98162da34 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=375bb3704d1371dec08f49cf8767f7b98162da34 commit 375bb3704d1371dec08f49cf8767f7b98162da34 Author: Ed Maste AuthorDate: 2023-02-06 16:33:38 +0000 Commit: Ed Maste CommitDate: 2023-02-08 21:04:36 +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 (cherry picked from commit 94e21add45344f0669f910ea77db499e8c892c90) --- 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 c4453540c47c..fda7937582f4 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 @@ -1576,37 +1576,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, @@ -1614,7 +1614,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: