From nobody Thu Jun 4 21:15:48 2026 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 4gWcmj53gRz6gxwM for ; Thu, 04 Jun 2026 21:15:49 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gWcmh5ZfSz3Lp4 for ; Thu, 04 Jun 2026 21:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780607748; 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=acKfPHeqMBj2HAdztk9uStcGa0lQBoo7YGBHpInKfDM=; b=TV1EQBsrvTuTdE94N8GWPIkyZ0NzZcX+XDZ9v3/53T1d5nllr0DgaitQH0CgP9TziBdG1t X7mKjWWYxydNFV+7P25xebrpAuWdEFjMzKE9KHnHi0DLk4tV/KPzk1xOa6WnTfRysz6Jag Dp9ZMiW8jyyRddv/IDH7ghM2nzAgpzg/nvHdyF7LoZu7eaO/PQ/hV3XUpYJ1LOpDuQZd94 zQNFpez+xmnSjWL/anH8X8TGFc3Ri0ZAsHACh6JmMbEIvrpz38TRGg/klbWu50V/bQmSwU O97sotKDfvWmMLkcodJaHmUTrVvNJJxnhZ9v4+Lhp9ebfdDGHnrZs60ceT5rUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780607748; a=rsa-sha256; cv=none; b=DamGgAQtEeXouMvDVbdeVURPF7bLw56n1sDDYTeAOcJxhAWqkmngeBvELYivTSR1idwL1z P3kCnM8qT6xkta6SSmbpR2A5FQMmxTSq5MNljpeO09KWIJ+wzK4PKLMHnU5+ZPynvqHAzk 8IBovi5z2JMlLl9Z8Hij4ld3v8LaWidUKoMi9W7R4ZFU+CZzOWwKZ2WSNsJbJHPqjbCB7F 77fT3DrvrO90dgsYE0VEwG9xkp6zbnqI3yEsuhTfLfX+ELB0dtrPkO92A7lUKh1IEugbJT OETmiVn7maBC3c8rAw6/vPz9OtKDV/WiQuZHA6z3srai5RkUrR39zSz0qANVyA== 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=1780607748; 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=acKfPHeqMBj2HAdztk9uStcGa0lQBoo7YGBHpInKfDM=; b=WSDNKSBBZ6J4b7nJ4TwwMbADhDZjaw70nTqnYq5IQpBa/IbEs2bs1ytTIuyYQFCRg8iays N7SRGTj1uRv7CeRET9Y5JRnKCiJVLFU/3b2kpDBIPktyLACfmTGIfRUfRCaYFNLkRbbqCb DO4M5MeHMbcIfiwrk7pfxXO4hcqbnmUnvkBFoTJmN8WvzqJQYjLBOXVYi18FfPoLwve0EO vw60R3rlwz9Qun1P5K2NtbgBdPp9+mb+Jggt7S8oX8cZS9xprjqI7LDdOv3m9vvc81rZ5+ qwOlhke5IA/52mWSZrKLDaPjESEE/lN4TQVMsfVFlTm2cKJGBgjSZT5nYzgI7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gWcmh4qdNz1DYX for ; Thu, 04 Jun 2026 21:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ce43 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 04 Jun 2026 21:15:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: ea0932d71aa7 - main - nuageinit: refactor goto abuse in chpasswd() 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 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/main X-Git-Reftype: branch X-Git-Commit: ea0932d71aa7a2d25b178f1593bfad194d8c7929 Auto-Submitted: auto-generated Date: Thu, 04 Jun 2026 21:15:48 +0000 Message-Id: <6a21eb04.3ce43.3d3e4401@gitrepo.freebsd.org> The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ea0932d71aa7a2d25b178f1593bfad194d8c7929 commit ea0932d71aa7a2d25b178f1593bfad194d8c7929 Author: Baptiste Daroussin AuthorDate: 2026-06-04 20:02:58 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-04 20:02:58 +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. --- 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