xattr_trusted.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 *dentry, const char *name,
  17. void *buffer, size_t size)
  18. {
  19. return ext2_xattr_get(d_inode(dentry), 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 *dentry, const char *name,
  25. const void *value, size_t size, int flags)
  26. {
  27. return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name,
  28. value, size, flags);
  29. }
  30. const struct xattr_handler ext2_xattr_trusted_handler = {
  31. .prefix = XATTR_TRUSTED_PREFIX,
  32. .list = ext2_xattr_trusted_list,
  33. .get = ext2_xattr_trusted_get,
  34. .set = ext2_xattr_trusted_set,
  35. };