summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-07-13 01:48:26 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-07-13 01:48:26 +0000
commitd68dfd7deceba0238e5ffdd737925560f48d2259 (patch)
treeef3fa28980bbfe15f43e78396b9e497dbec085e6
parent3401da7a59bf48c009687db0b1ddae6df391fff7 (diff)
downloaddrakwizard-d68dfd7deceba0238e5ffdd737925560f48d2259.tar
drakwizard-d68dfd7deceba0238e5ffdd737925560f48d2259.tar.gz
drakwizard-d68dfd7deceba0238e5ffdd737925560f48d2259.tar.bz2
drakwizard-d68dfd7deceba0238e5ffdd737925560f48d2259.tar.xz
drakwizard-d68dfd7deceba0238e5ffdd737925560f48d2259.zip
various fix and add test for create_mode, create_mask, create_directory
-rwxr-xr-xsamba_wizard/Sambashare.pm272
1 files changed, 160 insertions, 112 deletions
diff --git a/samba_wizard/Sambashare.pm b/samba_wizard/Sambashare.pm
index be578f08..d81fcbe2 100755
--- a/samba_wizard/Sambashare.pm
+++ b/samba_wizard/Sambashare.pm
@@ -62,21 +62,22 @@ my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb
#print Dumper($samba);
my %level = (
- 1 => N('All - No access restriction'),
- 2 => N('My rules - Ask me allowed and denied hosts')
+ 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'),
+ 1 => N("Newbie - classical options"),
+ 2 => N("Expert - advanced options"),
);
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'),
+ 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, "";
@@ -85,7 +86,7 @@ my $wiz_samba_etc = "/etc/sysconfig/wizard_samba";
$o->{pages} = {
welcome => {
- name => N('What do you want todo with your share?') . "\n\n" . N('add/remove/modify a share'),
+ name => N("What do you want todo with your share ?") . "\n\n" . N("add/remove/modify a share"),
pre => sub {
if (! -f $wiz_samba_etc) {
$::in->ask_warn(N("Information"), N("It seems that you don\'t setup a Samba server. Please setup a Samba server with Samba wizard before manage your share."));
@@ -107,18 +108,20 @@ $o->{pages} = {
return 'add_cdrom_share' }
elsif ($o->{var}{wiz_share} == 5) {
return 'add_homes' }
+ elsif ($o->{var}{wiz_share} == 6) {
+ return 'add_profiles' }
},
no_back => 1,
},
understanding => {
- name => N('Now i need to know your undestanding in Samba server configuration'),
+ name => N("Now i need to know your undestanding 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 => 'choose_share_to_modify',
},
choose_share_to_delete => {
- name => N('Delete which share?') . "\n\n" . N('Please choose the share you want to remove.'),
+ 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}, fixed_list => \@listshare },
@@ -126,7 +129,7 @@ $o->{pages} = {
next => 'summary_delete',
},
choose_share_to_modify => {
- name => N('Modify which share?') . "\n\n" . N('Please choose the share you want 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}, fixed_list => \@listshare_tomodify },
@@ -134,7 +137,7 @@ $o->{pages} = {
next => 'modify_share',
},
modify_share => {
- name => N('Modify a 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."));
@@ -150,7 +153,7 @@ $o->{pages} = {
},
complete => sub {
if (!($o->{var}{wiz_share_comment})) {
- $::in->ask_warn(N('Error'), N('Please enter a share comment.'));
+ $::in->ask_warn(N("Error"), N("Please enter a share comment."));
return 1;
}
},
@@ -164,18 +167,18 @@ $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}, 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}, 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, help => ('Inverted synonym for read only.') },
- { label => N('Public:'), val => \$o->{var}{wiz_share_public}, fixed_list => \@yesorno },
+ { label => N("Name of the share:"), fixed_val => \$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}, 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, help => ('Inverted synonym for read only.') },
+ { label => N("Public:"), val => \$o->{var}{wiz_share_public}, fixed_list => \@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.'),
+ 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'};
@@ -187,21 +190,21 @@ $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 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 share. ie: fred') },
- { label => N('User own directory:'), type => 'bool', val => \$o->{var}{wiz_owner} },
- { 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 (.)") },
+ { 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 share. ie: fred") },
+ { label => N("User own directory:"), type => 'bool', val => \$o->{var}{wiz_owner} },
+ { 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 @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; $_
+ 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};
@@ -209,7 +212,7 @@ $o->{pages} = {
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.'),
+ 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'};
@@ -221,28 +224,30 @@ $o->{pages} = {
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. Default: 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}, fixed_list => \@scase, help => N('lower or upper') },
- { label => N('preserve case'), val => \$o->{var}{wiz_share_preserve_case}, fixed_list => \@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') },
+ { 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. Default: 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}, fixed_list => \@scase, help => N("lower or upper") },
+ { label => N("preserve case"), val => \$o->{var}{wiz_share_preserve_case}, fixed_list => \@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 {
- if ($o->{var}{wiz_share_create_mask} and $o->{var}{wiz_share_create_mask} !~ /\d+/) {
- $::in->ask_warn(N("Error"), N("Create mask should be a number. ie: 0755.")) and return 1;
- }
+ map {
+ if ($_ !~ /^\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'),
+ 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}, 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 },
+ { 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}, 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 {
foreach my $clef (keys %$samba) {
@@ -259,13 +264,14 @@ $o->{pages} = {
}
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."));
+ system("chmod 755 $o->{var}{wiz_addshare_path}");
return 1;
} else { return 0 }
},
next => 'add_share_options',
},
add_cdrom_share => {
- name => N('Share a CDROM'),
+ name => N("Share a CDROM"),
pre => sub {
if ($samba->{cdrom}{comment}) {
$o->{var}{wiz_cdrom_comment} = $samba->{cdrom}{comment};
@@ -273,7 +279,7 @@ $o->{pages} = {
$o->{var}{wiz_cdrom_comment} = "%L CDrom";
}
if ($samba->{cdrom}{path}) {
- $o->{var}{wiz_cdrom_path} = $samba->{cdrom}{path}
+ $o->{var}{wiz_cdrom_path} = $samba->{cdrom}{path};
} else {
$o->{var}{wiz_cdrom_path} = "/mnt/cdrom";
}
@@ -283,47 +289,47 @@ $o->{pages} = {
$o->{var}{wiz_cdrom_public} = "yes";
},
data => [
- { label => N('Comment:'), fixed_val => \$o->{var}{wiz_cdrom_comment} },
- { 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} },
- { label => N('Public:'), fixed_val => \$o->{var}{wiz_cdrom_public} },
+ { label => N("Comment:"), fixed_val => \$o->{var}{wiz_cdrom_comment} },
+ { 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} },
+ { label => N("Public:"), fixed_val => \$o->{var}{wiz_cdrom_public} },
],
next => 'summary_addcdromshare',
},
add_share_options => {
- name => N('Add a share') . "\n" . N('If you don\'t want to use one of this options, leave it blanck.'),
+ name => N("Add a share") . "\n" . N("If you don\'t want to use one of this options, leave it blanck."),
pre => sub {
$o->{var}{wiz_addshare_createmode} = "0700";
$o->{var}{wiz_owner} = 1;
},
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: aginies') },
- { label => N('Write list:'), val => \$o->{var}{wiz_addshare_writelist}, help => N('Specifie 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('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/") },
+ { 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: aginies") },
+ { label => N("Write list:"), val => \$o->{var}{wiz_addshare_writelist}, help => N("Specifie 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("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 @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; $_
+ 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+/) {
+ 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'),
+ 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};
@@ -339,80 +345,102 @@ $o->{pages} = {
}
},
data => [
- { label => N('Comment:'), val => \$o->{var}{wiz_home_comment} },
- { label => N('Browseable:'), val => \$o->{var}{wiz_home_browseable}, fixed_list => \@yesorno },
- { label => N('Writable:'), val => \$o->{var}{wiz_home_writable}, fixed_list => \@yesorno },
- { label => N('Create mode:'), val => \$o->{var}{wiz_home_createmode} },
+ { label => N("Comment:"), val => \$o->{var}{wiz_home_comment} },
+ { label => N("Browseable:"), val => \$o->{var}{wiz_home_browseable}, fixed_list => \@yesorno },
+ { label => N("Writable:"), val => \$o->{var}{wiz_home_writable}, fixed_list => \@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_browseable} = "no";
+ $o->{var}{wiz_profiles_guest_ok} = "yes";
+ $o->{var}{wiz_profiles_writable} = "yes";
+ },
+ data => [
+ { label => N("Path:"), fixed_val => \$o->{var}{wiz_profiles_path} },
+ { label => N("Browseable:"), fixed_val => \$o->{var}{wiz_profiles_browseable} },
+ { label => N("Guest access:"), fixed_val => \$o->{var}{wiz_profiles_guest_ok} },
+ { label => N("Writable:"), fixed_val => \$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 this share, click the Next button or use the Back button.'),
+ name => N("Summary add home share") . "\n\n" . N("If you really want to add this this share, click the Next button or use the Back button."),
post => \&do_it_add_homeshare,
data => [
- { label => N('Comment:'), fixed_val => \$o->{var}{wiz_home_comment} },
- { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_home_browseable}, },
- { label => N('Writable:'), fixed_val => \$o->{var}{wiz_home_writable}, },
- { label => N('Create mode:'), fixed_val => \$o->{var}{wiz_home_createmode} },
+ { label => N("Comment:"), fixed_val => \$o->{var}{wiz_home_comment} },
+ { label => N("Browseable:"), fixed_val => \$o->{var}{wiz_home_browseable}, },
+ { label => N("Writable:"), fixed_val => \$o->{var}{wiz_home_writable}, },
+ { label => N("Create mode:"), fixed_val => \$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.'),
+ 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:'), fixed_val => \$o->{var}{wiz_selected_share} },
- { label => N('Comment:'), fixed_val => \$o->{var}{wiz_share_comment} },
- { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_share_browseable} },
- { label => N('Writable:'), fixed_val => \$o->{var}{wiz_share_writable} },
- { label => N('Public:'), fixed_val => \$o->{var}{wiz_share_public} },
+ { label => N("Name of the share:"), fixed_val => \$o->{var}{wiz_selected_share} },
+ { label => N("Comment:"), fixed_val => \$o->{var}{wiz_share_comment} },
+ { label => N("Browseable:"), fixed_val => \$o->{var}{wiz_share_browseable} },
+ { label => N("Writable:"), fixed_val => \$o->{var}{wiz_share_writable} },
+ { label => N("Public:"), fixed_val => \$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.'),
+ 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:'), fixed_val => \$o->{var}{wiz_cdrom_comment} },
- { 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} },
- { label => N('Public:'), fixed_val => \$o->{var}{wiz_cdrom_public} },
+ { label => N("Comment:"), fixed_val => \$o->{var}{wiz_cdrom_comment} },
+ { 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} },
+ { label => N("Public:"), fixed_val => \$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 this share, click the Next button or use the Back button.'),
+ name => N("Summary add share") . "\n\n" . N("If you really want to add this this share, click the Next button or use the Back button."),
post => \&do_it_add_share,
data => [
- { label => N('Name of the share:'), fixed_val => \$o->{var}{wiz_addshare_name} },
- { label => N('Comment:'), fixed_val => \$o->{var}{wiz_addshare_comment} },
- { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_addshare_browseable} },
- { label => N('Create mask:'), fixed_val => \$o->{var}{wiz_addshare_createmask} },
- { label => N('Writable:'), fixed_val => \$o->{var}{wiz_addshare_writable} },
- { label => N('Public:'), fixed_val => \$o->{var}{wiz_addshare_public} },
- { 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} },
+ { label => N("Name of the share:"), fixed_val => \$o->{var}{wiz_addshare_name} },
+ { label => N("Comment:"), fixed_val => \$o->{var}{wiz_addshare_comment} },
+ { label => N("Browseable:"), fixed_val => \$o->{var}{wiz_addshare_browseable} },
+ { label => N("Create mask:"), fixed_val => \$o->{var}{wiz_addshare_createmask} },
+ { label => N("Writable:"), fixed_val => \$o->{var}{wiz_addshare_writable} },
+ { label => N("Public:"), fixed_val => \$o->{var}{wiz_addshare_public} },
+ { 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',
},
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.'),
+ 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:'), fixed_val => \$o->{var}{wiz_selected_share} },
- { label => N('Comment for this share:'), fixed_val => \$o->{var}{wiz_selected_share_comment} },
+ { label => N("Delete this share:"), fixed_val => \$o->{var}{wiz_selected_share} },
+ { label => N("Comment for this share:"), fixed_val => \$o->{var}{wiz_selected_share_comment} },
],
post => \&do_it_remove_share,
next => 'end_delete_share',
},
end => {
- name => N('Congratulations') . "\n\n" . N('The wizard successfully configured your Samba samba.'),
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Samba samba."),
post => sub {
store_samba_type($o->{var}{wiz_type});
},
@@ -420,17 +448,22 @@ $o->{pages} = {
next => 0
},
end_modify_share => {
- name => N('Congratulations') . "\n\n" . N('The wizard successfully modify your share.'),
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully modify your share."),
end => 1,
next => 0
},
end_add_share => {
- name => N('Congratulations') . "\n\n" . N('The wizard successfully add your share.'),
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully add your share."),
+ end => 1,
+ next => 0
+ },
+ end_add_profiles => {
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully add your Profiles share."),
end => 1,
next => 0
},
end_delete_share => {
- name => N('Congratulations') . "\n\n" . N('The wizard successfully remove your share.'),
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully remove your share."),
end => 1,
next => 0
},
@@ -461,7 +494,7 @@ sub list_all_shares_to_modify() {
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 =~ /homes/) {
+ } elsif ($clef =~ /global/ or $clef =~ /print\$/ or $clef =~ /cdrom/ or $clef =~ /homes/ or $clef =~ /profiles/) {
print "unwanted\n";
} else {
push @listshare_tomodify, $clef;
@@ -487,7 +520,7 @@ sub list_all_shares() {
sub write_conf_restart_smb {
$samba->write_conf("/etc/samba/smb.conf");
if (services::is_service_running('smb')) {
- services::restart('smb')
+ services::restart('smb');
} else { services::start('smb') }
}
@@ -522,7 +555,7 @@ sub do_it_modify_share {
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}));
+ $::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..."));
@@ -564,6 +597,21 @@ sub do_it_modify_share {
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->{Profiles}{browseable} = $o->{var}{wiz_profiles_browseable};
+ $samba->{Profiles}{'guest ok'} = $o->{var}{wiz_profiles_guest_ok};
+ $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_add_cdromshare {
$::testing and return;
@@ -606,7 +654,7 @@ sub do_it_add_share {
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}));
+ $::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..."));