Message ID | 20221003152720.13140-4-robin.roevens@disroot.org |
---|---|
State | Superseded |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> 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 4Mh6BV71Xjz3wg5 for <patchwork@web04.haj.ipfire.org>; Mon, 3 Oct 2022 16:44:50 +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 4Mh6BT0v7Mz2BD; Mon, 3 Oct 2022 16:44:49 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Mh6BT04K4z2xn3; Mon, 3 Oct 2022 16:44:49 +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) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Mh6BR5YMgz2xg5 for <development@lists.ipfire.org>; Mon, 3 Oct 2022 16:44:47 +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 4Mh6BR4Rwlz1Ls for <development@lists.ipfire.org>; Mon, 3 Oct 2022 16:44:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 4B04C4C701 for <development@lists.ipfire.org>; Mon, 3 Oct 2022 18:44:47 +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 ESMTP id MG-Fss8cIjr7 for <development@lists.ipfire.org>; Mon, 3 Oct 2022 18:44:45 +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 9D43671E55; Mon, 3 Oct 2022 17:27:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1664815481; bh=2SeonbATKstyOvVX8yF4ATJuLGlpQyBScyjkpfMVhsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gJCbFnmTGgnQuFTBpfXuCji4f8vFgYzHgErkbAGxHe+LKRgliVoSWUVZQiV3Cedon /Z9cLkRAX3q8cCK7RdFUEatH/YFZtSRgZKRe2W0r3EaEqDP5ugsBu/VxD15FSpT2f9 0UhuESyWlweNmSbk9pECtprWuVSYjSo4b3+dSprMFkmMdXC/GDOc1euQnBlnswQmRE IifX2rxQMkU5BiOSR3NQSgUfGikRrtCLT8fmzgkCCLjIs/jqW3F5cDsUxhj4L2+Qwp qh1QSS5UZA1TWiv6wwXB2i2x0TThOEuK4NJg4SEJI9NkKz8eJ8eYAQPorXncWJUUNy /S/Jhp/JEQGxw== From: Robin Roevens <robin.roevens@disroot.org> To: development@lists.ipfire.org Subject: [PATCH 2/2] services.cgi: Fix status/actions on services with name != addon name Date: Mon, 3 Oct 2022 17:27:20 +0200 Message-Id: <20221003152720.13140-4-robin.roevens@disroot.org> In-Reply-To: <20221003152720.13140-1-robin.roevens@disroot.org> References: <20221003152720.13140-1-robin.roevens@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-sicho-MailScanner-ID: 9D43671E55.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1665415672.75163@kqA2OcbQmSHxZhgOULsTGg ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1664815487; a=rsa-sha256; cv=none; b=aXx8Wv920ZLB9BOpGNDTA5NcQ48PJFs6BbLuFqS4YN32rlb8wayv4oMkFr2Df1wrQEaIpU KRBG4wVqTC1WSsrUqyqvOX40YEn1fvQZODr5PZcYfiTFFYBQeZNYX+e108cvYjr7Q/45vr +evjubeXanvzbc1PFpVS/XUvW4vK597Fn3mBUAK9zh0QVtlknPGUK3Pnd9a2u2TniUBpER WOq81mfTgEJV6ksRlPDCvmqNFForc5DROcxC9RGx8sa4yBQrR3BF3yZn3xUBgfq7DlnKKe WHQwQgVfVIKr6oIbaRG40KSltFllhq4ciSQYSKoJdATyYHw9kKPIoiDj1liyfw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=gJCbFnmT; 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=1664815487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6grr7KggdhC/Km6vNwAZ9BuuBW/lQ88VmaZIt//hheY=; b=Avj+FpX3/ShOMy8mOw+Foy4FQIeXu9pPG7XJb3nyoNwsijxmgsRKHtbaYNby0gIsBQ/Svg loFyRSYvLDnOw5zwEt4Ee0HX4De2eiott59i8JoXeFG92S15cKFnBqIp52sl0MedYYDEUj Z6x1QgqQvQfWLUgcP964D//24RZajrrrZjJdOmusOTflTJp5UazjgEjfbCdnLiA61olXPp 3lJ2qW79cVp+c65+92LTRaFrYEWVSkKsGM/GkhwwHCSxeiAE2OzVHZpFxaSiSZiROxFJCh 26718+i9ASEwVVfPQAjAulP5BUbJR3oS0sQDGvd9TQHH3tUZBVl/6+ldN8MbEA== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=gJCbFnmT; 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 [-4.31 / 11.00]; BAYES_HAM(-3.00)[99.99%]; IP_REPUTATION_HAM(-1.07)[asn: 50673(-0.30), country: NL(-0.01), ip: 178.21.23.139(-0.76)]; MID_CONTAINS_FROM(1.00)[]; DKIM_REPUTATION(-0.77)[-0.76738082578851]; SPF_REPUTATION_HAM(-0.67)[-0.66696041144247]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; MV_CASE(0.50)[]; R_DKIM_ALLOW(0.26)[disroot.org:s=mail]; MIME_HTML_ONLY(0.20)[]; R_SPF_ALLOW(-0.20)[+a:c]; NEURAL_HAM(-0.06)[-0.062]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; DKIM_TRACE(0.00)[disroot.org:+]; RCPT_COUNT_TWO(0.00)[2]; SUBJECT_HAS_EXCLAIM(0.00)[]; MIME_TRACE(0.00)[0:~]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: 4Mh6BR4Rwlz1Ls X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
Fix Bug#12935 - status info broken on services.cgi for some addons
|
|
Commit Message
Robin Roevens
Oct. 3, 2022, 3:27 p.m. UTC
* addonctrl's new functionality to control explicit addon services was
implemented.
* Change 'Addon' column header to 'Addon Service' to be clear that
it's not addons but services listed here.
* Services not matching the name of the addon now display the addon
name between parentheses, so the user knows where the service comes
from.
* When no valid runlevel symlink is found by addonctrl for a service,
the 'enable on boot' checkbox is replaced by a small exclamation point
with alt-text "No valid runlevel symlink was found for the initscript of
this service." to inform user why a service can't be enabled.
* Added German and Dutch translation for above message.
Fixes: Bug#12935
Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
html/cgi-bin/services.cgi | 103 +++++++++++++++-----------------------
langs/de/cgi-bin/de.pl | 1 +
langs/en/cgi-bin/en.pl | 1 +
langs/nl/cgi-bin/nl.pl | 1 +
4 files changed, 42 insertions(+), 64 deletions(-)
Comments
Tested-by: Adolf Belka <adolf.belka@ipfire.org> On 03/10/2022 17:27, Robin Roevens wrote: > * addonctrl's new functionality to control explicit addon services was > implemented. > * Change 'Addon' column header to 'Addon Service' to be clear that > it's not addons but services listed here. > * Services not matching the name of the addon now display the addon > name between parentheses, so the user knows where the service comes > from. > * When no valid runlevel symlink is found by addonctrl for a service, > the 'enable on boot' checkbox is replaced by a small exclamation point > with alt-text "No valid runlevel symlink was found for the initscript of > this service." to inform user why a service can't be enabled. > * Added German and Dutch translation for above message. > > Fixes: Bug#12935 > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > --- > html/cgi-bin/services.cgi | 103 +++++++++++++++----------------------- > langs/de/cgi-bin/de.pl | 1 + > langs/en/cgi-bin/en.pl | 1 + > langs/nl/cgi-bin/nl.pl | 1 + > 4 files changed, 42 insertions(+), 64 deletions(-) > > diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi > index 29926ecc3..e91da884b 100644 > --- a/html/cgi-bin/services.cgi > +++ b/html/cgi-bin/services.cgi > @@ -142,14 +142,14 @@ END > my $paramstr=$ENV{QUERY_STRING}; > my @param=split(/!/, $paramstr); > if ($param[1] ne ''){ > - &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]"); > + &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]", "$param[2]"); > } > > print <<END > <div align='center'> > <table width='80%' cellspacing='1' class='tbl'> > <tr> > - <th align='center'><b>Addon</b></th> > + <th align='left'><b>Addon $Lang::tr{service}</b></th> > <th align='center'><b>Boot</b></th> > <th align='center' colspan=2><b>$Lang::tr{'action'}</b></th> > <th align='center'><b>$Lang::tr{'status'}</b></th> > @@ -170,33 +170,35 @@ END > foreach my $pak (keys %paklist) { > my %metadata = &Pakfire::getmetadata($pak, "installed"); > > + my $service; > + > if ("$metadata{'Services'}") { > - foreach my $service (split(/ /, "$metadata{'Services'}")) { > - push(@addon_services, $service); > - } > - } > - } > + foreach $service (split(/ /, "$metadata{'Services'}")) { > + $lines++; > + if ($lines % 2) { > + print "<tr>"; > + $col="bgcolor='$color{'color22'}'"; > + } else { > + print "<tr>"; > + $col="bgcolor='$color{'color20'}'"; > + } > > - foreach (@addon_services) { > - $lines++; > - if ($lines % 2){ > - print "<tr>"; > - $col="bgcolor='$color{'color22'}'"; > - }else{ > - print "<tr>"; > - $col="bgcolor='$color{'color20'}'"; > + # Add addon name to displayname of service if servicename differs from addon > + my $displayname = ($pak ne $service) ? "$service ($pak)" : $service; > + print "<td align='left' $col width='31%'>$displayname</td> "; > + > + my $status = isautorun($pak,$service,$col); > + print "$status "; > + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; > + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!stop!$service'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; > + my $status = isrunningaddon($pak,$service,$col); > + $status =~ s/\\[[0-1]\;[0-9]+m//g; > + > + chomp($status); > + print "$status"; > + print "</tr>"; > + } > } > - print "<td align='left' $col width='31%'>$_</td> "; > - my $status = isautorun($_,$col); > - print "$status "; > - print "<td align='center' $col width='8%'><a href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; > - print "<td align='center' $col width='8%'><a href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; > - my $status = isrunningaddon($_,$col); > - $status =~ s/\\[[0-1]\;[0-9]+m//g; > - > - chomp($status); > - print "$status"; > - print "</tr>"; > } > > print "</table></div>\n"; > @@ -215,51 +217,24 @@ END > } > > sub isautorun (@) { > - my ($cmd, $col) = @_; > - > - # Init directory. > - my $initdir = "/etc/rc.d/rc3.d/"; > - > - my $status = "<td align='center' $col></td>"; > + my ($pak, $service, $col) = @_; > + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot-status", "$service"); > + my $testcmd = @testcmd[0]; > + my $status = "<td align='center' $col><img alt='$Lang::tr{'service boot setting unavailable'}' title='$Lang::tr{'service boot setting unavailable'}' src='/images/dialog-warning.png' border='0' width='16' height='16' /></td>"; > > - # Check if autorun for the given cmd is enabled. > - if ( &find_init("$cmd", "$initdir") ) { > + # Check if autorun for the given service is enabled. > + if ( $testcmd =~ /enabled\ on\ boot/ ) { > # Adjust status. > - $status = "<td align='center' $col><a href='services.cgi?$_!disable'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; > - } else { > + $status = "<td align='center' $col><a href='services.cgi?$pak!disable!$service'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; > + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { > # Adjust status. > - $status = "<td align='center' $col><a href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; > + $status = "<td align='center' $col><a href='services.cgi?$pak!enable!$service'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; > } > > # Return the status. > return $status; > } > > -sub find_init (@) { > - my ($cmd, $dir) = @_; > - > - # Open given init directory. > - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; > - > - # Read-in init files from directory. > - my @inits = readdir(INITDIR); > - > - # Close directory handle. > - closedir(INITDIR); > - > - # Loop through the directory. > - foreach my $init (@inits) { > - # Check if the current processed file belongs to the given command. > - if ($init =~ /S\d+\d+$cmd\z/) { > - # Found, return "1" - True. > - return "1"; > - } > - } > - > - # Nothing found, return nothing. > - return; > -} > - > sub isrunning (@) { > my ($cmd, $col) = @_; > my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; > @@ -313,7 +288,7 @@ sub isrunning (@) { > } > > sub isrunningaddon (@) { > - my ($cmd, $col) = @_; > + my ($pak, $service, $col) = @_; > > my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; > my $pid = ''; > @@ -321,7 +296,7 @@ sub isrunningaddon (@) { > my $exename; > my @memory; > > - my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$cmd", "status"); > + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "status", "$service"); > my $testcmd = @testcmd[0]; > > if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){ > diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl > index 798abcffc..db7d117b0 100644 > --- a/langs/de/cgi-bin/de.pl > +++ b/langs/de/cgi-bin/de.pl > @@ -2251,6 +2251,7 @@ > 'server string' => 'Server String', > 'service' => 'Dienst', > 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde hinzugefügt', > +'service boot setting unavailable' => 'Für das Initscript dieses Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', > 'service name' => 'Name des Dienstes:', > 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde entfernt', > 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde aktualisiert', > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > index f770e7cd9..60dca5be4 100644 > --- a/langs/en/cgi-bin/en.pl > +++ b/langs/en/cgi-bin/en.pl > @@ -2306,6 +2306,7 @@ > 'server string' => 'Server String', > 'service' => 'Service', > 'service added' => 'Custom network service added', > +'service boot setting unavailable' => 'No valid runlevel symlink was found for the initscript of this service.', > 'service name' => 'Service name:', > 'service removed' => 'Custom network service removed', > 'service updated' => 'Custom network service updated', > diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl > index 49dabec99..4fd6955cc 100644 > --- a/langs/nl/cgi-bin/nl.pl > +++ b/langs/nl/cgi-bin/nl.pl > @@ -1899,6 +1899,7 @@ > 'server string' => 'Server String', > 'service' => 'Dienst', > 'service added' => 'Aangepaste netwerkdienst toegevoegd', > +'service boot setting unavailable' => 'Er werd voor het initscript van deze service geen geldige runlevel symlink gevonden.', > 'service name' => 'Dienstennaam:', > 'service removed' => 'Aangepaste netwerkdienst verwijderd', > 'service updated' => 'Aangepaste netwerkdienst bijgewerkt',
Hello, I am going to start with the second patch, because that is going to be shorter :) > On 3 Oct 2022, at 16:27, Robin Roevens <robin.roevens@disroot.org> wrote: > > * addonctrl's new functionality to control explicit addon services was > implemented. > * Change 'Addon' column header to 'Addon Service' to be clear that > it's not addons but services listed here. > * Services not matching the name of the addon now display the addon > name between parentheses, so the user knows where the service comes > from. > * When no valid runlevel symlink is found by addonctrl for a service, > the 'enable on boot' checkbox is replaced by a small exclamation point > with alt-text "No valid runlevel symlink was found for the initscript of > this service." to inform user why a service can't be enabled. > * Added German and Dutch translation for above message. > > Fixes: Bug#12935 > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > --- > html/cgi-bin/services.cgi | 103 +++++++++++++++----------------------- > langs/de/cgi-bin/de.pl | 1 + > langs/en/cgi-bin/en.pl | 1 + > langs/nl/cgi-bin/nl.pl | 1 + > 4 files changed, 42 insertions(+), 64 deletions(-) > > diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi > index 29926ecc3..e91da884b 100644 > --- a/html/cgi-bin/services.cgi > +++ b/html/cgi-bin/services.cgi > @@ -142,14 +142,14 @@ END > my $paramstr=$ENV{QUERY_STRING}; > my @param=split(/!/, $paramstr); > if ($param[1] ne ''){ > - &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]"); > + &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]", "$param[2]"); > } Although this has been like this before, I am strongly against passing anything from the request to the setuid binary. This will open us up for any shell command injections and so on. I would prefer to check the second argument to be at least on some kind of list as there are only a few keywords allowed (start, stop, restart, …) and the other parameters should only contain ASCII letters, numbers and maybe dash and underscore. Nothing else should be passed through here. > > print <<END > <div align='center'> > <table width='80%' cellspacing='1' class='tbl'> > <tr> > - <th align='center'><b>Addon</b></th> > + <th align='left'><b>Addon $Lang::tr{service}</b></th> > <th align='center'><b>Boot</b></th> > <th align='center' colspan=2><b>$Lang::tr{'action'}</b></th> > <th align='center'><b>$Lang::tr{'status'}</b></th> > @@ -170,33 +170,35 @@ END > foreach my $pak (keys %paklist) { > my %metadata = &Pakfire::getmetadata($pak, "installed"); > > + my $service; > + > if ("$metadata{'Services'}") { > - foreach my $service (split(/ /, "$metadata{'Services'}")) { > - push(@addon_services, $service); > - } > - } > - } > + foreach $service (split(/ /, "$metadata{'Services'}")) { > + $lines++; > + if ($lines % 2) { > + print "<tr>"; > + $col="bgcolor='$color{'color22'}'"; > + } else { > + print "<tr>"; > + $col="bgcolor='$color{'color20'}'"; > + } > > - foreach (@addon_services) { > - $lines++; > - if ($lines % 2){ > - print "<tr>"; > - $col="bgcolor='$color{'color22'}'"; > - }else{ > - print "<tr>"; > - $col="bgcolor='$color{'color20'}'"; > + # Add addon name to displayname of service if servicename differs from addon > + my $displayname = ($pak ne $service) ? "$service ($pak)" : $service; > + print "<td align='left' $col width='31%'>$displayname</td> "; > + > + my $status = isautorun($pak,$service,$col); > + print "$status "; > + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; > + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!stop!$service'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; > + my $status = isrunningaddon($pak,$service,$col); > + $status =~ s/\\[[0-1]\;[0-9]+m//g; > + > + chomp($status); > + print "$status"; > + print "</tr>"; > + } > } > - print "<td align='left' $col width='31%'>$_</td> "; > - my $status = isautorun($_,$col); > - print "$status "; > - print "<td align='center' $col width='8%'><a href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; > - print "<td align='center' $col width='8%'><a href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; > - my $status = isrunningaddon($_,$col); > - $status =~ s/\\[[0-1]\;[0-9]+m//g; > - > - chomp($status); > - print "$status"; > - print "</tr>"; > } > > print "</table></div>\n"; > @@ -215,51 +217,24 @@ END > } > > sub isautorun (@) { > - my ($cmd, $col) = @_; > - > - # Init directory. > - my $initdir = "/etc/rc.d/rc3.d/"; > - > - my $status = "<td align='center' $col></td>"; > + my ($pak, $service, $col) = @_; > + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot-status", "$service"); > + my $testcmd = @testcmd[0]; > + my $status = "<td align='center' $col><img alt='$Lang::tr{'service boot setting unavailable'}' title='$Lang::tr{'service boot setting unavailable'}' src='/images/dialog-warning.png' border='0' width='16' height='16' /></td>"; > > - # Check if autorun for the given cmd is enabled. > - if ( &find_init("$cmd", "$initdir") ) { > + # Check if autorun for the given service is enabled. > + if ( $testcmd =~ /enabled\ on\ boot/ ) { > # Adjust status. > - $status = "<td align='center' $col><a href='services.cgi?$_!disable'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; > - } else { > + $status = "<td align='center' $col><a href='services.cgi?$pak!disable!$service'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; > + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { > # Adjust status. > - $status = "<td align='center' $col><a href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; > + $status = "<td align='center' $col><a href='services.cgi?$pak!enable!$service'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; > } > > # Return the status. > return $status; > } > > -sub find_init (@) { > - my ($cmd, $dir) = @_; > - > - # Open given init directory. > - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; > - > - # Read-in init files from directory. > - my @inits = readdir(INITDIR); > - > - # Close directory handle. > - closedir(INITDIR); > - > - # Loop through the directory. > - foreach my $init (@inits) { > - # Check if the current processed file belongs to the given command. > - if ($init =~ /S\d+\d+$cmd\z/) { > - # Found, return "1" - True. > - return "1"; > - } > - } > - > - # Nothing found, return nothing. > - return; > -} > - > sub isrunning (@) { > my ($cmd, $col) = @_; > my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; > @@ -313,7 +288,7 @@ sub isrunning (@) { > } > > sub isrunningaddon (@) { > - my ($cmd, $col) = @_; > + my ($pak, $service, $col) = @_; > > my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; > my $pid = ''; > @@ -321,7 +296,7 @@ sub isrunningaddon (@) { > my $exename; > my @memory; > > - my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$cmd", "status"); > + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "status", "$service"); > my $testcmd = @testcmd[0]; > > if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){ > diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl > index 798abcffc..db7d117b0 100644 > --- a/langs/de/cgi-bin/de.pl > +++ b/langs/de/cgi-bin/de.pl > @@ -2251,6 +2251,7 @@ > 'server string' => 'Server String', > 'service' => 'Dienst', > 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde hinzugefügt', > +'service boot setting unavailable' => 'Für das Initscript dieses Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', > 'service name' => 'Name des Dienstes:', > 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde entfernt', > 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde aktualisiert', > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > index f770e7cd9..60dca5be4 100644 > --- a/langs/en/cgi-bin/en.pl > +++ b/langs/en/cgi-bin/en.pl > @@ -2306,6 +2306,7 @@ > 'server string' => 'Server String', > 'service' => 'Service', > 'service added' => 'Custom network service added', > +'service boot setting unavailable' => 'No valid runlevel symlink was found for the initscript of this service.', > 'service name' => 'Service name:', > 'service removed' => 'Custom network service removed', > 'service updated' => 'Custom network service updated', > diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl > index 49dabec99..4fd6955cc 100644 > --- a/langs/nl/cgi-bin/nl.pl > +++ b/langs/nl/cgi-bin/nl.pl > @@ -1899,6 +1899,7 @@ > 'server string' => 'Server String', > 'service' => 'Dienst', > 'service added' => 'Aangepaste netwerkdienst toegevoegd', > +'service boot setting unavailable' => 'Er werd voor het initscript van deze service geen geldige runlevel symlink gevonden.', > 'service name' => 'Dienstennaam:', > 'service removed' => 'Aangepaste netwerkdienst verwijderd', > 'service updated' => 'Aangepaste netwerkdienst bijgewerkt', > -- > 2.37.3 > > > -- > Dit bericht is gescanned op virussen en andere gevaarlijke > inhoud door MailScanner en lijkt schoon te zijn. >
Hi Michael Tremer schreef op di 04-10-2022 om 10:51 [+0100]: > Hello, > > I am going to start with the second patch, because that is going to > be shorter :) > > > On 3 Oct 2022, at 16:27, Robin Roevens <robin.roevens@disroot.org> > > wrote: > > > > * addonctrl's new functionality to control explicit addon services > > was > > implemented. > > * Change 'Addon' column header to 'Addon Service' to be clear that > > it's not addons but services listed here. > > * Services not matching the name of the addon now display the addon > > name between parentheses, so the user knows where the service > > comes > > from. > > * When no valid runlevel symlink is found by addonctrl for a > > service, > > the 'enable on boot' checkbox is replaced by a small exclamation > > point > > with alt-text "No valid runlevel symlink was found for the > > initscript of > > this service." to inform user why a service can't be enabled. > > * Added German and Dutch translation for above message. > > > > Fixes: Bug#12935 > > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > > --- > > html/cgi-bin/services.cgi | 103 +++++++++++++++-------------------- > > --- > > langs/de/cgi-bin/de.pl | 1 + > > langs/en/cgi-bin/en.pl | 1 + > > langs/nl/cgi-bin/nl.pl | 1 + > > 4 files changed, 42 insertions(+), 64 deletions(-) > > > > diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi > > index 29926ecc3..e91da884b 100644 > > --- a/html/cgi-bin/services.cgi > > +++ b/html/cgi-bin/services.cgi > > @@ -142,14 +142,14 @@ END > > my $paramstr=$ENV{QUERY_STRING}; > > my @param=split(/!/, $paramstr); > > if ($param[1] ne ''){ > > - &General::system("/usr/local/bin/addonctrl", > > "$param[0]", "$param[1]"); > > + &General::system("/usr/local/bin/addonctrl", > > "$param[0]", "$param[1]", "$param[2]"); > > } > > Although this has been like this before, I am strongly against > passing anything from the request to the setuid binary. > > This will open us up for any shell command injections and so on. I > would prefer to check the second argument to be at least on some kind > of list as there are only a few keywords allowed (start, stop, > restart, …) and the other parameters should only contain ASCII > letters, numbers and maybe dash and underscore. Nothing else should > be passed through here. Good point. I was thinking this regexp: /[^a-zA-Z_0-9\-\.]/ or should I not include a '.'? I don't think there currently are any addons or initscripts that contain a '.', but it could be in the future? Regards Robin > > > > > print <<END > > <div align='center'> > > <table width='80%' cellspacing='1' class='tbl'> > > <tr> > > - <th align='center'><b>Addon</b></th> > > + <th align='left'><b>Addon $Lang::tr{service}</b></th> > > <th align='center'><b>Boot</b></th> > > <th align='center' > > colspan=2><b>$Lang::tr{'action'}</b></th> > > <th align='center'><b>$Lang::tr{'status'}</b></th> > > @@ -170,33 +170,35 @@ END > > foreach my $pak (keys %paklist) { > > my %metadata = &Pakfire::getmetadata($pak, > > "installed"); > > > > + my $service; > > + > > if ("$metadata{'Services'}") { > > - foreach my $service (split(/ /, > > "$metadata{'Services'}")) { > > - push(@addon_services, $service); > > - } > > - } > > - } > > + foreach $service (split(/ /, > > "$metadata{'Services'}")) { > > + $lines++; > > + if ($lines % 2) { > > + print "<tr>"; > > + $col="bgcolor='$color{'colo > > r22'}'"; > > + } else { > > + print "<tr>"; > > + $col="bgcolor='$color{'colo > > r20'}'"; > > + } > > > > - foreach (@addon_services) { > > - $lines++; > > - if ($lines % 2){ > > - print "<tr>"; > > - $col="bgcolor='$color{'color22'}'"; > > - }else{ > > - print "<tr>"; > > - $col="bgcolor='$color{'color20'}'"; > > + # Add addon name to displayname of > > service if servicename differs from addon > > + my $displayname = ($pak ne > > $service) ? "$service ($pak)" : $service; > > + print "<td align='left' $col > > width='31%'>$displayname</td> "; > > + > > + my $status = > > isautorun($pak,$service,$col); > > + print "$status "; > > + print "<td align='center' $col > > width='8%'><a href='services.cgi?$pak!start!$service'><img > > alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' > > src='/images/go-up.png' border='0' /></a></td>"; > > + print "<td align='center' $col > > width='8%'><a href='services.cgi?$pak!stop!$service'><img > > alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go- > > down.png' border='0' /></a></td> "; > > + my $status = > > isrunningaddon($pak,$service,$col); > > + $status =~ s/\\[[0-1]\;[0-9]+m//g; > > + > > + chomp($status); > > + print "$status"; > > + print "</tr>"; > > + } > > } > > - print "<td align='left' $col width='31%'>$_</td> "; > > - my $status = isautorun($_,$col); > > - print "$status "; > > - print "<td align='center' $col width='8%'><a > > href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' > > title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' > > /></a></td>"; > > - print "<td align='center' $col width='8%'><a > > href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' > > title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' > > /></a></td> "; > > - my $status = isrunningaddon($_,$col); > > - $status =~ s/\\[[0-1]\;[0-9]+m//g; > > - > > - chomp($status); > > - print "$status"; > > - print "</tr>"; > > } > > > > print "</table></div>\n"; > > @@ -215,51 +217,24 @@ END > > } > > > > sub isautorun (@) { > > - my ($cmd, $col) = @_; > > - > > - # Init directory. > > - my $initdir = "/etc/rc.d/rc3.d/"; > > - > > - my $status = "<td align='center' $col></td>"; > > + my ($pak, $service, $col) = @_; > > + my @testcmd = > > &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot- > > status", "$service"); > > + my $testcmd = @testcmd[0]; > > + my $status = "<td align='center' $col><img > > alt='$Lang::tr{'service boot setting unavailable'}' > > title='$Lang::tr{'service boot setting unavailable'}' > > src='/images/dialog-warning.png' border='0' width='16' height='16' > > /></td>"; > > > > - # Check if autorun for the given cmd is enabled. > > - if ( &find_init("$cmd", "$initdir") ) { > > + # Check if autorun for the given service is enabled. > > + if ( $testcmd =~ /enabled\ on\ boot/ ) { > > # Adjust status. > > - $status = "<td align='center' $col><a > > href='services.cgi?$_!disable'><img alt='$Lang::tr{'deactivate'}' > > title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' > > width='16' height='16' /></a></td>"; > > - } else { > > + $status = "<td align='center' $col><a > > href='services.cgi?$pak!disable!$service'><img > > alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' > > src='/images/on.gif' border='0' width='16' height='16' > > /></a></td>"; > > + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { > > # Adjust status. > > - $status = "<td align='center' $col><a > > href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' > > title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' > > width='16' height='16' /></a></td>"; > > + $status = "<td align='center' $col><a > > href='services.cgi?$pak!enable!$service'><img > > alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' > > src='/images/off.gif' border='0' width='16' height='16' > > /></a></td>"; > > } > > > > # Return the status. > > return $status; > > } > > > > -sub find_init (@) { > > - my ($cmd, $dir) = @_; > > - > > - # Open given init directory. > > - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; > > - > > - # Read-in init files from directory. > > - my @inits = readdir(INITDIR); > > - > > - # Close directory handle. > > - closedir(INITDIR); > > - > > - # Loop through the directory. > > - foreach my $init (@inits) { > > - # Check if the current processed file belongs to > > the given command. > > - if ($init =~ /S\d+\d+$cmd\z/) { > > - # Found, return "1" - True. > > - return "1"; > > - } > > - } > > - > > - # Nothing found, return nothing. > > - return; > > -} > > - > > sub isrunning (@) { > > my ($cmd, $col) = @_; > > my $status = "<td align='center' > > bgcolor='${Header::colourred}'><font > > color='white'><b>$Lang::tr{'stopped'}</b></font></td><td > > colspan='2' $col></td>"; > > @@ -313,7 +288,7 @@ sub isrunning (@) { > > } > > > > sub isrunningaddon (@) { > > - my ($cmd, $col) = @_; > > + my ($pak, $service, $col) = @_; > > > > my $status = "<td align='center' > > bgcolor='${Header::colourred}'><font > > color='white'><b>$Lang::tr{'stopped'}</b></font></td><td > > colspan='2' $col></td>"; > > my $pid = ''; > > @@ -321,7 +296,7 @@ sub isrunningaddon (@) { > > my $exename; > > my @memory; > > > > - my @testcmd = > > &General::system_output("/usr/local/bin/addonctrl", "$cmd", > > "status"); > > + my @testcmd = > > &General::system_output("/usr/local/bin/addonctrl", "$pak", > > "status", "$service"); > > my $testcmd = @testcmd[0]; > > > > if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ > > running/){ > > diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl > > index 798abcffc..db7d117b0 100644 > > --- a/langs/de/cgi-bin/de.pl > > +++ b/langs/de/cgi-bin/de.pl > > @@ -2251,6 +2251,7 @@ > > 'server string' => 'Server String', > > 'service' => 'Dienst', > > 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde > > hinzugefügt', > > +'service boot setting unavailable' => 'Für das Initscript dieses > > Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', > > 'service name' => 'Name des Dienstes:', > > 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde > > entfernt', > > 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde > > aktualisiert', > > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > > index f770e7cd9..60dca5be4 100644 > > --- a/langs/en/cgi-bin/en.pl > > +++ b/langs/en/cgi-bin/en.pl > > @@ -2306,6 +2306,7 @@ > > 'server string' => 'Server String', > > 'service' => 'Service', > > 'service added' => 'Custom network service added', > > +'service boot setting unavailable' => 'No valid runlevel symlink > > was found for the initscript of this service.', > > 'service name' => 'Service name:', > > 'service removed' => 'Custom network service removed', > > 'service updated' => 'Custom network service updated', > > diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl > > index 49dabec99..4fd6955cc 100644 > > --- a/langs/nl/cgi-bin/nl.pl > > +++ b/langs/nl/cgi-bin/nl.pl > > @@ -1899,6 +1899,7 @@ > > 'server string' => 'Server String', > > 'service' => 'Dienst', > > 'service added' => 'Aangepaste netwerkdienst toegevoegd', > > +'service boot setting unavailable' => 'Er werd voor het initscript > > van deze service geen geldige runlevel symlink gevonden.', > > 'service name' => 'Dienstennaam:', > > 'service removed' => 'Aangepaste netwerkdienst verwijderd', > > 'service updated' => 'Aangepaste netwerkdienst bijgewerkt', > > -- > > 2.37.3 > > > > > > -- > > Dit bericht is gescanned op virussen en andere gevaarlijke > > inhoud door MailScanner en lijkt schoon te zijn. > > > >
Hello, > On 4 Oct 2022, at 11:33, Robin Roevens <robin.roevens@disroot.org> wrote: > > Hi > > Michael Tremer schreef op di 04-10-2022 om 10:51 [+0100]: >> Hello, >> >> I am going to start with the second patch, because that is going to >> be shorter :) >> >>> On 3 Oct 2022, at 16:27, Robin Roevens <robin.roevens@disroot.org> >>> wrote: >>> >>> * addonctrl's new functionality to control explicit addon services >>> was >>> implemented. >>> * Change 'Addon' column header to 'Addon Service' to be clear that >>> it's not addons but services listed here. >>> * Services not matching the name of the addon now display the addon >>> name between parentheses, so the user knows where the service >>> comes >>> from. >>> * When no valid runlevel symlink is found by addonctrl for a >>> service, >>> the 'enable on boot' checkbox is replaced by a small exclamation >>> point >>> with alt-text "No valid runlevel symlink was found for the >>> initscript of >>> this service." to inform user why a service can't be enabled. >>> * Added German and Dutch translation for above message. >>> >>> Fixes: Bug#12935 >>> Signed-off-by: Robin Roevens <robin.roevens@disroot.org> >>> --- >>> html/cgi-bin/services.cgi | 103 +++++++++++++++-------------------- >>> --- >>> langs/de/cgi-bin/de.pl | 1 + >>> langs/en/cgi-bin/en.pl | 1 + >>> langs/nl/cgi-bin/nl.pl | 1 + >>> 4 files changed, 42 insertions(+), 64 deletions(-) >>> >>> diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi >>> index 29926ecc3..e91da884b 100644 >>> --- a/html/cgi-bin/services.cgi >>> +++ b/html/cgi-bin/services.cgi >>> @@ -142,14 +142,14 @@ END >>> my $paramstr=$ENV{QUERY_STRING}; >>> my @param=split(/!/, $paramstr); >>> if ($param[1] ne ''){ >>> - &General::system("/usr/local/bin/addonctrl", >>> "$param[0]", "$param[1]"); >>> + &General::system("/usr/local/bin/addonctrl", >>> "$param[0]", "$param[1]", "$param[2]"); >>> } >> >> Although this has been like this before, I am strongly against >> passing anything from the request to the setuid binary. >> >> This will open us up for any shell command injections and so on. I >> would prefer to check the second argument to be at least on some kind >> of list as there are only a few keywords allowed (start, stop, >> restart, …) and the other parameters should only contain ASCII >> letters, numbers and maybe dash and underscore. Nothing else should >> be passed through here. > > Good point. I was thinking this regexp: /[^a-zA-Z_0-9\-\.]/ or should I > not include a '.'? I don't think there currently are any addons or > initscripts that contain a '.', but it could be in the future? I was thinking about the dot as well, and then thought it would not be required to include it since we do not have any services like this, and I do not remember any of them using a dot on any other distributions. The regular expression is slightly incorrect though. You want it to be like this: /^[A-Za-z0-9\-\_]+$/ The ^ and $ indicate that the entire string must match and not only a part. And the + after the brackets with the list of allowed characters says that we need to have at least one character, but could be more. However, the entire string must only contain those characters. -Michael > > Regards > Robin >> >>> >>> print <<END >>> <div align='center'> >>> <table width='80%' cellspacing='1' class='tbl'> >>> <tr> >>> - <th align='center'><b>Addon</b></th> >>> + <th align='left'><b>Addon $Lang::tr{service}</b></th> >>> <th align='center'><b>Boot</b></th> >>> <th align='center' >>> colspan=2><b>$Lang::tr{'action'}</b></th> >>> <th align='center'><b>$Lang::tr{'status'}</b></th> >>> @@ -170,33 +170,35 @@ END >>> foreach my $pak (keys %paklist) { >>> my %metadata = &Pakfire::getmetadata($pak, >>> "installed"); >>> >>> + my $service; >>> + >>> if ("$metadata{'Services'}") { >>> - foreach my $service (split(/ /, >>> "$metadata{'Services'}")) { >>> - push(@addon_services, $service); >>> - } >>> - } >>> - } >>> + foreach $service (split(/ /, >>> "$metadata{'Services'}")) { >>> + $lines++; >>> + if ($lines % 2) { >>> + print "<tr>"; >>> + $col="bgcolor='$color{'colo >>> r22'}'"; >>> + } else { >>> + print "<tr>"; >>> + $col="bgcolor='$color{'colo >>> r20'}'"; >>> + } >>> >>> - foreach (@addon_services) { >>> - $lines++; >>> - if ($lines % 2){ >>> - print "<tr>"; >>> - $col="bgcolor='$color{'color22'}'"; >>> - }else{ >>> - print "<tr>"; >>> - $col="bgcolor='$color{'color20'}'"; >>> + # Add addon name to displayname of >>> service if servicename differs from addon >>> + my $displayname = ($pak ne >>> $service) ? "$service ($pak)" : $service; >>> + print "<td align='left' $col >>> width='31%'>$displayname</td> "; >>> + >>> + my $status = >>> isautorun($pak,$service,$col); >>> + print "$status "; >>> + print "<td align='center' $col >>> width='8%'><a href='services.cgi?$pak!start!$service'><img >>> alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' >>> src='/images/go-up.png' border='0' /></a></td>"; >>> + print "<td align='center' $col >>> width='8%'><a href='services.cgi?$pak!stop!$service'><img >>> alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go- >>> down.png' border='0' /></a></td> "; >>> + my $status = >>> isrunningaddon($pak,$service,$col); >>> + $status =~ s/\\[[0-1]\;[0-9]+m//g; >>> + >>> + chomp($status); >>> + print "$status"; >>> + print "</tr>"; >>> + } >>> } >>> - print "<td align='left' $col width='31%'>$_</td> "; >>> - my $status = isautorun($_,$col); >>> - print "$status "; >>> - print "<td align='center' $col width='8%'><a >>> href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' >>> title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' >>> /></a></td>"; >>> - print "<td align='center' $col width='8%'><a >>> href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' >>> title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' >>> /></a></td> "; >>> - my $status = isrunningaddon($_,$col); >>> - $status =~ s/\\[[0-1]\;[0-9]+m//g; >>> - >>> - chomp($status); >>> - print "$status"; >>> - print "</tr>"; >>> } >>> >>> print "</table></div>\n"; >>> @@ -215,51 +217,24 @@ END >>> } >>> >>> sub isautorun (@) { >>> - my ($cmd, $col) = @_; >>> - >>> - # Init directory. >>> - my $initdir = "/etc/rc.d/rc3.d/"; >>> - >>> - my $status = "<td align='center' $col></td>"; >>> + my ($pak, $service, $col) = @_; >>> + my @testcmd = >>> &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot- >>> status", "$service"); >>> + my $testcmd = @testcmd[0]; >>> + my $status = "<td align='center' $col><img >>> alt='$Lang::tr{'service boot setting unavailable'}' >>> title='$Lang::tr{'service boot setting unavailable'}' >>> src='/images/dialog-warning.png' border='0' width='16' height='16' >>> /></td>"; >>> >>> - # Check if autorun for the given cmd is enabled. >>> - if ( &find_init("$cmd", "$initdir") ) { >>> + # Check if autorun for the given service is enabled. >>> + if ( $testcmd =~ /enabled\ on\ boot/ ) { >>> # Adjust status. >>> - $status = "<td align='center' $col><a >>> href='services.cgi?$_!disable'><img alt='$Lang::tr{'deactivate'}' >>> title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' >>> width='16' height='16' /></a></td>"; >>> - } else { >>> + $status = "<td align='center' $col><a >>> href='services.cgi?$pak!disable!$service'><img >>> alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' >>> src='/images/on.gif' border='0' width='16' height='16' >>> /></a></td>"; >>> + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { >>> # Adjust status. >>> - $status = "<td align='center' $col><a >>> href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' >>> title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' >>> width='16' height='16' /></a></td>"; >>> + $status = "<td align='center' $col><a >>> href='services.cgi?$pak!enable!$service'><img >>> alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' >>> src='/images/off.gif' border='0' width='16' height='16' >>> /></a></td>"; >>> } >>> >>> # Return the status. >>> return $status; >>> } >>> >>> -sub find_init (@) { >>> - my ($cmd, $dir) = @_; >>> - >>> - # Open given init directory. >>> - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; >>> - >>> - # Read-in init files from directory. >>> - my @inits = readdir(INITDIR); >>> - >>> - # Close directory handle. >>> - closedir(INITDIR); >>> - >>> - # Loop through the directory. >>> - foreach my $init (@inits) { >>> - # Check if the current processed file belongs to >>> the given command. >>> - if ($init =~ /S\d+\d+$cmd\z/) { >>> - # Found, return "1" - True. >>> - return "1"; >>> - } >>> - } >>> - >>> - # Nothing found, return nothing. >>> - return; >>> -} >>> - >>> sub isrunning (@) { >>> my ($cmd, $col) = @_; >>> my $status = "<td align='center' >>> bgcolor='${Header::colourred}'><font >>> color='white'><b>$Lang::tr{'stopped'}</b></font></td><td >>> colspan='2' $col></td>"; >>> @@ -313,7 +288,7 @@ sub isrunning (@) { >>> } >>> >>> sub isrunningaddon (@) { >>> - my ($cmd, $col) = @_; >>> + my ($pak, $service, $col) = @_; >>> >>> my $status = "<td align='center' >>> bgcolor='${Header::colourred}'><font >>> color='white'><b>$Lang::tr{'stopped'}</b></font></td><td >>> colspan='2' $col></td>"; >>> my $pid = ''; >>> @@ -321,7 +296,7 @@ sub isrunningaddon (@) { >>> my $exename; >>> my @memory; >>> >>> - my @testcmd = >>> &General::system_output("/usr/local/bin/addonctrl", "$cmd", >>> "status"); >>> + my @testcmd = >>> &General::system_output("/usr/local/bin/addonctrl", "$pak", >>> "status", "$service"); >>> my $testcmd = @testcmd[0]; >>> >>> if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ >>> running/){ >>> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl >>> index 798abcffc..db7d117b0 100644 >>> --- a/langs/de/cgi-bin/de.pl >>> +++ b/langs/de/cgi-bin/de.pl >>> @@ -2251,6 +2251,7 @@ >>> 'server string' => 'Server String', >>> 'service' => 'Dienst', >>> 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde >>> hinzugefügt', >>> +'service boot setting unavailable' => 'Für das Initscript dieses >>> Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', >>> 'service name' => 'Name des Dienstes:', >>> 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde >>> entfernt', >>> 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde >>> aktualisiert', >>> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl >>> index f770e7cd9..60dca5be4 100644 >>> --- a/langs/en/cgi-bin/en.pl >>> +++ b/langs/en/cgi-bin/en.pl >>> @@ -2306,6 +2306,7 @@ >>> 'server string' => 'Server String', >>> 'service' => 'Service', >>> 'service added' => 'Custom network service added', >>> +'service boot setting unavailable' => 'No valid runlevel symlink >>> was found for the initscript of this service.', >>> 'service name' => 'Service name:', >>> 'service removed' => 'Custom network service removed', >>> 'service updated' => 'Custom network service updated', >>> diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl >>> index 49dabec99..4fd6955cc 100644 >>> --- a/langs/nl/cgi-bin/nl.pl >>> +++ b/langs/nl/cgi-bin/nl.pl >>> @@ -1899,6 +1899,7 @@ >>> 'server string' => 'Server String', >>> 'service' => 'Dienst', >>> 'service added' => 'Aangepaste netwerkdienst toegevoegd', >>> +'service boot setting unavailable' => 'Er werd voor het initscript >>> van deze service geen geldige runlevel symlink gevonden.', >>> 'service name' => 'Dienstennaam:', >>> 'service removed' => 'Aangepaste netwerkdienst verwijderd', >>> 'service updated' => 'Aangepaste netwerkdienst bijgewerkt', >>> -- >>> 2.37.3 >>> >>> >>> -- >>> Dit bericht is gescanned op virussen en andere gevaarlijke >>> inhoud door MailScanner en lijkt schoon te zijn. >>> >> >> > > -- > Dit bericht is gescanned op virussen en andere gevaarlijke > inhoud door MailScanner en lijkt schoon te zijn.
Hi Michael Michael Tremer schreef op di 04-10-2022 om 13:49 [+0100]: > Hello, > > > On 4 Oct 2022, at 11:33, Robin Roevens <robin.roevens@disroot.org> > > wrote: > > > > Hi > > > > Michael Tremer schreef op di 04-10-2022 om 10:51 [+0100]: > > > Hello, > > > > > > I am going to start with the second patch, because that is going > > > to > > > be shorter :) > > > > > > > On 3 Oct 2022, at 16:27, Robin Roevens > > > > <robin.roevens@disroot.org> > > > > wrote: > > > > > > > > * addonctrl's new functionality to control explicit addon > > > > services > > > > was > > > > implemented. > > > > * Change 'Addon' column header to 'Addon Service' to be clear > > > > that > > > > it's not addons but services listed here. > > > > * Services not matching the name of the addon now display the > > > > addon > > > > name between parentheses, so the user knows where the service > > > > comes > > > > from. > > > > * When no valid runlevel symlink is found by addonctrl for a > > > > service, > > > > the 'enable on boot' checkbox is replaced by a small > > > > exclamation > > > > point > > > > with alt-text "No valid runlevel symlink was found for the > > > > initscript of > > > > this service." to inform user why a service can't be enabled. > > > > * Added German and Dutch translation for above message. > > > > > > > > Fixes: Bug#12935 > > > > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > > > > --- > > > > html/cgi-bin/services.cgi | 103 +++++++++++++++---------------- > > > > ---- > > > > --- > > > > langs/de/cgi-bin/de.pl | 1 + > > > > langs/en/cgi-bin/en.pl | 1 + > > > > langs/nl/cgi-bin/nl.pl | 1 + > > > > 4 files changed, 42 insertions(+), 64 deletions(-) > > > > > > > > diff --git a/html/cgi-bin/services.cgi b/html/cgi- > > > > bin/services.cgi > > > > index 29926ecc3..e91da884b 100644 > > > > --- a/html/cgi-bin/services.cgi > > > > +++ b/html/cgi-bin/services.cgi > > > > @@ -142,14 +142,14 @@ END > > > > my $paramstr=$ENV{QUERY_STRING}; > > > > my @param=split(/!/, $paramstr); > > > > if ($param[1] ne ''){ > > > > - &General::system("/usr/local/bin/addonctrl", > > > > "$param[0]", "$param[1]"); > > > > + &General::system("/usr/local/bin/addonctrl", > > > > "$param[0]", "$param[1]", "$param[2]"); > > > > } > > > > > > Although this has been like this before, I am strongly against > > > passing anything from the request to the setuid binary. > > > > > > This will open us up for any shell command injections and so on. > > > I > > > would prefer to check the second argument to be at least on some > > > kind > > > of list as there are only a few keywords allowed (start, stop, > > > restart, …) and the other parameters should only contain ASCII > > > letters, numbers and maybe dash and underscore. Nothing else > > > should > > > be passed through here. > > > > Good point. I was thinking this regexp: /[^a-zA-Z_0-9\-\.]/ or > > should I > > not include a '.'? I don't think there currently are any addons or > > initscripts that contain a '.', but it could be in the future? > > I was thinking about the dot as well, and then thought it would not > be required to include it since we do not have any services like > this, and I do not remember any of them using a dot on any other > distributions. I don't think I have indeed ever encountered an initscript with a dot in it. I was only thinking, as it is a legit and common character for filenames (in general) it could cause some confusion as to why the webui would not want to work if we ever come across an initscript with a dot in its name. But on second thought, the odds are probably very very low that we will ever have that on IPFire. So I'l leave the dot out. > > The regular expression is slightly incorrect though. You want it to > be like this: > > /^[A-Za-z0-9\-\_]+$/ > > The ^ and $ indicate that the entire string must match and not only a > part. And the + after the brackets with the list of allowed > characters says that we need to have at least one character, but > could be more. However, the entire string must only contain those > characters. I have to disagree in the regular expression being incorrect :-). The ^ right after the [ is not a start of line assertion here, but makes it a character class negation which will match as soon as a single character is found that is _not_ included in the list. So I was looking for a single illegal character in the string, while your regex will check if every character in the string is an allowed character. Regards Robin > > -Michael > > > > > Regards > > Robin > > > > > > > > > > > print <<END > > > > <div align='center'> > > > > <table width='80%' cellspacing='1' class='tbl'> > > > > <tr> > > > > - <th align='center'><b>Addon</b></th> > > > > + <th align='left'><b>Addon $Lang::tr{service}</b></th> > > > > <th align='center'><b>Boot</b></th> > > > > <th align='center' > > > > colspan=2><b>$Lang::tr{'action'}</b></th> > > > > <th align='center'><b>$Lang::tr{'status'}</b></th> > > > > @@ -170,33 +170,35 @@ END > > > > foreach my $pak (keys %paklist) { > > > > my %metadata = &Pakfire::getmetadata($pak, > > > > "installed"); > > > > > > > > + my $service; > > > > + > > > > if ("$metadata{'Services'}") { > > > > - foreach my $service (split(/ /, > > > > "$metadata{'Services'}")) { > > > > - push(@addon_services, $service); > > > > - } > > > > - } > > > > - } > > > > + foreach $service (split(/ /, > > > > "$metadata{'Services'}")) { > > > > + $lines++; > > > > + if ($lines % 2) { > > > > + print "<tr>"; > > > > + $col="bgcolor='$color{'colo > > > > r22'}'"; > > > > + } else { > > > > + print "<tr>"; > > > > + $col="bgcolor='$color{'colo > > > > r20'}'"; > > > > + } > > > > > > > > - foreach (@addon_services) { > > > > - $lines++; > > > > - if ($lines % 2){ > > > > - print "<tr>"; > > > > - $col="bgcolor='$color{'color22'}'"; > > > > - }else{ > > > > - print "<tr>"; > > > > - $col="bgcolor='$color{'color20'}'"; > > > > + # Add addon name to displayname of > > > > service if servicename differs from addon > > > > + my $displayname = ($pak ne > > > > $service) ? "$service ($pak)" : $service; > > > > + print "<td align='left' $col > > > > width='31%'>$displayname</td> "; > > > > + > > > > + my $status = > > > > isautorun($pak,$service,$col); > > > > + print "$status "; > > > > + print "<td align='center' $col > > > > width='8%'><a href='services.cgi?$pak!start!$service'><img > > > > alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' > > > > src='/images/go-up.png' border='0' /></a></td>"; > > > > + print "<td align='center' $col > > > > width='8%'><a href='services.cgi?$pak!stop!$service'><img > > > > alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' > > > > src='/images/go- > > > > down.png' border='0' /></a></td> "; > > > > + my $status = > > > > isrunningaddon($pak,$service,$col); > > > > + $status =~ s/\\[[0-1]\;[0-9]+m//g; > > > > + > > > > + chomp($status); > > > > + print "$status"; > > > > + print "</tr>"; > > > > + } > > > > } > > > > - print "<td align='left' $col width='31%'>$_</td> "; > > > > - my $status = isautorun($_,$col); > > > > - print "$status "; > > > > - print "<td align='center' $col width='8%'><a > > > > href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' > > > > title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' > > > > /></a></td>"; > > > > - print "<td align='center' $col width='8%'><a > > > > href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' > > > > title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' > > > > /></a></td> "; > > > > - my $status = isrunningaddon($_,$col); > > > > - $status =~ s/\\[[0-1]\;[0-9]+m//g; > > > > - > > > > - chomp($status); > > > > - print "$status"; > > > > - print "</tr>"; > > > > } > > > > > > > > print "</table></div>\n"; > > > > @@ -215,51 +217,24 @@ END > > > > } > > > > > > > > sub isautorun (@) { > > > > - my ($cmd, $col) = @_; > > > > - > > > > - # Init directory. > > > > - my $initdir = "/etc/rc.d/rc3.d/"; > > > > - > > > > - my $status = "<td align='center' $col></td>"; > > > > + my ($pak, $service, $col) = @_; > > > > + my @testcmd = > > > > &General::system_output("/usr/local/bin/addonctrl", "$pak", > > > > "boot- > > > > status", "$service"); > > > > + my $testcmd = @testcmd[0]; > > > > + my $status = "<td align='center' $col><img > > > > alt='$Lang::tr{'service boot setting unavailable'}' > > > > title='$Lang::tr{'service boot setting unavailable'}' > > > > src='/images/dialog-warning.png' border='0' width='16' > > > > height='16' > > > > /></td>"; > > > > > > > > - # Check if autorun for the given cmd is enabled. > > > > - if ( &find_init("$cmd", "$initdir") ) { > > > > + # Check if autorun for the given service is enabled. > > > > + if ( $testcmd =~ /enabled\ on\ boot/ ) { > > > > # Adjust status. > > > > - $status = "<td align='center' $col><a > > > > href='services.cgi?$_!disable'><img > > > > alt='$Lang::tr{'deactivate'}' > > > > title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' > > > > width='16' height='16' /></a></td>"; > > > > - } else { > > > > + $status = "<td align='center' $col><a > > > > href='services.cgi?$pak!disable!$service'><img > > > > alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' > > > > src='/images/on.gif' border='0' width='16' height='16' > > > > /></a></td>"; > > > > + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { > > > > # Adjust status. > > > > - $status = "<td align='center' $col><a > > > > href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' > > > > title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' > > > > width='16' height='16' /></a></td>"; > > > > + $status = "<td align='center' $col><a > > > > href='services.cgi?$pak!enable!$service'><img > > > > alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' > > > > src='/images/off.gif' border='0' width='16' height='16' > > > > /></a></td>"; > > > > } > > > > > > > > # Return the status. > > > > return $status; > > > > } > > > > > > > > -sub find_init (@) { > > > > - my ($cmd, $dir) = @_; > > > > - > > > > - # Open given init directory. > > > > - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; > > > > - > > > > - # Read-in init files from directory. > > > > - my @inits = readdir(INITDIR); > > > > - > > > > - # Close directory handle. > > > > - closedir(INITDIR); > > > > - > > > > - # Loop through the directory. > > > > - foreach my $init (@inits) { > > > > - # Check if the current processed file belongs to > > > > the given command. > > > > - if ($init =~ /S\d+\d+$cmd\z/) { > > > > - # Found, return "1" - True. > > > > - return "1"; > > > > - } > > > > - } > > > > - > > > > - # Nothing found, return nothing. > > > > - return; > > > > -} > > > > - > > > > sub isrunning (@) { > > > > my ($cmd, $col) = @_; > > > > my $status = "<td align='center' > > > > bgcolor='${Header::colourred}'><font > > > > color='white'><b>$Lang::tr{'stopped'}</b></font></td><td > > > > colspan='2' $col></td>"; > > > > @@ -313,7 +288,7 @@ sub isrunning (@) { > > > > } > > > > > > > > sub isrunningaddon (@) { > > > > - my ($cmd, $col) = @_; > > > > + my ($pak, $service, $col) = @_; > > > > > > > > my $status = "<td align='center' > > > > bgcolor='${Header::colourred}'><font > > > > color='white'><b>$Lang::tr{'stopped'}</b></font></td><td > > > > colspan='2' $col></td>"; > > > > my $pid = ''; > > > > @@ -321,7 +296,7 @@ sub isrunningaddon (@) { > > > > my $exename; > > > > my @memory; > > > > > > > > - my @testcmd = > > > > &General::system_output("/usr/local/bin/addonctrl", "$cmd", > > > > "status"); > > > > + my @testcmd = > > > > &General::system_output("/usr/local/bin/addonctrl", "$pak", > > > > "status", "$service"); > > > > my $testcmd = @testcmd[0]; > > > > > > > > if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ > > > > running/){ > > > > diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl > > > > index 798abcffc..db7d117b0 100644 > > > > --- a/langs/de/cgi-bin/de.pl > > > > +++ b/langs/de/cgi-bin/de.pl > > > > @@ -2251,6 +2251,7 @@ > > > > 'server string' => 'Server String', > > > > 'service' => 'Dienst', > > > > 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde > > > > hinzugefügt', > > > > +'service boot setting unavailable' => 'Für das Initscript > > > > dieses > > > > Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', > > > > 'service name' => 'Name des Dienstes:', > > > > 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde > > > > entfernt', > > > > 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde > > > > aktualisiert', > > > > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > > > > index f770e7cd9..60dca5be4 100644 > > > > --- a/langs/en/cgi-bin/en.pl > > > > +++ b/langs/en/cgi-bin/en.pl > > > > @@ -2306,6 +2306,7 @@ > > > > 'server string' => 'Server String', > > > > 'service' => 'Service', > > > > 'service added' => 'Custom network service added', > > > > +'service boot setting unavailable' => 'No valid runlevel > > > > symlink > > > > was found for the initscript of this service.', > > > > 'service name' => 'Service name:', > > > > 'service removed' => 'Custom network service removed', > > > > 'service updated' => 'Custom network service updated', > > > > diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl > > > > index 49dabec99..4fd6955cc 100644 > > > > --- a/langs/nl/cgi-bin/nl.pl > > > > +++ b/langs/nl/cgi-bin/nl.pl > > > > @@ -1899,6 +1899,7 @@ > > > > 'server string' => 'Server String', > > > > 'service' => 'Dienst', > > > > 'service added' => 'Aangepaste netwerkdienst toegevoegd', > > > > +'service boot setting unavailable' => 'Er werd voor het > > > > initscript > > > > van deze service geen geldige runlevel symlink gevonden.', > > > > 'service name' => 'Dienstennaam:', > > > > 'service removed' => 'Aangepaste netwerkdienst verwijderd', > > > > 'service updated' => 'Aangepaste netwerkdienst bijgewerkt', > > > > -- > > > > 2.37.3 > > > > > > > > > > > > -- > > > > Dit bericht is gescanned op virussen en andere gevaarlijke > > > > inhoud door MailScanner en lijkt schoon te zijn. > > > > > > > > > > > > > > -- > > Dit bericht is gescanned op virussen en andere gevaarlijke > > inhoud door MailScanner en lijkt schoon te zijn. > >
Hello, > On 4 Oct 2022, at 19:59, Robin Roevens <robin.roevens@disroot.org> wrote: > > Hi Michael > > Michael Tremer schreef op di 04-10-2022 om 13:49 [+0100]: >> Hello, >> >>> On 4 Oct 2022, at 11:33, Robin Roevens <robin.roevens@disroot.org> >>> wrote: >>> >>> Hi >>> >>> Michael Tremer schreef op di 04-10-2022 om 10:51 [+0100]: >>>> Hello, >>>> >>>> I am going to start with the second patch, because that is going >>>> to >>>> be shorter :) >>>> >>>>> On 3 Oct 2022, at 16:27, Robin Roevens >>>>> <robin.roevens@disroot.org> >>>>> wrote: >>>>> >>>>> * addonctrl's new functionality to control explicit addon >>>>> services >>>>> was >>>>> implemented. >>>>> * Change 'Addon' column header to 'Addon Service' to be clear >>>>> that >>>>> it's not addons but services listed here. >>>>> * Services not matching the name of the addon now display the >>>>> addon >>>>> name between parentheses, so the user knows where the service >>>>> comes >>>>> from. >>>>> * When no valid runlevel symlink is found by addonctrl for a >>>>> service, >>>>> the 'enable on boot' checkbox is replaced by a small >>>>> exclamation >>>>> point >>>>> with alt-text "No valid runlevel symlink was found for the >>>>> initscript of >>>>> this service." to inform user why a service can't be enabled. >>>>> * Added German and Dutch translation for above message. >>>>> >>>>> Fixes: Bug#12935 >>>>> Signed-off-by: Robin Roevens <robin.roevens@disroot.org> >>>>> --- >>>>> html/cgi-bin/services.cgi | 103 +++++++++++++++---------------- >>>>> ---- >>>>> --- >>>>> langs/de/cgi-bin/de.pl | 1 + >>>>> langs/en/cgi-bin/en.pl | 1 + >>>>> langs/nl/cgi-bin/nl.pl | 1 + >>>>> 4 files changed, 42 insertions(+), 64 deletions(-) >>>>> >>>>> diff --git a/html/cgi-bin/services.cgi b/html/cgi- >>>>> bin/services.cgi >>>>> index 29926ecc3..e91da884b 100644 >>>>> --- a/html/cgi-bin/services.cgi >>>>> +++ b/html/cgi-bin/services.cgi >>>>> @@ -142,14 +142,14 @@ END >>>>> my $paramstr=$ENV{QUERY_STRING}; >>>>> my @param=split(/!/, $paramstr); >>>>> if ($param[1] ne ''){ >>>>> - &General::system("/usr/local/bin/addonctrl", >>>>> "$param[0]", "$param[1]"); >>>>> + &General::system("/usr/local/bin/addonctrl", >>>>> "$param[0]", "$param[1]", "$param[2]"); >>>>> } >>>> >>>> Although this has been like this before, I am strongly against >>>> passing anything from the request to the setuid binary. >>>> >>>> This will open us up for any shell command injections and so on. >>>> I >>>> would prefer to check the second argument to be at least on some >>>> kind >>>> of list as there are only a few keywords allowed (start, stop, >>>> restart, …) and the other parameters should only contain ASCII >>>> letters, numbers and maybe dash and underscore. Nothing else >>>> should >>>> be passed through here. >>> >>> Good point. I was thinking this regexp: /[^a-zA-Z_0-9\-\.]/ or >>> should I >>> not include a '.'? I don't think there currently are any addons or >>> initscripts that contain a '.', but it could be in the future? >> >> I was thinking about the dot as well, and then thought it would not >> be required to include it since we do not have any services like >> this, and I do not remember any of them using a dot on any other >> distributions. > > I don't think I have indeed ever encountered an initscript with a dot > in it. I was only thinking, as it is a legit and common character for > filenames (in general) it could cause some confusion as to why the > webui would not want to work if we ever come across an initscript with > a dot in its name. But on second thought, the odds are probably very > very low that we will ever have that on IPFire. So I'l leave the dot > out. Thank you. The dot is a little bit concerning, because in a full path, it has special meanings (e.g. /etc/init.d/../../bin/bash). We don’t allow using / here, so we should be safe, but it is probably still a good idea to be as strict as possible. > >> >> The regular expression is slightly incorrect though. You want it to >> be like this: >> >> /^[A-Za-z0-9\-\_]+$/ >> >> The ^ and $ indicate that the entire string must match and not only a >> part. And the + after the brackets with the list of allowed >> characters says that we need to have at least one character, but >> could be more. However, the entire string must only contain those >> characters. > > I have to disagree in the regular expression being incorrect :-). > The ^ right after the [ is not a start of line assertion here, but > makes it a character class negation which will match as soon as a > single character is found that is _not_ included in the list. So I was > looking for a single illegal character in the string, while your regex > will check if every character in the string is an allowed character. Hmm, I thought that that could have been the case, but then wrote the whole thing again because that seemed to be easier for me :) I kind of prefer my version, because it allows certain things and that is it. It feels more strict - probably isn’t. Disallowing seems to be logically more complex. -Michael > > > Regards > Robin > >> >> -Michael >> >>> >>> Regards >>> Robin >>>> >>>>> >>>>> print <<END >>>>> <div align='center'> >>>>> <table width='80%' cellspacing='1' class='tbl'> >>>>> <tr> >>>>> - <th align='center'><b>Addon</b></th> >>>>> + <th align='left'><b>Addon $Lang::tr{service}</b></th> >>>>> <th align='center'><b>Boot</b></th> >>>>> <th align='center' >>>>> colspan=2><b>$Lang::tr{'action'}</b></th> >>>>> <th align='center'><b>$Lang::tr{'status'}</b></th> >>>>> @@ -170,33 +170,35 @@ END >>>>> foreach my $pak (keys %paklist) { >>>>> my %metadata = &Pakfire::getmetadata($pak, >>>>> "installed"); >>>>> >>>>> + my $service; >>>>> + >>>>> if ("$metadata{'Services'}") { >>>>> - foreach my $service (split(/ /, >>>>> "$metadata{'Services'}")) { >>>>> - push(@addon_services, $service); >>>>> - } >>>>> - } >>>>> - } >>>>> + foreach $service (split(/ /, >>>>> "$metadata{'Services'}")) { >>>>> + $lines++; >>>>> + if ($lines % 2) { >>>>> + print "<tr>"; >>>>> + $col="bgcolor='$color{'colo >>>>> r22'}'"; >>>>> + } else { >>>>> + print "<tr>"; >>>>> + $col="bgcolor='$color{'colo >>>>> r20'}'"; >>>>> + } >>>>> >>>>> - foreach (@addon_services) { >>>>> - $lines++; >>>>> - if ($lines % 2){ >>>>> - print "<tr>"; >>>>> - $col="bgcolor='$color{'color22'}'"; >>>>> - }else{ >>>>> - print "<tr>"; >>>>> - $col="bgcolor='$color{'color20'}'"; >>>>> + # Add addon name to displayname of >>>>> service if servicename differs from addon >>>>> + my $displayname = ($pak ne >>>>> $service) ? "$service ($pak)" : $service; >>>>> + print "<td align='left' $col >>>>> width='31%'>$displayname</td> "; >>>>> + >>>>> + my $status = >>>>> isautorun($pak,$service,$col); >>>>> + print "$status "; >>>>> + print "<td align='center' $col >>>>> width='8%'><a href='services.cgi?$pak!start!$service'><img >>>>> alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' >>>>> src='/images/go-up.png' border='0' /></a></td>"; >>>>> + print "<td align='center' $col >>>>> width='8%'><a href='services.cgi?$pak!stop!$service'><img >>>>> alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' >>>>> src='/images/go- >>>>> down.png' border='0' /></a></td> "; >>>>> + my $status = >>>>> isrunningaddon($pak,$service,$col); >>>>> + $status =~ s/\\[[0-1]\;[0-9]+m//g; >>>>> + >>>>> + chomp($status); >>>>> + print "$status"; >>>>> + print "</tr>"; >>>>> + } >>>>> } >>>>> - print "<td align='left' $col width='31%'>$_</td> "; >>>>> - my $status = isautorun($_,$col); >>>>> - print "$status "; >>>>> - print "<td align='center' $col width='8%'><a >>>>> href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' >>>>> title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' >>>>> /></a></td>"; >>>>> - print "<td align='center' $col width='8%'><a >>>>> href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' >>>>> title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' >>>>> /></a></td> "; >>>>> - my $status = isrunningaddon($_,$col); >>>>> - $status =~ s/\\[[0-1]\;[0-9]+m//g; >>>>> - >>>>> - chomp($status); >>>>> - print "$status"; >>>>> - print "</tr>"; >>>>> } >>>>> >>>>> print "</table></div>\n"; >>>>> @@ -215,51 +217,24 @@ END >>>>> } >>>>> >>>>> sub isautorun (@) { >>>>> - my ($cmd, $col) = @_; >>>>> - >>>>> - # Init directory. >>>>> - my $initdir = "/etc/rc.d/rc3.d/"; >>>>> - >>>>> - my $status = "<td align='center' $col></td>"; >>>>> + my ($pak, $service, $col) = @_; >>>>> + my @testcmd = >>>>> &General::system_output("/usr/local/bin/addonctrl", "$pak", >>>>> "boot- >>>>> status", "$service"); >>>>> + my $testcmd = @testcmd[0]; >>>>> + my $status = "<td align='center' $col><img >>>>> alt='$Lang::tr{'service boot setting unavailable'}' >>>>> title='$Lang::tr{'service boot setting unavailable'}' >>>>> src='/images/dialog-warning.png' border='0' width='16' >>>>> height='16' >>>>> /></td>"; >>>>> >>>>> - # Check if autorun for the given cmd is enabled. >>>>> - if ( &find_init("$cmd", "$initdir") ) { >>>>> + # Check if autorun for the given service is enabled. >>>>> + if ( $testcmd =~ /enabled\ on\ boot/ ) { >>>>> # Adjust status. >>>>> - $status = "<td align='center' $col><a >>>>> href='services.cgi?$_!disable'><img >>>>> alt='$Lang::tr{'deactivate'}' >>>>> title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' >>>>> width='16' height='16' /></a></td>"; >>>>> - } else { >>>>> + $status = "<td align='center' $col><a >>>>> href='services.cgi?$pak!disable!$service'><img >>>>> alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' >>>>> src='/images/on.gif' border='0' width='16' height='16' >>>>> /></a></td>"; >>>>> + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { >>>>> # Adjust status. >>>>> - $status = "<td align='center' $col><a >>>>> href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' >>>>> title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' >>>>> width='16' height='16' /></a></td>"; >>>>> + $status = "<td align='center' $col><a >>>>> href='services.cgi?$pak!enable!$service'><img >>>>> alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' >>>>> src='/images/off.gif' border='0' width='16' height='16' >>>>> /></a></td>"; >>>>> } >>>>> >>>>> # Return the status. >>>>> return $status; >>>>> } >>>>> >>>>> -sub find_init (@) { >>>>> - my ($cmd, $dir) = @_; >>>>> - >>>>> - # Open given init directory. >>>>> - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; >>>>> - >>>>> - # Read-in init files from directory. >>>>> - my @inits = readdir(INITDIR); >>>>> - >>>>> - # Close directory handle. >>>>> - closedir(INITDIR); >>>>> - >>>>> - # Loop through the directory. >>>>> - foreach my $init (@inits) { >>>>> - # Check if the current processed file belongs to >>>>> the given command. >>>>> - if ($init =~ /S\d+\d+$cmd\z/) { >>>>> - # Found, return "1" - True. >>>>> - return "1"; >>>>> - } >>>>> - } >>>>> - >>>>> - # Nothing found, return nothing. >>>>> - return; >>>>> -} >>>>> - >>>>> sub isrunning (@) { >>>>> my ($cmd, $col) = @_; >>>>> my $status = "<td align='center' >>>>> bgcolor='${Header::colourred}'><font >>>>> color='white'><b>$Lang::tr{'stopped'}</b></font></td><td >>>>> colspan='2' $col></td>"; >>>>> @@ -313,7 +288,7 @@ sub isrunning (@) { >>>>> } >>>>> >>>>> sub isrunningaddon (@) { >>>>> - my ($cmd, $col) = @_; >>>>> + my ($pak, $service, $col) = @_; >>>>> >>>>> my $status = "<td align='center' >>>>> bgcolor='${Header::colourred}'><font >>>>> color='white'><b>$Lang::tr{'stopped'}</b></font></td><td >>>>> colspan='2' $col></td>"; >>>>> my $pid = ''; >>>>> @@ -321,7 +296,7 @@ sub isrunningaddon (@) { >>>>> my $exename; >>>>> my @memory; >>>>> >>>>> - my @testcmd = >>>>> &General::system_output("/usr/local/bin/addonctrl", "$cmd", >>>>> "status"); >>>>> + my @testcmd = >>>>> &General::system_output("/usr/local/bin/addonctrl", "$pak", >>>>> "status", "$service"); >>>>> my $testcmd = @testcmd[0]; >>>>> >>>>> if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ >>>>> running/){ >>>>> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl >>>>> index 798abcffc..db7d117b0 100644 >>>>> --- a/langs/de/cgi-bin/de.pl >>>>> +++ b/langs/de/cgi-bin/de.pl >>>>> @@ -2251,6 +2251,7 @@ >>>>> 'server string' => 'Server String', >>>>> 'service' => 'Dienst', >>>>> 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde >>>>> hinzugefügt', >>>>> +'service boot setting unavailable' => 'Für das Initscript >>>>> dieses >>>>> Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', >>>>> 'service name' => 'Name des Dienstes:', >>>>> 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde >>>>> entfernt', >>>>> 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde >>>>> aktualisiert', >>>>> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl >>>>> index f770e7cd9..60dca5be4 100644 >>>>> --- a/langs/en/cgi-bin/en.pl >>>>> +++ b/langs/en/cgi-bin/en.pl >>>>> @@ -2306,6 +2306,7 @@ >>>>> 'server string' => 'Server String', >>>>> 'service' => 'Service', >>>>> 'service added' => 'Custom network service added', >>>>> +'service boot setting unavailable' => 'No valid runlevel >>>>> symlink >>>>> was found for the initscript of this service.', >>>>> 'service name' => 'Service name:', >>>>> 'service removed' => 'Custom network service removed', >>>>> 'service updated' => 'Custom network service updated', >>>>> diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl >>>>> index 49dabec99..4fd6955cc 100644 >>>>> --- a/langs/nl/cgi-bin/nl.pl >>>>> +++ b/langs/nl/cgi-bin/nl.pl >>>>> @@ -1899,6 +1899,7 @@ >>>>> 'server string' => 'Server String', >>>>> 'service' => 'Dienst', >>>>> 'service added' => 'Aangepaste netwerkdienst toegevoegd', >>>>> +'service boot setting unavailable' => 'Er werd voor het >>>>> initscript >>>>> van deze service geen geldige runlevel symlink gevonden.', >>>>> 'service name' => 'Dienstennaam:', >>>>> 'service removed' => 'Aangepaste netwerkdienst verwijderd', >>>>> 'service updated' => 'Aangepaste netwerkdienst bijgewerkt', >>>>> -- >>>>> 2.37.3 >>>>> >>>>> >>>>> -- >>>>> Dit bericht is gescanned op virussen en andere gevaarlijke >>>>> inhoud door MailScanner en lijkt schoon te zijn. >>>>> >>>> >>>> >>> >>> -- >>> Dit bericht is gescanned op virussen en andere gevaarlijke >>> inhoud door MailScanner en lijkt schoon te zijn. >> >> > > -- > Dit bericht is gescanned op virussen en andere gevaarlijke > inhoud door MailScanner en lijkt schoon te zijn.
diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index 29926ecc3..e91da884b 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -142,14 +142,14 @@ END my $paramstr=$ENV{QUERY_STRING}; my @param=split(/!/, $paramstr); if ($param[1] ne ''){ - &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]"); + &General::system("/usr/local/bin/addonctrl", "$param[0]", "$param[1]", "$param[2]"); } print <<END <div align='center'> <table width='80%' cellspacing='1' class='tbl'> <tr> - <th align='center'><b>Addon</b></th> + <th align='left'><b>Addon $Lang::tr{service}</b></th> <th align='center'><b>Boot</b></th> <th align='center' colspan=2><b>$Lang::tr{'action'}</b></th> <th align='center'><b>$Lang::tr{'status'}</b></th> @@ -170,33 +170,35 @@ END foreach my $pak (keys %paklist) { my %metadata = &Pakfire::getmetadata($pak, "installed"); + my $service; + if ("$metadata{'Services'}") { - foreach my $service (split(/ /, "$metadata{'Services'}")) { - push(@addon_services, $service); - } - } - } + foreach $service (split(/ /, "$metadata{'Services'}")) { + $lines++; + if ($lines % 2) { + print "<tr>"; + $col="bgcolor='$color{'color22'}'"; + } else { + print "<tr>"; + $col="bgcolor='$color{'color20'}'"; + } - foreach (@addon_services) { - $lines++; - if ($lines % 2){ - print "<tr>"; - $col="bgcolor='$color{'color22'}'"; - }else{ - print "<tr>"; - $col="bgcolor='$color{'color20'}'"; + # Add addon name to displayname of service if servicename differs from addon + my $displayname = ($pak ne $service) ? "$service ($pak)" : $service; + print "<td align='left' $col width='31%'>$displayname</td> "; + + my $status = isautorun($pak,$service,$col); + print "$status "; + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; + print "<td align='center' $col width='8%'><a href='services.cgi?$pak!stop!$service'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; + my $status = isrunningaddon($pak,$service,$col); + $status =~ s/\\[[0-1]\;[0-9]+m//g; + + chomp($status); + print "$status"; + print "</tr>"; + } } - print "<td align='left' $col width='31%'>$_</td> "; - my $status = isautorun($_,$col); - print "$status "; - print "<td align='center' $col width='8%'><a href='services.cgi?$_!start'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; - print "<td align='center' $col width='8%'><a href='services.cgi?$_!stop'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; - my $status = isrunningaddon($_,$col); - $status =~ s/\\[[0-1]\;[0-9]+m//g; - - chomp($status); - print "$status"; - print "</tr>"; } print "</table></div>\n"; @@ -215,51 +217,24 @@ END } sub isautorun (@) { - my ($cmd, $col) = @_; - - # Init directory. - my $initdir = "/etc/rc.d/rc3.d/"; - - my $status = "<td align='center' $col></td>"; + my ($pak, $service, $col) = @_; + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "boot-status", "$service"); + my $testcmd = @testcmd[0]; + my $status = "<td align='center' $col><img alt='$Lang::tr{'service boot setting unavailable'}' title='$Lang::tr{'service boot setting unavailable'}' src='/images/dialog-warning.png' border='0' width='16' height='16' /></td>"; - # Check if autorun for the given cmd is enabled. - if ( &find_init("$cmd", "$initdir") ) { + # Check if autorun for the given service is enabled. + if ( $testcmd =~ /enabled\ on\ boot/ ) { # Adjust status. - $status = "<td align='center' $col><a href='services.cgi?$_!disable'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; - } else { + $status = "<td align='center' $col><a href='services.cgi?$pak!disable!$service'><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></a></td>"; + } elsif ( $testcmd =~ /disabled\ on\ boot/ ) { # Adjust status. - $status = "<td align='center' $col><a href='services.cgi?$_!enable'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; + $status = "<td align='center' $col><a href='services.cgi?$pak!enable!$service'><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></a></td>"; } # Return the status. return $status; } -sub find_init (@) { - my ($cmd, $dir) = @_; - - # Open given init directory. - opendir (INITDIR, "$dir") || die "Cannot opendir $dir: $!"; - - # Read-in init files from directory. - my @inits = readdir(INITDIR); - - # Close directory handle. - closedir(INITDIR); - - # Loop through the directory. - foreach my $init (@inits) { - # Check if the current processed file belongs to the given command. - if ($init =~ /S\d+\d+$cmd\z/) { - # Found, return "1" - True. - return "1"; - } - } - - # Nothing found, return nothing. - return; -} - sub isrunning (@) { my ($cmd, $col) = @_; my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; @@ -313,7 +288,7 @@ sub isrunning (@) { } sub isrunningaddon (@) { - my ($cmd, $col) = @_; + my ($pak, $service, $col) = @_; my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; my $pid = ''; @@ -321,7 +296,7 @@ sub isrunningaddon (@) { my $exename; my @memory; - my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$cmd", "status"); + my @testcmd = &General::system_output("/usr/local/bin/addonctrl", "$pak", "status", "$service"); my $testcmd = @testcmd[0]; if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){ diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 798abcffc..db7d117b0 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -2251,6 +2251,7 @@ 'server string' => 'Server String', 'service' => 'Dienst', 'service added' => 'Benutzerdefinierter Netzwerkdienst wurde hinzugefügt', +'service boot setting unavailable' => 'Für das Initscript dieses Dienstes wurde kein gültiger Runlevel-Symlink gefunden.', 'service name' => 'Name des Dienstes:', 'service removed' => 'Benutzerdefinierter Netzwerkdienst wurde entfernt', 'service updated' => 'Benutzerdefinierter Netzwerkdienst wurde aktualisiert', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index f770e7cd9..60dca5be4 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -2306,6 +2306,7 @@ 'server string' => 'Server String', 'service' => 'Service', 'service added' => 'Custom network service added', +'service boot setting unavailable' => 'No valid runlevel symlink was found for the initscript of this service.', 'service name' => 'Service name:', 'service removed' => 'Custom network service removed', 'service updated' => 'Custom network service updated', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 49dabec99..4fd6955cc 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -1899,6 +1899,7 @@ 'server string' => 'Server String', 'service' => 'Dienst', 'service added' => 'Aangepaste netwerkdienst toegevoegd', +'service boot setting unavailable' => 'Er werd voor het initscript van deze service geen geldige runlevel symlink gevonden.', 'service name' => 'Dienstennaam:', 'service removed' => 'Aangepaste netwerkdienst verwijderd', 'service updated' => 'Aangepaste netwerkdienst bijgewerkt',