@@ -106,10 +106,6 @@ static int ftw_copy_file(const struct FTW *, const char *, const struct stat *,
106
106
static int ftw_copy_link (const struct FTW * , const char * , const struct stat * ,
107
107
int );
108
108
static int setfile (const struct stat * , int );
109
- #if 0
110
- static int preserve_dir_acls (const struct stat * , char * , char * );
111
- #endif
112
- static int preserve_fd_acls (int , int );
113
109
114
110
static void upfunc (void )
115
111
{
@@ -607,13 +603,6 @@ static int copy(const char *path,
607
603
608
604
if (pflag && setfile (statp , -1 )) {
609
605
rval = 1 ;
610
- #if 0
611
-
612
- if (preserve_dir_acls (statp , curr -> fts_accpath , to .p_path ) != 0 ) {
613
- rval = 1 ;
614
- }
615
-
616
- #endif
617
606
}
618
607
619
608
break ;
@@ -911,10 +900,6 @@ static int ftw_copy_file(const struct FTW *entp _U_,
911
900
rval = 1 ;
912
901
}
913
902
914
- if (pflag && preserve_fd_acls (from_fd , to_fd ) != 0 ) {
915
- rval = 1 ;
916
- }
917
-
918
903
if (close (to_fd )) {
919
904
SLOG ("%s: %s" , to .p_path , strerror (errno ));
920
905
rval = 1 ;
@@ -1027,169 +1012,3 @@ static int setfile(const struct stat *fs, int fd)
1027
1012
#endif
1028
1013
return rval ;
1029
1014
}
1030
-
1031
- static int preserve_fd_acls (int source_fd _U_ , int dest_fd _U_ )
1032
- {
1033
- #if 0
1034
- acl_t acl ;
1035
- acl_type_t acl_type ;
1036
- int acl_supported = 0 , ret , trivial ;
1037
- ret = fpathconf (source_fd , _PC_ACL_NFS4 );
1038
-
1039
- if (ret > 0 ) {
1040
- acl_supported = 1 ;
1041
- acl_type = ACL_TYPE_NFS4 ;
1042
- } else if (ret < 0 && errno != EINVAL ) {
1043
- warn ("fpathconf(..., _PC_ACL_NFS4) failed for %s" , to .p_path );
1044
- return 1 ;
1045
- }
1046
-
1047
- if (acl_supported == 0 ) {
1048
- ret = fpathconf (source_fd , _PC_ACL_EXTENDED );
1049
-
1050
- if (ret > 0 ) {
1051
- acl_supported = 1 ;
1052
- acl_type = ACL_TYPE_ACCESS ;
1053
- } else if (ret < 0 && errno != EINVAL ) {
1054
- warn ("fpathconf(..., _PC_ACL_EXTENDED) failed for %s" ,
1055
- to .p_path );
1056
- return 1 ;
1057
- }
1058
- }
1059
-
1060
- if (acl_supported == 0 ) {
1061
- return 0 ;
1062
- }
1063
-
1064
- acl = acl_get_fd_np (source_fd , acl_type );
1065
-
1066
- if (acl == NULL ) {
1067
- warn ("failed to get acl entries while setting %s" , to .p_path );
1068
- return 1 ;
1069
- }
1070
-
1071
- if (acl_is_trivial_np (acl , & trivial )) {
1072
- warn ("acl_is_trivial() failed for %s" , to .p_path );
1073
- acl_free (acl );
1074
- return 1 ;
1075
- }
1076
-
1077
- if (trivial ) {
1078
- acl_free (acl );
1079
- return 0 ;
1080
- }
1081
-
1082
- if (acl_set_fd_np (dest_fd , acl , acl_type ) < 0 ) {
1083
- warn ("failed to set acl entries for %s" , to .p_path );
1084
- acl_free (acl );
1085
- return 1 ;
1086
- }
1087
-
1088
- acl_free (acl );
1089
- #endif
1090
- return 0 ;
1091
- }
1092
-
1093
- #if 0
1094
- static int preserve_dir_acls (const struct stat * fs , char * source_dir ,
1095
- char * dest_dir )
1096
- {
1097
- acl_t (* aclgetf )(const char * , acl_type_t );
1098
- int (* aclsetf )(const char * , acl_type_t , acl_t );
1099
- struct acl * aclp ;
1100
- acl_t acl ;
1101
- acl_type_t acl_type ;
1102
- int acl_supported = 0 , ret , trivial ;
1103
- ret = pathconf (source_dir , _PC_ACL_NFS4 );
1104
-
1105
- if (ret > 0 ) {
1106
- acl_supported = 1 ;
1107
- acl_type = ACL_TYPE_NFS4 ;
1108
- } else if (ret < 0 && errno != EINVAL ) {
1109
- warn ("fpathconf(..., _PC_ACL_NFS4) failed for %s" , source_dir );
1110
- return 1 ;
1111
- }
1112
-
1113
- if (acl_supported == 0 ) {
1114
- ret = pathconf (source_dir , _PC_ACL_EXTENDED );
1115
-
1116
- if (ret > 0 ) {
1117
- acl_supported = 1 ;
1118
- acl_type = ACL_TYPE_ACCESS ;
1119
- } else if (ret < 0 && errno != EINVAL ) {
1120
- warn ("fpathconf(..., _PC_ACL_EXTENDED) failed for %s" ,
1121
- source_dir );
1122
- return 1 ;
1123
- }
1124
- }
1125
-
1126
- if (acl_supported == 0 ) {
1127
- return 0 ;
1128
- }
1129
-
1130
- /*
1131
- * If the file is a link we will not follow it
1132
- */
1133
- if (S_ISLNK (fs -> st_mode )) {
1134
- aclgetf = acl_get_link_np ;
1135
- aclsetf = acl_set_link_np ;
1136
- } else {
1137
- aclgetf = acl_get_file ;
1138
- aclsetf = acl_set_file ;
1139
- }
1140
-
1141
- if (acl_type == ACL_TYPE_ACCESS ) {
1142
- /*
1143
- * Even if there is no ACL_TYPE_DEFAULT entry here, a zero
1144
- * size ACL will be returned. So it is not safe to simply
1145
- * check the pointer to see if the default ACL is present.
1146
- */
1147
- acl = aclgetf (source_dir , ACL_TYPE_DEFAULT );
1148
-
1149
- if (acl == NULL ) {
1150
- warn ("failed to get default acl entries on %s" ,
1151
- source_dir );
1152
- return 1 ;
1153
- }
1154
-
1155
- aclp = & acl -> ats_acl ;
1156
-
1157
- if (aclp -> acl_cnt != 0 && aclsetf (dest_dir ,
1158
- ACL_TYPE_DEFAULT , acl ) < 0 ) {
1159
- warn ("failed to set default acl entries on %s" ,
1160
- dest_dir );
1161
- acl_free (acl );
1162
- return 1 ;
1163
- }
1164
-
1165
- acl_free (acl );
1166
- }
1167
-
1168
- acl = aclgetf (source_dir , acl_type );
1169
-
1170
- if (acl == NULL ) {
1171
- warn ("failed to get acl entries on %s" , source_dir );
1172
- return 1 ;
1173
- }
1174
-
1175
- if (acl_is_trivial_np (acl , & trivial )) {
1176
- warn ("acl_is_trivial() failed on %s" , source_dir );
1177
- acl_free (acl );
1178
- return 1 ;
1179
- }
1180
-
1181
- if (trivial ) {
1182
- acl_free (acl );
1183
- return 0 ;
1184
- }
1185
-
1186
- if (aclsetf (dest_dir , acl_type , acl ) < 0 ) {
1187
- warn ("failed to set acl entries on %s" , dest_dir );
1188
- acl_free (acl );
1189
- return 1 ;
1190
- }
1191
-
1192
- acl_free (acl );
1193
- return 0 ;
1194
- }
1195
- #endif
0 commit comments