From nobody Mon Aug 04 19:46:47 2025 X-Original-To: dev-commits-src-main@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 4bwnBJ0svVz63RVN; Mon, 04 Aug 2025 19:46:48 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bwnBH1K6xz4KdR; Mon, 04 Aug 2025 19:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754336807; 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=niuaIN6i9TUcYCif5OpyYbIiaqKhxqhdhfSXR07NicY=; b=pdb3OyIA7yTCyRuN1MLFFSL9Mh0okCopyyCeGQ0Rya+BtVUCTSDGr3GXXULXJu1HhXJhCx K9earHyjCd1K1MWwPtIGJYpSKyUyW7K49Zj0WODnhpu4fV9wIzBZXntkMCvp+C/9n5HWwy mvR9cTYlZLptzwZFWwqmrg0SNco3T3kFBhqdg0KXpcddMmwQIlNsyilsXvD5EGkQ8TBRIf f/5TfYt1cvsspELbY/nVqZ1vxcX4rjgX0OtpnbonZdJe3FiWjWIcDJUW9IqhxzwMN/WLWm 4yJZlc0Duifz0y3Yc2B73Zam6f8vkYGRkgvXOGQEd7a5SuBpU+SUVNuUhJu9wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754336807; 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=niuaIN6i9TUcYCif5OpyYbIiaqKhxqhdhfSXR07NicY=; b=T/VBrbFOxIo6e//OCL+i0HI/a1T3wEu/wbJ21F5ktTAesNCcVRfmBY96STn4z1Je/ePqKM 4zMmYJhOEY2SLSnFGe72szgTRMp8bHxNUkx98dPiTOCSiXe8UhUcQXJjzQ/04TsAzRY4wb HOyx0mvoWdqIn3Ba7lp+MlvQJdYmk/XD5MdJC/GIJxnuJoTN7ikcGDeXn4Pb/Yd/jDGI/J zO8m7s7tbkwDLDlqfWWd9jcL4j6UVpea/SKBJzyegFDE2HCgCOs6prwdHQYI4550xi6a3r YDjWg5k8d+wvcrd6ldjb7FhSlhpE8HCy/zeXYAaOsYHhBthKcg36TECd3DAzZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754336807; a=rsa-sha256; cv=none; b=h/izFkezVEjSrKTsCoGe3oOEFiv7jfSwHX3y9Djt/LCuTO1bIa/102PXfs/hD5JmDiG2mU dkzcV52W6EW3hVKboh7OvPAgsGERMQG5K3PuVTtSuLB8sE6/BffrP4uQbbjUXqeczue6D1 3camBTS0yTVVU7BDYMt2tsH+M8/qn8XYz9Kpc6/vPEteIG2U5XVivXCNcre1I0+F2AfV/W SnORC8DKDl3j7aue1vCZCgrPo/N4BGgng8b10DVSIpNNhq2wMbaBrvHl2pKcZmiVN1UkMp 1JQegMhfbVmtbULIN99cLk0NIX5HxF4O10He07yuAbrs13v6GMwECFZNhPk/gQ== 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 4bwnBH0sFWz13B9; Mon, 04 Aug 2025 19:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 574Jkl5x099026; Mon, 4 Aug 2025 19:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 574JklOm099024; Mon, 4 Aug 2025 19:46:47 GMT (envelope-from git) Date: Mon, 4 Aug 2025 19:46:47 GMT Message-Id: <202508041946.574JklOm099024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e1849d9a8db4 - main - ctld: Use a bool to track if a target uses a private auth_group List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1849d9a8db44087f04b3ecb11a4df9c308b08ac Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e1849d9a8db44087f04b3ecb11a4df9c308b08ac commit e1849d9a8db44087f04b3ecb11a4df9c308b08ac Author: John Baldwin AuthorDate: 2025-08-04 19:38:06 +0000 Commit: John Baldwin CommitDate: 2025-08-04 19:38:06 +0000 ctld: Use a bool to track if a target uses a private auth_group Sponsored by: Chelsio Communications Pull Request: https://github.com/freebsd/freebsd-src/pull/1794 --- usr.sbin/ctld/conf.cc | 11 ++++++----- usr.sbin/ctld/ctld.hh | 1 + usr.sbin/ctld/login.cc | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ctld/conf.cc b/usr.sbin/ctld/conf.cc index 10ce75237e35..4354d25147a4 100644 --- a/usr.sbin/ctld/conf.cc +++ b/usr.sbin/ctld/conf.cc @@ -519,7 +519,7 @@ static bool target_use_private_auth(const char *keyword) { if (target->t_auth_group != NULL) { - if (target->t_auth_group->ag_name != NULL) { + if (!target->t_private_auth) { log_warnx("cannot use both auth-group and " "%s for target \"%s\"", keyword, target->t_name); return (false); @@ -528,6 +528,7 @@ target_use_private_auth(const char *keyword) target->t_auth_group = auth_group_new(conf, target); if (target->t_auth_group == NULL) return (false); + target->t_private_auth = true; } return (true); } @@ -644,12 +645,12 @@ bool target_set_auth_group(const char *name) { if (target->t_auth_group != NULL) { - if (target->t_auth_group->ag_name != NULL) - log_warnx("auth-group for target \"%s\" " - "specified more than once", target->t_name); - else + if (target->t_private_auth) log_warnx("cannot use both auth-group and explicit " "authorisations for target \"%s\"", target->t_name); + else + log_warnx("auth-group for target \"%s\" " + "specified more than once", target->t_name); return (false); } target->t_auth_group = auth_group_find(conf, name); diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh index 06b932a65453..fa0b2256f8be 100644 --- a/usr.sbin/ctld/ctld.hh +++ b/usr.sbin/ctld/ctld.hh @@ -195,6 +195,7 @@ struct target { char *t_redirection; /* Name of this target's physical port, if any, i.e. "isp0" */ char *t_pport; + bool t_private_auth; }; struct isns { diff --git a/usr.sbin/ctld/login.cc b/usr.sbin/ctld/login.cc index 549fa0c397ad..a282103e0b62 100644 --- a/usr.sbin/ctld/login.cc +++ b/usr.sbin/ctld/login.cc @@ -990,14 +990,15 @@ login(struct ctld_connection *conn) ag = conn->conn_port->p_auth_group; if (ag == NULL) ag = conn->conn_target->t_auth_group; - if (ag->ag_name != NULL) { + if (conn->conn_port->p_auth_group == NULL && + conn->conn_target->t_private_auth) { log_debugx("initiator requests to connect " - "to target \"%s\"; auth-group \"%s\"", - conn->conn_target->t_name, - ag->ag_name); + "to target \"%s\"", conn->conn_target->t_name); } else { log_debugx("initiator requests to connect " - "to target \"%s\"", conn->conn_target->t_name); + "to target \"%s\"; %s", + conn->conn_target->t_name, + ag->ag_label); } } else { assert(conn->conn_session_type == CONN_SESSION_TYPE_DISCOVERY);