1 |
diff -Nur smeserver-shared-folders-0.3/createlinks smeserver-shared-folders-0.3_dump_xattr/createlinks |
2 |
--- smeserver-shared-folders-0.3/createlinks 2013-11-25 12:48:18.303255031 +0100 |
3 |
+++ smeserver-shared-folders-0.3_dump_xattr/createlinks 2013-11-25 12:48:50.685233828 +0100 |
4 |
@@ -30,6 +30,8 @@ |
5 |
event_link("share-modify", $event, "15"); |
6 |
} |
7 |
|
8 |
+event_link("share-dump-attributes", "pre-backup", "80"); |
9 |
+ |
10 |
foreach my $event (qw(share-create share-modify share-delete share-modify-servers)){ |
11 |
templates2events("/etc/samba/smb.conf", $event); |
12 |
templates2events("/etc/httpd/conf/httpd.conf", $event); |
13 |
diff -Nur smeserver-shared-folders-0.3/root/etc/e-smith/events/actions/share-dump-attributes smeserver-shared-folders-0.3_dump_xattr/root/etc/e-smith/events/actions/share-dump-attributes |
14 |
--- smeserver-shared-folders-0.3/root/etc/e-smith/events/actions/share-dump-attributes 1970-01-01 01:00:00.000000000 +0100 |
15 |
+++ smeserver-shared-folders-0.3_dump_xattr/root/etc/e-smith/events/actions/share-dump-attributes 2013-11-25 12:48:50.685233828 +0100 |
16 |
@@ -0,0 +1,16 @@ |
17 |
+#!/usr/bin/perl |
18 |
+ |
19 |
+use strict; |
20 |
+use esmith::AccountsDB; |
21 |
+ |
22 |
+my $a = esmith::AccountsDB->open_ro || |
23 |
+ die "Couldn't open AccountsDB\n"; |
24 |
+ |
25 |
+foreach my $share ( $a->get_all_by_prop( type => 'share' ) ){ |
26 |
+ my $key = $share->key; |
27 |
+ my $perm = $share->prop('ManualPermissions') || 'disabled'; |
28 |
+ next unless ( $perm eq 'yes' || $perm eq 'enabled' || $perm eq 'ntacl' ); |
29 |
+ # Dump posix ACL |
30 |
+ system("/usr/bin/getfacl -R --physical --absolute-names -- /home/e-smith/files/shares/$key/ > /home/e-smith/db/shares/$key.acl"); |
31 |
+ system("/usr/bin/getfattr -R -d -m '.*' -e hex -P --absolute-names -- /home/e-smith/files/shares/$key/ > /home/e-smith/db/shares/$key.xattr"); |
32 |
+} |