xattr_trusted.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * linux/fs/ext2/xattr_trusted.c
  3. * Handler for trusted extended attributes.
  4. *
  5. * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
  6. */
  7. #include "ext2.h"
  8. #include "xattr.h"
  9. static bool
  10. ext2_xattr_trusted_list(struct dentry *dentry)
  11. {
  12. return capable(CAP_SYS_ADMIN);
  13. }
  14. static int
  15. ext2_xattr_trusted_get(const struct xattr_handler *handler,
  16. struct dentry *unused, struct inode *inode,
  17. const char *name, void *buffer, size_t size)
  18. {
  19. return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
  20. buffer, size);
  21. }
  22. static int
  23. ext2_xattr_trusted_set(const struct xattr_handler *handler,
  24. struct dentry *unused, struct inode *inode,
  25. const char *name, const void *value,
  26. size_t size, int flags)
  27. {
  28. return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
  29. value, size, flags);
  30. }
  31. const struct xattr_handler ext2_xattr_trusted_handler = {
  32. .prefix = XATTR_TRUSTED_PREFIX,
  33. .list = ext2_xattr_trusted_list,
  34. .get = ext2_xattr_trusted_get,
  35. .set = ext2_xattr_trusted_set,
  36. };