MCPcopy Create free account
hub / github.com/RsyncProject/rsync / recv_rsync_acl

Function recv_rsync_acl

acls.c:731–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731static int recv_rsync_acl(int f, item_list *racl_list, SMB_ACL_TYPE_T type, mode_t mode)
732{
733 uchar computed_mask_bits = 0;
734 acl_duo *duo_item;
735 uchar flags;
736 int ndx = read_varint(f);
737
738 if (ndx < 0 || (size_t)ndx > racl_list->count) {
739 rprintf(FERROR_XFER, "recv_acl_index: %s ACL index %d > %d\n",
740 str_acl_type(type), ndx, (int)racl_list->count);
741 exit_cleanup(RERR_STREAMIO);
742 }
743
744 if (ndx != 0)
745 return ndx - 1;
746
747 ndx = racl_list->count;
748 duo_item = EXPAND_ITEM_LIST(racl_list, acl_duo, 1000);
749 duo_item->racl = empty_rsync_acl;
750
751 flags = read_byte(f);
752
753 if (flags & XMIT_USER_OBJ)
754 duo_item->racl.user_obj = recv_acl_access(f, NULL);
755 if (flags & XMIT_GROUP_OBJ)
756 duo_item->racl.group_obj = recv_acl_access(f, NULL);
757 if (flags & XMIT_MASK_OBJ)
758 duo_item->racl.mask_obj = recv_acl_access(f, NULL);
759 if (flags & XMIT_OTHER_OBJ)
760 duo_item->racl.other_obj = recv_acl_access(f, NULL);
761 if (flags & XMIT_NAME_LIST)
762 computed_mask_bits |= recv_ida_entries(f, &duo_item->racl.names);
763
764#ifdef HAVE_OSX_ACLS
765 /* If we received a superfluous mask, throw it away. */
766 duo_item->racl.mask_obj = NO_ENTRY;
767 (void)mode;
768 (void)computed_mask_bits;
769#else
770 if (duo_item->racl.names.count && duo_item->racl.mask_obj == NO_ENTRY) {
771 /* Mask must be non-empty with lists. */
772 if (type == SMB_ACL_TYPE_ACCESS)
773 computed_mask_bits = (mode >> 3) & 7;
774 else
775 computed_mask_bits |= duo_item->racl.group_obj & ~NO_ENTRY;
776 duo_item->racl.mask_obj = computed_mask_bits;
777 }
778#endif
779
780 duo_item->sacl = NULL;
781
782 return ndx;
783}
784
785/* Receive the ACL info the sender has included for this file-list entry. */
786void receive_acl(int f, struct file_struct *file)

Callers 1

receive_aclFunction · 0.85

Calls 6

read_varintFunction · 0.85
str_acl_typeFunction · 0.85
read_byteFunction · 0.85
recv_acl_accessFunction · 0.85
recv_ida_entriesFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected