Permissions option for new shares
authorJamie Cameron <jcameron@webmin.com>
Sat, 24 May 2008 22:57:51 +0000 (22:57 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 24 May 2008 22:57:51 +0000 (22:57 +0000)
samba/CHANGELOG
samba/edit_fshare.cgi
samba/lang/en
samba/save_fshare.cgi

index 1aad5b4..95ca7ea 100644 (file)
@@ -16,3 +16,5 @@ Added an icon for manually editing the Samba configuration file.
 Added checkboxes and a button to the View Connections page for disconnecting multiple users at once.
 ---- Changes since 1.270 ----
 Added checkboxes and a button for deleting multiple shares at once.
+---- Changes since 1.410 ----
+Added fields to set the permissions and group ownership of new shared directories.
index e9660ff..16f7cae 100755 (executable)
@@ -59,6 +59,12 @@ if (!$s) {
 
        print "<td align=right><b>$text{'share_owner'}</b></td>\n";
        print "<td>",&ui_user_textbox("createowner", "root"),"</td> </tr>\n";
+
+       print "<tr> <td align=right><b>$text{'share_createperms'}</b></td>\n";
+       print "<td>",&ui_textbox("createperms", "755", 5),"</td>\n";
+
+       print "<td align=right><b>$text{'share_group'}</b></td>\n";
+       print "<td>",&ui_group_textbox("creategroup", "root"),"</td> </tr>\n";
 }
 
 print "<tr> <td align=right><b>$text{'share_available'}</b></td>\n";
index cb67774..eedba6a 100644 (file)
@@ -247,6 +247,8 @@ share_home=Home Directories Share
 share_dir=Directory to share
 share_create=Automatically create directory?
 share_owner=Create with owner
+share_createperms=Create with permissions
+share_group=Create with group
 share_available=Available?
 share_browseable=Browseable?
 share_comment=Share Comment
@@ -349,6 +351,8 @@ savefshare_exist=A share called '$1' already exists
 savefshare_mode='$1' is not a valid share name
 savefshare_global=The name 'global' cannot be used for a share
 savefshare_owner=Missing or invalid owner for new directory
+savefshare_group=Missing or invalid group for new directory
+savefshare_perms=Missing or invalid permissions for new directory
 
 savemisc_fail=Failed to save options
 savemisc_lockdir=The directory containing the lock directory does not exist
index 82c2c1c..f68e6c8 100755 (executable)
@@ -57,6 +57,10 @@ if ($name ne "global") {
 if ($in{'create'} eq "yes") {
        defined(getpwnam($in{'createowner'})) ||
                &error($text{'savefshare_owner'});
+       defined(getgrnam($in{'creategroup'})) ||
+               &error($text{'savefshare_group'});
+       $in{'createperms'} =~ /^[0-7]{3,4}$/ ||
+               &error($text{'savefshare_perms'});
        }
 
 # Update config file
@@ -73,10 +77,12 @@ else {
        # Creating a new share
        &create_share($name);
        if ($in{'create'} eq "yes" && !-d $in{'path'}) {
-               mkdir($in{'path'}, 0755);
-               @uinfo = getpwnam($in{'createowner'});
-               chown($uinfo[2], $uinfo[3], $in{'path'});
-       }
+               &make_dir($in{'path'}, oct($in{'createperms'}));
+               &set_ownership_permissions($in{'createowner'},
+                                          $in{'creategroup'},
+                                          oct($in{'createperms'}),
+                                          $in{'path'});
+               }
        &save_samba_acl('rwvVsSpPnNoO', \%access, $name);
        }
 &unlock_file($config{'smb_conf'});