X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fremote.cgi;h=e760e7aaded5837be5dba38ba783fb8febabcd9d;hp=3b5916d99db1f6392dd811ef5eb9d26ed01507da;hb=70df830214c97a68fcb7e89ae0d7df58c35590be;hpb=bba7212c561429909e22267f43ebabfab866ba62 diff --git a/html/cgi-bin/remote.cgi b/html/cgi-bin/remote.cgi index 3b5916d99d..e760e7aade 100644 --- a/html/cgi-bin/remote.cgi +++ b/html/cgi-bin/remote.cgi @@ -1,13 +1,23 @@ #!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# -# $Id: remote.cgi,v 1.6.2.8 2005/02/22 22:21:56 gespinasse Exp $ -# +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use strict; @@ -22,6 +32,7 @@ require "${General::swroot}/header.pl"; my %remotesettings=(); my %checked=(); my $errormessage=''; +my $counter = 0; &Header::showhttpheaders(); @@ -63,16 +74,19 @@ if ( (($remotesettings{'ACTION'} eq $Lang::tr{'save'}) || ($remotesettings{'ACTI { &General::log($Lang::tr{'ssh1 disabled'}); } -if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} ){ - system('/usr/local/bin/restartssh','tempstart15') == 0 - or $errormessage = "$Lang::tr{'bad return code'} " . $?/256; - } -elsif ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ){ - system('/usr/local/bin/restartssh','tempstart30') == 0 - or $errormessage = "$Lang::tr{'bad return code'} " . $?/256; +if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} || $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ){ + if ($remotesettings{'ENABLE_SSH'} eq 'off') + { + system ('/usr/bin/touch', "${General::swroot}/remote/enablessh"); + system('/usr/local/bin/sshctrl'); + } + if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} ) { $counter = 900;} + elsif ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ) { $counter = 1800;} + + system("/usr/local/bin/sshctrl tempstart $counter >/dev/null"); } else { - system('/usr/local/bin/restartssh') == 0 + system('/usr/local/bin/sshctrl') == 0 or $errormessage = "$Lang::tr{'bad return code'} " . $?/256; } }