From patchwork Tue Oct 13 16:08:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 3579 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 "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4C9gWt6s8vz3x1S for ; Tue, 13 Oct 2020 16:11:06 +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 "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4C9gT508hnz1WR; Tue, 13 Oct 2020 16:08:41 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4C9gT33t5yz304T; Tue, 13 Oct 2020 16:08:39 +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 "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4C9gT13Vz7z2xkD for ; Tue, 13 Oct 2020 16:08:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (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 did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4C9gSz2zjJz1Fn; Tue, 13 Oct 2020 16:08:35 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1602605315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fgSgx4mTNvuP37MV8dAqXxm466/jofM9+9DE2hqjh2s=; b=4q938RYpVQx72znBTMGW9wDir5p+Ru02Lg8OhU54Wwe+wKQ4nvN/picr1U8garSZMa6Pdj AgReQueG+rZ3voDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1602605315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fgSgx4mTNvuP37MV8dAqXxm466/jofM9+9DE2hqjh2s=; b=iNetXwxwAH1FaFQKNLlWW62FI33EiY5GyzfrLfr7i1OTxbiODMSzs9I5vx6dN0x8jj2LfL 3ChmnisjLhyT8DyvmHI7/Q6SxV5mk1X76dzYOyao78K+12W4c8lnsfLmtCgcV9rdPBcDZJ 3z1LBXFvgIWwyyL2xSt2VtfnCSSBAiLim5VShgMIgTNCwiwIynvzAoNT8vjfmom35MwJq5 rnTkqM2s9H6Bt7gedbcmE0Qu7u0MMmFOu91yK3UDeYSXfL+JN0NdIDjJPkEZJ5cHQv4WpA nQpaBkk3Ty+PppGLn5ZfCwo6GfR4wiJ1zhW29QHJceqSA3AA2rcIY5j+f6H24g== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 53/54] samba: Allow rewriting configuration from CLI Date: Tue, 13 Oct 2020 16:08:11 +0000 Message-Id: <20201013160812.27754-53-michael.tremer@ipfire.org> In-Reply-To: <20201013160812.27754-1-michael.tremer@ipfire.org> References: <20201013160812.27754-1-michael.tremer@ipfire.org> MIME-Version: 1.0 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: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- html/cgi-bin/samba.cgi | 152 ++++++++++++++++++++------------------ src/paks/samba/install.sh | 12 +-- 2 files changed, 82 insertions(+), 82 deletions(-) diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi index ec1237134..be670a95e 100644 --- a/html/cgi-bin/samba.cgi +++ b/html/cgi-bin/samba.cgi @@ -50,11 +50,6 @@ my %shares = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); -############################################################################################################################ -############################################# Samba Dienste fr Statusberprfung ########################################## - -&Header::showhttpheaders(); - ############################################################################################################################ #################################### Initialisierung von Samba Variablen fr global Settings ############################### @@ -72,7 +67,17 @@ my $LOGLINES = '50'; ############################################################################################################################ &General::readhash("${General::swroot}/samba/settings", \%sambasettings); + +# Hook to regenerate the configuration files. +if ($ENV{"REMOTE_ADDR"} eq "") { + &writeconfiguration(); + exit(0); +} + +&Header::showhttpheaders(); + &Header::getcgihash(\%sambasettings); +delete $sambasettings{'__CGI__'};delete $sambasettings{'x'};delete $sambasettings{'y'}; &Header::openpage('Samba', 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); @@ -100,81 +105,19 @@ if ($sambasettings{'ACTION'} eq 'userdelete'){system("/usr/local/bin/sambactrl s ############################################################################################################################ ##################################### Umsetzen der Werte von Checkboxen und Dropdowns ###################################### -if ($sambasettings{'ACTION'} eq $Lang::tr{'save'}) -{ ############################################################################################################################ ##################################### Schreiben settings und bersetzen fr smb.conf ####################################### -delete $sambasettings{'__CGI__'};delete $sambasettings{'x'};delete $sambasettings{'y'}; -&General::writehash("${General::swroot}/samba/settings", \%sambasettings); - -############################################################################################################################ -############################################# Schreiben der Samba globals ################################################## - - open (FILE, ">${General::swroot}/samba/global") or die "Can't save the global settings: $!"; - flock (FILE, 2); - -print FILE <${General::swroot}/samba/global") or die "Can't save the global settings: $!"; + flock (FILE, 2); + + print FILE <