Mention the number of child args.
[rsync/rsync.git] / acls.c
diff --git a/acls.c b/acls.c
index 347356d..90279fc 100644 (file)
--- a/acls.c
+++ b/acls.c
@@ -31,6 +31,8 @@ extern int list_only;
 extern int orig_umask;
 extern int numeric_ids;
 extern int inc_recurse;
+extern int preserve_devices;
+extern int preserve_specials;
 
 /* Flags used to indicate what items are being transmitted for an entry. */
 #define XMIT_USER_OBJ (1<<0)
@@ -537,6 +539,23 @@ static int get_rsync_acl(const char *fname, rsync_acl *racl,
 int get_acl(const char *fname, stat_x *sxp)
 {
        sxp->acc_acl = create_racl();
+
+       if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+               /* Everyone supports this. */
+       } else if (S_ISLNK(sxp->st.st_mode)) {
+               return 0;
+       } else if (IS_SPECIAL(sxp->st.st_mode)) {
+#ifndef NO_SPECIAL_ACLS
+               if (!preserve_specials)
+#endif
+                       return 0;
+       } else if (IS_DEVICE(sxp->st.st_mode)) {
+#ifndef NO_DEVICE_ACLS
+               if (!preserve_devices)
+#endif
+                       return 0;
+       }
+
        if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS,
                          sxp->st.st_mode) < 0) {
                free_acl(sxp);
@@ -570,9 +589,9 @@ static void send_ida_entries(int f, const ida_entries *idal)
                const char *name;
                if (ida->access & NAME_IS_USER) {
                        xbits |= XFLAG_NAME_IS_USER;
-                       name = add_uid(ida->id);
+                       name = numeric_ids ? NULL : add_uid(ida->id);
                } else
-                       name = add_gid(ida->id);
+                       name = numeric_ids ? NULL : add_gid(ida->id);
                write_varint(f, ida->id);
                if (inc_recurse && name) {
                        int len = strlen(name);
@@ -1082,6 +1101,9 @@ int default_perms_for_dir(const char *dir)
        if (sacl == NULL) {
                /* Couldn't get an ACL.  Darn. */
                switch (errno) {
+               case EINVAL:
+                       /* If SMB_ACL_TYPE_DEFAULT isn't valid, then the ACLs must be non-POSIX. */
+                       break;
 #ifdef ENOTSUP
                case ENOTSUP:
 #endif