1/* Copy extended attributes between files - default check callback */
2
3/* Copyright (C) 2003 Andreas Gruenbacher <agruen@suse.de>, SuSE Linux AG.
4
5   This program is free software; you can redistribute it and/or modify it
6   under the terms of the GNU General Public License as published by the
7   Free Software Foundation; either version 2, or (at your option) any
8   later version.
9
10   This program is distributed in the hope that it will be useful, but
11   WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; see the file COPYING.  If not, write to the Free
17   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
18
19#include <string.h>
20#include "error_context.h"
21
22int
23attr_copy_check_permissions(const char *name, struct error_context *ctx)
24{
25	/* Skip POSIX ACLs. */
26	if (strncmp(name, "system.posix_acl_", 17) == 0 &&
27	    (strcmp(name+17, "access") == 0 ||
28	     strcmp(name+17, "default") == 0))
29		return 0;
30
31	/* Skip permissions attributes which are used on IRIX, and
32	   hence are part of the XFS ondisk format (incl. ACLs). */
33	if (strncmp(name, "trusted.SGI_", 12) == 0 &&
34	    (strcmp(name+12, "ACL_DEFAULT") == 0 ||
35	     strcmp(name+12, "ACL_FILE") == 0 ||
36	     strcmp(name+12, "CAP_FILE") == 0 ||
37	     strcmp(name+12, "MAC_FILE") == 0))
38		return 0;
39
40	/* The xfsroot namespace mirrored attributes, some of which
41	   are also also available via the system.* and trusted.*
42	   namespaces.  To avoid the problems this would cause,
43	   we skip xfsroot altogether.
44	   Note: xfsroot namespace has now been removed from XFS. */
45	if (strncmp(name, "xfsroot.", 8) == 0)
46		return 0;
47
48	return 1;
49}
50
51