summaryrefslogtreecommitdiffstats
path: root/samba_wizard/scripts/Smbconf.pm
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-10-23 10:04:57 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-10-23 10:04:57 +0000
commitd381270aa94a7ed230dfaee421d1f0e3bad42d5f (patch)
tree8d8cdefae6a5a98d861378f6bf5f35e485210746 /samba_wizard/scripts/Smbconf.pm
parent742f6a645859e78af7fde1376809988d3752702e (diff)
downloaddrakwizard-d381270aa94a7ed230dfaee421d1f0e3bad42d5f.tar
drakwizard-d381270aa94a7ed230dfaee421d1f0e3bad42d5f.tar.gz
drakwizard-d381270aa94a7ed230dfaee421d1f0e3bad42d5f.tar.bz2
drakwizard-d381270aa94a7ed230dfaee421d1f0e3bad42d5f.tar.xz
drakwizard-d381270aa94a7ed230dfaee421d1f0e3bad42d5f.zip
acces restriction
Diffstat (limited to 'samba_wizard/scripts/Smbconf.pm')
-rwxr-xr-xsamba_wizard/scripts/Smbconf.pm70
1 files changed, 55 insertions, 15 deletions
diff --git a/samba_wizard/scripts/Smbconf.pm b/samba_wizard/scripts/Smbconf.pm
index 4f2ab90d..ed065f55 100755
--- a/samba_wizard/scripts/Smbconf.pm
+++ b/samba_wizard/scripts/Smbconf.pm
@@ -78,6 +78,7 @@ sub write_conf {
else {
print FH $_;
}
+ print "$_\n";
}
}
@@ -142,6 +143,7 @@ sub chg_var {
$self->{conf}->{$menu}{$var}{value} = $str;
}
+# all or selected printers
sub printer_sharing {
my $self = shift;
my $printer;
@@ -237,6 +239,38 @@ sub get_home_sharing {
1;
}
+sub get_netmask {
+ "192.168.100.1/255.255.255.0";
+}
+
+sub get_allow_host {
+ $old->{conf}->{global}{"hosts allow"}{value};
+}
+
+sub get_deny_host {
+ $old->{conf}->{global}{"hosts deny"}{value};
+}
+
+sub chk_level {
+# if ($ENV{wiz_level} == 2) {
+# $ENV{wiz_allow_allow} = "toto";
+# $ENV{wiz_allow_allow} = "toto";
+# }
+# else {
+# $ENV{wiz_hosts_deny} = "tata";
+# $ENV{wiz_hosts_deny} = "tata";
+# }
+# if ($ENV{wiz_level} == 3) {
+# $ENV{wiz_allow_allow} = "toto";
+# $ENV{wiz_allow_allow} = "toto";
+# }
+# else {
+# $ENV{wiz_hosts_deny} = "tata";
+# $ENV{wiz_hosts_deny} = "tata";
+# }
+ $ENV{wiz_level};
+}
+
# remember one variable cannot be commented and not in the same file.
sub do_it {
my $file = "__WIZ_HOME__/samba_wizard/scripts/smb.conf.default";
@@ -244,23 +278,11 @@ sub do_it {
my $conf = read_conf($file);
$conf->chg_var("global", "security", "share");
$conf->chg_var("global", "workgroup", $ENV{wiz_workgroup});
+ print "$ENV{wiz_workgroup}\n";
$conf->chg_var("global", "server string", $ENV{wiz_banner});
$conf->chg_var("public", "write list", $ENV{wiz_write_list}) if $ENV{wiz_do_file_sharing};
$conf->chg_var("public", "read list", $ENV{wiz_read_list}) if $ENV{wiz_do_file_sharing};
my $ip = $o->get_from_known_dev("IP");
- if ($ENV{wiz_do_printer_sharing}) {
- standalone->explanations("Enabling printer sharing");
- $conf->printer_sharing();
- }
- else {
- standalone->explanations("Disabling printer sharing");
- foreach $printer (keys (%::bool)) {
- if (!int($::bool{$printer})) {
- $conf->comment_menu("$printer", ";");
- }
- }
- $conf->comment_menu("printers", ";");
- }
if ($ENV{wiz_do_file_sharing}) {
standalone->explanations("Enabling $ENV{wiz_dir} samba file sharing");
$conf->comment_menu("public", "");
@@ -276,10 +298,28 @@ sub do_it {
else {
standalone->explanations("Disabling samba homes sharing");
$conf->comment_menu("homes", ";");
- }
- $conf->chg_var("global", "hosts allow", $ip);
+ }
+ standalone->explanations("Samba deny $ENV{wiz_hosts_deny}");
+ standalone->explanations("Samba allow $ENV{wiz_hosts_allow}");
+ $conf->chg_var("global", "hosts deny", $ENV{wiz_hosts_deny});
+ $conf->comment_var("global", "hosts deny", "");
+ $conf->chg_var("global", "hosts allow", $ENV{wiz_hosts_allow});
+ $conf->comment_var("global", "hosts allow", "");
$conf->chg_var("global", "security", "share");
$conf->chg_var("public", "path", $ENV{wiz_dir}) if $ENV{wiz_dir};
+ if ($ENV{wiz_do_printer_sharing}) {
+ standalone->explanations("Enabling printer sharing");
+ $conf->printer_sharing();
+ }
+ else {
+ standalone->explanations("Disabling printer sharing");
+ foreach $printer (keys (%::bool)) {
+ if (!int($::bool{$printer})) {
+ $conf->comment_menu("$printer", ";");
+ }
+ }
+ $conf->comment_menu("printers", ";");
+ }
$conf->write_conf("/etc/samba/smb.conf");
system("/etc/rc.d/init.d/smb restart");
10;