1 |
diff -Nur smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares smeserver-shared-folders-0.1_mod/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares |
2 |
--- smeserver-shared-folders-0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares 2011-07-05 13:58:01.000000000 +0200 |
3 |
+++ smeserver-shared-folders-0.1_mod/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/shares 2011-07-05 16:08:28.000000000 +0200 |
4 |
@@ -469,6 +469,13 @@ |
5 |
</entry> |
6 |
|
7 |
<entry> |
8 |
+ <base>ERROR_ENCRYPTED_ENABLED</base> |
9 |
+ <trans> |
10 |
+ This shared folder is encrypted and access is enabled. You have to put it in protected mode before removing it |
11 |
+ </trans> |
12 |
+ </entry> |
13 |
+ |
14 |
+ <entry> |
15 |
<base>INVALID_INACTIVITY</base> |
16 |
<trans> |
17 |
Inactivity value must be numbers only |
18 |
diff -Nur smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares smeserver-shared-folders-0.1_mod/root/etc/e-smith/web/functions/shares |
19 |
--- smeserver-shared-folders-0.1/root/etc/e-smith/web/functions/shares 2011-07-05 13:58:01.000000000 +0200 |
20 |
+++ smeserver-shared-folders-0.1_mod/root/etc/e-smith/web/functions/shares 2011-07-05 13:59:19.000000000 +0200 |
21 |
@@ -119,14 +119,7 @@ |
22 |
|
23 |
<subroutine src="print_ajaxplorer_fields()" /> |
24 |
|
25 |
- <subroutine src="print_section_bar()" /> |
26 |
- |
27 |
<subroutine src="print_encryption_fields()" /> |
28 |
- <field type="text" id="inactivity" validation="validate_inactivity"> |
29 |
- <description>DESC_INACTIVITY</description> |
30 |
- <label>INACTIVITY</label> |
31 |
- </field> |
32 |
- |
33 |
|
34 |
<subroutine src="print_save_or_add_button()" /> |
35 |
</page> |
36 |
diff -Nur smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm smeserver-shared-folders-0.1_mod/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm |
37 |
--- smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2011-07-05 13:58:01.000000000 +0200 |
38 |
+++ smeserver-shared-folders-0.1_mod/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/shares.pm 2011-07-05 16:26:51.000000000 +0200 |
39 |
@@ -250,19 +250,31 @@ |
40 |
|
41 |
} |
42 |
|
43 |
- |
44 |
+# If EncFS is available, print encryptions options |
45 |
sub print_encryption_fields { |
46 |
my $self = shift; |
47 |
+ |
48 |
+ return undef unless(system('rpm -q fuse-encfs 2>&1 > /dev/null') == 0); |
49 |
+ |
50 |
my $encryption = $self->{cgi}->param('encryption') || 'disabled'; |
51 |
my $action = $self->{cgi}->param('action') || ''; |
52 |
|
53 |
+ my $sharename = $self->{cgi}->param('name') || ''; |
54 |
+ |
55 |
+ return undef if ($action eq 'modify' && $encryption ne 'enabled'); |
56 |
+ |
57 |
+ my $inactivity = (($sharename ne '') && ($accountdb->get($sharename))) ? |
58 |
+ ($accountdb->get($sharename)->prop('Inactivity') || '30'):'30'; |
59 |
+ |
60 |
+ print_section_bar(); |
61 |
+ |
62 |
print qq(<tr><td colspan="2">) . $self->localise('DESC_ENCRYPTION') . qq(</td></tr>); |
63 |
print qq(<tr><td class="sme-noborders-label">) . |
64 |
$self->localise('LABEL_ENCRYPTION') . qq(</td>\n); |
65 |
|
66 |
if ($action eq 'modify') { |
67 |
print qq( |
68 |
- <td class="sme-noborders-content">$encryption |
69 |
+ <td class="sme-noborders-content">) . $self->localise(uc($encryption)) . qq( |
70 |
<input type="hidden" name="encryption" value="$encryption"> |
71 |
</td> |
72 |
); |
73 |
@@ -289,6 +301,14 @@ |
74 |
); |
75 |
} |
76 |
|
77 |
+ print qq(<tr><td colspan="2">) . $self->localise('DESC_INACTIVITY') . qq(</td></tr>); |
78 |
+ print qq(<tr><td class="sme-noborders-label">) . |
79 |
+ $self->localise('INACTIVITY') . qq(</td>\n); |
80 |
+ print qq( |
81 |
+ <td><input type="text" name="inactivity" value="$inactivity"> |
82 |
+ </td> |
83 |
+ ); |
84 |
+ |
85 |
print qq(</tr>\n); |
86 |
|
87 |
return undef; |
88 |
@@ -667,10 +687,18 @@ |
89 |
unless ($self->cgi->param('cancel')){ |
90 |
if (my $acct = $accountdb->get($name)) { |
91 |
if ($acct->prop('type') eq 'share') { |
92 |
- $acct->set_prop('type', 'share-deleted'); |
93 |
- |
94 |
# Untaint $name before use in system() |
95 |
$name =~ /(.+)/; $name = $1; |
96 |
+ my $encryption = $acct->prop('Encryption') || 'disabled'; |
97 |
+ my $mountstatus = `/bin/mount | grep /home/e-smith/files/shares/$name/ | grep -c fuse`; |
98 |
+ chomp($mountstatus); |
99 |
+ if (($encryption eq 'enabled') && ($mountstatus eq '1')){ |
100 |
+ $self->error("ERROR_ENCRYPTED_ENABLED"); |
101 |
+ return undef; |
102 |
+ } |
103 |
+ |
104 |
+ $acct->set_prop('type', 'share-deleted'); |
105 |
+ |
106 |
if (system ("/sbin/e-smith/signal-event", "share-delete", $name) == 0) { |
107 |
$self->success("SUCCESSFULLY_DELETED_SHARE"); |
108 |
$acct->delete(); |
109 |
@@ -734,7 +762,8 @@ |
110 |
|
111 |
return 'OK' if ($self->{cgi}->param('encryption') eq 'disabled'); |
112 |
|
113 |
- unless (scalar (split("",$pass1)) >= 8){ |
114 |
+ my @num = split(//,$pass1); |
115 |
+ unless (scalar (@num) >= 8){ |
116 |
return $self->localise('PASSWORD_TOO_SHORT'); |
117 |
} |
118 |
|
119 |
diff -Nur smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/userpanelEncfs.pm smeserver-shared-folders-0.1_mod/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/userpanelEncfs.pm |
120 |
--- smeserver-shared-folders-0.1/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/userpanelEncfs.pm 2011-07-05 13:58:01.000000000 +0200 |
121 |
+++ smeserver-shared-folders-0.1_mod/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/userpanelEncfs.pm 2011-07-05 16:27:07.000000000 +0200 |
122 |
@@ -83,7 +83,7 @@ |
123 |
my $sharename = $i->key(); |
124 |
my $sharedesc = $i->prop('Name'); |
125 |
|
126 |
- my $mountstatus = `/bin/mount | /bin/grep /home/e-smith/files/shares/$sharename | grep -c fuse`; |
127 |
+ my $mountstatus = `/bin/mount | /bin/grep /home/e-smith/files/shares/$sharename/ | grep -c fuse`; |
128 |
chomp($mountstatus); |
129 |
my $sharestatus = ($mountstatus eq '1') ? $self->localise('MOUNTED') : $self->localise('NOT_MOUNTED'); |
130 |
|
131 |
@@ -117,8 +117,11 @@ |
132 |
my $rec = $accountdb->get($share); |
133 |
my $timeout = $rec->prop('InactivityTimeOut') || '30'; |
134 |
$timeout = '30' unless ($timeout =~ m/\d+/); |
135 |
+ my $recycle = $rec->prop('RecycleBin') || 'disabled'; |
136 |
+ my $recycledir = $rec->prop('RecycleBinDir') || 'Recycle Bin'; |
137 |
my $source = "/home/e-smith/files/shares/$share/.store"; |
138 |
my $dest = "/home/e-smith/files/shares/$share/files"; |
139 |
+ $pass =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'"])/\\$1/g; |
140 |
$pass = $1 if ( $pass =~ /(.*)/ ); |
141 |
|
142 |
unless ( system("echo $pass | /usr/bin/encfs -i $timeout -S --public -o nonempty,umask=000 $source $dest > /dev/null 2>&1") == 0){ |
143 |
@@ -126,6 +129,12 @@ |
144 |
return undef; |
145 |
} |
146 |
|
147 |
+ if ( !-e $dest . '/' . $recycledir && $recycle eq 'enabled'){ |
148 |
+ unless(mkdir $dest . '/' . $recycledir){ |
149 |
+ $fm->error('ERROR_MOUNTING'); |
150 |
+ } |
151 |
+ } |
152 |
+ |
153 |
$fm->success('SUCCESS'); |
154 |
} |
155 |
|