From mboxrd@z Thu Jan 1 00:00:00 1970 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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6222255821827096080==" List-Id: --===============6222255821827096080== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =3D (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/i= nclude/colors.txt", \%color); =20 -############################################################################= ################################################ -############################################# Samba Dienste fr Statusberprfu= ng ########################################## - -&Header::showhttpheaders(); - ############################################################################= ################################################ #################################### Initialisierung von Samba Variablen fr = global Settings ############################### =20 @@ -72,7 +67,17 @@ my $LOGLINES =3D '50'; ############################################################################= ################################################ =20 &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 $sambaset= tings{'y'}; =20 &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 ###################################### =20 -if ($sambasettings{'ACTION'} eq $Lang::tr{'save'}) -{ ############################################################################= ################################################ ##################################### Schreiben settings und bersetzen fr sm= b.conf ####################################### =20 -delete $sambasettings{'__CGI__'};delete $sambasettings{'x'};delete $sambaset= tings{'y'}; -&General::writehash("${General::swroot}/samba/settings", \%sambasettings); - -############################################################################= ################################################ -############################################# Schreiben der Samba globals ##= ################################################ - - open (FILE, ">${General::swroot}/samba/global") or die "Can't save the glob= al settings: $!"; - flock (FILE, 2); -=09 -print FILE <${General::swroot}/samba/global") or die "Can't save the glob= al settings: $!"; + flock (FILE, 2); +=09 + print FILE <