summaryrefslogtreecommitdiffstats
path: root/samba_wizard/Sambashare.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-06-10 02:49:23 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-06-10 02:49:23 +0000
commitc99b76ee6993dba6bd420e5d1efb9d8dd84bef61 (patch)
treeba87e0f88b9a2bc75a3c9ad21ddb35717e3df393 /samba_wizard/Sambashare.pm
parent659193ac7a4af0d5392f7f556d7467186550db09 (diff)
downloaddrakwizard-c99b76ee6993dba6bd420e5d1efb9d8dd84bef61.tar
drakwizard-c99b76ee6993dba6bd420e5d1efb9d8dd84bef61.tar.gz
drakwizard-c99b76ee6993dba6bd420e5d1efb9d8dd84bef61.tar.bz2
drakwizard-c99b76ee6993dba6bd420e5d1efb9d8dd84bef61.tar.xz
drakwizard-c99b76ee6993dba6bd420e5d1efb9d8dd84bef61.zip
fix write_list read_list options
Diffstat (limited to 'samba_wizard/Sambashare.pm')
-rwxr-xr-xsamba_wizard/Sambashare.pm44
1 files changed, 36 insertions, 8 deletions
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm
index ee86edac..d3394434 100755
--- a/samba_wizard/Sambashare.pm
+++ b/samba_wizard/Sambashare.pm
@@ -94,7 +94,7 @@ $o->{pages} = {
$o->{var}{wiz_share} = 1;
},
data => [
- { label => N("what do you want:"), val => \$o->{var}{wiz_share}, type => 'list', list => [ keys %share ], format => sub { $share{$_[0]} } },
+ { label => '', val => \$o->{var}{wiz_share}, type => 'list', list => [ keys %share ], format => sub { $share{$_[0]} } },
],
post => sub {
if ($o->{var}{wiz_share} == 1) {
@@ -121,7 +121,7 @@ $o->{pages} = {
name => N('Delete wich share ?') . "\n\n" . N('Please choose the share you want to remove.'),
pre => \&list_all_shares,
data => [
- { label => N('Share you want to delete:'), val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare },
+ { label => '', type => 'list', val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare },
],
next => 'summary_delete',
},
@@ -129,7 +129,7 @@ $o->{pages} = {
name => N('Modify wich share ?') . "\n\n" . N('Please choose the share you want to modify.'),
pre => \&list_all_shares_to_modify,
data => [
- { label => N('Share you want to modify:'), val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare_tomodify },
+ { label => '', type => 'list', val => \$o->{var}{wiz_selected_share}, fixed_list => \@listshare_tomodify },
],
next => 'modify_share',
},
@@ -186,13 +186,26 @@ $o->{pages} = {
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: 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('valid users'), val => \$o->{var}{wiz_share_valid_users}, help => N('To restrict the share to a particular set of users. If this is empty (the default) then any user can login. ie: guibo, anne') },
+ { label => N('Read list:'), val => \$o->{var}{wiz_share_readlist}, help => N('Specifies a list of user 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 read-only share. ie: fred') },
+ { label => N('valid user'), 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('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 (.)") },
],
+ complete => sub {
+ map { my $user = $_;
+ 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};
+ if ($o->{var}{wiz_share_writelist} !~ /^\w+$/ and $o->{var}{wiz_share_writelist} or
+ $o->{var}{wiz_share_readlist} !~ /^\w+$/ and $o->{var}{wiz_share_readlist} or
+ $o->{var}{wiz_share_valid_users} !~ /^\w+$/ and $o->{var}{wiz_share_valid_users}) {
+ $::in->ask_warn(N('Error'), N('Please enter a unique user name for: "write list", "read list" and "valid user".'));
+ return 1; }
+ },
next => 'modify_share_options2',
},
modify_share_options2 => {
@@ -283,11 +296,24 @@ $o->{pages} = {
data => [
{ label => N('Writable:'), val => \$o->{var}{wiz_addshare_writable}, fixed_list => \@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: 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('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 lis\t of users that have read-write access to a read-only share. ie: fredl') },
{ 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/") },
],
+ complete => sub {
+ map { my $user = $_;
+ 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_share_writelist} !~ /^\w+$/ and $o->{var}{wiz_share_writelist} or
+ $o->{var}{wiz_share_readlist} !~ /^\w+$/ and $o->{var}{wiz_share_readlist}) {
+ $::in->ask_warn(N('Error'), N('Please enter a unique user name for: "write list", "read list" and "valid user".'));
+ return 1; }
+ },
+
next => 'summary_addshare',
},
add_homes => {
@@ -486,6 +512,7 @@ sub do_it_modify_share {
if ($o->{var}{wiz_understanding} == 2) {
$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};
+ system("chown -R $o->{var}{wiz_share_writelist}.users $o->{var}{wiz_share_path}");
$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_valid_users} and $samba->{$share}{'valid users'} = $o->{var}{wiz_share_valid_users};
@@ -553,6 +580,7 @@ sub do_it_add_share {
$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};
+ system("chown -R $o->{var}{wiz_addshare_writelist}.users $o->{var}{wiz_addshare_path}");
$o->{var}{wiz_addshare_create_mask} and $samba->{$share}{'create mask'} = $o->{var}{wiz_addshare_create_mask};
write_conf_restart_smb();