summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsamba_wizard/Samba.pm151
1 files changed, 93 insertions, 58 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index 1ebdcdfc..54f14d80 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -47,29 +47,19 @@ my $o = {
wiz_do_file_sharing => '',
wiz_all_printers => '',
wiz_level => '',
- wiz_printers => '',
- wiz_do_printer_sharing => '',
- wiz_printers_comment => '',
- wiz_printers_browseable => '',
- wiz_printers_guestok => '',
- wiz_printers_createmode => '',
+ wiz_printers => '', wiz_do_printer_sharing => '', wiz_printers_comment => '',
+ wiz_printers_browseable => '', wiz_printers_guestok => '', wiz_printers_createmode => '',
wiz_do_homes => '',
wiz_workgroup => '',
wiz_dir => '',
- wiz_share_comment => '',
- wiz_share_browseable => '',
- wiz_share_writable => '',
+ wiz_share_comment => '', wiz_share_browseable => '', wiz_share_writable => '',
wiz_banner => '',
wiz_write_list => '',
wiz_read_list => '',
wiz_hosts_deny => '',
- wiz_log_file => '',
- wiz_log_level => '',
- wiz_max_log_size => '',
+ wiz_log_file => '', wiz_log_level => '', wiz_max_log_size => '',
list_printers => '',
- wiz_home_writable => '',
- wiz_home_browseable => '',
- wiz_home_createmode => '',
+ wiz_home_writable => '', wiz_home_browseable => '', wiz_home_createmode => '',
wiz_home_comment => '',
wiz_local_master => '',
wiz_os_level => '',
@@ -77,18 +67,12 @@ my $o = {
wiz_domain_logons => '',
wiz_domain_master => '',
wiz_password_server => '',
- wiz_passdb_backend => '',
- wiz_passdb_backend_yn => '',
+ wiz_passdb_backend => '', wiz_passdb_backend_yn => '',
wiz_domain => '',
- wiz_ldap_admin_dn => '',
- wiz_ldap_suffix => '',
- wiz_ldap_root_pw => '',
- wiz_ldap_root_pw_2 => '',
- wiz_addshare_comment => '',
- wiz_addshare_browseable => '',
- wiz_addshare_writable => '',
- wiz_addshare_createmode => '',
- wiz_selected_share => '',
+ wiz_ldap_admin_dn => '', wiz_ldap_suffix => '', wiz_ldap_root_pw => '', wiz_ldap_root_pw_2 => '',
+ wiz_addshare_comment => '', wiz_addshare_browseable => '', wiz_addshare_writable => '',
+ wiz_addshare_createmode => '', wiz_addshare_dotfiles => '',
+ wiz_selected_share => '',
wiz_selected_share_comment => '',
},
init => sub {
@@ -125,7 +109,7 @@ my %share = (
4 => N('CDrom - share a CDrom'),
);
-my @yesorno = qw(yes no);
+my @yesorno = qw(yes no);# push @yesorno, " ";
my @loglevel = qw(0 1 2 3 4 5 6 7 8 9 10);
$o->{pages} = {
@@ -166,6 +150,11 @@ $o->{pages} = {
$o->{var}{wiz_security} = "user";
$o->{var}{wiz_domain_logons} = "yes";
$o->{var}{wiz_wins_support} ||= $samba->{global}{'wins support'};
+ if ($samba->{'os level'}) {
+ $o->{var}{wiz_oslevel} = $samba->{'os level'};
+ } else {
+ $o->{var}{wiz_oslevel} = "64";
+ }
if ($samba->{global}{'passdb backend'}) {
$o->{var}{wiz_passdb_backend_yn} = "yes"
} else {
@@ -180,6 +169,7 @@ $o->{pages} = {
{ label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} },
{ label => N('Security:'), fixed_val => \$o->{var}{wiz_security} },
{ label => N('Wins support:'), val => \$o->{var}{wiz_wins_support}, fixed_list => \@yesorno },
+ { label => N('Os level:'), fixed_val => \$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 {
@@ -195,7 +185,12 @@ $o->{pages} = {
pre => sub {
$o->{var}{wiz_domain_master} = "no";
$o->{var}{wiz_security} = "user";
- },
+ if ($samba->{'os level'}) {
+ $o->{var}{wiz_oslevel} = $samba->{'os level'};
+ } else {
+ $o->{var}{wiz_oslevel} = "64";
+ }
+ },
data => [
{ label => N('Security:'), fixed_val => \$o->{var}{wiz_security} },
{ label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} },
@@ -277,7 +272,7 @@ $o->{pages} = {
},
},
delete_share => {
- name => N('Remove a share ?'),
+ name => N('Remove a share'),
pre => sub {
my $dshare = $o->{var}{wiz_selected_share};
$o->{var}{wiz_selected_share_comment} = $samba->{$dshare}{comment};
@@ -295,6 +290,7 @@ $o->{pages} = {
$o->{var}{wiz_share_comment} = $samba->{$share}{comment};
$o->{var}{wiz_add_share_writable} = $samba->{$share}{writable};
$o->{var}{wiz_share_browseable} = $samba->{$share}{browseable};
+ $o->{var}{wiz_share_path} = $samba->{$share}{path};
$o->{var}{wiz_share_public} = $samba->{$share}{public};
},
complete => sub {
@@ -306,24 +302,28 @@ $o->{pages} = {
data => [
{ label => N('Name of the share:'), fixed_val => \$o->{var}{wiz_selected_share} },
{ label => N('Comment:'), val => \$o->{var}{wiz_share_comment} },
- { label => N('Browseable:'), val => \$o->{var}{wiz_share_browseable}, fixed_list => \@yesorno },
+ { label => N('Path:'), val => \$o->{var}{wiz_share_path} },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_share_browseable}, fixed_list => \@yesorno, help => N("Allows share to be displayed in list of share.") },
{ label => N('Writable:'), val => \$o->{var}{wiz_share_writable}, fixed_list => \@yesorno },
{ label => N('Public:'), val => \$o->{var}{wiz_share_public}, fixed_list => \@yesorno },
],
next => 'modify_share_options',
},
modify_share_options => {
- name => N('Modify a share'),
+ name => N('Modify a share') . "\n\n" . N('Advanced options, use them if you know what you are doing.'),
pre => sub {
my $share = $o->{var}{wiz_selected_share};
$o->{var}{wiz_share_createmode} = $samba->{$share}{'create mode'};
$o->{var}{wiz_share_readlist} = exists $samba->{$share}{'read list'};
$o->{var}{wiz_share_writelist} = exists $samba->{$share}{'write list'};
+ $o->{var}{wiz_share_dotfiles} = exists $samba->{$share}{'hide dot files'};
},
data => [
{ label => N('Create mode:'), val => \$o->{var}{wiz_share_createmode} },
- { label => N('Read list:'), val => \$o->{var}{wiz_share_readlist}, help => N('root fred @users @wheel') },
- { label => N('Write list:'), val => \$o->{var}{wiz_share_writelist}, help => N('root fred @users @wheel') },
+ { 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: root fred @users @wheel') },
+ { label => N('Write list:'), val => \$o->{var}{wiz_share_writelist}, help => N('Specifies a list of users that have read-write access to a read-only share. ie: root fred @users @wheel') },
+ { label => N('Show dot files:'), val => \$o->{var}{wiz_share_dotfiles}, fixed_list => \@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_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/") },
],
next => 'summary_modify',
},
@@ -332,7 +332,8 @@ $o->{pages} = {
data => [
{ label => N('Name of the share:'), val => \$o->{var}{wiz_addshare_name} },
{ label => N('Comment:'), val => \$o->{var}{wiz_addshare_comment} },
- { label => N('Browseable:'), val => \$o->{var}{wiz_addshare_browseable}, fixed_list => \@yesorno },
+ { label => N('Path:'), val => \$o->{var}{wiz_addshare_path} },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_addshare_browseable}, fixed_list => \@yesorno, help => N("Allows share to be displayed in list of share.") },
{ label => N('Public:'), val => \$o->{var}{wiz_addshare_public}, fixed_list => \@yesorno },
],
complete => sub {
@@ -365,7 +366,7 @@ $o->{pages} = {
},
data => [
{ label => N('Comment:'), fixed_val => \$o->{var}{wiz_cdrom_comment} },
- { label => N('Cdrom path:'), fixed_val => \$o->{var}{wiz_cdrom_path} },
+ { label => N('CDrom path:'), fixed_val => \$o->{var}{wiz_cdrom_path} },
{ label => N('Browseable:'), fixed_val => \$o->{var}{wiz_cdrom_browseable} },
{ label => N('Root preexec:'), fixed_val => \$o->{var}{wiz_cdrom_pre} },
{ label => N('Root postexec:'), fixed_val => \$o->{var}{wiz_cdrom_post} },
@@ -374,7 +375,7 @@ $o->{pages} = {
next => 'summary_addcdromshare',
},
add_share_options => {
- name => N('Add a share') . "\n" . N('If you doesn\'t want to use one this options, leave it blanck.'),
+ name => N('Add a share') . "\n" . N('If you doesn\'t want to use one of this options, leave it blanck.'),
pre => sub {
$o->{var}{wiz_addshare_createmode} = "0700";
$o->{var}{wiz_addshare_public} = "no";
@@ -382,8 +383,10 @@ $o->{pages} = {
data => [
{ label => N('Writable:'), val => \$o->{var}{wiz_addshare_writable}, fixed_list => \@yesorno },
{ label => N('Create mode:'), val => \$o->{var}{wiz_addshare_createmode} },
- { label => N('Read list:'), val => \$o->{var}{wiz_addshare_readlist}, help => N('root fred @users @wheel') },
- { label => N('Write list:'), val => \$o->{var}{wiz_addshare_writelist}, help => N('root fred @users @wheel') }
+ { 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: root fred @users @wheel') },
+ { label => N('Write list:'), val => \$o->{var}{wiz_addshare_writelist}, help => N('Specifies a lis\t of users that have read-write access to a read-only share. ie: root fred @users @wheel') },
+ { label => N('Show dot files:'), val => \$o->{var}{wiz_addshare_dotfiles}, fixed_list => \@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/") },
],
next => 'summary_addshare',
},
@@ -530,7 +533,7 @@ $o->{pages} = {
data => [
{ label => N('Comment:'), val => \$o->{var}{wiz_share_comment} },
{ label => N('Shared directory:'), val => \$o->{var}{wiz_dir} },
- { label => N('Browseable:'), val => \$o->{var}{wiz_share_browseable}, fixed_list => \@yesorno },
+ { label => N('Browseable:'), val => \$o->{var}{wiz_share_browseable}, fixed_list => \@yesorno, help => N("Allows share to be displayed in list of share.") },
{ label => N('Writable:'), val => \$o->{var}{wiz_share_writable}, fixed_list => \@yesorno },
{ text => N("Create shared directory if it doesn't exist"), type => 'bool', val => \$o->{var}{create_missing_directory} },
],
@@ -560,8 +563,8 @@ $o->{pages} = {
}
},
data => [
- { label => N('read list:'), help => N('root fred @users @wheel'), val => \$o->{var}{wiz_read_list} },
- { label => N('write list:'), help => N('root fred @users @wheel'), val => \$o->{var}{wiz_write_list} },
+ { label => N('read list:'), help => N('Specifies a list of users that have read-only access to a writable share. ie: root fred @users @wheel'), val => \$o->{var}{wiz_read_list} },
+ { label => N('write list:'), help => N('Specifies a list of users that have read-write access to a read-only share. ie: root fred @users @wheel'), val => \$o->{var}{wiz_write_list} },
],
next => 'summary',
},
@@ -641,6 +644,8 @@ $o->{pages} = {
{ label => N('Create mode:'), fixed_val => \$o->{var}{wiz_share_createmode} },
{ label => N('Read list:'), fixed_val => \$o->{var}{wiz_share_readlist} },
{ label => N('Write list:'), fixed_val => \$o->{var}{wiz_share_writelist} },
+ { label => N('Show dot files:'), fixed_val => \$o->{var}{wiz_share_dotfiles} },
+ { label => N('Hide files:'), fixed_val => \$o->{var}{wiz_share_hidefiles} },
],
post => \&do_it_modify_share,
next => 'end_modify_share',
@@ -670,6 +675,7 @@ $o->{pages} = {
{ label => N('Create mode:'), fixed_val => \$o->{var}{wiz_addshare_createmode} },
{ label => N('Read list:'), fixed_val => \$o->{var}{wiz_addshare_readlist} },
{ label => N('Write list:'), fixed_val => \$o->{var}{wiz_addshare_writelist} },
+ { label => N('Show dot files:'), fixed_val => \$o->{var}{wiz_addshare_dotfiles} },
],
next => 'end_add_share',
},
@@ -827,23 +833,34 @@ sub printer_sharing() {
}
sub global_special_options() {
- $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_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_domain} and $samba->{global}{domain} = $o->{var}{wiz_domain};
- # ldap options
- if ($o->{var}{wiz_passdb_backend_yn} == "yes" ) {
- $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend};
- $samba->{global}{'ldap admin_dn'} = $o->{var}{wiz_ldap_admin_dn};
- $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix};
- }
- # 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'};
+ # detect Samab type 3 is standalone
+ if ($o->{var}{wiz_type} == "3") {
+ exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'};
+ $samba->{global}{'security'} = "share";
+ 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_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_domain} and $samba->{global}{domain} = $o->{var}{wiz_domain};
+ # ldap options if needed
+ if ($o->{var}{wiz_passdb_backend_yn} == "yes" ) {
+ $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend};
+ $samba->{global}{'ldap admin_dn'} = $o->{var}{wiz_ldap_admin_dn};
+ $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix};
+ }
+ # 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'};
+ }
}
sub get_printers() {
@@ -882,31 +899,41 @@ sub write_conf_restart_smb {
sub do_it_remove_share {
$::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
my $share = $o->{var}{wiz_selected_share};
delete $samba->{$share};
write_conf_restart_smb();
+ undef $w;
check_started('smbd');
}
sub do_it_modify_share {
$::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
my $share = $o->{var}{wiz_selected_share};
$samba->{$share};
$samba->{$share}{comment} = $o->{var}{wiz_share_comment};
$samba->{$share}{browseable} = $o->{var}{wiz_share_browseable};
$samba->{$share}{writable} = $o->{var}{wiz_share_writable};
$samba->{$share}{public} = $o->{var}{wiz_share_public};
+ $o->{var}{wiz_share_hidefiles} and $samba->{$share}{'hide files'} = $o->{var}{wiz_share_hidefiles};
+ $o->{var}{wiz_share_dotfiles} and $samba->{$share}{'hide dot files'} = $o->{var}{wiz_share_dotfiles};
$o->{var}{wiz_share_readlist} and $samba->{$share}{'read list'} = $o->{var}{wiz_share_readlist};
$o->{var}{wiz_share_writelist} and $samba->{$share}{'write list'} = $o->{var}{wiz_share_writelist};
$o->{var}{wiz_share_createmode} and $samba->{$share}{'create mode'} = $o->{var}{wiz_share_createmode};
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 server"), N("Configuring your Samba server..."));
$samba->{cdrom}{comment} = $o->{var}{wiz_cdrom_comment};
$samba->{cdrom}{path} = $o->{var}{wiz_cdrom_path};
$samba->{cdrom}{path} = $o->{var}{wiz_cdrom_path};
@@ -916,22 +943,30 @@ sub do_it_add_cdromshare {
$samba->{cdrom}{public} = $o->{var}{wiz_cdrom_public};
write_conf_restart_smb();
+ undef $w;
check_started('smbd');
}
sub do_it_add_share {
$::testing and return;
+ my $in = 'interactive'->vnew('su', 'Samba');
+ my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
+
my $share = $o->{var}{wiz_addshare_name};
$samba->{$share};
$samba->{$share}{comment} = $o->{var}{wiz_addshare_comment};
+ $samba->{$share}{path} = $o->{var}{wiz_addshare_path};
$samba->{$share}{browseable} = $o->{var}{wiz_addshare_browseable};
$samba->{$share}{writable} = $o->{var}{wiz_addshare_writable};
$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};
$o->{var}{wiz_addshare_readlist} and $samba->{$share}{'read list'} = $o->{var}{wiz_addshare_readlist};
$o->{var}{wiz_addshare_writelist} and $samba->{$share}{'write list'} = $o->{var}{wiz_addshare_writelist};
$o->{var}{wiz_addshare_createmode} and $samba->{$share}{'create mode'} = $o->{var}{wiz_addshare_createmode};
write_conf_restart_smb();
+ undef $w;
check_started('smbd');
}