summaryrefslogtreecommitdiffstats
path: root/samba_wizard/scripts/Smbconf.pm
diff options
context:
space:
mode:
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;