diff -Nur smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares smeserver-shared-folders-0.1_mod/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares
--- smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares 2012-02-18 01:05:59.000000000 +0100
+++ smeserver-shared-folders-0.1_mod/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares 2012-02-18 01:18:49.000000000 +0100
@@ -6,29 +6,27 @@
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open_ro();
$OUT = "";
- foreach my $share ($adb->get_all_by_prop(type => 'share'))
- {
- my %properties = $share->props;
- my $key = $share->key;
+ foreach my $share ($adb->get_all_by_prop(type => 'share')) {
+ my %properties = $share->props;
+ my $key = $share->key;
my $allow;
- my $pass;
- my $satisfy;
- my $webdav = (($properties{'WebDav'} || 'disabled') =~ m/^(enabled|on|yes)$/i) ? 1 : 0;
-
- # Find which users have read or write access
- my @writers = ('admin');
- my @readers = ();
- if ($properties{'WriteGroups'}) {
- my @groups = split (/[;,]/, $properties{'WriteGroups'});
+ my $pass;
+ my $satisfy;
+ my $webdav = (($properties{'WebDav'} || 'disabled') =~ m/^(enabled|on|yes)$/i) ? 1 : 0;
+
+ # Find which users have read or write access
+ my @writers = ('admin');
+ my @readers = ();
+ if ($properties{'WriteGroups'}) {
+ my @groups = split (/[;,]/, $properties{'WriteGroups'});
foreach my $group (@groups) {
my $members = $adb->get_prop($group, 'Members') || "";
- if (length($members) > 0) {
- push @writers, split (/[;,]/, $members);
- }
+ if (length($members) > 0) {
+ push @writers, split (/[;,]/, $members);
+ }
}
-
}
if ($properties{'WriteUsers'}) {
my @users = split (/[;,]/, $properties{'WriteUsers'});
@@ -39,11 +37,10 @@
foreach my $group (@groups) {
my $members = $adb->get_prop($group, 'Members') || "";
- if (length($members) > 0) {
- push @readers, split (/[;,]/, $members);
- }
+ if (length($members) > 0) {
+ push @readers, split (/[;,]/, $members);
+ }
}
-
}
if ($properties{'ReadUsers'}) {
my @users = split (/[;,]/, $properties{'ReadUsers'});
@@ -63,80 +60,77 @@
my $readers = join(" ", @readers) || '';
my $writers = join(" ", @writers) || '';
- if ($properties{'httpAccess'})
- {
- if ($properties{'httpAccess'} eq 'local')
- {
- $allow = "$localAccess $externalSSLAccess";
- $pass = 0;
- $satisfy = 'all';
- $webdav = 0;
- }
- elsif ($properties{'httpAccess'} eq 'local-pw')
- {
- $allow = "$localAccess $externalSSLAccess";
- $pass = 1;
- $satisfy = 'all';
- }
- elsif ($properties{'httpAccess'} eq 'global')
- {
- $allow = 'all';
- $pass = 0;
- $satisfy = 'all';
- $webdav = 0;
- }
- elsif ($properties{'httpAccess'} eq 'global-pw')
- {
- $allow = 'all';
- $pass = 1;
- $satisfy = 'all';
- }
- elsif ($properties{'httpAccess'} eq 'global-pw-remote')
- {
- $allow = "$localAccess $externalSSLAccess";
- $pass = 1;
- $satisfy = 'any';
- $webdav = 0;
- }
- else{
- next;
- }
- }
-
- my $allowOverride = $properties{'AllowOverride'} || "None";
- my $followSymLinks = $properties{'FollowSymLinks'} || "disabled";
- my $indexes = $properties{'Indexes'} || "enabled";
- my $requireSSL = $properties{'RequireSSL'} || "enabled";
+ if ($properties{'httpAccess'}) {
+ if ($properties{'httpAccess'} eq 'local') {
+ $allow = "$localAccess $externalSSLAccess";
+ $pass = 0;
+ $satisfy = 'all';
+ $webdav = 0;
+ }
+ elsif ($properties{'httpAccess'} eq 'local-pw') {
+ $allow = "$localAccess $externalSSLAccess";
+ $pass = 1;
+ $satisfy = 'all';
+ }
+ elsif ($properties{'httpAccess'} eq 'global') {
+ $allow = 'all';
+ $pass = 0;
+ $satisfy = 'all';
+ $webdav = 0;
+ }
+ elsif ($properties{'httpAccess'} eq 'global-pw') {
+ $allow = 'all';
+ $pass = 1;
+ $satisfy = 'all';
+ }
+ elsif ($properties{'httpAccess'} eq 'global-pw-remote') {
+ $allow = "$localAccess $externalSSLAccess";
+ $pass = 1;
+ $satisfy = 'any';
+ $webdav = 0;
+ }
+ else {
+ next;
+ }
+ }
+
+ my $allowOverride = $properties{'AllowOverride'} || "None";
+ my $followSymLinks = $properties{'FollowSymLinks'} || "disabled";
+ my $indexes = $properties{'Indexes'} || "enabled";
+ my $requireSSL = $properties{'RequireSSL'} || "enabled";
my $dynamicContent = $properties{'DynamicContent'} || "disabled";
- $OUT .= "\n";
- $OUT .= "#------------------------------------------------------------\n";
- $OUT .= "# $key shared folder ($properties{'Name'})\n";
- $OUT .= "#------------------------------------------------------------\n";
-
- $OUT .= "\n";
- $OUT .= "\n";
- $OUT .= " Options None\n";
- $OUT .= " Options +Indexes\n" if ($indexes eq 'enabled');
- $OUT .= " Options +FollowSymLinks\n" if (($followSymLinks eq 'enabled') || ($allowOverride =~ /^all$/i));
- $OUT .= " SSLRequireSSL on\n" if ($requireSSL eq 'enabled');
+ $OUT .= "\n";
+ $OUT .= "#------------------------------------------------------------\n";
+ $OUT .= "# $key shared folder ($properties{'Name'})\n";
+ $OUT .= "#------------------------------------------------------------\n";
+
+ $OUT .= "\n";
+ $OUT .= "\n";
+ $OUT .= " Options None\n";
+ $OUT .= " Options +Indexes\n" if ($indexes eq 'enabled');
+ $OUT .= " Options +FollowSymLinks\n"
+ if (($followSymLinks eq 'enabled') || ($allowOverride =~ /^all$/i));
+ $OUT .= " SSLRequireSSL on\n" if ($requireSSL eq 'enabled');
- if ($dynamicContent eq 'enabled')
- {
+ if ($dynamicContent eq 'enabled') {
$OUT .= " Options +Includes\n";
- $OUT .= " AddType application/x-httpd-php .php .php3 .phtml\n";
+ $OUT .= " AddType application/x-httpd-php .php .php3 .phtml\n";
$OUT .= " AddType application/x-httpd-php-source .phps\n";
- my $basedir = $properties{PHPBaseDir}
- || ("/home/e-smith/files/shares/$key/");
- $OUT .= " php_admin_value open_basedir $basedir\n";
- $OUT .= " php_admin_flag register_globals on\n" if (($properties{PHPRegisterGlobals} || 'disabled') eq 'enabled');
- $OUT .= " php_admin_flag allow_url_fopen on\n" if (($properties{PHPAllowUrlFopen} || 'disabled') eq 'enabled');
- $OUT .= " php_admin_value memory_limit $properties{PHPMemoryLimit}\n" if ($properties{PHPMemoryLimit});
- $OUT .= " php_admin_value max_execution_time $properties{PHPMaxExecutionTime}\n" if ($properties{PHPMaxExecutionTime});
- }
- else
- {
+ my $basedir = $properties{PHPBaseDir}
+ || ("/home/e-smith/files/shares/$key/");
+ $OUT .= " php_admin_value open_basedir $basedir\n";
+ $OUT .= " php_admin_flag register_globals on\n"
+ if (($properties{PHPRegisterGlobals} || 'disabled') eq 'enabled');
+ $OUT .= " php_admin_flag allow_url_fopen on\n"
+ if (($properties{PHPAllowUrlFopen} || 'disabled') eq 'enabled');
+ $OUT .= " php_admin_value memory_limit $properties{PHPMemoryLimit}\n"
+ if ($properties{PHPMemoryLimit});
+ $OUT .= " php_admin_value max_execution_time $properties{PHPMaxExecutionTime}\n"
+ if ($properties{PHPMaxExecutionTime});
+ }
+ else {
$OUT .= " DirectoryIndex index.shtml index.htm index.html\n";
$OUT .= " Options +IncludesNOEXEC\n";
$OUT .= " \n";
@@ -145,22 +139,20 @@
$OUT .= " \n";
}
- $OUT .= " AllowOverride $allowOverride\n";
- $OUT .= " order deny,allow\n";
- $OUT .= " deny from all\n";
- $OUT .= " allow from $allow\n";
- if ($pass)
- {
- $OUT .= " AuthName \"$properties{'Name'}\"\n";
- $OUT .= " AuthType Basic\n";
- $OUT .= " AuthExternal pwauth\n";
- $OUT .= " require user $readers\n" unless ($webdav);
- $OUT .= " Satisfy $satisfy\n";
- }
- # WebDav is enabled only when auth is required
- if ($webdav)
- {
- $OUT .=<<"HERE";
+ $OUT .= " AllowOverride $allowOverride\n";
+ $OUT .= " order deny,allow\n";
+ $OUT .= " deny from all\n";
+ $OUT .= " allow from $allow\n";
+ if ($pass) {
+ $OUT .= " AuthName \"$properties{'Name'}\"\n";
+ $OUT .= " AuthType Basic\n";
+ $OUT .= " AuthExternal pwauth\n";
+ $OUT .= " require user $readers\n" unless ($webdav);
+ $OUT .= " Satisfy $satisfy\n";
+ }
+ # WebDav is enabled only when auth is required
+ if ($webdav) {
+ $OUT .=<<"HERE";
Dav on
@@ -171,19 +163,19 @@
HERE
- }
- $OUT .= "\n";
+ }
+ $OUT .= "\n";
if ($dynamicContent eq 'enabled'){
- $OUT .= "\n";
+ $OUT .= "\n";
$OUT .= " SetHandler cgi-script\n";
$OUT .= " Options ExecCGI\n";
$OUT .= "\n";
}
- else{
- $OUT .= "\n";
+ else {
+ $OUT .= "\n";
$OUT .= " order deny,allow\n";
$OUT .= " Deny from all\n";
$OUT .= "\n";
- }
+ }
}
}