/[smecontribs]/rpms/smeserver-shared-folders/contribs8/smeserver-shared-folders-0.1-extended_access.patch
ViewVC logotype

Contents of /rpms/smeserver-shared-folders/contribs8/smeserver-shared-folders-0.1-extended_access.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Mar 3 22:04:39 2013 UTC (11 years, 1 month ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-shared-folders-0_1-80_el5_sme, smeserver-shared-folders-0_1-83_el5_sme, smeserver-shared-folders-0_1-84_el5_sme, smeserver-shared-folders-0_1-82_el5_sme, smeserver-shared-folders-0_1-87_el5_sme, smeserver-shared-folders-0_1-86_el5_sme, smeserver-shared-folders-0_1-81_el5_sme, smeserver-shared-folders-0_1-85_el5_sme, smeserver-shared-folders-0_1-79_el5_sme, HEAD
Initial import

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/createlinks mezzanine_patched_smeserver-shared-folders-0.1/createlinks
2 --- smeserver-shared-folders-0.1/createlinks 2009-05-17 20:09:55.000000000 +0200
3 +++ mezzanine_patched_smeserver-shared-folders-0.1/createlinks 2009-05-17 19:19:34.000000000 +0200
4 @@ -33,7 +33,9 @@
5 foreach my $event (qw(share-create share-modify share-delete share-modify-servers))
6 {
7 templates2events("/etc/samba/smb.conf", $event);
8 + templates2events("/etc/httpd/conf/httpd.conf", $event);
9 safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/smbd");
10 + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
11 }
12
13 templates2events("/etc/fstab", "post-upgrade");
14 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares
15 --- smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares 1970-01-01 01:00:00.000000000 +0100
16 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/90e-smithAccess50shares 2009-05-17 19:19:34.000000000 +0200
17 @@ -0,0 +1,144 @@
18 +#------------------------------------------------------------
19 +# Shared Folders HTTP Access
20 +#------------------------------------------------------------
21 +
22 +{
23 + use esmith::AccountsDB;
24 + my $adb = esmith::AccountsDB->open_ro();
25 + $OUT = "";
26 + foreach my $share ($adb->get_all_by_prop(type => 'share'))
27 + {
28 + my %properties = $share->props;
29 + my $key = $share->key;
30 +
31 + my $allow;
32 + my $pass;
33 + my $satisfy;
34 +
35 + # Find which users has at least read access
36 + my @users = ('admin');
37 + if ($properties{'WriteGroups'}) {
38 + my @groups = split (/[;,]/, $properties{'WriteGroups'});
39 +
40 + foreach my $group (@groups) {
41 + my $members = $adb->get_prop($group, 'Members') || "";
42 + if (length($members) > 0) {
43 + push @users, split (/[;,]/, $members);
44 + }
45 + }
46 +
47 + }
48 + if ($properties{'ReadGroups'}) {
49 + my @groups = split (/[;,]/, $properties{'ReadGroups'});
50 +
51 + foreach my $group (@groups) {
52 + my $members = $adb->get_prop($group, 'Members') || "";
53 + if (length($members) > 0) {
54 + push @users, split (/[;,]/, $members);
55 + }
56 + }
57 +
58 + }
59 +
60 + my %seen = ();
61 + my @unique = sort (grep { ! $seen{ $_ }++ } @users);
62 +
63 + my $users = join(" ", @unique) || '';
64 +
65 + if ($properties{'httpAccess'})
66 + {
67 + if ($properties{'httpAccess'} eq 'none')
68 + {
69 + next;
70 + }
71 + elsif ($properties{'httpAccess'} eq 'local')
72 + {
73 + $allow = $localAccess;
74 + $pass = 0;
75 + $satisfy = 'all';
76 + }
77 + elsif ($properties{'httpAccess'} eq 'local-pw')
78 + {
79 + $allow = $localAccess;
80 + $pass = 1;
81 + $satisfy = 'all';
82 + }
83 + elsif ($properties{'httpAccess'} eq 'global')
84 + {
85 + $allow = 'all';
86 + $pass = 0;
87 + $satisfy = 'all';
88 + }
89 + elsif ($properties{'httpAccess'} eq 'global-pw')
90 + {
91 + $allow = 'all';
92 + $pass = 1;
93 + $satisfy = 'all';
94 + }
95 + elsif ($properties{'httpAccess'} eq 'global-pw-remote')
96 + {
97 + $allow = $localAccess;
98 + $pass = 1;
99 + $satisfy = 'any';
100 + }
101 + }
102 +
103 + my $allowOverride = $properties{'AllowOverride'} || "None";
104 + my $followSymLinks = $properties{'FollowSymLinks'} || "disabled";
105 + my $indexes = $properties{'Indexes'} || "enabled";
106 + my $requireSSL = $properties{'RequireSSL'} || "enabled";
107 + my $dynamicContent = $properties{'DynamicContent'} || "disabled";
108 +
109 + $OUT .= "\n";
110 + $OUT .= "#------------------------------------------------------------\n";
111 + $OUT .= "# $key shared folder ($properties{'Name'})\n";
112 + $OUT .= "#------------------------------------------------------------\n";
113 +
114 + $OUT .= "\n";
115 + $OUT .= "<Directory /home/e-smith/files/shares/$key/files>\n";
116 + $OUT .= " Options None\n";
117 + $OUT .= " Options +Indexes\n" if ($indexes eq 'enabled');
118 + $OUT .= " Options +FollowSymLinks\n" if ($followSymLinks eq 'enabled');
119 + $OUT .= " SSLRequireSSL on\n" if ($requireSSL eq 'enabled');
120 +
121 + if ($dynamicContent eq 'enabled')
122 + {
123 + $OUT .= " Options +Includes\n";
124 + $OUT .= " AddType application/x-httpd-php .php .php3 .phtml\n";
125 + $OUT .= " AddType application/x-httpd-php-source .phps\n";
126 +
127 + my $basedir = $properties{PHPBaseDir}
128 + || ("/home/e-smith/files/shares/$key/");
129 + $OUT .= " php_admin_value open_basedir $basedir\n";
130 + $OUT .= " php_admin_flag register_globals on\n" if (($properties{PHPRegisterGlobals} || 'disabled') eq 'enabled');
131 + $OUT .= " php_admin_value memory_limit $properties{PHPMemoryLimit}\n" if ($properties{PHPMemoryLimit});
132 + $OUT .= " php_admin_value max_execution_time $properties{PHPMaxExecutionTime}\n" if ($properties{PHPMaxExecutionTime});
133 +
134 + }
135 + else
136 + {
137 + $OUT .= " DirectoryIndex index.shtml index.htm index.html\n";
138 + $OUT .= " Options +IncludesNOEXEC\n";
139 + $OUT .= " <FilesMatch \"\\.(php|php3|phtml)\$\">\n";
140 + $OUT .= " order deny,allow\n";
141 + $OUT .= " Deny from all\n";
142 + $OUT .= " </FilesMatch>\n";
143 + }
144 +
145 + $OUT .= " AllowOverride $allowOverride\n";
146 + $OUT .= " order deny,allow\n";
147 + $OUT .= " deny from all\n";
148 + $OUT .= " allow from $allow\n";
149 + if ($pass)
150 + {
151 + $OUT .= " AuthName \"$properties{'Name'}\"\n";
152 + $OUT .= " AuthType Basic\n";
153 + $OUT .= " AuthExternal pwauth\n";
154 + $OUT .= " require user $users\n";
155 + $OUT .= " Satisfy $satisfy\n";
156 + }
157 +
158 + $OUT .= "</Directory>\n";
159 +
160 + }
161 +}
162 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/25ShareContent mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/25ShareContent
163 --- smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/25ShareContent 1970-01-01 01:00:00.000000000 +0100
164 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/25ShareContent 2009-05-17 19:19:34.000000000 +0200
165 @@ -0,0 +1,42 @@
166 +{
167 + use esmith::AccountsDB;
168 + my $accounts = esmith::AccountsDB->open_ro;
169 +
170 + use esmith::DomainsDB;
171 + my $domains = esmith::DomainsDB->open_ro;
172 +
173 + $OUT = "";
174 +
175 + my $share = $virtualHostContent;
176 + my $basedir = "/home/e-smith/files/shares/$share";
177 +
178 + if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
179 + eq 'yes')
180 + {
181 + my @shares = $accounts->get_all_by_prop(type => 'share');
182 + foreach my $share (@shares)
183 + {
184 + my $key = $share->key;
185 + my $access = $share->prop('httpAccess') || 'none';
186 + next if (($access eq 'none') || ($key eq $virtualHostContent));
187 + my $basedir = "/home/e-smith/files/shares/$key";
188 + my $name = $share->prop("Name") || "";
189 +
190 + $OUT .= "\n";
191 + $OUT .= " # $key share ($name)\n";
192 + $OUT .= "\n";
193 +
194 + my $SSLPort = $modSSL{'TCPPort'} || '443';
195 +
196 + if (( $port ne $SSLPort ) && (($share->prop('RequireSSL') || 'enabled') eq 'enabled')){
197 + $OUT .= " RewriteEngine on\n";
198 + $OUT .= " RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}/$key\$1 \[L,R\]\n";
199 + }
200 + else{
201 + $OUT .= " Alias /$key $basedir/files\n";
202 + }
203 + }
204 + $OUT .= " # No shares in system\n" unless @shares;
205 + }
206 +}
207 +
208 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/90shares mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/90shares
209 --- smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/90shares 2009-04-08 11:55:18.000000000 +0200
210 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/90shares 2009-05-17 19:19:34.000000000 +0200
211 @@ -6,7 +6,7 @@
212
213 foreach my $share ($adb->get_all_by_prop(type => 'share'))
214 {
215 - if ( ($share->prop('status') || 'enabled') eq 'enabled'){
216 + if ( ($share->prop('smbAccess') || 'browseable') =~ /browseable$/ ){
217 $OUT .= esmith::templates::processTemplate (
218 {
219 MORE_DATA => {
220 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/shares/40browseable mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/shares/40browseable
221 --- smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/shares/40browseable 2009-04-08 11:55:18.000000000 +0200
222 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/templates/etc/smb.conf/shares/40browseable 2009-05-17 19:19:34.000000000 +0200
223 @@ -1,5 +1,5 @@
224 {
225 - if ( ($share->prop('Browseable') || 'yes') eq 'no') {
226 + if ( ($share->prop('smbAccess') || 'browseable') eq 'non-browseable') {
227 $OUT .= "browseable = no\n";
228 }
229 }
230 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares
231 --- smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2009-04-08 11:55:18.000000000 +0200
232 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2009-05-17 20:09:48.000000000 +0200
233 @@ -47,6 +47,9 @@
234 <field type="text" id="description" validation="validate_description">
235 <label>DESCRIPTION</label>
236 </field>
237 +
238 + <subroutine src="print_section_bar()" />
239 +
240 <field
241 type="literal"
242 id="perms_desc"
243 @@ -55,19 +58,21 @@
244 </field>
245 <subroutine src="genGroupAccess()"/>
246
247 - <field type="select"
248 - id="status"
249 - options="'disabled' => 'DISABLED', 'enabled' => 'ENABLED'">
250 - <label>LABEL_STATUS</label>
251 - <description>DESC_STATUS</description>
252 + <subroutine src="print_section_bar()" />
253 +
254 + <field
255 + type="literal"
256 + id="smbdesc"
257 + value="">
258 + <description>DESC_SMB_SETTINGS</description>
259 </field>
260
261 <field type="select"
262 - id="browseable"
263 - options="'no' => 'NO', 'yes' => 'YES'">
264 - <label>LABEL_BROWSEABLE</label>
265 - <description>DESC_BROWSEABLE</description>
266 - </field>
267 + id="smbaccess"
268 + options="smbAccess_list()">
269 + <label>LABEL_SMB_ACCESS</label>
270 + <description>DESC_SMB_ACCESS</description>
271 + </field>
272
273 <field type="select"
274 id="recyclebin"
275 @@ -76,7 +81,39 @@
276 <description>DESC_RECYCLEBIN</description>
277 </field>
278
279 - <subroutine src="print_save_or_add_button()" />
280 + <subroutine src="print_section_bar()" />
281 +
282 + <field
283 + type="literal"
284 + id="httpdesc"
285 + value="">
286 + <description>DESC_HTTP_SETTINGS</description>
287 + </field>
288 +
289 + <field type="select" id="httpaccess" options="httpAccess_list()">
290 + <label>LABEL_HTTP_ACCESS</label>
291 + <description>DESC_HTTP_ACCESS</description>
292 + </field>
293 +
294 + <field type="select" id="requireSSL"
295 + options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'">
296 + <label>LABEL_REQUIRE_SSL</label>
297 + <description>DESC_REQUIRE_SSL</description>
298 + </field>
299 +
300 + <field type="select" id="indexes"
301 + options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'">
302 + <label>LABEL_INDEXES</label>
303 + <description>DESC_INDEXES</description>
304 + </field>
305 +
306 + <field type="select" id="dynamic"
307 + options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'">
308 + <label>LABEL_DYNAMIC_CONTENT</label>
309 + <description>DESC_DYNAMIC_CONTENT</description>
310 + </field>
311 +
312 + <subroutine src="print_save_or_add_button()" />
313 </page>
314 <page name="Remove" pre-event="turn_off_buttons()" post-event="remove_share()">
315 <title>REMOVE_TITLE</title>
316 diff -Nur -x '*.orig' -x '*.rej' smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm mezzanine_patched_smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm
317 --- smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2009-04-08 11:55:18.000000000 +0200
318 +++ mezzanine_patched_smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2009-05-17 19:19:34.000000000 +0200
319 @@ -24,12 +24,15 @@
320 print_share_table
321 print_share_name_field
322 genGroupAccess
323 + smbAccess_list
324 + httpAccess_list
325 max_share_name_length
326 handle_shares
327 remove_share
328 print_save_or_add_button
329 wherenext
330 print_custom_button
331 + print_section_bar
332 );
333
334 our $VERSION = sprintf '%d.%03d', q$Revision: 1.8 $ =~ /: (\d+).(\d+)/;
335 @@ -172,9 +175,12 @@
336
337 # Set default value
338 my $q = $self->{cgi};
339 - $q->param(-name=>'status',-value=>'enabled');
340 - $q->param(-name=>'browseable',-value=>'yes');
341 + $q->param(-name=>'smbaccess',-value=>'browseable');
342 $q->param(-name=>'recyclebin',-value=>'disabled');
343 + $q->param(-name=>'httpaccess',-value=>'none');
344 + $q->param(-name=>'requireSSL',-value=>'disabled');
345 + $q->param(-name=>'indexes',-value=>'disabled');
346 + $q->param(-name=>'dynamic',-value=>'disabled');
347
348 print qq(<tr><td colspan="2">) . $self->localise('NAME_FIELD_DESC',
349 {maxLength => $maxLength }) . qq(</td></tr>);
350 @@ -200,12 +206,18 @@
351 $rec->prop('ReadGroups'));
352 $q->param(-name=>'WriteGroups',-value=>
353 $rec->prop('WriteGroups'));
354 - $q->param(-name=>'status',-value=>
355 - ($rec->prop('status') || 'enabled'));
356 - $q->param(-name=>'browseable',-value=>
357 - ($rec->prop('Browseable') || 'yes'));
358 + $q->param(-name=>'smbaccess',-value=>
359 + ($rec->prop('smbAccess') || 'enabled'));
360 $q->param(-name=>'recyclebin',-value=>
361 ($rec->prop('RecycleBin') || 'disabled'));
362 + $q->param(-name=>'httpaccess',-value=>
363 + ($rec->prop('httpAccess') || 'none'));
364 + $q->param(-name=>'requireSSL',-value=>
365 + ($rec->prop('RequireSSL') || 'enabled'));
366 + $q->param(-name=>'indexes',-value=>
367 + ($rec->prop('Indexes') || 'enabled'));
368 + $q->param(-name=>'dynamic',-value=>
369 + ($rec->prop('DynamicContent') || 'disabled'));
370 }
371 }
372 else {
373 @@ -278,6 +290,40 @@
374 return $out;
375 }
376
377 +# Print a section bar
378 +sub print_section_bar{
379 + my ($fm) = @_;
380 + print " <tr>\n <td colspan='2'>\n";
381 + print "<hr class=\"sectionbar\"/>\n";
382 + return undef;
383 +}
384 +
385 +
386 +# Returns the hash of public access settings for showing in the smb
387 +# access drop down list.
388 +
389 +sub smbAccess_list {
390 + return {
391 + 'none' => 'NONE',
392 + 'browseable' => 'ENABLED_BROWSEABLE',
393 + 'non-browseable' => 'ENABLED_NON_BROWSEABLE',
394 + };
395 +}
396 +
397 +
398 +# Returns the hash of public access settings for showing in the http
399 +# access drop down list.
400 +
401 +sub httpAccess_list {
402 + return {
403 + 'none' => 'NONE',
404 + 'local' => 'LOCAL_NETWORK_NO_PASSWORD',
405 + 'local-pw' => 'LOCAL_NETWORK_PASSWORD',
406 + 'global' => 'ENTIRE_INTERNET_NO_PASSWORD',
407 + 'global-pw' => 'ENTIRE_INTERNET_PASSWORD',
408 + 'global-pw-remote' => 'ENTIRE_INTERNET_PASSWORD_REMOTE'
409 + };
410 +}
411
412 # VALIDATION ROUTINES
413
414 @@ -402,11 +448,14 @@
415 if (my $acct = $accountdb->new_record($name, {
416 Name => $self->cgi->param('description'),
417 WriteGroups => $WriteGroups,
418 - ReadGroups => $ReadGroups,
419 - Browseable => $self->cgi->param('browseable'),
420 - RecycleBin => $self->cgi->param('recyclebin'),
421 - status => $self->cgi->param('status'),
422 - type => 'share',
423 + ReadGroups => $ReadGroups,
424 + RecycleBin => $self->cgi->param('recyclebin'),
425 + smbAccess => $self->cgi->param('smbaccess'),
426 + httpAccess => $self->cgi->param('httpaccess'),
427 + RequireSSL => $self->cgi->param('requireSSL'),
428 + Indexes => $self->cgi->param('indexes'),
429 + DynamicContent => $self->cgi->param('dynamic'),
430 + type => 'share',
431 }) )
432 {
433 # Untaint $name before use in system()
434 @@ -445,12 +494,14 @@
435
436 $acct->merge_props(
437 Name => $self->cgi->param('description'),
438 - WriteGroups => $WriteGroups,
439 - ReadGroups => $ReadGroups,
440 - Browseable => $self->cgi->param('browseable'),
441 - RecycleBin => $self->cgi->param('recyclebin'),
442 - status => $self->cgi->param('status'),
443 -
444 + WriteGroups => $WriteGroups,
445 + ReadGroups => $ReadGroups,
446 + RecycleBin => $self->cgi->param('recyclebin'),
447 + smbAccess => $self->cgi->param('smbaccess'),
448 + httpAccess => $self->cgi->param('httpaccess'),
449 + RequireSSL => $self->cgi->param('requireSSL'),
450 + Indexes => $self->cgi->param('indexes'),
451 + DynamicContent => $self->cgi->param('dynamic'),
452 );
453
454 # Untaint $name before use in system()

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed