summaryrefslogtreecommitdiffstats
path: root/proxy_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'proxy_wizard')
-rw-r--r--proxy_wizard/proxy.wiz20
-rw-r--r--proxy_wizard/scripts/Squidconf.pm28
2 files changed, 37 insertions, 11 deletions
diff --git a/proxy_wizard/proxy.wiz b/proxy_wizard/proxy.wiz
index 16ec0be4..0d043688 100644
--- a/proxy_wizard/proxy.wiz
+++ b/proxy_wizard/proxy.wiz
@@ -23,8 +23,8 @@
<Variable
name="wiz_squid_port"
shellVariable="wiz_squid_port"
- defaultValue="3128"
valueIsTranslated="false"
+ defaultValue="3128"
>
</Variable>
@@ -47,7 +47,6 @@
<Variable
name="wiz_squid_mynetw"
shellVariable="wiz_squid_mynetw"
- defaultValue="0.0.0.0/0.0.0.0"
valueIsTranslated="false"
>
</Variable>
@@ -112,7 +111,7 @@
<Page
name="port"
helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-proxy.html"
- jumpScript="__WIZ_HOME__/proxy_wizard/scripts/testport.sh"
+ func="testport"
executionLevel="NORMAL"
nextFinish="false"
canBack="true"
@@ -150,7 +149,6 @@
<Freetext
- name="wiz_squid_port"
variableName="wiz_squid_port"
helpText="Proxy port:"
editable="true"
@@ -315,18 +313,17 @@
helpText="You have entered a port that may be useful for this service:"
>
</Info>
-
-
<Info
- fillScript="__WIZ_HOME__/proxy_wizard/scripts/printservices.sh"
+ helpText="Press Next if you want to keep this value, or Back to correct your choice."
>
</Info>
-
- <Info
- helpText="Press Next if you want to keep this value, or Back to correct your choice."
+ <Freetext
+ fillfunc="port"
+ helpText="/etc/services:"
+ editable="false"
>
- </Info>
+ </Freetext>
</Page>
<Page
@@ -359,6 +356,7 @@
<Freetext
name="f_wiz_squid_mynetw"
variableName="wiz_squid_mynetw"
+ fillfunc="network_mask"
helpText="Authorised network:"
editable="true"
>
diff --git a/proxy_wizard/scripts/Squidconf.pm b/proxy_wizard/scripts/Squidconf.pm
index 4437e355..d9d1c103 100644
--- a/proxy_wizard/scripts/Squidconf.pm
+++ b/proxy_wizard/scripts/Squidconf.pm
@@ -3,10 +3,38 @@
package Squidconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
require "__WIZ_HOME__/common/scripts/Varspaceval.pm";
+require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
use MDK::Common;
use strict;
use standalone;
+sub network_mask {
+ my $o = DrakconnectConf->new();
+ my $wiz_ip_server = $o->get_from_known_dev("IP");
+ my $mask = $o->get_from_known_dev("Mask");
+ "$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+}
+
+sub testport {
+ if ($ENV{wiz_squid_port} == 3128 || $ENV{wiz_squid_port} == 8080) {
+ return 0;
+ }
+ elsif ($ENV{wiz_squid_port} <= 1024 || $ENV{wiz_squid_port} >= 65536) {
+ return 2;
+ }
+ 1;
+}
+
+sub port {
+ my $ret;
+ my @lines = grep(/$ENV{wiz_squid_port}\/tcp/, cat_("/etc/services"));
+ foreach (@lines) {
+ s/\t/ /g;
+ $ret .= "\n$_";
+ }
+ $ret;
+}
+
sub do_it_squid {
my $file="/etc/squid/squid.conf";
-f $file and MDK::Common::cp_af($file, $file.".orig");