From nobody Sun Jun 28 18:40:28 2026 X-Original-To: dev-commits-src-branches@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 4gpJBP1J81z6jkQk for ; Sun, 28 Jun 2026 18:40:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpJBN3cySz3Y2t for ; Sun, 28 Jun 2026 18:40:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672028; 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=1LsmJDz1A3tLE9sHGbTzum+v59HW/WZKGyJxGFTV6ng=; b=PJTqhQWJk48Ugy1JZksYS+amLGcnf9IqVSEG41k1fvgiuIND7+7dx5EkpXvxm+mjKkruc1 qHqTSR2VT+4FO4+rwymyXfMFp9DC6PbkiyJH6pnGddeEw4XQ9H0acfx5VtyL5N6RFP0nbp 77jP7El9xBrOCGr7BTygvTZ+zGc9N0pCMDTUr7kWdB7g1VQ+h/NpmCwGNfh0XE+nc5g80j 3kDzMxCxTJLGMBdXTHBy3EWbnJUK7mII/jeM9ajqKH4I1zHG9tONBUfes1a1NquMpyab8h UrP0MOD1CFP1/grmffO/Bq9hmJ2wwhxMvcEMQBbQAp1n53wi2uWKLsJyhoR+3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782672028; a=rsa-sha256; cv=none; b=fyCCi41DLZtki6J/KK58wHGNU7f0oieYuofLHfHQc/Kb25cKCtuY2DtkjHUiWCgB6EB1cO ysdX6tSkOC7R8VAH9GED6T2PrS2HrzPjnIIAL2n58JeQksrz5DiJ4uaShcZUETzZuEokSY DA0U3IMO5p/6TpzwOr1imkv22i71se70UW62Vs01mSYt6uHzwdoylxy9PfQuRTSa9qskpQ PvRW3SkC0bgn2UuWxBsx76ucfrPfY4wCv1ta0yi9bT4kUTbWR8TPiY7/BALOLcNyy+1kby I4T9iJaQpMd+vfxTxvDkDEMYHoh6shtlEUH4YLlSVwaNOj+3GO88cvybynqqOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672028; 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=1LsmJDz1A3tLE9sHGbTzum+v59HW/WZKGyJxGFTV6ng=; b=ZxIZxXxj98gzywe8nNyk0PiL/UNLCoiAYRN0Sq4PltkgcWpL2pwvr2XNruTzt4o2hx27r1 epjIz+60F/FW6FYLcF9redlj3kUA1t7vlVznowNJGjIpAke+aXtAj0NLEqNn+KM0W0FFrJ eCFfgVPKpLerh8arlIB1lcMaN94HV+3mOuRn2/JotgF4qdNm3+VQj8vrutGNZRjw2XPQkM 9Fd23n9MzMfckkFi/wjVQkfB4vnv72/3C+M9dlKbbQH4f9y8PChnGoBQyFsTYAxISqfI1I Pi7quEkxzra3UGuc8Ntae4bsvnHdU852DtqPgudPR93ncqC5gfN1Z331yqXhbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpJBN2P0lz6T4 for ; Sun, 28 Jun 2026 18:40:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c511 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 18:40:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 53906065f040 - stable/15 - nuageinit: refactor goto abuse in chpasswd() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 53906065f040141e5a9eae664292fd6eb285e375 Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 18:40:28 +0000 Message-Id: <6a416a9c.1c511.2eea6615@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=53906065f040141e5a9eae664292fd6eb285e375 commit 53906065f040141e5a9eae664292fd6eb285e375 Author: Baptiste Daroussin AuthorDate: 2026-06-04 20:02:58 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-28 18:32:25 +0000 nuageinit: refactor goto abuse in chpasswd() Replace goto next/list pattern with proper elseif/else control structure. The goto-based flow was fragile and hard to follow; the elseif chain makes the validation logic explicit and linear. (cherry picked from commit ea0932d71aa7a2d25b178f1593bfad194d8c7929) --- libexec/nuageinit/nuage.lua | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index bdd4bf60007e..e2db27bc7e85 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -605,26 +605,20 @@ local function chpasswd(obj) if obj.users ~= nil then if type(obj.users) ~= "table" then warnmsg("Invalid type for chpasswd.users, expecting a list, got a ".. type(obj.users)) - goto list - end - for _, u in ipairs(obj.users) do - if type(u) ~= "table" then - warnmsg("Invalid chpasswd.users entry, expecting an object, got a " .. type(u)) - goto next - end - if not u.name then - warnmsg("Invalid entry for chpasswd.users: missing 'name'") - goto next - end - if not u.password then - warnmsg("Invalid entry for chpasswd.users: missing 'password'") - goto next + else + for _, u in ipairs(obj.users) do + if type(u) ~= "table" then + warnmsg("Invalid chpasswd.users entry, expecting an object, got a " .. type(u)) + elseif not u.name then + warnmsg("Invalid entry for chpasswd.users: missing 'name'") + elseif not u.password then + warnmsg("Invalid entry for chpasswd.users: missing 'password'") + else + exec_change_password(u.name, u.password, u.type, expire) + end end - exec_change_password(u.name, u.password, u.type, expire) - ::next:: end end - ::list:: if obj.list ~= nil then warnmsg("chpasswd.list is deprecated consider using chpasswd.users") if type(obj.list) == "string" then