From patchwork Tue Oct 11 22:01:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 20 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Mn8tV0kysz3whg for ; Tue, 11 Oct 2022 22:03:30 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Mn8tP4CFQz2Z8; Tue, 11 Oct 2022 22:03:25 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Mn8tN6WhVz2yw5; Tue, 11 Oct 2022 22:03:24 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Mn8tL65Jrz2xy3 for ; Tue, 11 Oct 2022 22:03:22 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4Mn8tK5253z1gg for ; Tue, 11 Oct 2022 22:03:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id C93DB4DB07 for ; Wed, 12 Oct 2022 00:03:20 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with UTF8SMTP id eNhUGSavEKot for ; Wed, 12 Oct 2022 00:03:19 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id DBC04751EE for ; Wed, 12 Oct 2022 00:02:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1665525746; bh=XsC06qJsOlySW/dEq39NFmDUqr2U7/u9uHHwFa9SFkw=; h=From:To:Subject:Date; b=PNXDO6rSfnhcA0IJQz+Wpjjo7UrmqZ1OaMjti6uwBMrXMzDfLAI2N63/CNmNyWLXq rODSY43oMuyAfxZ7eaKzWx+KalLR7EiBlBwqN+6Ny2ykmHykF2KqPghRHGQL9B/1Vy wkLUCVkAP2WERBvSKBTQFL6vTkrn6tS0tvfTKWILwcAhtgcQ0ywB5egGpGDGVZ0FYW i2LvtidDl5Omfuvt4MgfeFas7iBYNby3TEZfW2Sjhy6ge4DH+a8yiuJgWfBqgFOXT6 8EYES2gxCfvDLzro9ajLpZEahOpio5R3PGptMgL88NGco1HhCL8YqOFcK0zYNJFDlA dRv4MVUhASzeg== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v3 0/5] Fix Bug#12935 + cosmetic changes/enhancements Date: Wed, 12 Oct 2022 00:01:52 +0200 Message-Id: <20221011220157.17385-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: DBC04751EE.A2AA4 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1666130530.83221@NDU/RF5p9crJ3SYVHlWa6Q ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1665525801; a=rsa-sha256; cv=none; b=FsJl0CBN/iFdSMl7sFykpirIQBFMgqyXcHSe+QeYHMUY2rd/FkRLQBEdcOnbgodEZTZL2f 9Vp6GQFjudG3KdkiBsD6PPEohCjayCWRvjnvLEAHPSJMvRmfuJX8inc9FIrZHXudMG+boH CYhXCF10vUsh44kYbN+xCqINEdqa6JfjCoD/0kuXNOlMhQzEFP7U9SZgNg4AWcwcy4wVt7 CKpcQyfnSFIzOx9NApm80m3cfq8smek3yWyxyMdAEn0Y0GQUfBX1f7HpCkwLW46LHyd97K R3q++fhTv4TvG/CsU8nj+e3kh1egvGeodGZ2k1a4XonBqd6dFY33Z2RyuSNJfw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=PNXDO6rS; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=quarantine) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1665525801; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=5SGAn+8pviKtO0HN7a0BORSj9mr55Sx3JaA9kc3N68s=; b=AHf87gWbNPDuOVGmmabFfFokbPgQwicSLGRhjyhwuNpXzuhcvEs3DRdzTQwhNaQv6kRQL2 glQtRBESvp6pk9EfWMFzWi304W0onF6ChkyoRfsN7yWUsCEHETqJgEYqWsDFbW56W9OZxJ Bsx11NsBFNBqBwzJh3RoVkM0a5D9tRtJjYtwDB7+Ict1Ur0IVJmMYxP3bYTMUm71aBPARG g8Srjm2WL9yOcfwUZgpyQ40erjEuRCpXCNIg8m7JwTxtzE8wPJytTMxPZM9rIrqpknySb1 9Z4qETmjjtYCEpLonP0qAkHcNjPdBg09JdJ3OHVCrXpmveOLk64oBzZqBn+ETw== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=PNXDO6rS; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=quarantine) header.from=disroot.org X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-2.23 / 11.00]; IP_REPUTATION_HAM(-1.14)[asn: 50673(-0.32), country: NL(-0.01), ip: 178.21.23.139(-0.81)]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-1.00)[-1.000]; DKIM_REPUTATION(-0.82)[-0.82134715129011]; SPF_REPUTATION_HAM(-0.61)[-0.61440594065069]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; MV_CASE(0.50)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(0.27)[disroot.org:s=mail]; R_SPF_ALLOW(-0.20)[+a]; BAYES_HAM(-0.11)[66.32%]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; RCPT_COUNT_ONE(0.00)[1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; RCVD_COUNT_THREE(0.00)[4]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+] X-Rspamd-Queue-Id: 4Mn8tK5253z1gg X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Hi all After carefully reviewing and adopting all comments Michael had about the code in previous patchset, here is again a new version of it. Only PATCH 1 was changed since v2: - propper initialization of variables where required preventing possible undefined behaviour - more reliable error checking: all functions now return a meaningfull integer one way or another to indicate if and what kind of error happend. No need anymore to set errno to 0 manually as it no longer depended on. - No more checking against NULL making many comparisions easier for the eye - fix some possible memory leaks - fix a possible unallocation of not yet allocated memory - in case of a system error, a descriptive error is shown instead of the number, using the %m directive. Hoping to pass the required strict evaluation this time :-). For reference, the content of the summary mail that was sent with v1 of the patch: --- This patchset fixes Bug#12935 (https://bugzilla.ipfire.org/show_bug.cgi?id=12935) Summary: Addons where the initscript does not match the addon-name and addons with multiple initscripts are now listed on services.cgi since CU170. But addonctrl still expected addon name to be equal to initscript name; Hence starting/stopping/enabling/disabling of such addons was not possible. This has always been like that, but that problem was hidden as services.cgi also did not display those addon services. After discussing this with Adolf on the Bug report, we concluded that we should adapt addonctrl to work with the new addon metadata Services-field instead. I basically rewrote addonctrl to not only use the new services metadata but also to have better errorchecking and added the posibility to check if a service is currently enabled or disabled. As a result services.cgi no longer has to go checking the precense of runlevel initscripts, but can just ask addonctrl. I also added a warning to services.cgi if a runlevel initscript does not exists, to prevent the user from wondering why he can't enable a specific service. (Adolf pointed out some services don't install runlevel initscripts by default) More details in the bugreport and in the commit-messages of the patches. Regards Robin