diff options
author | Nicolas Vigier <nvigier@mandriva.com> | 2008-03-05 16:34:38 +0000 |
---|---|---|
committer | Nicolas Vigier <nvigier@mandriva.com> | 2008-03-05 16:34:38 +0000 |
commit | 1ea920072c09c49c019188e7d30b7fca1e6e8391 (patch) | |
tree | 433600c92ac24c915f53e9bd981e19cbcc965c5f /samba_wizard | |
parent | de522045836b90f9067ebbd04ee2895e3c5e7e11 (diff) | |
download | drakwizard-1ea920072c09c49c019188e7d30b7fca1e6e8391.tar drakwizard-1ea920072c09c49c019188e7d30b7fca1e6e8391.tar.gz drakwizard-1ea920072c09c49c019188e7d30b7fca1e6e8391.tar.bz2 drakwizard-1ea920072c09c49c019188e7d30b7fca1e6e8391.tar.xz drakwizard-1ea920072c09c49c019188e7d30b7fca1e6e8391.zip |
remove and don't install disabled wizards so that mcc doesn't offer to run them
Diffstat (limited to 'samba_wizard')
-rw-r--r-- | samba_wizard/.perl_checker | 1 | ||||
-rw-r--r-- | samba_wizard/Makefile | 12 | ||||
-rwxr-xr-x | samba_wizard/Samba.pm | 490 | ||||
-rwxr-xr-x | samba_wizard/Sambaprint.pm | 304 | ||||
-rwxr-xr-x | samba_wizard/Sambashare.pm | 976 | ||||
-rw-r--r-- | samba_wizard/images/IC-sambaprt-48.png | bin | 1915 -> 0 bytes | |||
-rw-r--r-- | samba_wizard/images/IC-sambashare-48.png | bin | 2988 -> 0 bytes | |||
-rw-r--r-- | samba_wizard/images/sambasrv.png | bin | 3511 -> 0 bytes | |||
-rw-r--r-- | samba_wizard/scripts/smb.conf.default | 524 |
9 files changed, 0 insertions, 2307 deletions
diff --git a/samba_wizard/.perl_checker b/samba_wizard/.perl_checker deleted file mode 100644 index 0f955156..00000000 --- a/samba_wizard/.perl_checker +++ /dev/null @@ -1 +0,0 @@ -Net::Ping
\ No newline at end of file diff --git a/samba_wizard/Makefile b/samba_wizard/Makefile deleted file mode 100644 index 661dadfa..00000000 --- a/samba_wizard/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -install2: - su -c 'make install' - -install: - mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards - mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards/samba_wizard - mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards/samba_wizard/scripts - mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards/samba_wizard/images - install --mode=u=rw,g=r,o=r -p samba.wiz ${prefix}/share/wizards/samba_wizard - cp -avf ./images/*.png ${prefix}/share/wizards/samba_wizard/images/ - install --mode=u=rw,g=r,o=r -p scripts/Smbconf.pm ${prefix}/share/wizards/samba_wizard/scripts - install --mode=u=rw,g=r,o=r -p scripts/smb.conf.default ${prefix}/share/wizards/samba_wizard/scripts diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm deleted file mode 100755 index d845812d..00000000 --- a/samba_wizard/Samba.pm +++ /dev/null @@ -1,490 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard -# Copyright (C) 2002,2005 Mandriva -# -# Authors: Arnaud Desmons <adesmons@mandrakesoft.com> -# Florent Villard <warly@mandrakesoft.com> -# antoine Ginies <aginies@mandriva> -# -# 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 MDK::Wizard::Samba; -use strict; - -use common; -use services; -use MDK::Wizard::Wizcommon; -use Gtk2; - -use Libconf::Templates; -use Libconf::Glueconf::Samba::Smb_conf; - -my $wiz = new MDK::Wizard::Wizcommon; -my $in = interactive->vnew; - -my $DOMAINNAME = chomp_(`dnsdomainname`); -my $SHORTHOSTNAME = chomp_(`hostname -s`); -my $wiz_samba_etc = "/etc/sysconfig/wizard_samba"; -my @listshare; -my @listprinters; - -my $o = { - name => 'Samba wizard', - var => { - wiz_box_list => '', - wiz_netbios => '', - wiz_all_printers => '', - wiz_level => '', - wiz_workgroup => '', - wiz_banner => '', - wiz_log_file => '', wiz_log_level => '', wiz_max_log_size => '', - wiz_local_master => '', - wiz_os_level => '', - wiz_security => '', - wiz_domain_logons => '', - wiz_domain_master => '', - wiz_password_server => '', - wiz_passdb_backend => '', wiz_passdb_backend_yn => '', - wiz_ldap_admin_dn => '', wiz_ldap_suffix => '', wiz_ldap_root_pw => '', wiz_ldap_root_pw_2 => '', - wiz_preferred_master => '', - wiz_wins_server => '', - wiz_name_resolve_order => '', - wiz_dns_proxy => '', - wiz_sambatype => '', - }, - init => sub { - my ($err, $msg) = test_host_domain($SHORTHOSTNAME, $DOMAINNAME); - if (!$err) { - $in->ask_warn(N('Error'), $msg); - die 'wizcancel'; - } - }, - needed_rpm => [ 'samba-server' ], - defaultimage => "/usr/share/wizards/samba_wizard/images/sambasrv.png", - }; - -# we ask glueconf to give us the structure representing /etc/samba/smb.conf -if (!-f "/etc/samba/smb.conf") { mkdir_p("/etc/samba/"); cp_af("/usr/share/wizards/samba_wizard/scripts/smb.conf.default", "/etc/samba/smb.conf") } -my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf' }); -#my $samba = new Libconf::Glueconf::Samba::Smb_conf(filename => '/etc/samba/smb.conf', comments_struct => [['^\s*#'], ['^\s*;']]); -$samba->{libconf}{disable_inline_comments} = 1; - -#debug -use Data::Dumper; -print Dumper($samba); - -my %type = ( - 1 => N("BDC - backup domain controller (need PDC+LDAP)"), - 2 => N("PDC - primary domain controller"), - 3 => N("Standalone - standalone server"), - # 4 => N("Member - member of a domain"), - ); - -my @yesorno = qw(yes no); push @yesorno, ""; -my @loglevel = qw(0 1 2 3 4 5 6 7 8 9); - -$o->{pages} = { - welcome => { - name => N("Samba server configuration Wizard") . "\n\n" . N("Samba allows your server to behave as a file and print server for workstations running non-Linux systems."), - no_back => 1, - pre => sub { - if (-f $wiz_samba_etc) { -# $::isWizard = 1; -# $in->ask_warn(N("Information"), N("It seems you previously setup a Samba server. This wizard will re-read your old configuration, and show you the Samba server type you choose")) and return 0; - my $data = cat_($wiz_samba_etc); - # detect old Samba type - my ($old_type) = $data =~ /type=(\d)/; - $o->{var}{wiz_type} = chomp_($old_type); - } else { $o->{var}{wiz_type} = 3 } - }, - post => sub { - if ($o->{var}{wiz_type} == 2) { - return 'pdc' } - elsif ($o->{var}{wiz_type} == 1) { - return 'bdc' } - elsif ($o->{var}{wiz_type} == 3) { - return 'ask_workgroup' } - elsif ($o->{var}{wiz_type} == 4) { - return 'member' } - }, - data => [ - { label => "", val => \$o->{var}{wiz_type}, type => 'list', list => [ sort keys %type ], format => sub { $type{$_[0]} } }, - ], - }, - pdc => { - name => N("PDC server: primary domain controller") . "\n\n" . N("Server configured as a PDC is responsible for Windows authentication throughout the domain.") . "\n" . N("Single server installations may use smbpasswd or tdbsam password backends") . "\n" . N("Domain master = yes, causes the server to register the NetBIOS name <pdc name>1B. This name will be recognized by other servers."), - pre => sub { - $o->{var}{wiz_domain_master} = "yes"; - $o->{var}{wiz_security} = "user"; - $o->{var}{wiz_domain_logons} = "yes"; - $o->{var}{wiz_wins_support} ||= $samba->{global}{'wins support'}; - $o->{var}{wiz_oslevel} = "128"; - - if (exists $samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend_yn} = "yes"; - } - else { - $o->{var}{wiz_passdb_backend_yn} = "no"; - } - }, - next => 'ask_workgroup', -# post => sub { -# $o->{var}{wiz_passdb_backend_yn} =~ /yes/ and return 'ldap_conf'; -# }, - data => [ - { label => N("Domain logons:"), val_ref => \$o->{var}{wiz_domain_logons} }, - { label => N("Domain master:"), val_ref => \$o->{var}{wiz_domain_master} }, - { label => N("Security:"), val_ref => \$o->{var}{wiz_security} }, - { label => N("Wins support:"), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno }, - { label => N("admin users:"), val => \$o->{var}{wiz_admin_users}, help => N("root \@adm") }, - { label => N("Os level:"), val_ref => \$o->{var}{wiz_oslevel}, help => N("The global os level option dictates the operating system level at which Samba will masquerade during a browser election. If you wish to have Samba win an election and become the master browser, you can set the level above that of the operating system on your network with the highest current value. ie: os level = 34") }, -# { label => N("Use LDAP Passdb backend"), val => \$o->{var}{wiz_passdb_backend_yn}, fixed_list => \@yesorno }, - ], - complete => sub { - if (!$o->{var}{wiz_domain_master}) { - $in->ask_warn(N("Error"), N("The domain is wrong.")); - return 1; - } else { return 0 } - }, - next => 'ask_workgroup', - }, - bdc => { - name => N("BDC server: backup domain controller") . "\n\n" . N("This enables BDCs to carry much of the network logon processing. A BDC on a local segment handles logon requests and authenticates users when the PDC is busy on the local network. When a segment becomes heavily loaded, the reponsibility is offloaded to another segment's BDC or to the PDC."), - pre => sub { - $o->{var}{wiz_domain_master} = "no"; - $o->{var}{wiz_security} = "user"; - $o->{var}{wiz_wins_support} = ""; - $o->{var}{wiz_oslevel} = "70"; - $o->{var}{wiz_local_master} = "yes"; - $o->{var}{wiz_domain_master} = "no"; - $o->{var}{wiz_preferred_master} = "yes"; - $o->{var}{wiz_domain_logons} = "yes"; - $o->{var}{wiz_wins_server} = ""; - if ($samba->{global}{'name resolve order'}) { - $o->{var}{wiz_name_resolve_order} = $samba->{global}{'name resolve order'}; - } else { $o->{var}{wiz_name_resolve_order} = "lmhosts host wins bcast" } - $o->{var}{wiz_dns_proxy} = "no"; - }, - data => [ - { label => N("Wins support:"), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno }, - { label => N("Wins server:"), val => \$o->{var}{wiz_wins_server}, help => N("This specifies the IP address (or DNS name: IP address for preference) of the WINS server that nmbd(8) should register with. If you have a WINS server on your network then you should set this to the WINS server's IP.") }, - { label => N("Wins name resolve order:"), val => \$o->{var}{wiz_name_resolve_order} }, - ], - complete => sub { - if ($o->{var}{wiz_wins_support} =~ /no/ and !$o->{var}{wiz_wins_server}) { - $in->ask_warn(N("Error"), N("Your server doesn't support Wins. Please provide a Wins server, or leave blank Wins Support entry.")); - return 1; - } else { return 0 } - }, - next => 'ask_bdc2', - }, - ask_bdc2 => { - name => N("BDC server: needed fixed options"), - data => [ - { label => N("Domain master:"), val_ref => \$o->{var}{wiz_domain_master} }, - { label => N("Security:"), val_ref => \$o->{var}{wiz_security} }, - { label => N("Os level:"), val_ref => \$o->{var}{wiz_oslevel} }, - { label => N("Local master:"), val_ref => \$o->{var}{wiz_local_master} }, - { label => N("Domain master"), val_ref => \$o->{var}{wiz_domain_master} }, - { label => N("Preferred master"), val_ref => \$o->{var}{wiz_preferred_master} }, - { label => N("Domain logons"), val_ref => \$o->{var}{wiz_domain_logons} }, - { label => N("admin users:"), val => \$o->{var}{wiz_admin_users}, help => N("root \@adm") }, - ], - next => 'ldap_conf', - }, - member => { - name => N("Member of a domain") . "\n\n" . N("Share data, users home or printers.") . "\n" . N("Please enter the domain you want to join."), - pre => sub { - $o->{var}{wiz_security} = "domain"; - $o->{var}{wiz_domain_master} = "no"; - $o->{var}{wiz_password_server} ||= $samba->{global}{'password server'}; - if ($samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend_yn} = "yes"; - } else { - $o->{var}{wiz_passdb_backend_yn} = "no"; - } - }, - post => sub { - $o->{var}{wiz_passdb_backend_yn} =~ /yes/ and return 'ldap_conf'; - }, - data => [ - { label => N("Password server"), hidden => 1, val => \$o->{var}{wiz_password_server} }, - { label => N("Use LDAP Passdb backend"), val => \$o->{var}{wiz_passdb_backend_yn}, fixed_list => \@yesorno }, - { label => N("Security:"), val_ref => \$o->{var}{wiz_security} }, - { label => N("Domain master:"), val_ref => \$o->{var}{wiz_domain_master} }, - - ], - complete => sub { - if (!$o->{var}{wiz_password_server}) { - $in->ask_warn(N("Error"), N("Please provide the password server.")); - return 1; - } else { return 0 } - }, - next => 'ask_workgroup', - }, - ldap_conf => { - name => N("LDAP configuration for Domain Controlling") . "\n\n" . N("The account (dn) that samba uses to access the LDAP server. This account needs to have write access to the LDAP tree. You will need to give samba the password for this dn."), - pre => sub { - $o->{var}{wiz_ldap_passwd_sync} = "yes"; - if ($samba->{global}{'ldap suffix'}) { - $o->{var}{wiz_ldap_suffix} = $samba->{global}{'ldap suffix'}; - } else { $o->{var}{wiz_ldap_suffix} = "dc=mydomain, dc=com" } - if ($samba->{global}{'ldap admin dn'}) { - $o->{var}{wiz_ldap_admin_dn} ||= $samba->{global}{'ldap admin dn'}; - } else { $o->{var}{wiz_ldap_admin_dn} = "cn=Manager,dc=mydomain,dc=com" } - if ($samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'}; - } else { $o->{var}{wiz_passdb_backend} = "ldapsam:ldap://localhost" } - if ($samba->{global}{'ldap machine suffix'}) { - $o->{var}{wiz_ldap_machine_suffix} = $samba->{global}{'ldap machine suffix'}; - } else { $o->{var}{wiz_ldap_machine_suffix} = "ou=Computers" } - if ($samba->{global}{'ldap group suffix'}) { - $o->{var}{wiz_ldap_group_suffix} = $samba->{global}{'ldap group suffix'}; - } else { $o->{var}{wiz_ldap_group_suffix} = "ou=Groups" } - if ($samba->{global}{'ldap user suffix'}) { - $o->{var}{wiz_ldap_user_suffix} = $samba->{global}{'ldap user suffix'}; - } else { $o->{var}{wiz_ldap_user_suffix} = "ou=Users" } - }, - data => [ - { label => N("Passdb backend"), val => \$o->{var}{wiz_passdb_backend}, help => "ldapsam:ldap://<ldap server name>" }, - { label => N("LDAP administrator"), val => \$o->{var}{wiz_ldap_admin_dn}, help => N(" The ldap admin dn defines the Distinguished Name (DN) name used by Samba to contact the ldap server when retreiving user account information. ie: cn=Manager,dc=mydomain,dc=com") }, - { label => N("LDAP suffix"), val => \$o->{var}{wiz_ldap_suffix}, help => N("Specifies where user and machine accounts are added to the tree. Can be overriden by ldap user suffix and ldap machine suffix. It also used as the base dn for all ldap searches. ie: dc=\$DOMAINNAME,dc=com") }, - { label => N("LDAP password"), hidden => 1, val => \$o->{var}{wiz_ldap_root_pw} }, - { label => N("LDAP password check:"), hidden => 1, val => \$o->{var}{wiz_ldap_root_pw_2} }, - { label => N("LDAP machine suffix:"), val => \$o->{var}{wiz_ldap_machine_suffix}, help => N("It specifies where machines should be added to the ldap tree. ie: ou=Computers") }, - { label => N("LDAP user suffix:"), val => \$o->{var}{wiz_ldap_user_suffix}, help => N("This parameter specifies where users are added to the tree. If this parameter is not specified, the value from ldap suffix will be used.") }, - { label => N("LDAP group suffix:"), val => \$o->{var}{wiz_ldap_group_suffix}, help => N("This parameters specifies the suffix that is used for groups when these are added to the LDAP directory. ie: ou=Groups") }, - ], - complete => sub { - if (!($o->{var}{wiz_ldap_suffix})) { - $in->ask_warn(N("Error"), N("Please provide an LDAP suffix.")); - return 1; - } - if (! ($o->{var}{wiz_ldap_admin_dn})) { - $in->ask_warn(N("Error"), N("Please enter an LDAP administrator.")); - return 1; - } - if (! ($o->{var}{wiz_ldap_root_pw})) { - $in->ask_warn(N("Error"), N("Please enter an LDAP password.")); - return 1; - } - if ($o->{var}{wiz_ldap_root_pw} ne $o->{var}{wiz_ldap_root_pw_2}) { - $in->ask_warn(N("Error"), N("Passwords do not match.")); - return 1; - } - }, - next => 'ask_workgroup', - }, - ask_workgroup => { - name => N("Workgroup") . "\n\n" . N("Samba needs to know the Windows Workgroup it will serve."), - pre => sub { - $o->{var}{wiz_workgroup} ||= $samba->{global}{workgroup}; - $o->{var}{wiz_netbios} ||= $samba->{global}{netbios}; - $o->{var}{wiz_netbios_name} ||= $samba->{global}{"netbios name"}; - }, - data => [ - { label => N("Workgroup:"), val => \$o->{var}{wiz_workgroup} }, - { label => N("Netbios name:"), val => \$o->{var}{wiz_netbios_name} }, - ], - complete => sub { - if (!$o->{var}{wiz_workgroup}) { - $in->ask_warn(N("Error"), N("The Workgroup is wrong.")); - return 1; - } else { return 0 } - }, - next => 'ask_banner', - }, - ask_banner => { - name => N("Server Banner.") . "\n\n" . N("The banner is the way this server will be described in the Windows workstations."), - pre => sub { - $o->{var}{wiz_banner} ||= $samba->{global}{'server string'}; - }, - data => [ - { label => N("Banner:"), val => \$o->{var}{wiz_banner}, help => "Samba Server %v" }, - ], - complete => sub { - if (!$o->{var}{wiz_banner}) { - $in->ask_warn(N("Error"), N("The Server Banner is incorrect.")); - return 1; - } else { return 0 } - }, - next => 'ask_log', - }, - ask_log => { - name => N("Samba Log") . "\n" . N("Log file: use file.%m to use a separate log file for each machine that connects") . "\n" . N("Log level: set the log (verbosity) level (0 <= log level <= 10)") . "\n" . N("Max Log size: put a capping on the size of the log files (in Kb)."), - pre => sub { - $o->{var}{wiz_log_file} ||= $samba->{global}{'log file'}; - $o->{var}{wiz_log_level} ||= $samba->{global}{'log level'}; - $o->{var}{wiz_max_log_size} ||= $samba->{global}{'max log size'}; - }, - data => [ - { label => N("Log file:"), val => \$o->{var}{wiz_log_file}, help => "/var/log/samba/log.%m" }, - { label => N("Max log size:"), val => \$o->{var}{wiz_max_log_size}, help => "50" }, - { label => N("Log level:"), val => \$o->{var}{wiz_log_level}, fixed_list => \@loglevel }, - ], - next => 'summary', - }, - summary => { - name => N("The wizard collected the following parameters to configure Samba.") . "\n\n" . N("To accept these values, and configure your server, click the Next button or use the Back button to correct them.") . "\n" . N("If you have previously create some shares, they will appear in this configuration. Run 'drakwizard sambashare' to manage your shares."), - pre => sub { - $o->{var}{wiz_sambatype} = $type{$o->{var}{wiz_type}}; - }, - data => [ - { label => N("Samba type:"), val_ref => \$o->{var}{wiz_sambatype} }, - { label => N("Workgroup:"), val_ref => \$o->{var}{wiz_workgroup} }, - { label => N("Server banner:"), val_ref => \$o->{var}{wiz_banner} }, - { label => N("Log file:"), val_ref => \$o->{var}{wiz_log_file} }, - ], - post => \&do_it, - next => 'end' - }, - end => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Samba server."), - post => sub { - store_samba_type($o->{var}{wiz_type}); - }, - no_back => 1, - end => 1, - next => 0 - }, - error_end => { - name => N("Failed"), - data => [ { label => N("Please relaunch drakwizard, and try to change some parameters.") } ], - no_back => 1, - end => 1, - next => 0, - }, - }; - -sub new { - my ($class, $conf) = @_; - bless $o, $class; -} - -sub check() { - $> and return 1; - $wiz->{net}->is_dhcp and return 2; - 0; -} - -sub global_special_options() { - # set charset - $samba->{global}{'dos charset'} ||= "850"; - $samba->{global}{'unix charset'} ||= "ISO8859-1"; - - # detect Samba type 3 is standalone - if ($o->{var}{wiz_type} == "3") { - $samba->{global}{security} = "share"; - exists $samba->{global}{domain_master} and delete $samba->{global}{domain_master}; - exists $samba->{global}{'domain logons'} and delete $samba->{global}{'domain logons'}; - exists $samba->{global}{'wins support'} and delete $samba->{global}{'wins support'}; - exists $samba->{global}{'os level'} and delete $samba->{global}{'os level'}; - } else { - # so pdc, bdc or member - $o->{var}{wiz_local_master} and $samba->{global}{'local master'} = $o->{var}{wiz_local_master}; - $o->{var}{wiz_preferred_master} and $samba->{global}{'preferred master'} = $o->{var}{wiz_preferred_master}; - $o->{var}{wiz_wins_server} and $samba->{global}{'wins server'} = $o->{var}{wiz_wins_server}; - $o->{var}{wiz_name_resolve_order} and $samba->{global}{'name resolve order'} = $o->{var}{wiz_name_resolve_order}; - $o->{var}{wiz_dns_proxy} and $samba->{global}{'dns proxy'} = $o->{var}{wiz_dns_proxy}; - $o->{var}{wiz_domain_master} and $samba->{global}{'domain master'} = $o->{var}{wiz_domain_master}; - $o->{var}{wiz_security} and $samba->{global}{security} = $o->{var}{wiz_security}; - $o->{var}{wiz_domain_logons} and $samba->{global}{'domain logons'} = $o->{var}{wiz_domain_logons}; - $o->{var}{wiz_oslevel} and $samba->{global}{'os level'} = $o->{var}{wiz_oslevel}; - $o->{var}{wiz_passdb_backend} and $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; - $o->{var}{wiz_wins_support} and $samba->{global}{'wins support'} = $o->{var}{wiz_wins_support}; - $o->{var}{wiz_password_server} and $samba->{global}{'password server'} = $o->{var}{wiz_password_server}; - $o->{var}{wiz_admin_users} and $samba->{global}{'admin users'} = $o->{var}{wiz_admin_users}; - $samba->{global}{'add machine script'} = "/usr/sbin/useradd -d /dev/null -g machines -c 'Machine Account' -s /bin/false -M '%u'"; - # ldap options if needed - if ($o->{var}{wiz_passdb_backend_yn} =~ /yes/) { - $samba->{global}{'ldap passwd sync'} = "yes"; - $samba->{global}{'add machine script'} and delete $samba->{global}{'add machine script'}; - $o->{var}{wiz_ldap_suffix} and $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix}; - $o->{var}{wiz_ldap_admin_dn} and $samba->{global}{'ldap admin dn'} = $o->{var}{wiz_ldap_admin_dn}; - $o->{var}{wiz_passdb_backend} and $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; - $o->{var}{wiz_ldap_machine_suffix} and $samba->{global}{'ldap machine suffix'} = $o->{var}{wiz_ldap_machine_suffix}; - $o->{var}{wiz_ldap_group_suffix} and $samba->{global}{'ldap group suffix'} = $o->{var}{wiz_ldap_group_suffix}; - $o->{var}{wiz_ldap_user_suffix} and $samba->{global}{'ldap user suffix'} = $o->{var}{wiz_ldap_user_suffix}; - } else { - # delete ldap options if exist - exists $samba->{global}{'passdb backend'} and delete $samba->{global}{'passdb backend'}; - exists $samba->{global}{'ldap admin dn'} and delete $samba->{global}{'ldap admin_dn'}; - exists $samba->{global}{'ldap suffix'} and delete $samba->{global}{'ldap suffix'}; - exists $samba->{global}{'ldap passwd sync'} and delete$samba->{global}{'ldap passwd sync'}; - exists $samba->{global}{'ldap machine suffix'} and delete $samba->{global}{'ldap machine suffix'}; - exists $samba->{global}{'ldap group suffix'} and delete $samba->{global}{'ldap group suffix'}; - exists $samba->{global}{'ldap user suffix'} and delete $samba->{global}{'ldap user suffix'}; - } - } -} - -sub store_samba_type { - # write config file to store Samba type - my ($type) = @_; - output($wiz_samba_etc, <<EOF); -# 1 = BDC - backup domain controller -# 2 = PDC - primary domain controller -# 3 = Standalone - standalone server -# 4 = Member - member of a domain -EOF - - append_to_file($wiz_samba_etc, "type=$type\n"); -} - -sub map_unxigroup_ntgroup { - my $conf = "/etc/group"; - my @groups; - foreach (cat_($conf)) { - push @groups, $1 if m/^([^#:]+):[^:]+:([^:]+):/ and $2 > 499; - } - foreach (@groups) { - system("net groupmap add unixgroup=$_ ntgroup=$_"); - } -} - -sub write_conf_restart_smb { - $samba->write_conf("/etc/samba/smb.conf"); - if (services::is_service_running('smb')) { - services::restart('smb'); - } else { services::start('smb') } -} - -# remember one variable cannot be commented and not in the same file. -sub do_it { - $::testing and return; - # display a wait dialog box - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server...")); - # global section - $samba->{global}{workgroup} = $o->{var}{wiz_workgroup}; - exists $o->{var}{wiz_netbios_name} and $samba->{global}{"netbios name"} = $o->{var}{wiz_netbios_name}; - $samba->{global}{'server string'} = $o->{var}{wiz_banner}; - - # add special global options - global_special_options; - map_unxigroup_ntgroup; - - # log level in global section - $o->{var}{wiz_log_file} and $samba->{global}{'log file'} = $o->{var}{wiz_log_file}; - $o->{var}{wiz_log_level} and $samba->{global}{'log level'} = $o->{var}{wiz_log_level}; - $o->{var}{wiz_max_log_size} and $samba->{global}{'max log size'} = $o->{var}{wiz_max_log_size}; - - write_conf_restart_smb(); - # remove wait message - undef $w; - check_started('smbd'); -} -1; diff --git a/samba_wizard/Sambaprint.pm b/samba_wizard/Sambaprint.pm deleted file mode 100755 index d6816a13..00000000 --- a/samba_wizard/Sambaprint.pm +++ /dev/null @@ -1,304 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard -# Copyright (C) 2005 Mandriva -# -# Authors: antoine Ginies <aginies -@- mandriva> -# -# 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 MDK::Wizard::Sambaprint; -use strict; - -use common; -use services; -use MDK::Wizard::Wizcommon; - -use Libconf::Templates; -use Libconf::Glueconf::Samba::Smb_conf; - -my $wiz = new MDK::Wizard::Wizcommon; -my $in = interactive->vnew; - -my $wiz_samba_etc = "/etc/sysconfig/wizard_samba"; -my @listshare; -my @listprinters; - -my $o = { - name => 'Samba printers wizard', - var => { - wiz_all_printers => '', - wiz_printers => '', wiz_do_printer_sharing => '', wiz_printers_comment => '', - wiz_printers_browseable => '', wiz_printers_guestok => '', wiz_printers_createmode => '', - list_printers => '', - }, - defaultimage => "/usr/share/wizards/samba_wizard/images/IC-sambaprt-48.png", - }; - -# we ask glueconf to give us the structure representing /etc/samba/smb.conf -my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf'}); - -#debug -use Data::Dumper; -print Dumper($samba); - -my %cprint = ( - 1 => N("Printers - configure your printers"), - # 2 => N('Print - printers drivers'), - ); - -my @yesorno = qw(yes no); push @yesorno, ""; - -$o->{pages} = { - welcome => { - name => N("You can enable or disable printers in your Samba server configuration."), - no_back => 1, - pre => sub { - if (! -f $wiz_samba_etc) { - $in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares.")) or $in->exit; - } - $o->{var}{wiz_do_printer_sharing} = "0"; - }, - data => [ - # { label => "", val => \$o->{var}{wiz_todo}, list => [ keys %cprint ], format => sub { $cprint{$_[0]} } }, - { text => N("Enable printers in Samba?"), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} }, - ], - post => sub { - if ($o->{var}{wiz_do_printer_sharing} == 0) { - return 'summary_disable'; - } else { return 'ask_printers' } - }, - next => 'ask_printers', - }, - ask_printers => { - name => N("Printers are available.") . "\n\n" . N("Select which printers you want to be accessible from known users"), - pre => sub { - $o->{var}{list_printers} ||= [ list_printers() ]; - $o->{var}{wiz_box_list} ||= []; - }, - data => [ - { text => N("Enable all printers"), type => 'bool', val => \$o->{var}{wiz_all_printers} }, - { val => \$o->{var}{wiz_box_list}, boolean_list => \$o->{var}{list_printers}, disabled => sub { $o->{var}{wiz_all_printers} and return 1; 0 } }, - ], - next => 'ask_printers_options', - }, - ask_printers_options => { - name => N("Now you can configure your printers service. Change value only if you know what your are doing."), - pre => sub { - if ($samba->{printers}{comment}) { - $o->{var}{wiz_printers_comment} ||= $samba->{printers}{comment}; - } else { - $o->{var}{wiz_printers_comment} = "All Printers"; - } - $o->{var}{wiz_printers_browseable} ||= $samba->{printers}{browseable} or $o->{var}{wiz_printers_browseable} = "no"; - $o->{var}{wiz_printers_guestok} ||= $samba->{printers}{'guest ok'} or $o->{var}{wiz_printers_guestok} = "yes"; - if ($samba->{printers}{'create mode'}) { - $o->{var}{wiz_printers_createmode} ||= $samba->{printers}{'create mode'}; - } else { - $o->{var}{wiz_printers_createmode} = "0700"; - } - }, - post => sub { - if ($o->{var}{wiz_do_homes} == 1) { - return 'ask_homes'; - } - }, - data => [ - { label => N("Comment:"), val => \$o->{var}{wiz_printers_comment} }, -# { label => N("Create mode:"), val => \$o->{var}{wiz_printers_createmode} }, - { label => N("Browseable:"), val => \$o->{var}{wiz_printers_browseable}, fixed_list => \@yesorno }, - { label => N("Guest ok:"), val => \$o->{var}{wiz_printers_guestok}, fixed_list => \@yesorno }, - ], - next => 'summary', - }, - summary => { - name => N("Configuring Samba printers"), - pre => sub { - $o->{var}{wiz_sambatype} = $cprint{$o->{var}{wiz_type}}; - }, - data => [ - { label => N("Comment:"), val_ref => \$o->{var}{wiz_printers_comment} }, - { label => N("Create mode:"), val_ref => \$o->{var}{wiz_printers_createmode} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_printers_browseable} }, - { label => N("Guest ok:"), val_ref => \$o->{var}{wiz_printers_guestok} }, - ], - post => \&do_it, - next => 'end', - }, - summary_disable => { - name => N("Disable Samba printers"), - post => \&do_it, - next => 'end', - no_back => 1, - }, - end => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Samba printer."), - no_back => 1, - end => 1, - next => 0 - }, - error_end => { - name => N("Failed"), - data => [ { label => N("Please relaunch drakwizard, and try to change some parameters.") } ], - no_back => 1, - end => 1, - next => 0, - }, - }; - -sub new { - my ($class, $conf) = @_; - bless $o, $class; -} - -sub check() { - $> and return 1; - $wiz->{net}->is_dhcp and return 2; - 0; -} - -#section has the name of the printer -sub add_printer { - my ($printer) = @_; - $samba->{$printer}{printer} = $printer; - $samba->{$printer}{printable} = 'yes'; -} - -sub remove_printer { - my ($printer) = @_; - delete $samba->{$printer}; -} - -sub list_printers_smbconf() { - undef @listprinters; - foreach my $clef (keys %$samba) { - if ($samba->{$clef}{printable} =~ /yes/i) { - print "$clef is a printer\n"; - push @listprinters, $clef; - } - } - return @listprinters; -} - -sub list_printers() { - my @list if 0; - return @list if @list; - @list = sort grep /^(?!\#).+/, map { - my ($printer) = split(':', $_); - } cat_("/etc/printcap"); - if (@list) { - @list; - } else { () } -} - - -sub printer_sharing() { - # create default section for printers with default value - $samba->{global}{'printer adm'} = "\@adm"; - $samba->{printers}; - $samba->{printers}{comment} = $o->{var}{wiz_printers_comment}; - $samba->{printers}{browseable} = $o->{var}{wiz_printers_browseable}; - $samba->{printers}{'guest ok'} = $o->{var}{wiz_printers_guestok}; - $samba->{printers}{'create mode'} = $o->{var}{wiz_printers_createmode}; - # dont want user to change those value... - $samba->{printers}{path} = "/var/spool/samba"; - $samba->{printers}{writable} = "no"; - $samba->{printers}{printable} = "yes"; - $samba->{printers}{'print command'} = "lpr-cups -P \%p -o raw \%s -r"; - $samba->{printers}{'use client driver'} = "yes"; - if ($o->{var}{wiz_box_list}) { - for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { - my $printer = $o->{var}{list_printers}[$i]; - if ($o->{var}{wiz_box_list}[$i]) { - add_printer($printer); - } else { - remove_printer($printer); - } - } - } -} - -sub printer_section() { - $samba->{'pdf-gen'}; - $samba->{'pdf-gen'}{path} = "/var/tmp"; - $samba->{'pdf-gen'}{'guest ok'} = "no"; - $samba->{'pdf-gen'}{printable} = "yes"; - $samba->{'pdf-gen'}{comment} = "PDF Generator (only valid users)"; - $samba->{'pdf-gen'}{printing} = "bsd"; - $samba->{'pdf-gen'}{'print command'} = "/usr/share/samba/scripts/print-pdf \"%s\" \"%H\" \"//%L/%u\" \"%m\" \"%I\" \"%J\" &"; - $samba->{'pdf-gen'}{'lpq command'} = "/bin/true"; -} - -sub printdollar_section() { - $samba->{'print$'}; - $samba->{'print$'}{browseable} = "yes"; - $samba->{'print$'}{path} = "/var/lib/samba/printers"; - $samba->{'print$'}{browseable} = "yes"; - $samba->{'print$'}{'write list'} = "\@adm root"; - $samba->{'print$'}{'guest ok'} = "yes"; - $samba->{'print$'}{'inherit permissions'} = "yes"; -} - -sub get_printers() { - if ($o->{var}{wiz_do_printer_sharing}) { - my $string; - $o->{var}{wiz_all_printers} and return "all printers"; - for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { - $string .= "$o->{var}{list_printers}[$i]\n" if $o->{var}{wiz_box_list}[$i]; - } - $string; - } - else { - 'disabled'; - } -} - -sub write_conf_restart_smb { - $samba->write_conf("/etc/samba/smb.conf"); - if (services::is_service_running('smb')) { - services::restart('smb'); - } else { services::start('smb') } -} - -# remember one variable cannot be commented and not in the same file. -sub do_it { - $::testing and return; - # display a wait dialog box - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server...")); - - # share printers - if ($o->{var}{wiz_do_printer_sharing} == 1) { - printer_sharing(); - printer_section(); - printdollar_section(); - } else { - if ($o->{var}{wiz_box_list}) { - for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) { - $o->{var}{list_printers}[$i] and remove_printer($o->{var}{list_printers}[$i]); - } - } - $samba->{global}{'printer adm'} and delete $samba->{global}{'printer adm'}; - $samba->{printers} and delete $samba->{printers}; - $samba->{'print$'} and delete $samba->{'print$'}; - $samba->{'pdf-gen'} and delete $samba->{'pdf-gen'}; - } - - write_conf_restart_smb(); - # remove wait message - undef $w; - check_started('smbd'); - } -1; diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm deleted file mode 100755 index 9545feb2..00000000 --- a/samba_wizard/Sambashare.pm +++ /dev/null @@ -1,976 +0,0 @@ -#!/usr/bin/perl - -# Drakwizard -# Copyright (C) 2005 Mandriva -# -# Authors: antoine Ginies <aginies @ mandriva> -# -# 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 MDK::Wizard::Sambashare; -use strict; - -use common; -use services; -use MDK::Wizard::Wizcommon; - -use Libconf::Templates; -use Libconf::Glueconf::Samba::Smb_conf; - -my $wiz = new MDK::Wizard::Wizcommon; -my $in = interactive->vnew; - -my @listshare; -my @listshare_tomodify; - -my $o = { - name => 'Samba wizard', - var => { - wiz_do_homes => '', - wiz_dir => '', - wiz_share_comment => '', wiz_share_browseable => '', wiz_share_writable => '', - wiz_write_list => '', - wiz_read_list => '', - wiz_hosts_deny => '', - wiz_home_writable => '', wiz_home_browseable => '', wiz_home_createmode => '', - wiz_home_comment => '', - wiz_share_comment => '', wiz_share_browseable => '', wiz_share_writable => '', - wiz_share_create_mask => '', wiz_share_dotfiles => '', wiz_share_hidefiles => '', - wiz_selected_share => '', - wiz_selected_share_comment => '', - wiz_understanding => '', - }, - needed_rpm => [ 'samba-server' ], - defaultimage => "/usr/share/wizards/samba_wizard/images/IC-sambashare-48.png", - }; - -# we ask glueconf to give us the structure representing /etc/samba/smb.conf -my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf'}); - -#use Data::Dumper; -#print Dumper($samba); - -my %level = ( - 1 => N("All - No access restriction"), - 2 => N("My rules - Ask me allowed and denied hosts") - ); - -my %understanding = ( - 1 => N("Newbie - classical options"), - 2 => N("Expert - advanced options"), - ); - -my %menu_root_share = ( - 1 => N("Add/remove/modify share (expert only)"), - 2 => N("Special share (CDrom, Homes, Profiles)"), - 3 => N("Public share"), - 4 => N("User share"), - ); - -my %menu_special_share = ( - 1 => N("CDrom - share a CDrom"), - 2 => N("Homes - share home user dir"), - 3 => N("Profiles - profiles directory on the fly"), - ); - -my %menu_manage = ( - 1 => N("Add - add a share"), - 2 => N("Remove - remove a share"), - 3 => N("Modify - modify a share"), - ); - -my %share = ( - 1 => N("Add - add a share"), - 2 => N("Remove - remove a share"), - 3 => N("Modify - modify a share"), - 4 => N("CDrom - share a CDrom"), - 5 => N("Homes - share home user dir"), - 6 => N("Profiles - profiles directory on the fly"), - ); - -my @yesorno = qw(yes no); push @yesorno, ""; -my @scase = qw(lower upper); push @scase, ""; -my $wiz_samba_etc = "/etc/sysconfig/wizard_samba"; - -$o->{pages} = { - welcome => { - name => N("What do you want to do?") . "\n\n" . N("Manage, create special share, create public/user share"), - pre => sub { - if (! -f $wiz_samba_etc) { - $in->ask_warn(N("Information"), N("It seems that you haven't setup a Samba server. Please setup a Samba server with Samba wizard before manage your shares.")) or $in->exit; - } - $o->{var}{wiz_share} = 0; - }, - data => [ - { label => '', val => \$o->{var}{wiz_share}, type => 'list', list => [ sort keys %menu_root_share ], format => sub { $menu_root_share{$_[0]} } }, - ], - post => sub { - if ($o->{var}{wiz_share} == 1) { - return 'manage_share' } - elsif ($o->{var}{wiz_share} == 2) { - return 'special_share' } - elsif ($o->{var}{wiz_share} == 3) { - return 'add_public_share' } - elsif ($o->{var}{wiz_share} == 4) { - return 'add_user_share' } - }, - no_back => 1, - }, - manage_share => { - name => N("What do you want to do with your share?") . "\n\n" . N("add/remove/modify a share"), - pre => sub { $o->{var}{manage_share} = 0 }, - data => [ - { label => '', val => \$o->{var}{manage_share}, type => 'list', list => [ keys %menu_manage ], format => sub { $menu_manage{$_[0]} } }, - ], - post => sub { - if ($o->{var}{manage_share} == 1) { - return 'add_share' } - elsif ($o->{var}{manage_share} == 2) { - return 'choose_share_to_delete' } - elsif ($o->{var}{manage_share} == 3) { - return 'choose_share_to_modify' } - }, - no_back => 1, - }, - special_share => { - name => N("Create a special share, what kind?"), - pre => sub { $o->{var}{special_share} = 1 }, - data => [ - { label => '', val => \$o->{var}{special_share}, type => 'list', list => [ keys %menu_special_share ], format => sub { $menu_special_share{$_[0]} } }, - ], - post => sub { - if ($o->{var}{special_share} == 1) { - return 'add_cdrom_share' } - elsif ($o->{var}{special_share} == 2) { - return 'add_homes' } - elsif ($o->{var}{special_share} == 3) { - return 'add_profiles' } - }, - no_back => 1, - }, - - understanding => { - name => N("Now I need to know your understanding in Samba server configuration"), - data => [ - { label => N("What kind of user are you:"), val => \$o->{var}{wiz_understanding}, list => [ keys %understanding ], format => sub { $understanding{$_[0]} } }, - ], - next => 'modify_share', - }, - choose_share_to_delete => { - name => N("Delete which share?") . "\n\n" . N("Please choose the share you want to remove."), - pre => \&list_all_shares, - data => [ - { label => '', type => 'list', val => \$o->{var}{wiz_selected_share}, list_ref => \@listshare }, - ], - next => 'summary_delete', - }, - choose_share_to_modify => { - name => N("Modify which share?") . "\n\n" . N("Please choose the share you want to modify."), - pre => \&list_all_shares_to_modify, - data => [ - { label => '', type => 'list', val => \$o->{var}{wiz_selected_share}, list_ref => \@listshare_tomodify }, - ], - post => sub { if ($o->{var}{wiz_selected_share} eq 'homes') { return 'modify_homes_share' } - }, - next => 'understanding', - }, - modify_homes_share => { - name => N("Modify Homes share"), - pre => sub { - exists $samba->{homes}{comment} and $o->{var}{wiz_homes_commment} = $samba->{homes}{comment}; - exists $samba->{homes}{writable} and $o->{var}{wiz_homes_writable} = $samba->{homes}{writable}; - exists $samba->{homes}{browseable} and $o->{var}{wiz_homes_browseable} = $samba->{homes}{browseable}; - exists $samba->{homes}{'create mode'} and $o->{var}{wiz_homes_create_mode} = $samba->{homes}{'create mode'}; - exists $samba->{homes}{'create mask'} and $o->{var}{wiz_homes_create_mask} = $samba->{homes}{'create mask'}; - exists $samba->{homes}{'directory mask'} and $o->{var}{wiz_homes_directory_mask} = $samba->{homes}{'directory mask'}; - }, - data => [ - { label => N("Comment:"), val => \$o->{var}{wiz_homes_comment}, help => N("This is a text field that is seen next to a share when a client does a queries the server") }, - { label => N("Writable:"), val => \$o->{var}{wiz_homes_writable}, list_ref => \@yesorno }, - { label => N("Browseable:"), val => \$o->{var}{wiz_homes_browseable}, list_ref => \@yesorno }, - { label => N("Create mode:"), val => \$o->{var}{wiz_homes_create_mode} }, - { label => N("Create mask:"), val => \$o->{var}{wiz_homes_create_mask} }, - { label => N("Directory mask:"), val => \$o->{var}{wiz_homes_directory_mask} }, - ], - complete => sub { - map { - if ($_ and !/^\d+$/) { - $in->ask_warn(N("Error"), N("Create mask, create mode and directory mask should be numeric. ie: 0755.")) and return 1; - } - } $o->{var}{wiz_homes_create_mask}, $o->{var}{wiz_homes_directory_mask}, $o->{var}{wiz_homes_create_mode}; - }, - next => 'summary_modify_homes_share', - }, - modify_share => { - name => N("Modify a share"), - pre => sub { - if (!$o->{var}{wiz_selected_share}) { - $in->ask_warn(N("Information"), N("There is no share to modify, please add one.")); - exit(1); - } else { - my $share = $o->{var}{wiz_selected_share}; - exists $samba->{$share}{comment} and $o->{var}{wiz_share_comment} = $samba->{$share}{comment}; - exists $samba->{$share}{writable} and $o->{var}{wiz_share_writable} = $samba->{$share}{writable}; - exists $samba->{$share}{browseable} and $o->{var}{wiz_share_browseable} = $samba->{$share}{browseable}; - exists $samba->{$share}{path} and $o->{var}{wiz_share_path} = $samba->{$share}{path}; - exists $samba->{$share}{public} and $o->{var}{wiz_share_public} = $samba->{$share}{public}; - } - }, - complete => sub { - if (!($o->{var}{wiz_share_comment})) { - $in->ask_warn(N("Error"), N("Please enter a share comment.")); - return 1; - } - }, - post => sub { - if ($o->{var}{wiz_understanding} == 1) { - return 'summary_modify'; - } elsif ($o->{var}{wiz_understanding} == 2) { - return 'modify_share_options'; - } else { - print "perdu\n"; - } - }, - data => [ - { label => N("Name of the share:"), val_ref => \$o->{var}{wiz_selected_share} }, - { label => N("Comment:"), val => \$o->{var}{wiz_share_comment}, help => N("This is a text field that is seen next to a share when a client does a queries the server") }, - { label => N("Path:"), val => \$o->{var}{wiz_share_path} }, - { label => N("Browseable:"), val => \$o->{var}{wiz_share_browseable}, list_ref => \@yesorno, help => N("Allows share to be displayed in list of share.") }, - { label => N("Writable:"), val => \$o->{var}{wiz_share_writable}, list_ref => \@yesorno, help => ('Inverted synonym for read only.') }, - { label => N("Public:"), val => \$o->{var}{wiz_share_public}, list_ref => \@yesorno }, - ], - no_back => 1, - next => 'modify_share_options', - }, - modify_share_options => { - name => N("Advanced options, step 1") . "\n\n" . N("Advanced options, use them if you know what you are doing.") . "\n" . N("If you choose Write list wizard will create the samba user without password. Use: smbpasswd [username] to redefine samba user password."), - pre => sub { - my $share = $o->{var}{wiz_selected_share}; - exists $samba->{$share}{'read list'} and $o->{var}{wiz_share_readlist} = $samba->{$share}{'read list'}; - exists $samba->{$share}{'write list'} and $o->{var}{wiz_share_writelist} = $samba->{$share}{'write list'}; - exists $samba->{$share}{'hide dot files'} and $o->{var}{wiz_share_dotfiles} = $samba->{$share}{'hide dot files'}; - exists $samba->{$share}{'hide files'} and $o->{var}{wiz_share_hidefiles} = $samba->{$share}{'hide files'}; - $o->{var}{wiz_owner} = "0"; - exists $samba->{$share}{'valid users'} and $o->{var}{wiz_share_valid_users} = $samba->{$share}{'valid users'}; - exists $samba->{$share}{'admin users'} and $o->{var}{wiz_share_admin_users} = $samba->{$share}{'admin users'}; - }, - data => [ - { label => N("Read list:"), val => \$o->{var}{wiz_share_readlist}, help => N("Specifies a list of users that have read-only access to a writable share. ie: anne") }, - { label => N("Write list:"), val => \$o->{var}{wiz_share_writelist}, help => N("Specifies a user that have read-write access to a share. ie: fred") }, - { label => N("User own directory:"), type => 'bool', val => \$o->{var}{wiz_owner} }, - { label => N("valid users"), val => \$o->{var}{wiz_share_valid_users}, help => N("To restrict the share to a particular user. If this is empty (the default) then any user can login. ie: guibo") }, - { label => N("admin users"), val => \$o->{var}{wiz_share_admin_users}, help => N("This is a list of users who will be granted administrative privileges on the share. This means that they will do all file operations as the super-user (root). You should use this option very carefully, as any user in this list will be able to do anything they like on the share, irrespective of file permissions.") }, - { label => N("Hide files:"), val => \$o->{var}{wiz_share_hidefiles}, help => N("The hide files option provides one or more directory or filename patterns to Samba. Any file matching this pattern will be treated as a hidden file from the perspective of the client. ie: /.icewm/") }, - { label => N("Hide dot files:"), val => \$o->{var}{wiz_share_dotfiles}, list_ref => \@yesorno, help => N("The hide dot files option hides any files on the server that begin with a dot (.)") }, - ], - complete => sub { - map { my @users = split(" ", $_); - foreach my $user (@users) { - print "$user\n"; - if ($user and !any { /^$user:/ } cat_("/etc/passwd")) { - $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user)); - return 1; $_; - } - } - } $o->{var}{wiz_share_writelist}, $o->{var}{wiz_share_readlist}, $o->{var}{wiz_share_valid_users}; - }, - next => 'modify_share_options2', - }, - modify_share_options2 => { - name => N("Advanced options, step 2") . "\n\n" . N("Advanced options, use them only if you know what you are doing."), - pre => sub { - my $share = $o->{var}{wiz_selected_share}; - exists $samba->{$share}{'preserve case'} and $o->{var}{wiz_share_preserve_case} = $samba->{$share}{'preserve case'}; - exists $samba->{$share}{'short preserve case'} and $o->{var}{wiz_share_short_preserve_case} = $samba->{$share}{'short preserve case'}; - exists $samba->{$share}{'create mask'} and $o->{var}{wiz_share_create_mask} = $samba->{$share}{'create mask'} or $samba->{$share}{'create mask'} = "664"; - exists $samba->{$share}{'directory mask'} and $o->{var}{wiz_share_directory_mask} = $samba->{$share}{'directory mask'} or $samba->{$share}{'directory mask'} = 775; - exists $samba->{$share}{'force create mode'} and $o->{var}{wiz_share_force_create_mode} = $samba->{$share}{'force create mode'}; - exists $samba->{$share}{'force directory mode'} and $o->{var}{wiz_share_force_directory_mode} = $samba->{$share}{'force directory mode'}; - exists $samba->{$share}{'force group'} and $o->{var}{wiz_share_force_group} = $samba->{$share}{'force group'}; - exists $samba->{$share}{'default case'} and $o->{var}{wiz_share_default_case} = $samba->{$share}{'default case'}; - }, - data => [ -# { label => N("create mask"), val => \$o->{var}{wiz_share_create_mask}, help => N("When a file is created, the necessary permissions are calculated according to the mapping from DOS modes to UNIX permissions, and the resulting UNIX mode is then bit-wise \'AND\'ed with this parameter. This parameter may be thought of as a bit-wise MASK for the UNIX modes of a file. Any bit not set here will be removed from the modes set on a file when it is created.") }, - { label => N("force create mode"), val => \$o->{var}{wiz_share_force_create_mode}, help => N("This parameter specifies a set of UNIX mode bit permissions that will always be set on a file created by Samba. This is done by bitwise \'OR\'ing these bits onto the mode bits of a file that is being created or having its permissions changed. The default for this parameter is (in octal) 000. ie: force create mode = 0700 ") }, - { label => N("force directory mode"), val => \$o->{var}{wiz_share_force_directory_mode}, help => N("This parameter specifies a set of UNIX mode bit permissions that will always be set on a directory created by Samba. This is done by bitwise \'OR\'ing these bits onto the mode bits of a directory that is being created. The default for this parameter is (in octal) 0000 which will not add any extra permission bits to a created directory. ie: force directory mode = 0755") }, - { label => N("force group"), val => \$o->{var}{wiz_share_force_group}, help => N("This specifies a UNIX group name that will be assigned as the default primary group for all users connecting to this service. This is useful for sharing files by ensuring that all access to files on service will use the named group for their permissions checking. ie: force group = agroup") }, - { label => N("default case"), val => \$o->{var}{wiz_share_default_case}, list_ref => \@scase, help => N("lower or upper") }, - { label => N("preserve case"), val => \$o->{var}{wiz_share_preserve_case}, list_ref => \@yesorno, help => N("This controls if new filenames are created with the case that the client passes, or if they are forced to be the default case") }, - ], - complete => sub { - map { - if ($_ and $_ !~ /^\d+$/) { - $in->ask_warn(N("Error"), N("Create mask, force directory mode and force create mode should be numeric. ie: 0755.")) and return 1; - } - } $o->{var}{wiz_share_create_mask}, $o->{var}{wiz_share_force_directory_mode}, $o->{var}{wiz_share_force_create_mode}; - }, - next => 'summary_modify', - }, - add_share => { - name => N("Add a share") . "\n" . N("Comment: description of the share") . "\n" . N("Browseable: view share") . "\n" . N("Writable: user can write in the share"), - data => [ - { label => N("Name of the share:"), val => \$o->{var}{wiz_addshare_name} }, - { label => N("Comment:"), val => \$o->{var}{wiz_addshare_comment} }, - { label => N("Path:"), val => \$o->{var}{wiz_addshare_path} }, - { label => N("Browseable:"), val => \$o->{var}{wiz_addshare_browseable}, list_ref => \@yesorno, help => N("Allows share to be displayed in list of share.") }, - { label => N("Public:"), val => \$o->{var}{wiz_addshare_public}, list_ref => \@yesorno }, - ], - complete => sub { - foreach my $clef (keys %$samba) { - if ($clef =~ /$o->{var}{wiz_addshare_name}/) { - $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name.")); - return 1; - } - } - if (!$o->{var}{wiz_addshare_path}) { - $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1; - } - if (!$o->{var}{wiz_addshare_comment}) { - $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1; - } - if (! -d $o->{var}{wiz_addshare_path}) { - mkdir_p($o->{var}{wiz_addshare_path}) or $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")); - - return 1; - } else { return 0 } - }, - next => 'add_share_options', - no_back => 1, - }, - add_cdrom_share => { - name => N("Share a CDROM"), - pre => sub { - if ($samba->{cdrom}{comment}) { - $o->{var}{wiz_cdrom_comment} = $samba->{cdrom}{comment}; - } else { - $o->{var}{wiz_cdrom_comment} = "%L CDrom"; - } - if ($samba->{cdrom}{path}) { - $o->{var}{wiz_cdrom_path} = $samba->{cdrom}{path}; - } else { - $o->{var}{wiz_cdrom_path} = "/mnt/cdrom"; - } - $o->{var}{wiz_cdrom_browseable} = "yes"; - $o->{var}{wiz_cdrom_pre} = "/bin/mount /mnt/cdrom"; - $o->{var}{wiz_cdrom_post} = "/bin/umount /mnt/cdrom"; - $o->{var}{wiz_cdrom_public} = "yes"; - }, - data => [ - { label => N("Comment:"), val_ref => \$o->{var}{wiz_cdrom_comment} }, - { label => N("CDrom path:"), val_ref => \$o->{var}{wiz_cdrom_path} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_cdrom_browseable} }, - { label => N("Root preexec:"), val_ref => \$o->{var}{wiz_cdrom_pre} }, - { label => N("Root postexec:"), val_ref => \$o->{var}{wiz_cdrom_post} }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_cdrom_public} }, - ], - next => 'summary_addcdromshare', - }, - add_user_share => { - name => N("Add a user share") . "\n", - pre => sub { - $o->{var}{wiz_add_user_share_browseable} = "yes"; - $o->{var}{wiz_add_user_share_public} = "no"; - $o->{var}{wiz_add_user_share_createmode} = "0700"; - $o->{var}{wiz_add_user_share_createmask} = "664"; - $o->{var}{wiz_add_user_share_directorymask} = "775"; - }, - data => [ - { label => N("Name of the share:"), val => \$o->{var}{wiz_add_user_share_name} }, - { label => N("Comment:"), val => \$o->{var}{wiz_add_user_share_comment} }, - { label => N("Path:"), val => \$o->{var}{wiz_add_user_share_path} }, - { label => N("Write list:"), val => \$o->{var}{wiz_add_user_share_writelist} }, - { label => N("Read list:"), val => \$o->{var}{wiz_add_user_share_readlist} }, - ], - complete => sub { - foreach my $clef (keys %$samba) { - if ($clef =~ /$o->{var}{wiz_add_user_share_name}/) { - $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name.")); - return 1; - } - } - if (!$o->{var}{wiz_add_user_share_path}) { - $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")) and return 1; - } - if (!$o->{var}{wiz_add_user_share_comment}) { - $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1; - } - if (! -d $o->{var}{wiz_add_user_share_path}) { - mkdir_p($o->{var}{wiz_add_user_share_path}) or $in->ask_warn(N("Error"), N("Can\'t create the directory, please enter a correct path.")); - return 1; - } else { return 0 } - map { my @users = split(" ", $_); - foreach my $user (@users) { - if ($user and !any { /^$user:/ } cat_("/etc/passwd")) { - $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user)); - return 1; $_; - } - } - } $o->{var}{wiz_add_user_share_writelist}, $o->{var}{wiz_add_user_share_readlist}; - }, - next => 'summary_add_user_share', - }, - add_public_share => { - name => N("Add a public share"), - pre => sub { - $o->{var}{wiz_add_public_share_browseable} = "yes"; - $o->{var}{wiz_add_public_share_public} = "yes"; - $o->{var}{wiz_add_public_share_createmode} = "0700"; - $o->{var}{wiz_add_public_owner} = ""; - $o->{var}{wiz_add_public_share_createmask} = "664"; - $o->{var}{wiz_add_public_share_directorymask} = "775"; - }, - data => [ - { label => N("Name of the share:"), val => \$o->{var}{wiz_add_public_share_name} }, - { label => N("Comment:"), val => \$o->{var}{wiz_add_public_share_comment} }, - { label => N("Path:"), val => \$o->{var}{wiz_add_public_share_path} }, - { label => N("Writable:"), val => \$o->{var}{wiz_add_public_share_writable}, list_ref => \@yesorno }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_add_public_share_public} }, - - ], - complete => sub { - foreach my $clef (keys %$samba) { - if ($clef =~ /$o->{var}{wiz_add_public_share_name}/) { - $in->ask_warn(N("Error"), N("Share with the same name already exist or share name empty, please choose another name.")); - return 1; - } - } - if ($o->{var}{wiz_add_public_share_writable} eq 'yes') { - $in->ask_okcancel(N("WARNING"), N("Be careful, you define your public share writable. This wizard will change permission to nobody.users, so do not use this feature on a home directory !")) or return 1; - } - if (!$o->{var}{wiz_add_public_share_path}) { - $in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path.")) and return 1; - } - if (!$o->{var}{wiz_add_public_share_comment}) { - $in->ask_warn(N("Error"), N("Please enter a comment for this share.")) and return 1; - } - if (! -d $o->{var}{wiz_add_public_share_path}) { - mkdir_p($o->{var}{wiz_add_public_share_path}) or $in->ask_warn(N("Error"), N("Can't create the directory, please enter a correct path.")); - return 1; - } else { return 0 } - }, - next => 'summary_add_public_share', - }, - add_share_options => { - name => N("Add a share") . "\n" . N("If you don't want to use one of this options, leave it blank."), - pre => sub { - $o->{var}{wiz_addshare_createmode} = "0700"; - $o->{var}{wiz_owner} = "0"; - $o->{var}{wiz_addshare_createmask} = "664"; - $o->{var}{wiz_addshare_directorymask} = "775"; - }, - data => [ - { label => N("Writable:"), val => \$o->{var}{wiz_addshare_writable}, list_ref => \@yesorno }, -# { label => N("Create mask:"), val => \$o->{var}{wiz_addshare_createmask} }, - { label => N("Read list:"), val => \$o->{var}{wiz_addshare_readlist}, help => N("Specifies a list \of users that have read-only access to a writable share. ie: aginies") }, - { label => N("Write list:"), val => \$o->{var}{wiz_addshare_writelist}, help => N("Specifies a user that have read-write access to a share. ie: guibo") }, - { label => N("User own directory:"), type => 'bool', val => \$o->{var}{wiz_owner} }, - { label => N("Hide dot files:"), val => \$o->{var}{wiz_addshare_dotfiles}, list_ref => \@yesorno, help => N("The hide dot files option hides any files on the server that begin with a dot (.)") }, - { label => N("Hide files:"), val => \$o->{var}{wiz_addshare_hidefiles}, help => N("The hide files option provides one or more directory or filename patterns to Samba. Any file matching this pattern will be treated as a hidden file from the perspective of the client. ie: /.icewm/") }, - ], - complete => sub { - map { my @users = split(" ", $_); - foreach my $user (@users) { - if ($user and !any { /^$user:/ } cat_("/etc/passwd")) { - $in->ask_warn(N("Error"), N("Please provide a system user, %s not present.", $user)); - return 1; $_; - } - } - } $o->{var}{wiz_addshare_writelist}, $o->{var}{wiz_addshare_readlist}; - if ($o->{var}{wiz_addshare_createmask} and $o->{var}{wiz_addshare_createmask} !~ /^\d+$/) { - $in->ask_warn(N("Error"), N("Create mask should be a number. ie: 0755.")) and return 1; - } - }, - next => 'summary_addshare', - }, - add_homes => { - name => N("Users home options") . "\n" . N("You have selected to allow user access their home directories via samba but you/they must use smbpasswd to set a password.") . "\n" . N("Comment: description of users home directory") . "\n" . N("Browseable: view share") . "\n" . N("Writable: user can write in their home") . "\n" . N("Create mode: man chmod for more info"), - pre => sub { - if ($samba->{homes}{comment}) { - $o->{var}{wiz_home_comment} ||= $samba->{homes}{comment}; - } else { - $o->{var}{wiz_home_comment} = "Home Directories"; - } - $o->{var}{wiz_home_browseable} ||= $samba->{homes}{browseable}; - $o->{var}{wiz_home_writable} ||= $samba->{homes}{writable}; - if ($samba->{homes}{'create mode'}) { - $o->{var}{wiz_home_createmode} ||= $samba->{homes}{'create mode'}; - } else { - $o->{var}{wiz_home_createmode} = "0755"; - } - }, - data => [ - { label => N("Comment:"), val => \$o->{var}{wiz_home_comment} }, - { label => N("Browseable:"), val => \$o->{var}{wiz_home_browseable}, list_ref => \@yesorno }, - { label => N("Writable:"), val => \$o->{var}{wiz_home_writable}, list_ref => \@yesorno }, -# { label => N("Create mode:"), val => \$o->{var}{wiz_home_createmode} }, - ], - next => 'summary_homeshare', - complete => sub { - if ($o->{var}{wiz_home_createmode} and $o->{var}{wiz_home_createmode} !~ /^\d+$/) { - $in->ask_warn(N("Error"), N("Create mode should be a number. ie: 0755.")) and return 1; - } - }, - }, - add_profiles => { - name => N("Specific roving profile share, use the user's home directory"), - pre => sub { - $o->{var}{wiz_profiles_path} = "/var/lib/samba/profiles"; - $o->{var}{wiz_profiles_comment} = "User Profiles"; - $o->{var}{wiz_profiles_browseable} = "no"; - $o->{var}{wiz_profiles_guest_ok} = "yes"; - $o->{var}{wiz_profiles_writable} = "yes"; - }, - data => [ - { label => N("Path:"), val_ref => \$o->{var}{wiz_profiles_path} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_profiles_browseable} }, - { label => N("Guest access:"), val_ref => \$o->{var}{wiz_profiles_guest_ok} }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_profiles_writable} }, - ], - next => 'end_add_profiles', - post => \&do_it_add_profiles, - }, - summary_homeshare => { - name => N("Summary add home share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."), - post => \&do_it_add_homeshare, - data => [ - { label => N("Comment:"), val_ref => \$o->{var}{wiz_home_comment} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_home_browseable}, }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_home_writable}, }, - { label => N("Create mode:"), val_ref => \$o->{var}{wiz_home_createmode} }, - ], - next => 'end_add_share', - }, - summary_modify => { - name => N("Summary modify a share") . "\n\n" . N("If you really want to modify this share, click the Next button or use the Back button."), - data => [ - { label => N("Name of the share:"), val_ref => \$o->{var}{wiz_selected_share} }, - { label => N("Comment:"), val_ref => \$o->{var}{wiz_share_comment} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_share_browseable} }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_share_writable} }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_share_public} }, - ], - post => \&do_it_modify_share, - next => 'end_modify_share', - }, - summary_addcdromshare => { - name => N("CDROM") . "\n\n" . N("If you really want to share a CDROM, click the Next button or use the Back button."), - post => \&do_it_add_cdromshare, - data => [ - { label => N("Comment:"), val_ref => \$o->{var}{wiz_cdrom_comment} }, - { label => N("Cdrom path:"), val_ref => \$o->{var}{wiz_cdrom_path} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_cdrom_browseable} }, - { label => N("Root preexec:"), val_ref => \$o->{var}{wiz_cdrom_pre} }, - { label => N("Root postexec:"), val_ref => \$o->{var}{wiz_cdrom_post} }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_cdrom_public} }, - ], - next => 'end_add_share', - }, - summary_addshare => { - name => N("Summary add share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."), - post => \&do_it_add_share, - data => [ - { label => N("Name of the share:"), val_ref => \$o->{var}{wiz_addshare_name} }, - { label => N("Comment:"), val_ref => \$o->{var}{wiz_addshare_comment} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_addshare_browseable} }, - { label => N("Create mask:"), val_ref => \$o->{var}{wiz_addshare_createmask} }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_addshare_writable} }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_addshare_public} }, - { label => N("Read list:"), val_ref => \$o->{var}{wiz_addshare_readlist} }, - { label => N("Write list:"), val_ref => \$o->{var}{wiz_addshare_writelist} }, - { label => N("Hide dot files:"), val_ref => \$o->{var}{wiz_addshare_dotfiles} }, - ], - next => 'end_add_share', - }, - summary_delete => { - name => N("Summary remove a share") . "\n\n" . N("If you really want to remove this share, click the Next button or use the Back button."), - pre => sub { - my $dshare = $o->{var}{wiz_selected_share}; - $o->{var}{wiz_selected_share_comment} = $samba->{$dshare}{comment}; - }, - data => [ - { label => N("Delete this share:"), val_ref => \$o->{var}{wiz_selected_share} }, - { label => N("Comment for this share:"), val_ref => \$o->{var}{wiz_selected_share_comment} }, - ], - post => \&do_it_remove_share, - next => 'end_delete_share', - no_back => 1, - }, - summary_modify_homes_share => { - name => N("Summary of modify homes share"), - data => [ - { label => N("Comment:"), val_ref => \$o->{var}{wiz_homes_comment} }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_homes_writable} }, - { label => N("Browseable:"), val_ref => \$o->{var}{wiz_homes_browseable} }, - { label => N("Create mode:"), val_ref => \$o->{var}{wiz_homes_create_mode} }, - { label => N("Create mask:"), val_ref => \$o->{var}{wiz_homes_create_mask} }, - { label => N("Directory mask:"), val_ref => \$o->{var}{wiz_homes_directory_mask} }, - ], - post => \&do_it_modify_homes_share, - next => 'end_add_user_share', - no_back => 1, - }, - summary_add_user_share => { - name => N("Summary of add a user share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."), - data => [ - { label => N("Name of the share:"), val_ref => \$o->{var}{wiz_add_user_share_name} }, - { label => N("Comment:"), val_ref => \$o->{var}{wiz_add_user_share_comment} }, - { label => N("Path:"), val_ref => \$o->{var}{wiz_add_user_share_path} }, - { label => N("Write list:"), val_ref => \$o->{var}{wiz_add_user_share_writelist} }, - ], - post => \&do_it_add_user_share, - next => 'end_add_user_share', - }, - summary_add_public_share => { - name => N("Summary of add a public share") . "\n\n" . N("If you really want to add this share, click the Next button or use the Back button."), - data => [ - { label => N("Name of the share:"), val => \$o->{var}{wiz_add_public_share_name} }, - { label => N("Comment:"), val => \$o->{var}{wiz_add_public_share_comment} }, - { label => N("Path:"), val => \$o->{var}{wiz_add_public_share_path} }, - { label => N("Public:"), val_ref => \$o->{var}{wiz_add_public_share_public} }, - { label => N("Writable:"), val_ref => \$o->{var}{wiz_add_public_share_writable} }, - ], - post => \&do_it_add_public_share, - next => 'end_add_public_share', - }, - end => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Samba."), - post => sub { - store_samba_type($o->{var}{wiz_type}); - }, - end => 1, - next => 0, - no_back => 1, - }, - end_modify_share => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully modified your share."), - end => 1, - next => 0, - no_back => 1, - }, - end_add_share => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully added your share."), - end => 1, - next => 0, - no_back => 1, - }, - end_add_user_share => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully added your user share."), - end => 1, - next => 0, - no_back => 1, - }, - end_add_public_share => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully added your public share."), - end => 1, - next => 0, - no_back => 1, - }, - end_add_profiles => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully added your Profiles share."), - end => 1, - next => 0, - no_back => 1, - }, - end_delete_share => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully removed your share."), - end => 1, - next => 0, - no_back => 1, - }, - error_end => { - name => N("Failed"), - data => [ { label => N("Please relaunch drakwizard, and try to change some parameters.") } ], - no_back => 1, - end => 1, - next => 0, - }, - }; - -sub new { - my ($class, $conf) = @_; - bless $o, $class; -} - -sub check() { - $> and return 1; - $wiz->{net}->is_dhcp and return 2; - 0; -} - -sub list_all_shares_to_modify { - undef @listshare_tomodify; - foreach my $clef (keys %$samba) { - if ($samba->{$clef}{printable} =~ /yes/i) { - print "$clef is a printer\n"; - } elsif ($clef =~ /global/ or $clef =~ /print\$/ or $clef =~ /cdrom/ or $clef =~ /profiles/) { - print "unwanted\n"; - } else { - push @listshare_tomodify, $clef; - } - } - return @listshare_tomodify; -} - -sub list_all_shares() { - undef @listshare; - foreach my $clef (keys %$samba) { - if ($samba->{$clef}{printable} =~ /yes/i) { - print "$clef is a printer\n"; - } elsif ($clef =~ /global/ or $clef =~ /print\$/) { - print "unwanted\n"; - } else { - push @listshare, $clef; - } - } - return @listshare; -} - -sub write_conf_restart_smb { - $samba->write_conf("/etc/samba/smb.conf"); - if (services::is_service_running('smb')) { - services::restart('smb'); - } else { services::start('smb') } -} - -sub do_it_remove_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - my $share = $o->{var}{wiz_selected_share}; - delete $samba->{$share}; - if ($share =~ /Profiles/) { delete $samba->{global}{'logon home'} } - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -sub create_smbuser { - my ($list) = @_; - my @users = split(" ", $list); - foreach my $user (@users) { - if (!any { /^$user:/ } cat_("/etc/samba/smbpasswd")) { - system("smbpasswd -a $user -n"); - } - } -} - -sub do_it_modify_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $share = $o->{var}{wiz_selected_share}; - $samba->{$share}; - $samba->{$share}{path} = $o->{var}{wiz_share_path}; - if (!-d $samba->{$share}{path}) { - mkdir($samba->{$share}{path}); - if (!-d $samba->{$share}{path}) { - $in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path})); - } - } - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - $samba->{$share}{comment} = $o->{var}{wiz_share_comment}; - $o->{var}{wiz_share_browseable} and $samba->{$share}{browseable} = $o->{var}{wiz_share_browseable}; - $o->{var}{wiz_share_writable} and $samba->{$share}{writable} = $o->{var}{wiz_share_writable}; - $o->{var}{wiz_share_public} and $samba->{$share}{public} = $o->{var}{wiz_share_public}; - # master level - if ($o->{var}{wiz_understanding} == 2) { - $o->{var}{wiz_share_readlist} and $samba->{$share}{'read list'} = $o->{var}{wiz_share_readlist}; - if ($o->{var}{wiz_share_writelist}) { - $samba->{$share}{'write list'} = $o->{var}{wiz_share_writelist}; - if ($o->{var}{wiz_owner}) { - system("chown -R $o->{var}{wiz_share_writelist}.users $o->{var}{wiz_share_path}"); - } - create_smbuser($o->{var}{wiz_share_writelist}); - } - if ($o->{var}{wiz_share_valid_users}) { - $samba->{$share}{'valid users'} = $o->{var}{wiz_share_valid_users}; - create_smbuser($o->{var}{wiz_share_valid_users}); - } - if ($o->{var}{wiz_share_admin_users}) { - $samba->{$share}{'admin users'} = $o->{var}{wiz_share_admin_users}; - create_smbuser($o->{var}{wiz_share_admin_users}); - } - - $o->{var}{wiz_share_dotfiles} and $samba->{$share}{'hide dot files'} = $o->{var}{wiz_share_dotfiles}; - $o->{var}{wiz_share_hidefiles} and $samba->{$share}{'hide files'} = $o->{var}{wiz_share_hidefiles}; - $o->{var}{wiz_share_preserve_case} and $samba->{$share}{'preserve case'} = $o->{var}{wiz_share_preserve_case}; - $o->{var}{wiz_share_short_preserve_case} and $samba->{$share}{'short preserve case'} = $o->{var}{wiz_share_short_preserve_case}; - $o->{var}{wiz_share_create_mask} and $samba->{$share}{'create mask'} = $o->{var}{wiz_share_create_mask}; - $o->{var}{wiz_share_directory_mask} and $samba->{$share}{'directory mask'} = $o->{var}{wiz_share_directory_mask}; - $o->{var}{wiz_share_force_create_mode} and $samba->{$share}{'force create mode'} = $o->{var}{wiz_share_force_create_mode}; - $o->{var}{wiz_share_force_directory_mode} and $samba->{$share}{'force directory mode'} = $o->{var}{wiz_share_force_directory_mode}; - $o->{var}{wiz_share_force_group} and $samba->{$share}{'force group'} = $o->{var}{wiz_share_force_group}; - $o->{var}{wiz_share_default_case} and $samba->{$share}{'default case'} = $o->{var}{wiz_share_default_case}; - } - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} -sub do_it_add_profiles { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - $samba->{Profiles}{path} = $o->{var}{wiz_profiles_path}; - $samba->{global}{'logon home'} = "\\\\%L\\Profiles\\%u"; - $samba->{Profiles}{browseable} = $o->{var}{wiz_profiles_browseable}; - $samba->{Profiles}{'guest ok'} = $o->{var}{wiz_profiles_guest_ok}; - $samba->{Profiles}{comment} = $o->{var}{wiz_profiles_comment}; - $samba->{Profiles}{writable} = $o->{var}{wiz_profiles_writable}; - $samba->{Profiles}{'root preexec'} = "PROFILE='/var/lib/samba/profiles/\%u'; if [ ! -e \$PROFILE ]; then mkdir -pm700 \$PROFILE; chown '\%u':'\%g' \$PROFILE;fi"; - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -sub do_it_modify_homes_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba homes share"), N("Configuring your Samba server...")); - - $o->{var}{wiz_homes_commment} and $samba->{homes}{comment} = $o->{var}{wiz_homes_commment}; - $o->{var}{wiz_homes_writable} and $samba->{homes}{writable} = $o->{var}{wiz_homes_writable}; - $o->{var}{wiz_homes_browseable} and $samba->{homes}{browseable} = $o->{var}{wiz_homes_browseable}; - $o->{var}{wiz_homes_create_mode} and $samba->{homes}{'create mode'} = $o->{var}{wiz_homes_create_mode}; - $o->{var}{wiz_homes_create_mask} and $samba->{homes}{'create mask'} = $o->{var}{wiz_homes_create_mask}; - $o->{var}{wiz_homes_directory_mask} and $samba->{homes}{'directory mask'} = $o->{var}{wiz_homes_directory_mask}; - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -sub do_it_add_cdromshare { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - $samba->{cdrom}{comment} = $o->{var}{wiz_cdrom_comment}; - $samba->{cdrom}{path} = $o->{var}{wiz_cdrom_path}; - $samba->{cdrom}{browseable} = $o->{var}{wiz_cdrom_browseable}; - $samba->{cdrom}{'root preexec'} = $o->{var}{wiz_cdrom_pre}; - $samba->{cdrom}{'root postexec'} = $o->{var}{wiz_cdrom_post}; - $samba->{cdrom}{public} = $o->{var}{wiz_cdrom_public}; - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -sub do_it_add_homeshare { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - $samba->{homes}; - $samba->{homes}{comment} = $o->{var}{wiz_home_comment}; - $o->{var}{wiz_home_browseable} and $samba->{homes}{browseable} = $o->{var}{wiz_home_browseable}; - $o->{var}{wiz_home_writable} and $samba->{homes}{writable} = $o->{var}{wiz_home_writable}; - $o->{var}{wiz_home_createmode} and $samba->{homes}{'create mode'} = $o->{var}{wiz_home_createmode}; - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -sub do_it_add_public_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $share = $o->{var}{wiz_add_public_share_name}; - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - - $samba->{$share}; - $samba->{$share}{browseable} = $o->{var}{wiz_add_public_share_browseable}; - $samba->{$share}{public} = $o->{var}{wiz_add_public_share_public}; - $samba->{$share}{'create mask'} = $o->{var}{wiz_add_public_share_createmask}; - $samba->{$share}{'directory mask'} = $o->{var}{wiz_add_public_share_directorymask}; - $samba->{$share}{comment} = $o->{var}{wiz_add_public_share_comment}; - $samba->{$share}{path} = $o->{var}{wiz_add_public_share_path}; - if ($o->{var}{wiz_add_public_share_writable} eq 'yes') { - $samba->{$share}{'writable'} = $o->{var}{wiz_add_public_share_writable}; - system("chown -R nobody.users $o->{var}{wiz_add_public_share_path}"); - } - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); - -} - -sub do_it_add_user_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $share = $o->{var}{wiz_add_user_share_name}; - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - - $samba->{$share}; - $samba->{$share}{browseable} = $o->{var}{wiz_add_user_share_browseable}; - $samba->{$share}{public} = $o->{var}{wiz_add_user_share_public}; - $samba->{$share}{path} = $o->{var}{wiz_add_user_share_createmode}; - $samba->{$share}{'create mask'} = $o->{var}{wiz_add_user_share_createmask}; - $samba->{$share}{'directory mask'} = $o->{var}{wiz_add_user_share_directorymask}; - $samba->{$share}{comment} = $o->{var}{wiz_add_user_share_comment}; - $samba->{$share}{path} = $o->{var}{wiz_add_user_share_path}; - - $samba->{$share}{'write list'} = $o->{var}{wiz_add_user_share_writelist}; - system("chown -R $o->{var}{wiz_add_user_share_writelist}.users $o->{var}{wiz_add_user_share_path}"); - create_smbuser($o->{var}{wiz_add_user_share_writelist}); - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); - -} - -sub do_it_add_share { - $::testing and return; - my $in = 'interactive'->vnew('su', 'Samba'); - my $share = $o->{var}{wiz_addshare_name}; - $samba->{$share}; - $samba->{$share}{path} = $o->{var}{wiz_addshare_path}; - if (!-d $samba->{$share}{path}) { - system("mkdir $samba->{$share}{path}"); - if (!-d $samba->{$share}{path}) { - $in->ask_warn(N("Error"), N("Can\'t create %s. Please check why wizard can\'t create this directory.", $samba->{$share}{path})); - } - } - my $w = $in->wait_message(N("Samba share"), N("Configuring your Samba server...")); - $samba->{$share}{comment} = $o->{var}{wiz_addshare_comment}; - $o->{var}{wiz_addshare_browseable} and $samba->{$share}{browseable} = $o->{var}{wiz_addshare_browseable}; - $o->{var}{wiz_addshare_writable} and $samba->{$share}{writable} = $o->{var}{wiz_addshare_writable}; - $o->{var}{wiz_addshare_public} and $samba->{$share}{public} = $o->{var}{wiz_addshare_public}; - $o->{var}{wiz_addshare_dotfiles} and $samba->{$share}{'hide dot files'} = $o->{var}{wiz_addshare_dotfiles}; - $o->{var}{wiz_addshare_hidefiles} and $samba->{$share}{'hide files'} = $o->{var}{wiz_addshare_hidefiles}; - if ($o->{var}{wiz_addshare_readlist}) { - $samba->{$share}{'read list'} = $o->{var}{wiz_addshare_readlist}; - create_smbuser($o->{var}{wiz_addshare_readlist}); - } - - if ($o->{var}{wiz_addshare_writelist}) { - $samba->{$share}{'write list'} = $o->{var}{wiz_addshare_writelist}; - if ($o->{var}{wiz_owner}) { - system("chown -R $o->{var}{wiz_addshare_writelist}.users $o->{var}{wiz_addshare_path}"); - } - create_smbuser($o->{var}{wiz_addshare_writelist}); - } - $o->{var}{wiz_addshare_createmask} and $samba->{$share}{'create mask'} = $o->{var}{wiz_addshare_createmask}; - $o->{var}{wiz_addshare_directorymask} and $samba->{$share}{'directory mask'} = $o->{var}{wiz_addshare_directorymask}; - - - write_conf_restart_smb(); - undef $w; - check_started('smbd'); -} - -1; diff --git a/samba_wizard/images/IC-sambaprt-48.png b/samba_wizard/images/IC-sambaprt-48.png Binary files differdeleted file mode 100644 index 9a5ea6b5..00000000 --- a/samba_wizard/images/IC-sambaprt-48.png +++ /dev/null diff --git a/samba_wizard/images/IC-sambashare-48.png b/samba_wizard/images/IC-sambashare-48.png Binary files differdeleted file mode 100644 index 9a69c841..00000000 --- a/samba_wizard/images/IC-sambashare-48.png +++ /dev/null diff --git a/samba_wizard/images/sambasrv.png b/samba_wizard/images/sambasrv.png Binary files differdeleted file mode 100644 index 397ee501..00000000 --- a/samba_wizard/images/sambasrv.png +++ /dev/null diff --git a/samba_wizard/scripts/smb.conf.default b/samba_wizard/scripts/smb.conf.default deleted file mode 100644 index 939ec9a5..00000000 --- a/samba_wizard/scripts/smb.conf.default +++ /dev/null @@ -1,524 +0,0 @@ - -# This is the main Samba configuration file. You should read the -# smb.conf(5) manual page in order to understand the options listed -# here. Samba has a huge number of configurable options (perhaps too -# many!) most of which are not shown in this example -# -# Any line which starts with a ; (semi-colon) or a # (hash) -# is a comment and is ignored. In this example we will use a # -# for commentry and a ; for parts of the config file that you -# may wish to enable -# -# NOTE: Whenever you modify this file you should run the command "testparm" -# to check that you have not made any basic syntactic errors. -# -#======================= Global Settings ===================================== -[global] - -# 1. Server Naming Options: -# workgroup = NT-Domain-Name or Workgroup-Name - workgroup = MDKGROUP - -# netbios name is the name you will see in "Network Neighbourhood", -# but defaults to your hostname -# netbios name = <name_of_this_server> - -# server string is the equivalent of the NT Description field - server string = Samba Server %v - -# Message command is run by samba when a "popup" message is sent to it. -# The example below is for use with LinPopUp: -; message command = /usr/bin/linpopup "%f" "%m" %s; rm %s - -# 2. Printing Options: -# CHANGES TO ENABLE PRINTING ON ALL CUPS PRINTERS IN THE NETWORK -# (as cups is now used in linux-mandrake 7.2 by default) -# if you want to automatically load your printer list rather -# than setting them up individually then you'll need this - printcap name = cups - load printers = yes - -# It should not be necessary to spell out the print system type unless -# yours is non-standard. Currently supported print systems include: -# bsd, sysv, plp, lprng, aix, hpux, qnx, cups - printing = cups - -# Samba 2.2 supports the Windows NT-style point-and-print feature. To -# use this, you need to be able to upload print drivers to the samba -# server. The printer admins (or root) may install drivers onto samba. -# Note that this feature uses the print$ share, so you will need to -# enable it below. -# printer admin = @<group> <user> - printer admin = @adm -# This should work well for winbind: -# printer admin = @"Domain Admins" - -# 3. Logging Options: -# this tells Samba to use a separate log file for each machine -# that connects - log file = /var/log/samba/log.%m - -# Put a capping on the size of the log files (in Kb). - max log size = 50 - -# Set the log (verbosity) level (0 <= log level <= 10) -# log level = 3 - -# 4. Security and Domain Membership Options: -# This option is important for security. It allows you to restrict -# connections to machines which are on your local network. The -# following example restricts access to two C class networks and -# the "loopback" interface. For more examples of the syntax see -# the smb.conf man page. Do not enable this if (tcp/ip) name resolution does -# not work for all the hosts in your network. -# hosts allow = 192.168.1. 192.168.2. 127. - -# Uncomment this if you want a guest account, you must add this to /etc/passwd -# otherwise the user "nobody" is used -# guest account = pcguest -# Allow users to map to guest: - map to guest = bad user - -# Security mode. Most people will want user level security. See -# security_level.txt for details. - security = user -# Use password server option only with security = server or security = domain -# When using security = domain, you should use password server = * -# password server = <NT-Server-Name> -# password server = * - -# Password Level allows matching of _n_ characters of the password for -# all combinations of upper and lower case. -# password level = 8 -# username level = 8 - -# You may wish to use password encryption. Please read -# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation. -# Do not enable this option unless you have read those documents -# Encrypted passwords are required for any use of samba in a Windows NT domain -# The smbpasswd file is only required by a server doing authentication, thus -# members of a domain do not need one. - encrypt passwords = yes - smb passwd file = /etc/samba/smbpasswd - -# The following are needed to allow password changing from Windows to -# also update the Linux system password. -# NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above. -# NOTE2: You do NOT need these to allow workstations to change only -# the encrypted SMB passwords. They allow the Unix password -# to be kept in sync with the SMB password. -; unix password sync = Yes -# You either need to setup a passwd program and passwd chat, or -# enable pam password change -; pam password change = yes -# passwd program = /usr/bin/passwd %u -; passwd chat = *New*UNIX*password* %n\n *Re*ype*new*UNIX*password* %n\n \ -;*passwd:*all*authentication*tokens*updated*successfully* - -# Unix users can map to different SMB User names -; username map = /etc/samba/smbusers - -# Using the following line enables you to customise your configuration -# on a per machine basis. The %m gets replaced with the netbios name -# of the machine that is connecting -# include = /etc/samba/smb.conf.%m - -# Options for using winbind. Winbind allows you to do all account and -# authentication from a Windows or samba domain controller, creating -# accounts on the fly, and maintaining a mapping of Windows RIDs to unix uid's -# and gid's. winbind uid and winbind gid are the only required parameters. -# -# winbind uid is the range of uid's winbind can use when mapping RIDs to uid's -# idmap uid = 10000-20000 -# -# winbind gid is the range of uid's winbind can use when mapping RIDs to gid's -# idmap gid = 10000-20000 -# -# winbind separator is the character a user must use between their domain -# name and username, defaults to "\" -# winbind separator = + -# -# winbind use default domain allows you to have winbind return usernames -# in the form user instead of DOMAIN+user for the domain listed in the -# workgroup parameter. -# winbind use default domain = yes -# -# template homedir determines the home directory for winbind users, with -# %D expanding to their domain name and %U expanding to their username: -# template homedir = /home/%D/%U - -# When using winbind, you may want to have samba create home directories -# on the fly for authenticated users. Ensure that /etc/pam.d/samba is -# using 'service=system-auth-winbind' in pam_stack modules, and then -# enable obedience of pam restrictions below: -# obey pam restrictions = yes - -# -# template shell determines the shell users authenticated by winbind get -# template shell = /bin/bash - -# 5. Browser Control and Networking Options: -# Most people will find that this option gives better performance. -# See speed.txt and the manual pages for details - socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 - -# Configure Samba to use multiple interfaces -# If you have multiple network interfaces then you must list them -# here. See the man page for details. -# interfaces = 192.168.12.2/24 192.168.13.2/24 - -# Configure remote browse list synchronisation here -# request announcement to, or browse list sync from: -# a specific host or from / to a whole subnet (see below) -# remote browse sync = 192.168.3.25 192.168.5.255 -# Cause this host to announce itself to local subnets here -# remote announce = 192.168.1.255 192.168.2.44 - -# set local master to no if you don't want Samba to become a master -# browser on your network. Otherwise the normal election rules apply -# local master = no - -# OS Level determines the precedence of this server in master browser -# elections. The default value should be reasonable -# os level = 33 - -# Domain Master specifies Samba to be the Domain Master Browser. This -# allows Samba to collate browse lists between subnets. Don't use this -# if you already have a Windows NT domain controller doing this job -# domain master = yes - -# Preferred Master causes Samba to force a local browser election on startup -# and gives it a slightly higher chance of winning the election -# preferred master = yes - -# 6. Domain Control Options: -# Enable this if you want Samba to be a domain logon server for -# Windows95 workstations or Primary Domain Controller for WinNT and Win2k -# domain logons = yes - -# if you enable domain logons then you may want a per-machine or -# per user logon script -# run a specific logon batch file per workstation (machine) -# logon script = %m.bat -# run a specific logon batch file per username -# logon script = %U.bat - -# Where to store roaming profiles for WinNT and Win2k -# %L substitutes for this servers netbios name, %U is username -# You must uncomment the [Profiles] share below -# logon path = \\%L\Profiles\%U - -# Where to store roaming profiles for Win9x. Be careful with this as it also -# impacts where Win2k finds it's /HOME share -# logon home = \\%L\%U\.profile - - -# The add user script is used by a domain member to add local user accounts -# that have been authenticated by the domain controller, or when adding -# users via the Windows NT Tools (ie User Manager for Domains). - -# Scripts for file (passwd, smbpasswd) backend: -# add user script = /usr/sbin/useradd -s /bin/false '%u' -# delete user script = /usr/sbin/userdel '%s' -# add user to group script = /usr/bin/gpasswd -a '%u' '%g' -# delete user from group script = /usr/bin/gpasswd -d '%u' '%g' -# set primary group script = /usr/sbin/usermod -g '%g' '%u' -# add group script = /usr/sbin/groupadd %g && getent group '%g'|awk -F: '{print $3}' -# delete group script = /usr/sbin/groupdel '%g' - -# Scripts for LDAP backend (assumes nss_ldap is in use on the domain controller, -# and needs configuration in smbldap_conf.pm -# add user script = /usr/share/samba/scripts/smbldap-useradd.pl '%u' -# delete user script = /usr/share/samba/scripts/smbldap-userdel.pl '%u' -# add user to group script = /usr/share/samba/scripts/smbldap-groupmod.pl -m '%u' '%g' -# delete user from group script = /usr/share/samba/scripts/smbldap-groupmod.pl -x '%u' '%g' -# set primary group script = /usr/share/samba/scripts/smbldap-usermod.pl -g '%g' '%u' -# add group script = /usr/share/samba/scripts/smbldap-groupadd.pl '%g' && /usr/share/samba/scripts/smbldap-groupshow.pl %g|awk '/^gidNumber:/ {print $2}' -# delete group script = /usr/share/samba/scripts/smbldap-userdel.pl '%g' - - -# The add machine script is use by a samba server configured as a domain -# controller to add local machine accounts when adding machines to the domain. -# The script must work from the command line when replacing the macros, -# or the operation will fail. Check that groups exist if forcing a group. -# Script for domain controller for adding machines: -# add machine script = /usr/sbin/useradd -d /dev/null -g machines -c 'Machine Account' -s /bin/false -M %u -# Script for domain controller with LDAP backend for adding machines (please -# configure in /etc/samba/smbldap_conf.pm first): -# add machine script = /usr/share/samba/scripts/smbldap-useradd.pl -w -d /dev/null -g machines -c 'Machine Account' -s /bin/false %u - -# Domain groups: -# Domain groups are now configured by using the 'net groupmap' tool - -# Samba Password Database configuration: -# Samba now has runtime-configurable password database backends. Multiple -# passdb backends may be used, but users will only be added to the first one -# Default: -# passdb backend = smbpasswd guest -# TDB backen with fallback to smbpasswd and guest -# passdb backend = tdbsam smbpasswd guest -# LDAP with fallback to smbpasswd guest -# Enable SSL by using an ldaps url, or enable tls with 'ldap ssl' below. -# passdb backend = ldapsam:ldaps://ldap.mydomain.com smbpasswd guest -# Use the samba2 LDAP schema: -# passdb backend = ldapsam_compat:ldaps://ldap.mydomain.com smbpasswd guest - -# Idmap settings (set idmap uid and idmap gid above): -# Idmap backend to use: -# idmap backend = ldap:ldap://ldap.mydomain.com - -# LDAP configuration for Domain Controlling: -# The account (dn) that samba uses to access the LDAP server -# This account needs to have write access to the LDAP tree -# You will need to give samba the password for this dn, by -# running 'smbpasswd -w mypassword' -# ldap admin dn = cn=root,dc=mydomain,dc=com -# ldap ssl = start_tls -# start_tls should run on 389, but samba defaults incorrectly to 636 -# ldap port = 389 -# ldap suffix = dc=mydomain,dc=com -# Seperate suffixes are available for machines, users, groups, and idmap, if -# ldap suffix appears first, it is appended to the specific suffix. -# Example for a unix-ish directory layout: -# ldap machine suffix = ou=Hosts -# ldap user suffix = ou=People -# ldap group suffix = ou=Group -# ldap idmap suffix = ou=Idmap -# Example for AD-ish layout: -# ldap machine suffix = cn=Computers -# ldap user suffix = cn=Users -# ldap group suffix = cn=Groups -# ldap idmap suffix = cn=Idmap - - -# 7. Name Resolution Options: -# All NetBIOS names must be resolved to IP Addresses -# 'Name Resolve Order' allows the named resolution mechanism to be specified -# the default order is "host lmhosts wins bcast". "host" means use the unix -# system gethostbyname() function call that will use either /etc/hosts OR -# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf -# and the /etc/resolv.conf file. "host" therefore is system configuration -# dependant. This parameter is most often of use to prevent DNS lookups -# in order to resolve NetBIOS names to IP Addresses. Use with care! -# The example below excludes use of name resolution for machines that are NOT -# on the local network segment -# - OR - are not deliberately to be known via lmhosts or via WINS. -# name resolve order = wins lmhosts bcast - -# Windows Internet Name Serving Support Section: -# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server -# wins support = yes - -# WINS Server - Tells the NMBD components of Samba to be a WINS Client -# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both -# wins server = w.x.y.z - -# WINS Proxy - Tells Samba to answer name resolution queries on -# behalf of a non WINS capable client, for this to work there must be -# at least one WINS Server on the network. The default is NO. -# wins proxy = yes - -# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names -# via DNS nslookups. The built-in default for versions 1.9.17 is yes, -# this has been changed in version 1.9.18 to no. - dns proxy = no - -# 8. File Naming Options: -# Case Preservation can be handy - system default is _no_ -# NOTE: These can be set on a per share basis -# preserve case = no -# short preserve case = no -# Default case is normally upper case for all DOS files -# default case = lower -# Be very careful with case sensitivity - it can break things! -# case sensitive = no - -# Enabling internationalization: -# you can match a Windows code page with a UNIX character set. -# Windows: 437 (US), 737 (GREEK), 850 (Latin1 - Western European), -# 852 (Eastern Eu.), 861 (Icelandic), 932 (Cyrillic - Russian), -# 936 (Japanese - Shift-JIS), 936 (Simpl. Chinese), 949 (Korean Hangul), -# 950 (Trad. Chin.). -# UNIX: ISO8859-1 (Western European), ISO8859-2 (Eastern Eu.), -# ISO8859-5 (Russian Cyrillic), KOI8-R (Alt-Russ. Cyril.) -# This is an example for french users: -# dos charset = 850 -# unix charset = ISO8859-1 - - -#============================ Share Definitions ============================== -[homes] - comment = Home Directories - browseable = no - writable = yes -# You can enable VFS recycle bin and on-access virus-scanning on a per -# share basis: -# Uncomment the next 2 lines (make sure you create a .recycle folder in -# the base of the share and ensure all users will have write access to it. -# For virus scanning, install samba-vscan-clamav and ensure the clamd service -# is running -# vfs objects = vscan-clamav recycle -# vscan-clamav: config-file = /etc/samba/vscan-clamav.conf - -# Un-comment the following and create the netlogon directory for Domain Logons -# [netlogon] -# comment = Network Logon Service -# path = /var/lib/samba/netlogon -# guest ok = yes -# writable = no - -#Uncomment the following 2 lines if you would like your login scripts to -#be created dynamically by ntlogon (check that you have it in the correct -#location (the default of the ntlogon rpm available in contribs) -#root preexec = /usr/bin/ntlogon -u "%U" -g "%G" -o %a -d /var/lib/samba/netlogon/ -#root postexec = rm -f "/var/lib/samba/netlogon/%U.bat" - -# Un-comment the following to provide a specific roving profile share -# the default is to use the user's home directory -#[Profiles] -# path = /var/lib/samba/profiles -# browseable = no -# guest ok = yes -# writable = yes -# This script can be enabled to create profile directories on the fly -# You may want to turn off guest acces if you enable this, as it -# hasn't been thoroughly tested. -#root preexec = PROFILE="/var/lib/samba/profiles/%u"; if [ ! -e $PROFILE ]; \ -# then mkdir -pm700 $PROFILE; chown "%u":"%g" $PROFILE;fi -# If you want read-only profiles, fake permissions so windows clients think -# they have written to the files -# vfs objects = fake_perms - -# NOTE: If you have a CUPS print system there is no need to -# specifically define each individual printer. -# You must configure the samba printers with the appropriate Windows -# drivers on your Windows clients or upload the printer driver to the -# server from Windows (NT/2000/XP). On the Samba server no filtering is -# done. If you wish that the server provides the driver and the clients -# send PostScript ("Generic PostScript Printer" under Windows), you have -# to use 'printcap name = cups' or swap the 'print command' line below -# with the commented one. Note that print commands only work if not using -# 'printing=cups' -[printers] - comment = All Printers - path = /var/spool/samba - browseable = no -# to allow user 'guest account' to print. - guest ok = yes - writable = no - printable = yes - create mode = 0700 -# ===================================== -# print command: see above for details. -# ===================================== - print command = lpr-cups -P %p -o raw %s -r # using client side printer drivers. -# print command = lpr-cups -P %p %s # using cups own drivers (use generic PostScript on clients). -# If you install drivers on the server, you will want to uncomment this so -# clients request the driver - use client driver = yes - -# This share is used for Windows NT-style point-and-print support. -# To be able to install drivers, you need to be either root, or listed -# in the printer admin parameter above. Note that you also need write access -# to the directory and share definition to be able to upload the drivers. -# For more information on this, please see the Printing Support Section of -# /usr/share/doc/samba-<version>/docs/Samba-HOWTO-Collection.pdf -# -# A special case is using the CUPS Windows Postscript driver, which allows -# all features available via CUPS on the client, by publishing the ppd file -# and the cups driver by using the 'cupsaddsmb' tool. This requires the -# installation of the CUPS driver (http://www.cups.org/windows.php) -# on the server, but doesn't require you to use Windows at all :-). -[print$] - path = /var/lib/samba/printers - browseable = yes - write list = @adm root - guest ok = yes - inherit permissions = yes - # Settings suitable for Winbind: - # write list = @"Domain Admins" root - # force group = +@"Domain Admins" - -# A useful application of samba is to make a PDF-generation service -# To streamline this, install windows postscript drivers (preferably colour) -# on the samba server, so that clients can automatically install them. -# Note that this only works if 'printing' is *not* set to 'cups' - -[pdf-gen] - path = /var/tmp - guest ok = No - printable = Yes - comment = PDF Generator (only valid users) - printing = bsd - printcap name = cups - #print command = /usr/share/samba/scripts/print-pdf file path win_path recipient IP & - print command = /usr/share/samba/scripts/print-pdf "%s" "%H" "//%L/%u" "%m" "%I" "%J" & - lpq command = /bin/true - -# This one is useful for people to share files -;[tmp] -; comment = Temporary file space -; path = /tmp -; read only = no -; public = yes - -# A publicly accessible directory, but read only, except for people in -# the "staff" group -;[public] -; comment = Public Stuff -; path = /home/samba/public -; public = yes -; writable = no -; write list = @staff -# Audited directory through experimental VFS audit.so module: -# Uncomment next line. -# vfs object = /usr/lib/samba/vfs/audit.so - -# Other examples. -# -# A private printer, usable only by Fred. Spool data will be placed in Fred's -# home directory. Note that fred must have write access to the spool directory, -# wherever it is. -;[fredsprn] -; comment = Fred's Printer -; valid users = fred -; path = /homes/fred -; printer = freds_printer -; public = no -; writable = no -; printable = yes - -# A private directory, usable only by Fred. Note that Fred requires write -# access to the directory. -;[fredsdir] -; comment = Fred's Service -; path = /usr/somewhere/private -; valid users = fred -; public = no -; writable = yes -; printable = no - -# a service which has a different directory for each machine that connects -# this allows you to tailor configurations to incoming machines. You could -# also use the %u option to tailor it by user name. -# The %m gets replaced with the machine name that is connecting. -;[pchome] -; comment = PC Directories -; path = /usr/pc/%m -; public = no -; writable = yes - -# The following two entries demonstrate how to share a directory so that two -# users can place files there that will be owned by the specific users. In this -# setup, the directory should be writable by both users and should have the -# sticky bit set on it to prevent abuse. Obviously this could be extended to -# as many users as required. -;[myshare] -; comment = Mary's and Fred's stuff -; path = /usr/somewhere/shared -; valid users = mary fred -; public = no -; writable = yes -; printable = no -; create mask = 0765 - |