diff options
-rwxr-xr-x | samba_wizard/Sambashare.pm | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm index d3ca3108..833afa89 100755 --- a/samba_wizard/Sambashare.pm +++ b/samba_wizard/Sambashare.pm @@ -360,7 +360,8 @@ $o->{pages} = { { 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("Public:"), fixed_val => \$o->{var}{wiz_add_user_share_public} }, + { 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) { @@ -379,11 +380,19 @@ $o->{pages} = { 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") . "\n" . N("Comment: description of the share") . "\n", + name => N("Add a public share"), pre => sub { $o->{var}{wiz_add_public_share_browseable} = "yes"; $o->{var}{wiz_add_public_share_public} = "yes"; @@ -567,10 +576,10 @@ $o->{pages} = { pre => sub { }, 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("Public:"), fixed_val => \$o->{var}{wiz_add_user_share_public} }, + { label => N("Name of the share:"), fixed_val => \$o->{var}{wiz_add_user_share_name} }, + { label => N("Comment:"), fixed_val => \$o->{var}{wiz_add_user_share_comment} }, + { label => N("Path:"), fixed_val => \$o->{var}{wiz_add_user_share_path} }, + { label => N("Write list:"), fixed_val => \$o->{var}{wiz_add_user_share_writelist} }, ], post => \&do_it_add_user_share, next => 'end_add_user_share', @@ -844,9 +853,7 @@ sub do_it_add_user_share { $samba->{$share}{path} = $o->{var}{wiz_add_user_share_path}; $samba->{$share}{'write list'} = $o->{var}{wiz_add_user_share_writelist}; - if ($o->{var}{wiz_owner}) { - system("chown -R $o->{var}{wiz_add_user_share_writelist}.users $o->{var}{wiz_add_user_share_path}"); - } + 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(); |