Menu

[r10552]: / trunk / patches / ports-rsync.patch  Maximize  Restore  History

Download this file

625 lines (624 with data), 17.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
diff -urN /dev/null net/rsync/files/patch-acls.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-acls.c 2011-10-20 23:16:25.000000000 -0700
@@ -0,0 +1,369 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./acls.c 2011-10-20 23:11:41.000000000 -0700
+@@ -79,20 +79,35 @@
+ uchar other_obj;
+ } rsync_acl;
+
++typedef struct nfs4_acl {
++ char *nfs4_acl_text;
++ ssize_t nfs4_acl_len;
++} nfs4_acl;
++
+ typedef struct {
+ rsync_acl racl;
+ SMB_ACL_T sacl;
+ } acl_duo;
+
++typedef struct {
++ nfs4_acl nacl;
++ SMB_ACL_T sacl;
++} nfs4_duo;
++
+ static const rsync_acl empty_rsync_acl = {
+ {NULL, 0}, NO_ENTRY, NO_ENTRY, NO_ENTRY, NO_ENTRY
+ };
++static const nfs4_acl empty_nfs4_acl = {
++ NULL, -1
++};
+
+ static item_list access_acl_list = EMPTY_ITEM_LIST;
+ static item_list default_acl_list = EMPTY_ITEM_LIST;
++static item_list nfs4_acl_list = EMPTY_ITEM_LIST;
+
+ static size_t prior_access_count = (size_t)-1;
+ static size_t prior_default_count = (size_t)-1;
++static size_t prior_nfs4_count = (size_t)-1;
+
+ /* === Calculations on ACL types === */
+
+@@ -188,6 +203,17 @@
+ return racl;
+ }
+
++static nfs4_acl *create_nfs4_acl(void)
++{
++ nfs4_acl *nacl = new(nfs4_acl);
++
++ if (!nacl)
++ out_of_memory("create_nfs4_acl");
++ *nacl = empty_nfs4_acl;
++
++ return nacl;
++}
++
+ static BOOL ida_entries_equal(const ida_entries *ial1, const ida_entries *ial2)
+ {
+ id_access *ida1, *ida2;
+@@ -212,6 +238,11 @@
+ && ida_entries_equal(&racl1->names, &racl2->names);
+ }
+
++static BOOL nfs4_acl_equal(const nfs4_acl *nacl1, const nfs4_acl *nacl2)
++{
++ return (strcmp(nacl1->nfs4_acl_text, nacl2->nfs4_acl_text) == 0);
++}
++
+ /* Are the extended (non-permission-bit) entries equal? If so, the rest of
+ * the ACL will be handled by the normal mode-preservation code. This is
+ * only meaningful for access ACLs! Note: the 1st arg is a fully-populated
+@@ -245,6 +276,13 @@
+ *racl = empty_rsync_acl;
+ }
+
++static void nfs4_acl_free(nfs4_acl *nacl)
++{
++ if (nacl->nfs4_acl_text)
++ free(nacl->nfs4_acl_text);
++ *nacl = empty_nfs4_acl;
++}
++
+ void free_acl(stat_x *sxp)
+ {
+ if (sxp->acc_acl) {
+@@ -257,6 +295,11 @@
+ free(sxp->def_acl);
+ sxp->def_acl = NULL;
+ }
++ if (sxp->nfs4_acl) {
++ nfs4_acl_free(sxp->nfs4_acl);
++ free(sxp->nfs4_acl);
++ sxp->nfs4_acl = NULL;
++ }
+ }
+
+ #ifdef SMB_ACL_NEED_SORT
+@@ -487,6 +530,26 @@
+ return *match;
+ }
+
++static int find_matching_nfs4_acl(const nfs4_acl *nacl, const item_list *nfs4_acl_list)
++{
++ static int nfs4_match = -1;
++ int *match = &nfs4_match;
++ size_t count = nfs4_acl_list->count;
++
++ if (*match == -1)
++ *match = nfs4_acl_list->count - 1;
++ while (count--) {
++ nfs4_acl *base = nfs4_acl_list->items;
++ if (nfs4_acl_equal(base + *match, nacl))
++ return *match;
++ if (!(*match)--)
++ *match = nfs4_acl_list->count - 1;
++ }
++
++ *match = -1;
++ return *match;
++}
++
+ static int get_rsync_acl(const char *fname, rsync_acl *racl,
+ SMB_ACL_TYPE_T type, mode_t mode)
+ {
+@@ -551,6 +614,21 @@
+ /* Return the Access Control List for the given filename. */
+ int get_acl(const char *fname, stat_x *sxp)
+ {
++ if (sys_acl_get_brand_file(fname, &sxp->brand) < 0)
++ return -1;
++
++ if (sxp->brand == SMB_ACL_BRAND_NFS4) {
++ SMB_ACL_T sacl;
++ if ((sacl = sys_acl_get_file(fname, SMB_ACL_TYPE_NFS4)) == NULL)
++ return -1;
++
++ sxp->nfs4_acl = create_nfs4_acl();
++ sxp->nfs4_acl->nfs4_acl_text = acl_to_text(sacl, &sxp->nfs4_acl->nfs4_acl_len);
++
++ sys_acl_free_acl(sacl);
++ return 0;
++ }
++
+ sxp->acc_acl = create_racl();
+
+ if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+@@ -748,6 +826,25 @@
+ }
+ }
+
++void send_nfs4_acl(int f, nfs4_acl *nacl, item_list *nfs4_list)
++{
++ int ndx = find_matching_nfs4_acl(nacl, nfs4_list);
++
++ /* Send 0 (-1 + 1) to indicate that literal ACL data follows. */
++ write_varint(f, ndx + 1);
++
++ if (ndx < 0) {
++ nfs4_acl *new_nacl = EXPAND_ITEM_LIST(&nfs4_acl_list, nfs4_acl, 1000);
++
++ write_varint(f, nacl->nfs4_acl_len);
++ write_buf(f, nacl->nfs4_acl_text, nacl->nfs4_acl_len);
++
++ *new_nacl = *nacl;
++ *nacl = empty_nfs4_acl;
++ }
++}
++
++
+ /* Send the ACL from the stat_x structure down the indicated file descriptor.
+ * This also frees the ACL data. */
+ void send_acl(int f, stat_x *sxp)
+@@ -757,6 +854,12 @@
+ return;
+ }
+
++ if (sxp->brand == SMB_ACL_BRAND_NFS4) {
++ write_varint(f, SMB_ACL_TYPE_NFS4);
++ send_nfs4_acl(f, sxp->nfs4_acl, &nfs4_acl_list);
++ return;
++ }
++
+ if (!sxp->acc_acl) {
+ sxp->acc_acl = create_racl();
+ rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
+@@ -764,12 +867,14 @@
+ /* Avoid sending values that can be inferred from other data. */
+ rsync_acl_strip_perms(sxp);
+
++ write_varint(f, SMB_ACL_TYPE_ACCESS);
+ send_rsync_acl(f, sxp->acc_acl, SMB_ACL_TYPE_ACCESS, &access_acl_list);
+
+ if (S_ISDIR(sxp->st.st_mode)) {
+ if (!sxp->def_acl)
+ sxp->def_acl = create_racl();
+
++ write_varint(f, SMB_ACL_TYPE_DEFAULT);
+ send_rsync_acl(f, sxp->def_acl, SMB_ACL_TYPE_DEFAULT, &default_acl_list);
+ }
+ }
+@@ -1046,15 +1151,58 @@
+ return ndx;
+ }
+
++
++static int recv_nfs4_acl(int f, item_list *nfs4_acl_list, struct file_struct *file)
++{
++ nfs4_duo *duo_item;
++ int ndx = read_varint(f);
++
++ if (ndx < 0 || (size_t)ndx > nfs4_acl_list->count) {
++ rprintf(FERROR_XFER, "recv_nfs4_index: %s ACL index %d > %d\n",
++ str_acl_type(SMB_ACL_TYPE_NFS4), ndx, (int)nfs4_acl_list->count);
++ exit_cleanup(RERR_STREAMIO);
++ }
++
++ if (ndx != 0)
++ return ndx - 1;
++
++ ndx = nfs4_acl_list->count;
++ duo_item = EXPAND_ITEM_LIST(nfs4_acl_list, nfs4_duo, 1000);
++ duo_item->nacl = empty_nfs4_acl;
++
++ duo_item->nacl.nfs4_acl_len = read_varint(f);
++ duo_item->nacl.nfs4_acl_text = new_array(char, duo_item->nacl.nfs4_acl_len + 1);
++ if (!duo_item->nacl.nfs4_acl_text)
++ out_of_memory("recv_nfs4_acl");
++
++ read_buf(f, duo_item->nacl.nfs4_acl_text, duo_item->nacl.nfs4_acl_len);
++ duo_item->nacl.nfs4_acl_text[duo_item->nacl.nfs4_acl_len] = 0;
++
++ duo_item->sacl = NULL;
++ return ndx;
++}
++
++
+ /* Receive the ACL info the sender has included for this file-list entry. */
+ void receive_acl(int f, struct file_struct *file)
+ {
++ int ndx;
++ SMB_ACL_TYPE_T type;
++
+ if (protocol_version < 30) {
+ old_recv_acl(file, f);
+ return;
+ }
+
+- F_ACL(file) = recv_rsync_acl(f, &access_acl_list, SMB_ACL_TYPE_ACCESS, file->mode);
++ type = read_varint(f);
++ if (type == SMB_ACL_TYPE_NFS4){
++ ndx = recv_nfs4_acl(f, &nfs4_acl_list, file);
++ F_ACL(file) = ndx;
++ return;
++ }
++
++ ndx = recv_rsync_acl(f, &access_acl_list, SMB_ACL_TYPE_ACCESS, file->mode);
++ F_ACL(file) = ndx;
+
+ if (S_ISDIR(file->mode))
+ F_DIR_DEFACL(file) = recv_rsync_acl(f, &default_acl_list, SMB_ACL_TYPE_DEFAULT, 0);
+@@ -1078,10 +1226,37 @@
+ return ndx;
+ }
+
++static int cache_nfs4_acl(nfs4_acl *nacl, item_list *nfs4_list)
++{
++ int ndx;
++
++ if (!nacl)
++ ndx = -1;
++ else if ((ndx = find_matching_nfs4_acl(nacl, nfs4_list)) == -1) {
++ nfs4_duo *new_duo;
++ ndx = nfs4_list->count;
++ new_duo = EXPAND_ITEM_LIST(nfs4_list, nfs4_duo, 1000);
++ new_duo->nacl = *nacl;
++ new_duo->sacl = NULL;
++ *nacl = empty_nfs4_acl;
++ }
++
++ return ndx;
++}
++
++
+ /* Turn the ACL data in stat_x into cached ACL data, setting the index
+ * values in the file struct. */
+ void cache_tmp_acl(struct file_struct *file, stat_x *sxp)
+ {
++ if (sxp->brand == SMB_ACL_BRAND_NFS4) {
++ if (prior_nfs4_count == (size_t)-1)
++ prior_nfs4_count = nfs4_acl_list.count;
++
++ F_ACL(file) = cache_nfs4_acl(sxp->nfs4_acl, &nfs4_acl_list);
++ return;
++ }
++
+ if (prior_access_count == (size_t)-1)
+ prior_access_count = access_acl_list.count;
+
+@@ -1111,6 +1286,21 @@
+ }
+ }
+
++static void uncache_nfs4_acls(item_list *nfs4_list, size_t start)
++{
++ nfs4_duo *nfs4_item = nfs4_list->items;
++ nfs4_duo *nfs4_start = nfs4_item + start;
++
++ nfs4_item += nfs4_list->count;
++ nfs4_list->count = start;
++
++ while (nfs4_item-- > nfs4_start) {
++ nfs4_acl_free(&nfs4_item->nacl);
++ if (nfs4_item->sacl)
++ sys_acl_free_acl(nfs4_item->sacl);
++ }
++}
++
+ void uncache_tmp_acls(void)
+ {
+ if (prior_access_count != (size_t)-1) {
+@@ -1122,6 +1312,10 @@
+ uncache_duo_acls(&default_acl_list, prior_default_count);
+ prior_default_count = (size_t)-1;
+ }
++ if (prior_nfs4_count != (size_t)-1) {
++ uncache_nfs4_acls(&nfs4_acl_list, prior_nfs4_count);
++ prior_nfs4_count = (size_t)-1;
++ }
+ }
+
+ #ifndef HAVE_OSX_ACLS
+@@ -1274,6 +1468,7 @@
+ return 0;
+ }
+
++
+ /* Given a fname, this sets extended access ACL entries, the default ACL (for a
+ * dir), and the regular mode bits on the file. Call this with fname set to
+ * NULL to just check if the ACL is different.
+@@ -1293,6 +1488,32 @@
+ return -1;
+ }
+
++ if (sxp->brand == SMB_ACL_BRAND_NFS4) {
++ ndx = F_ACL(file);
++ if (ndx >= 0 && (size_t)ndx < nfs4_acl_list.count) {
++ nfs4_duo *duo_item = nfs4_acl_list.items;
++ duo_item += ndx;
++ changed = 1;
++
++ if (!duo_item->sacl) {
++ duo_item->sacl = acl_from_text(duo_item->nacl.nfs4_acl_text);
++ if (!duo_item->sacl)
++ return -1;
++ }
++
++ if (!dry_run && fname) {
++ if (sys_acl_set_file(fname, SMB_ACL_TYPE_NFS4, duo_item->sacl) < 0) {
++ rsyserr(FERROR_XFER, errno, "set_acl: sys_acl_set_file(%s, %s)",
++ fname, str_acl_type(SMB_ACL_TYPE_NFS4));
++ return -1;
++ }
++
++ return changed;
++ }
++ }
++ }
++
++
+ ndx = F_ACL(file);
+ if (ndx >= 0 && (size_t)ndx < access_acl_list.count) {
+ acl_duo *duo_item = access_acl_list.items;
diff -urN /dev/null net/rsync/files/patch-backup.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-backup.c 2011-10-20 23:17:47.000000000 -0700
@@ -0,0 +1,19 @@
+--- /dev/null 2010-07-03 09:19:01.000000000 -0700
++++ ./backup.c 2011-10-20 23:11:41.000000000 -0700
+@@ -139,6 +139,8 @@
+ } else {
+ #ifdef SUPPORT_ACLS
+ sx.acc_acl = sx.def_acl = NULL;
++ sx.nfs4_acl = NULL;
++ sys_acl_get_brand_file(rel, &sx.brand);
+ #endif
+ #ifdef SUPPORT_XATTRS
+ sx.xattr = NULL;
+@@ -219,6 +221,7 @@
+ return 1;
+ #ifdef SUPPORT_ACLS
+ sx.acc_acl = sx.def_acl = NULL;
++ sx.nfs4_acl = NULL;
+ #endif
+ #ifdef SUPPORT_XATTRS
+ sx.xattr = NULL;
diff -urN /dev/null net/rsync/files/patch-flist.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-flist.c 2011-10-20 23:18:12.000000000 -0700
@@ -0,0 +1,10 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./flist.c 2011-10-20 23:11:41.000000000 -0700
+@@ -1455,6 +1455,7 @@
+ if (preserve_acls && !S_ISLNK(file->mode)) {
+ sx.st.st_mode = file->mode;
+ sx.acc_acl = sx.def_acl = NULL;
++ sx.nfs4_acl = NULL;
+ if (get_acl(fname, &sx) < 0) {
+ io_error |= IOERR_GENERAL;
+ return NULL;
diff -urN /dev/null net/rsync/files/patch-generator.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-generator.c 2011-10-20 23:18:53.000000000 -0700
@@ -0,0 +1,11 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./generator.c 2011-10-20 23:11:41.000000000 -0700
+@@ -1363,6 +1363,8 @@
+
+ #ifdef SUPPORT_ACLS
+ sx.acc_acl = sx.def_acl = NULL;
++ sx.nfs4_acl = NULL;
++ sys_acl_get_brand_file(fname, &sx.brand);
+ #endif
+ #ifdef SUPPORT_XATTRS
+ sx.xattr = NULL;
diff -urN /dev/null net/rsync/files/patch-hlink.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-hlink.c 2011-10-20 23:20:45.000000000 -0700
@@ -0,0 +1,29 @@
+--- /dev/null 2010-06-30 09:17:26.000000000 -0700
++++ ./hlink.c 2011-10-20 23:11:41.000000000 -0700
+@@ -373,6 +373,7 @@
+ int j = 0;
+ #ifdef SUPPORT_ACLS
+ alt_sx.acc_acl = alt_sx.def_acl = NULL;
++ alt_sx.nfs4_acl = NULL;
+ #endif
+ #ifdef SUPPORT_XATTRS
+ alt_sx.xattr = NULL;
+@@ -411,7 +412,9 @@
+ else {
+ sxp->acc_acl = alt_sx.acc_acl;
+ sxp->def_acl = alt_sx.def_acl;
++ sxp->nfs4_acl = alt_sx.nfs4_acl;
+ alt_sx.acc_acl = alt_sx.def_acl = NULL;
++ alt_sx.nfs4_acl = NULL;
+ }
+ }
+ #endif
+@@ -501,6 +504,8 @@
+
+ #ifdef SUPPORT_ACLS
+ prev_sx.acc_acl = prev_sx.def_acl = NULL;
++ prev_sx.nfs4_acl = NULL;
++ sys_acl_get_brand_file(fname, &prev_sx.brand);
+ #endif
+ #ifdef SUPPORT_XATTRS
+ prev_sx.xattr = NULL;
diff -urN /dev/null net/rsync/files/patch-main.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-main.c 2011-10-20 23:22:37.000000000 -0700
@@ -0,0 +1,10 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./main.c 2011-10-20 23:11:53.000000000 -0700
+@@ -932,6 +932,7 @@
+ rprintf(FERROR,"server_recv: recv_file_list error\n");
+ exit_cleanup(RERR_FILESELECT);
+ }
++
+ if (inc_recurse && file_total == 1)
+ recv_additional_file_list(f_in);
+ verbose = save_verbose;
diff -urN /dev/null net/rsync/files/patch-rsync.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-rsync.c 2011-10-20 23:23:10.000000000 -0700
@@ -0,0 +1,38 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./rsync.c 2011-10-20 23:11:53.000000000 -0700
+@@ -466,6 +466,8 @@
+ }
+ #ifdef SUPPORT_ACLS
+ sx2.acc_acl = sx2.def_acl = NULL;
++ sx2.nfs4_acl = NULL;
++ sys_acl_get_brand_file(fname, &sx2.brand);
+ #endif
+ #ifdef SUPPORT_XATTRS
+ sx2.xattr = NULL;
+@@ -573,10 +575,12 @@
+ * If set_acl() changes permission bits in the process of setting
+ * an access ACL, it changes sxp->st.st_mode so we know whether we
+ * need to chmod(). */
++/*
+ if (preserve_acls && !S_ISLNK(new_mode)) {
+ if (set_acl(fname, file, sxp, new_mode) > 0)
+ updated = 1;
+ }
++*/
+ #endif
+
+ #ifdef HAVE_CHMOD
+@@ -611,6 +615,13 @@
+ }
+ #endif
+
++#ifdef SUPPORT_ACLS
++ if (preserve_acls && !S_ISLNK(new_mode)) {
++ if (set_acl(fname, file, sxp, new_mode) > 0)
++ updated = 1;
++ }
++#endif
++
+ if (verbose > 1 && flags & ATTRS_REPORT) {
+ if (updated)
+ rprintf(FCLIENT, "%s\n", fname);
diff -urN /dev/null net/rsync/files/patch-rsync.h
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-rsync.h 2011-10-20 23:23:41.000000000 -0700
@@ -0,0 +1,26 @@
+--- /dev/null 2011-10-20 23:09:29.000000000 -0700
++++ ./rsync.h 2011-10-20 23:11:53.000000000 -0700
+@@ -954,13 +954,22 @@
+ #ifdef SUPPORT_ACLS
+ struct rsync_acl *acc_acl; /* access ACL */
+ struct rsync_acl *def_acl; /* default ACL */
++ struct nfs4_acl *nfs4_acl; /* NFSv4 ACL */
++ int brand;
+ #endif
+ #ifdef SUPPORT_XATTRS
+ item_list *xattr;
+ #endif
+ } stat_x;
+
+-#define ACL_READY(sx) ((sx).acc_acl != NULL)
++#ifdef SUPPORT_ACLS
++#include "lib/sysacls.h"
++#endif
++
++#define ACL_READY_POSIX(sx) ((sx).acc_acl != NULL)
++#define ACL_READY_NFS4(sx) ((sx).nfs4_acl != NULL)
++#define ACL_READY(sx) (((sx).brand == SMB_ACL_BRAND_NFS4) ? (ACL_READY_NFS4(sx)) : (ACL_READY_POSIX(sx)))
++
+ #define XATTR_READY(sx) ((sx).xattr != NULL)
+
+ #include "proto.h"
diff -urN /dev/null net/rsync/files/patch-sysacls.c
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-sysacls.c 2011-10-20 23:21:36.000000000 -0700
@@ -0,0 +1,41 @@
+--- /dev/null 2011-02-22 08:51:14.000000000 -0800
++++ ./lib/sysacls.c 2011-10-20 23:11:48.000000000 -0700
+@@ -80,12 +80,36 @@
+ return acl_get_file( path_p, type);
+ }
+
+-#if 0
+ SMB_ACL_T sys_acl_get_fd(int fd)
+ {
+ return acl_get_fd(fd);
+ }
+-#endif
++
++int sys_acl_get_brand( SMB_ACL_T the_acl, int *brand_p)
++{
++ return acl_get_brand_np(the_acl, brand_p);
++}
++
++int sys_acl_get_brand_file( const char *path_p, int *brand_p)
++{
++ int fd;
++ acl_t acl;
++
++ if ((fd = open(path_p, O_RDONLY|O_NONBLOCK)) < 0)
++ return -1;
++ if ((acl = acl_get_fd(fd)) == NULL) {
++ close(fd);
++ return -1;
++ }
++ close(fd);
++ if (acl_get_brand_np(acl, brand_p) < 0) {
++ acl_free(acl);
++ return -1;
++ }
++
++ acl_free(acl);
++ return 0;
++}
+
+ #if defined(HAVE_ACL_GET_PERM_NP)
+ #define acl_get_perm(p, b) acl_get_perm_np(p, b)
diff -urN /dev/null rsync/files/patch-sysacls.h
--- /dev/null 1969-12-31 16:00:00.000000000 -0800
+++ net/rsync/files/patch-sysacls.h 2011-10-20 23:22:05.000000000 -0700
@@ -0,0 +1,31 @@
+--- /dev/null 2008-03-01 12:01:41.000000000 -0800
++++ ./lib/sysacls.h 2011-10-20 23:11:53.000000000 -0700
+@@ -48,6 +48,7 @@
+ #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
+ #define SMB_ACL_OTHER ACL_OTHER
+ #define SMB_ACL_MASK ACL_MASK
++#define SMB_ACL_EVERYONE ACL_EVERYONE
+
+ #define SMB_ACL_T acl_t
+
+@@ -58,6 +59,11 @@
+
+ #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
+ #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
++#define SMB_ACL_TYPE_NFS4 ACL_TYPE_NFS4
++
++#define SMB_ACL_BRAND_UNKNOWN ACL_BRAND_UNKNOWN
++#define SMB_ACL_BRAND_POSIX ACL_BRAND_POSIX
++#define SMB_ACL_BRAND_NFS4 ACL_BRAND_NFS4
+
+ #define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
+ #define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
+@@ -292,6 +298,8 @@
+ SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
+ SMB_ACL_T sys_acl_get_fd(int fd);
+ SMB_ACL_T sys_acl_init(int count);
++int sys_acl_get_brand( SMB_ACL_T the_acl, int *brand_p);
++int sys_acl_get_brand_file( const char *path_p, int *brand_p);
+ int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
+ int sys_acl_set_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype, uint32 bits, id_t u_g_id);
+ int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits);
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.