/[smeserver]/rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-bz11557-smbv1.patch
ViewVC logotype

Contents of /rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-bz11557-smbv1.patch

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


Revision 1.1 - (show annotations) (download)
Wed May 12 20:38:18 2021 UTC (3 years, 6 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-backup-2_6_0-26_el7_sme
* Wed May 12 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.6.0-26.sme
- allow mounting smbv1 backup share [SME: 11557]

1 diff -Nur e-smith-backup-2.6.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.6.0/root/etc/e-smith/events/actions/workstation-backup-dar
2 --- e-smith-backup-2.6.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2021-05-12 15:57:35.360000000 -0400
3 +++ e-smith-backup-2.6.0/root/etc/e-smith/events/actions/workstation-backup-dar 2021-05-12 16:06:37.891000000 -0400
4 @@ -50,6 +50,7 @@
5 my $ether = $internalinterface->prop('Name');
6 my $smbhost = $backupwk->prop('SmbHost');
7 my $smbshare = $backupwk->prop('SmbShare');
8 +my $smbv1 = $backupwk->prop('SmbV1') || 'disabled';
9 my $smbhostmac = $backupwk->prop('SmbHostMAC');
10 my $smbhostdelay = $backupwk->prop('SmbHostDelay') || 300;
11 my $login = $backupwk->prop('Login');
12 @@ -90,7 +91,7 @@
13 $report .= wol ($ether,$smbhost,$smbhostmac,$smbhostdelay);
14
15 # mount backup
16 -bmount($mntdir,$smbhost,$smbshare,$VFSType);
17 +bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
18
19 # rotating backup indicators
20 $incnum++;
21 @@ -333,11 +334,12 @@
22 # mount dar unit according to dar-workstation configuration
23 # return nothing if mount successfull
24
25 - my ($host,$share,$mountdir,$login,$password,$VFSType) = @_;
26 + my ($host,$share,$mountdir,$login,$password,$VFSType,$smbv1) = @_;
27
28 if ($VFSType eq 'cifs')
29 {
30 - return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) );
31 + my $opt= ($smbv1 eq "enabled")? ",vers=1.0": "";
32 + return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix$opt 2>&1) );
33 }
34 elsif ($VFSType eq 'nfs')
35 {
36 @@ -479,7 +481,7 @@
37
38 sub bmount
39 {
40 - my ($mntdir,$host,$share,$VFSType) = @_;
41 + my ($mntdir,$host,$share,$VFSType,$smbv1) = @_;
42 # verify backup directory not already mounted
43
44 if (!checkMount ($mntdir))
45 @@ -502,7 +504,7 @@
46 createTree ($mntdir);
47
48 # mount the backup directory
49 - my $err = dmount($host,$share,$mntdir,'','',$VFSType);
50 + my $err = dmount($host,$share,$mntdir,'','',$VFSType,$smbv1);
51 ldie("Error while mounting <//$smbhost/$smbshare>\n" . $err) if $err;
52
53 # verify $mntdir is mounted
54 diff -Nur e-smith-backup-2.6.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup e-smith-backup-2.6.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup
55 --- e-smith-backup-2.6.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2021-05-12 15:57:35.382000000 -0400
56 +++ e-smith-backup-2.6.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2021-05-12 16:10:52.006000000 -0400
57 @@ -936,5 +936,10 @@
58 <base>DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9</base>
59 <trans>If you restore from Koozali SME Server 9 or before, pay attention that some folders in the system are now symlinks. Basic backup configuration does not include /bin, /lib, /lib64, /sbin, /var/lock and /var/run. If you have added them for files in their subdirectories, we will prevent the restoration of those folders to prevent dar from replacing those symlinks and leave the system unusable. Those additions are, however, not recommended as they are at risk to overwrite files provides by rpms.</trans>
60 </entry>
61 + <entry>
62 + <base>SMBV1</base>
63 + <trans>Mount as legacy SMB v1 share (unsecure, not recommended).</trans>
64 + </entry>
65 +
66
67 </lexicon>
68 diff -Nur e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup
69 --- e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup 2021-05-12 15:57:35.383000000 -0400
70 +++ e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup 2021-05-12 16:06:37.670000000 -0400
71 @@ -1033,6 +1033,7 @@
72 my ($q) = @_;
73 my $backupwk_status;
74 my $enabledIncOnlyTimeout = "";
75 + my $smbv1 = "";
76 my $backupwkLogin = 'backup';
77 my $backupwkPassword = 'backup';
78 my $backupwkStation = 'host';
79 @@ -1066,6 +1067,7 @@
80 $backupwkIncOnlyTimeout = $rec->prop('IncOnlyTimeout') || 'yes';
81 $compression = $rec->prop('Compression') || '0';
82 $dof = (defined $rec->prop('FullDay')) ? $rec->prop('FullDay') : '7';
83 + $smbv1 = ( ($rec->prop('SmbV1') || 'disabled') eq "enabled" ) ? "enabled" : "disabled" ;
84 $VFSType = $rec->prop('VFSType') || 'cifs';
85 $backupwk_status = $rec->prop('status');
86 }
87 @@ -1094,6 +1096,7 @@
88 {
89 print $fm->localise('LOGIN'), ' ', $backupwkLogin, '<br/>';
90 print $fm->localise('PASSWORD'), ' ********<br/>';
91 + print $fm->localise('SMBV1'), ' ', $smbv1, '<br/>';
92 }
93 print $fm->localise('WORKSTN_BACKUP_SETSNUM'), ' ', $setsNumber, '<br/>';
94 print $fm->localise('WORKSTN_BACKUP_DAYSINSET'), ' ', $filesinset, '<br/>';
95 @@ -1182,6 +1185,7 @@
96 my $VFSType = $q->param ('VFSType');
97 my $error="";
98 my $dof;
99 + my $smbv1 = '';
100 my @usbdisks;
101 my %dlabels = ();
102 my @dlabels = split(' ', $fm->localise('DOW'));
103 @@ -1208,6 +1212,7 @@
104 $backupwkIncOnlyTimeout = $rec->prop('IncOnlyTimeout') || 'yes';
105 $compression = $rec->prop('Compression') || '0';
106 $dof = (defined $rec->prop('FullDay')) ? $rec->prop('FullDay') : '7';
107 + $smbv1 = ( ($rec->prop('SmbV1') || 'disabled') eq "enabled" ) ? "checked" : "" ;
108 }
109
110 ($backupwkHour, $backupwkMin) = split (':', $backupwkTime, -1);
111 @@ -1344,6 +1349,23 @@
112 -default => $backupwkPassword,
113 -size => 20)),
114 );
115 +#smbv1
116 + print $q->Tr(
117 + esmith::cgi::genCell(
118 + $q,
119 + $fm->localise('SMBV1')
120 + ),
121 +
122 + esmith::cgi::genCell (
123 + $q,
124 + " <input type=\"checkbox\""
125 + . " name=\"smbv1\""
126 + . " $smbv1"
127 + . " value=\"on\">"
128 + ),
129 +
130 + );
131 +
132 }
133
134 print '</table>';
135 @@ -1476,6 +1498,7 @@
136
137 my $status = $q->param ('workstnbackup') || "";
138 my $inconly = $q->param ('incOnlyTimeout');
139 + my $smbv1 = $q->param ('smbv1');
140 my $dof = $q->param('dof');
141 my $ampm;
142 my $incOnlyTimeout;
143 @@ -1631,6 +1654,15 @@
144 $incOnlyTimeout = 'no';
145 }
146
147 + if (defined $smbv1 && $smbv1 eq 'on')
148 + {
149 + $smbv1 = 'enabled';
150 + }
151 + else
152 + {
153 + $smbv1 = 'disabled';
154 + }
155 +
156 my $compression = $q->param ('compression');
157 if (( $compression < 0 ) || ( $compression > 9 ))
158 {
159 @@ -1642,6 +1674,7 @@
160
161 $rec->set_prop('SmbHost', $backupwkStation);
162 $rec->set_prop('SmbShare', $backupwkFolder);
163 + $rec->set_prop('SmbV1', $smbv1);
164 $rec->set_prop('Mount', $backupwkMount);
165 $rec->set_prop('Login', $backupwkLogin);
166 $rec->set_prop('Password', $backupwkPassword);
167 @@ -1733,7 +1766,7 @@
168 # we test if the remote host is reachable, else we simply display a warning
169 if ( $VFSType =~ m/cifs|nfs/s )
170 {
171 - my $error_message = vmount($backupwkStation,$backupwkFolder,$backupwkMount,$VFSType);
172 + my $error_message = vmount($backupwkStation,$backupwkFolder,$backupwkMount,$VFSType,$smbv1);
173 if (! $error_message)
174 {
175 bunmount($backupwkMount,$VFSType);
176 @@ -1774,6 +1807,7 @@
177 my $id = $rec->prop('Id') || $conf->get('SystemName')->value . "." . $conf->get('DomainName')->value;
178 my $smbhost = $rec->prop('SmbHost');
179 my $smbshare = $rec->prop('SmbShare');
180 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
181 my $VFSType = $rec->prop('VFSType') || 'cifs';
182 my $err;
183 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
184 @@ -1792,7 +1826,7 @@
185 };
186
187 # Mounting backup shared folder
188 - my $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
189 + my $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
190 if ($error_message)
191 {
192 esmith::cgi::genResult($q, $error_message, $id);
193 @@ -1902,6 +1936,7 @@
194 my $backupwkrec = $conf->get('backupwk');
195 my $smbhost = $backupwkrec->prop('SmbHost');
196 my $smbshare = $backupwkrec->prop('SmbShare');
197 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
198 my $mntdir = $backupwkrec->prop('Mount') || '/mnt/smb';
199 my $key;
200 my $error_message;
201 @@ -1913,7 +1948,7 @@
202 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
203
204 # Mounting backup shared folder
205 - $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
206 + $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
207 if ($error_message)
208 {
209 esmith::cgi::genResult($q, $error_message, $id);
210 @@ -2142,6 +2177,7 @@
211 my $VFSType = $rec->prop('VFSType') || 'cifs';
212 my $smbhost = $rec->prop('SmbHost');
213 my $smbshare = $rec->prop('SmbShare');
214 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
215 my $err;
216 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
217
218 @@ -2160,7 +2196,7 @@
219 };
220
221 # Mounting backup shared folder
222 - my $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
223 + my $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
224 if ($error_message)
225 {
226 esmith::cgi::genResult($q, $error_message, $id);
227 @@ -2295,12 +2331,13 @@
228 my $VFSType = $backupwkrec->prop('VFSType') || 'cifs';
229 my $smbhost = $backupwkrec->prop('SmbHost');
230 my $smbshare = $backupwkrec->prop('SmbShare');
231 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
232 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
233 my $err;
234 my $error_message;
235
236 # Mounting backup shared folder
237 - $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
238 + $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
239 if ($error_message)
240 {
241 esmith::cgi::genHeaderNonCacheable($q,undef, $fm->localise('RESTORE_CANNOT_PROCEED'));
242 @@ -2532,6 +2569,7 @@
243 my $VFSType = $rec->prop('VFSType') || 'cifs';
244 my $smbhost = $rec->prop('SmbHost');
245 my $smbshare = $rec->prop('SmbShare');
246 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
247 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
248 my $err;
249 my $error_message;
250 @@ -2551,7 +2589,7 @@
251 };
252
253 # Mounting backup shared folder
254 - $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
255 + $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
256 if ($error_message)
257 {
258 esmith::cgi::genResult($q, $error_message, $id);
259 @@ -2680,6 +2718,7 @@
260 my $backupwkrec = $conf->get('backupwk');
261 my $smbhost = $backupwkrec->prop('SmbHost');
262 my $smbshare = $backupwkrec->prop('SmbShare');
263 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
264 my $mntdir = $backupwkrec->prop('Mount') || '/mnt/smb';
265 my $key;
266 my $id = $backupwkrec->prop('Id') ||
267 @@ -2702,7 +2741,7 @@
268 }
269
270 # Mounting backup shared folder
271 - $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
272 + $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
273 if ($error_message)
274 {
275 esmith::cgi::genResult($q, $error_message, $id);
276 @@ -2857,12 +2896,13 @@
277 my $VFSType = $backupwkrec->prop('VFSType') || 'cifs';
278 my $smbhost = $backupwkrec->prop('SmbHost');
279 my $smbshare = $backupwkrec->prop('SmbShare');
280 + my $smbv1 = $backupwkrec->prop('SmbV1') || 'disabled';
281 my $err;
282 my $error_message;
283 $mntdir = "/$smbshare" if ( $VFSType eq 'usb' );
284
285 # Mounting backup shared folder
286 - $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType);
287 + $error_message = bmount($mntdir,$smbhost,$smbshare,$VFSType,$smbv1);
288 if ($error_message)
289 {
290 esmith::cgi::genResult($q, $error_message, $id);
291 @@ -3108,11 +3148,12 @@
292 # mount dar unit according to dar-workstation configuration
293 # return nothing if mount successfull
294
295 - my ($host,$share,$mountdir,$login,$password,$VFSType) = @_;
296 + my ($host,$share,$mountdir,$login,$password,$VFSType,$smbv1) = @_;
297
298 if ($VFSType eq 'cifs')
299 {
300 - return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) );
301 + my $opt= ($smbv1 eq "enabled")? ",vers=1.0": "";
302 + return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix$opt 2>&1) );
303 }
304 elsif ($VFSType eq 'nfs')
305 {
306 @@ -3155,7 +3196,7 @@
307
308 sub bmount
309 {
310 - my ($mntdir,$host,$share,$VFSType) = @_;
311 + my ($mntdir,$host,$share,$VFSType,$smbv1) = @_;
312 # verify backup directory not already mounted
313
314 if (!checkMount ($mntdir))
315 @@ -3176,7 +3217,7 @@
316 return ($fm->localise('ERR_MOUNTING_SMBSHARE') . "<//$host/$share>\n" . $err) if $err;
317
318 # mount the backup directory
319 - $err = dmount($host,$share,$mntdir,'','',$VFSType);
320 + $err = dmount($host,$share,$mntdir,'','',$VFSType,$smbv1);
321 return ($fm->localise('ERR_MOUNTING_SMBSHARE') . "<//$host/$share>\n" . $err) if $err;
322
323 # verify $mntdir is mounted
324 @@ -3238,10 +3279,11 @@
325 {
326 # mount dar unit according to dar-workstation configuration in order to test the remote host
327 # return nothing if mount successfull
328 - my ($host,$share,$mountdir,$VFSType) = @_;
329 + my ($host,$share,$mountdir,$VFSType,$smbv1) = @_;
330 if ($VFSType eq 'cifs')
331 {
332 - return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) );
333 + my $opt= ($smbv1 eq "enabled")? ",vers=1.0": "";
334 + return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix$opt 2>&1) );
335 }
336 elsif ($VFSType eq 'nfs')
337 {

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