diff options
author | Florent Villard <warly@mandriva.com> | 2003-10-20 10:51:59 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2003-10-20 10:51:59 +0000 |
commit | 306951e28791b261f894a8b71255b4c45d105661 (patch) | |
tree | 9fa88f156c8a6fa200986dc52b42ab43047e81f6 /samba_wizard | |
parent | eacbbd06a147d56f4edfaf008cc667b55577b3be (diff) | |
download | drakwizard-306951e28791b261f894a8b71255b4c45d105661.tar drakwizard-306951e28791b261f894a8b71255b4c45d105661.tar.gz drakwizard-306951e28791b261f894a8b71255b4c45d105661.tar.bz2 drakwizard-306951e28791b261f894a8b71255b4c45d105661.tar.xz drakwizard-306951e28791b261f894a8b71255b4c45d105661.zip |
change copyright
remove old xml related files
Diffstat (limited to 'samba_wizard')
-rwxr-xr-x | samba_wizard/Samba.pm | 7 | ||||
-rw-r--r-- | samba_wizard/samba.wiz | 778 | ||||
-rwxr-xr-x | samba_wizard/scripts/Smbconf.pm | 339 |
3 files changed, 4 insertions, 1120 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index ffd79c3f..b2c2f3e2 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -1,9 +1,10 @@ #!/usr/bin/perl # Drakwizard - -# Copyright (C) 2002 Arnaud Desmons <adesmons@mandrakesoft.com> -# Copyright (C) 2003 Florent Villard <warly@mandrakesoft.com> +# Copyright (C) 2002,2003 Mandrakesoft +# +# Authors: Arnaud Desmons <adesmons@mandrakesoft.com> +# Florent Villard <warly@mandrakesoft.com> # # 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 diff --git a/samba_wizard/samba.wiz b/samba_wizard/samba.wiz deleted file mode 100644 index b802677c..00000000 --- a/samba_wizard/samba.wiz +++ /dev/null @@ -1,778 +0,0 @@ -<?xml version="1.0"?> - -<Wizard - name="general" - libScript="__WIZ_HOME__/common/scripts/functions.sh" - wizardTitle="Samba wizard" - imagePosition="top" - defaultImage="__WIZ_HOME__/samba_wizard/images/samba.png" - perlModule="__WIZ_HOME__/samba_wizard/scripts/Smbconf.pm" - rpm="samba-server" - summaryFunc="do_it" -> - <Variable - name="box_list" - shellVariable="wiz_box_list" - > - </Variable> - <Variable - name="hosts_allow" - shellVariable="wiz_hosts_allow" - > - </Variable> - <Variable - name="hosts_deny" - shellVariable="wiz_hosts_deny" - > - </Variable> - <Variable - name="doFileSharing" - comment="true if we do file sharing, false otherwise" - shellVariable="wiz_do_file_sharing" - > - </Variable> - <Variable - name="level" - shellVariable="wiz_level" - > - </Variable> - <Variable - name="all_printers" - shellVariable="wiz_all_printers" - > - </Variable> - <Variable - name="wiz_printers" - shellVariable="wiz_printers" - > - </Variable> - <Variable - name="doPrinterSharing" - comment="true if samba do printer sharing" - shellVariable="wiz_do_printer_sharing" - > - </Variable> - <Variable - name="doHomes" - comment="true if samba do printer sharing" - shellVariable="wiz_do_homes" - > - </Variable> - <Variable - name="workgroup" - comment="The workgroup name" - shellVariable="wiz_workgroup" - > - </Variable> - - <Variable - name="shared_dir" - comment="The workgroup name" - shellVariable="wiz_dir" - > - </Variable> - - <Variable - name="banner" - comment="The samba server banner name" - shellVariable="wiz_banner" - > - </Variable> - - <Variable - name="write_list" - shellVariable="wiz_write_list" - > - </Variable> - - <Variable - name="read_list" - shellVariable="wiz_read_list" - > - </Variable> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="Welcome" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - <Info - helpText="Samba Configuration Wizard" - > - </Info> - - - <Info - helpText="Samba allows your server to behave as a file and print server for workstations running non-Linux systems." - > - </Info> - - <Info - helpText="This wizard will help you configuring the Samba services of your server." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_workgroup" - func="check_workgroup" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="error_in_workgroup" - jumpIndex="1" - > - </Target> - - <Target - targetName="ask_banner" - jumpIndex="10" - > - </Target> - - <Info - helpText="Workgroup" - > - </Info> - - <Info - helpText="Samba needs to know the Windows Workgroup it will serve." - > - </Info> - <Freetext - name="freetext2" - variableName="workgroup" - helpText="Workgroup:" - editable="true" - fillfunc="get_workgroup" - > - </Freetext> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="error_in_workgroup" - jumpPage="ask_workgroup" - nextButtonText="Fix it" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - <Info - helpText="The Workgroup is wrong" - > - </Info> - </Page> - - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_banner" - func="check_banner" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="error_in_banner" - jumpIndex="1" - > - </Target> - - <Target - targetName="ask_net" - jumpIndex="10" - > - </Target> - - <Info - helpText="Server Banner." - > - </Info> - - - <Info - helpText="The banner is the way this server will be described in the Windows workstations." - > - </Info> - - - <Freetext - name="serverBannerInput" - variableName="banner" - helpText="Banner:" - editable="true" - fillfunc="get_banner" - > - </Freetext> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="error_in_banner" - jumpPage="ask_banner" - nextButtonText="Fix It" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Info - helpText="The Server Banner is incorrect" - > - </Info> - </Page> - <Page - name="ask_net" - func="chk_level" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - <Target - targetName="ask_services" - jumpIndex="1" - > - </Target> - - <Target - targetName="ask_netmask" - jumpIndex="2" - > - </Target> - <Info - helpText="Access control" - > - </Info> - - <Chooser - name="chooser1" - variableName="level" - helpText="Access level :" - > - <Option - value="1" - description="All - No access restriction" - > - </Option> - - <Option - value="2" - description="My rules - Ask me allowed and denied hosts" - > - </Option> - </Chooser> - </Page> - <Page - name="ask_netmask" - jumpPage="ask_services" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - is="level=2" - > - <Info - helpText="Access control" - > - </Info> - - <Info - helpText="* Example 1: allow all IPs in 150.203.*.*; except one\nhosts allow = 150.203. EXCEPT 150.203.6.66" - > - </Info> - <Info - helpText="* Example 2: allow hosts that match the given network/netmask\nhosts allow = 150.203.15.0/255.255.255.0" - > - </Info> - <Info - helpText="* Example 3: allow a couple of hosts\nhosts allow = lapland, arvidsjaur" - > - </Info> - <Info - helpText="* Example 4: allow only hosts in NIS netgroup \qfoonet\q, but deny access from one particular host\nhosts allow = @foonet\nhosts deny = pirate" - > - </Info> - <Info - helpText="Note that access still requires suitable user-level passwords." - > - </Info> - - <Freetext - variableName="hosts_allow" - helpText="Allow hosts:" - editable="true" - fillfunc="get_allow_host" - refresh="true" - > - </Freetext> - <Freetext - variableName="hosts_deny" - helpText="Deny hosts:" - editable="true" - fillfunc="get_deny_host" - refresh="true" - > - </Freetext> - </Page> - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_services" - func="check_services" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="warn_smbpasswd" - jumpIndex="3" - > - </Target> - - <Target - targetName="ask_dir" - jumpIndex="2" - > - </Target> - - <Target - targetName="ask_printers" - jumpIndex="1" - > - </Target> - - <Target - targetName="doit" - jumpIndex="0" - > - </Target> - - <Info - helpText="Enabled Samba Services" - > - </Info> - - - <Info - helpText="Samba can provide a common file sharing area to your Windows workstation, and can also provide printer sharing for the printers connected to your server." - > - </Info> - - - <Boolean - name="fileSharingBoolean" - variableName="doFileSharing" - forceEnabled="true" - forceDisabled="false" - helpText="Enable file sharing area" - fillfunc="get_file_sharing" - > - </Boolean> - - <Boolean - name="printerSharingBoolean" - variableName="doPrinterSharing" - forceEnabled="true" - forceDisabled="false" - helpText="Enable Server Printer Sharing" - > - </Boolean> - <Boolean - name="homesSharingBoolean" - variableName="doHomes" - forceEnabled="true" - forceDisabled="false" - helpText="Make home directories available for their owners" - fillfunc="get_home_sharing" - > - </Boolean> - - </Page> - - <Page - name="warn_smbpasswd" - comment="Warning" - func="ask_dir" - nextButtonText="OK" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="ask_dir" - jumpIndex="2" - > - </Target> - - <Target - targetName="ask_printers" - jumpIndex="1" - > - </Target> - - <Target - targetName="doit" - jumpIndex="0" - > - </Target> - - <Info - helpText="You have selected to allow user access their home directories via samba but you/they must use smbpasswd to set a password." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_dir" - is="doFileSharing" - func="check_dir" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="error_in_dir" - jumpIndex="1" - > - </Target> - - <Target - targetName="ask_access" - jumpIndex="10" - > - </Target> - - <Info - helpText="Shared directory:" - > - </Info> - - - <Info - helpText="Type the path of the directory you want being shared." - > - </Info> - - <Freetext - name="freetext_dir" - variableName="shared_dir" - helpText="Shared directory:" - editable="true" - fillfunc="get_dir" - > - </Freetext> - </Page> - - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_access" - is="doFileSharing" - func="check_users" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - <Target - targetName="error_in_acces" - jumpIndex="2" - > - </Target> - - - <Target - targetName="ask_printers" - jumpIndex="1" - > - </Target> - - - <Target - targetName="doit" - jumpIndex="0" - > - </Target> - - <Info - helpText="File permissions" - > - </Info> - - - <Info - helpText="Type users or group separated by a comma (groups must be preceded by a \'@\') like this :\nroot, fred, @users, @wheel for each kind of permission." - > - </Info> - - <Freetext - variableName="read_list" - helpText="read list:" - editable="true" - fillfunc="get_read" - help="root, fred, @users, @wheel" - > - </Freetext> - <Freetext - variableName="write_list" - helpText="write list:" - editable="true" - fillfunc="get_write" - help="root, fred, @users, @wheel" - > - </Freetext> - </Page> - - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="ask_printers" - jumpPage="doit" - is="doPrinterSharing" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - <Info - helpText="Select which printers you want to be accessible from known users" - > - </Info> - <Boolean - variableName="all_printers" - helpText="Enable all printers" - > - </Boolean> - <Boolean - is="all_printers=0" - variableName="box_list" - listfunc="list_printers" - > - </Boolean> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="error_in_dir" - jumpPage="ask_dir" - nextButtonText="Fix it" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Info - helpText="The path you entered does not exist." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="doit" - func="do_it" - nextButtonText="Configure" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="catastrophic_exit" - jumpIndex="2" - > - </Target> - - <Target - targetName="done" - jumpIndex="10" - > - </Target> - - <Info - helpText="Configuring Samba" - > - </Info> - - - <Info - helpText="The wizard collected the following parameters -needed to configure Samba." - > - </Info> - - <Freetext - name="freetext3" - variableName="workgroup" - helpText="Workgroup:" - editable="false" - > - </Freetext> - - <Freetext - name="freetext4" - variableName="banner" - helpText="Server Banner:" - editable="false" - > - </Freetext> - - <Freetext - name="freetext" - variableName="doFileSharing" - helpText="File Sharing:" - editable="false" - > - </Freetext> - - <Freetext - name="freetext" - variableName="shared_dir" - helpText="Shared directory:" - editable="false" - > - </Freetext> - - - <Freetext - name="freetext1" - variableName="doPrinterSharing" - helpText="Print Server:" - editable="false" - > - </Freetext> - - <Freetext - name="freetext2" - variableName="doHomes" - helpText="Home:" - editable="false" - > - </Freetext> - - - <Freetext - name="freetext5" - helpText="Printers:" - editable="false" - fillfunc="get_printers" - > - </Freetext> - - <Info - helpText="To accept these values, and configure your server, click the Next button or use the Back button to correct them." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="done" - nextButtonText="Quit" - executionLevel="NORMAL" - nextFinish="true" - canBack="false" - canCancel="false" - > - - <Info - helpText="Congratulations" - > - </Info> - - - <Info - helpText="The wizard successfully configured your Samba server." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="catastrophic_exit" - comment="Exit in case of catastrophic system error" - nextButtonText="Exit" - executionLevel="NORMAL" - nextFinish="true" - canBack="false" - canCancel="false" - > - - <Info - helpText="Something terrible happened" - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="error_need_root" - comment="Error: this wizard must run as root." - nextButtonText="OK" - executionLevel="NORMAL" - nextFinish="true" - canBack="false" - canCancel="false" - > - - <Info - helpText="This Wizard needs to run as root" - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" - name="error_need_net" - subWizard="__WIZ_HOME__/server_wizard/server.wiz" - executionLevel="NORMAL" - nextFinish="false" - canBack="false" - canCancel="true" - > - - <Info - helpText="Network not configured yet" - > - </Info> - - - <Info - helpText="You have to configure the basic network parameters before launching this wizard." - > - </Info> - - <Info - helpText="Press next to configure these parameters now, or Cancel to exit this wizard." - > - </Info> - - - <Info - helpText="If you choose to configure now, you will automatically continue with the SAMBA configuration" - > - </Info> - </Page> -</Wizard> diff --git a/samba_wizard/scripts/Smbconf.pm b/samba_wizard/scripts/Smbconf.pm deleted file mode 100755 index 253b9c0c..00000000 --- a/samba_wizard/scripts/Smbconf.pm +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard - -# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com) -# -# 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 2, 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package Smbconf; -use lib '/usr/lib/libDrakX'; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; -require "__WIZ_HOME__/common/scripts/IFCFG.pm"; -use MDK::Common; -use strict; -use services; -use Data::Dumper; - -# All possibilies in the config file must be precedeed by ";" -# This script can just comment, uncomment or/and change values -# but can not add anything. -# so one variable cannot be commented and not in the same file. - -my $o = IFCFG->new(); - -sub check { - $> and return 1; - $o->is_dhcp() and return 2; - 0; -} - -sub check_services { - $ENV{wiz_do_homes} and return 3; - $ENV{wiz_do_file_sharing} and return 2; - $ENV{wiz_do_printer_sharing} and return 1; - 0; -} - -sub check_dir { - -d ($ENV{wiz_dir}) and return 10; - 1; -} - -# the "__" before comment is to avoid conflicts with possible "comment" variable -# for variables value is in value key and comment idem (no risque of conflict) - -sub read_conf { - my $self = {}; - my ($file) = @_; - my $menu; - my @tab; - my %conf; - - open(FH, $file) or die "$! ($file)"; - while (<FH>) { - if (/^(\s*\;?\s*)\[(.*)\].*/) { - $menu = $2; - $conf{$menu}{__comment} = $1; - } - elsif (/^(?!\#)(\s*\;*\s*)(.*?)\s*=\s*(.*)\s*$/) { - $conf{$menu}{$2}{value} = $3; - $conf{$menu}{$2}{comment} = $1; - } - push @tab, $_; - } - $self->{conf} = \%conf; - $self->{tab} = \@tab; - bless $self; -} - -# we parse @tab to check for values in the struct. - -sub write_conf { - my $self = shift; - my ($file) = @_; - my $menu; - - open(FH, "> $file") or die "$!"; - foreach (@{$self->{tab}}) { - if (/^\s*\;?\s*\[(.*)\].*/) { - $menu = $1; - print FH "$self->{conf}->{$menu}{__comment}"."[$menu]\n"; - } - elsif (/^(?!\#)\s*\;*\s*(.*?)\s*=/) { - print FH "$self->{conf}->{$menu}{$1}{comment}"."$1" ." = ". "$self->{conf}->{$menu}{$1}{value}\n"; - } - else { - print FH $_; - } - } -} - -#section has the name of the printer -sub add_printer { - my $self = shift; - my ($printer) = @_; - - if (exists $self->{conf}->{$printer}) { - $self->comment_menu($printer, " "); - } - else { - $self->{conf}->{$printer}{printable}{comment} = " "; - $self->{conf}->{$printer}{printer}{comment} = " "; - push @{$self->{tab}}, "[$printer]\n"; - push @{$self->{tab}}, "printer = $printer\n"; - push @{$self->{tab}}, "printable = yes\n"; - $self->{conf}->{$printer}{printer}{value} = $printer; - $self->{conf}->{$printer}{printable}{value} = "yes"; - } -} - -sub list_printers { - my @list if 0; - - return @list if @list; - @list = sort grep /^(?!\#).*/, map { - my ($printer) = split(':', $_); - } cat_("/etc/printcap"); -} - - -sub check_users { - return 1 if $ENV{wiz_do_printer_sharing}; - 0; -} - -sub comment_menu { - my $self = shift; - my ($menu, $str) = @_; - - return if (!$menu or !exists $self->{conf}->{$menu}); - $self->{conf}->{$menu}{__comment} = $str; - foreach (keys %{$self->{conf}->{$menu}}) { - ($_ eq "__comment") and next; - $self->{conf}->{$menu}{$_}{comment} = $str; - } -} - -sub comment_var { - my $self = shift; - my ($menu, $var, $str) = @_; - - $self->{conf}->{$menu}{$var}{comment} = $str; -} - -sub chg_var { - my $self = shift; - my ($menu, $var, $str) = @_; - - $self->{conf}->{$menu}{$var}{value} = $str; -} - -# all or selected printers -sub printer_sharing { - my $self = shift; - - if ($ENV{wiz_all_printers}) { - $self->comment_menu("printers", " "); - foreach my $printer (keys (%::bool)) { - $self->comment_menu($printer, ";"); - } - } - else { - $self->comment_menu("printers", ";"); - foreach my $printer (keys (%::bool)) { - if (int($::bool{$printer})) { - $self->comment_menu($printer, " "); - $self->add_printer($printer); - } - else { - $self->comment_menu($printer, ";"); - } - } - } -} - -sub get_printers { - if ($ENV{wiz_do_printer_sharing}) { - my $string; - $ENV{wiz_all_printers} and return "all printers"; - foreach (keys (%::bool)) { - $string .= "$_, " if int($::bool{$_}); - } - "$string"; - } - else { - "disabled"; - } -} - -sub check_workgroup { - !$ENV{wiz_workgroup} and return 1; - 10; -} - -sub ask_acces { - 10; -} - -my $old = read_conf("/etc/samba/smb.conf"); - -sub get_write { - $old->{conf}->{public}{"write list"}{value}; -} - -sub get_read { - $old->{conf}->{public}{"read list"}{value}; -} - -sub check_banner { - !$ENV{wiz_banner} and return 1; - 10; -} - -sub get_workgroup { - $old->{conf}->{global}{workgroup}{value}; -} - -sub get_banner { - $old->{conf}->{global}{"server string"}{value}; -} - -sub ask_dir { - return 2 if $ENV{wiz_do_file_sharing}; - return 1 if $ENV{wiz_do_printer_sharing}; - 0; -} - -sub get_dir { - $old->{conf}->{public}{path}{value}; -} - -sub get_file_sharing { - return 0 if ($old->{conf}->{public}{__comment} =~ /\;|\#/); - 1; -} - -sub get_home_sharing { - return 0 if ($old->{conf}->{homes}{__comment} =~ /\;|\#/); - 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"; - - my $conf = read_conf($file); - $conf->chg_var("global", "workgroup", $ENV{wiz_workgroup}); - $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->itf_get("IPADDR"); - if ($ENV{wiz_do_file_sharing}) { - standalone->explanations("Enabling $ENV{wiz_dir} samba file sharing"); - $conf->comment_menu("public", " "); - $conf->chg_var("public", "path", $ENV{wiz_dir}); - } - else { - standalone->explanations("Disabling samba file sharing"); - $conf->comment_menu("public", ";"); - } - if ($ENV{wiz_do_homes}) { - standalone->explanations("Enabling samba homes sharing"); - $conf->comment_menu("homes", " "); - } - else { - standalone->explanations("Disabling samba homes sharing"); - $conf->comment_menu("homes", ";"); - } - 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->chg_var("global", "hosts allow", $ENV{wiz_hosts_allow}); - - if ($ENV{wiz_do_printer_sharing}) { - standalone->explanations("Enabling printer sharing"); - $conf->printer_sharing(); - } - else { - standalone->explanations("Disabling printer sharing"); - foreach my $printer (keys (%::bool)) { - if (!int($::bool{$printer})) { - $conf->comment_menu("$printer", ";"); - } - } - $conf->comment_menu("printers", ";"); - } - $conf->write_conf("/etc/samba/smb.conf"); - if (services::is_service_running('smb')) { - services::restart('smb') - } else { - services::start('smb') - } - 10; -} -1; |