xfs_mac.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_MAC_H__
  33. #define __XFS_MAC_H__
  34. /*
  35. * Mandatory Access Control
  36. *
  37. * Layout of a composite MAC label:
  38. * ml_list contains the list of categories (MSEN) followed by the list of
  39. * divisions (MINT). This is actually a header for the data structure which
  40. * will have an ml_list with more than one element.
  41. *
  42. * -------------------------------
  43. * | ml_msen_type | ml_mint_type |
  44. * -------------------------------
  45. * | ml_level | ml_grade |
  46. * -------------------------------
  47. * | ml_catcount |
  48. * -------------------------------
  49. * | ml_divcount |
  50. * -------------------------------
  51. * | category 1 |
  52. * | . . . |
  53. * | category N | (where N = ml_catcount)
  54. * -------------------------------
  55. * | division 1 |
  56. * | . . . |
  57. * | division M | (where M = ml_divcount)
  58. * -------------------------------
  59. */
  60. #define XFS_MAC_MAX_SETS 250
  61. typedef struct xfs_mac_label {
  62. __uint8_t ml_msen_type; /* MSEN label type */
  63. __uint8_t ml_mint_type; /* MINT label type */
  64. __uint8_t ml_level; /* Hierarchical level */
  65. __uint8_t ml_grade; /* Hierarchical grade */
  66. __uint16_t ml_catcount; /* Category count */
  67. __uint16_t ml_divcount; /* Division count */
  68. /* Category set, then Division set */
  69. __uint16_t ml_list[XFS_MAC_MAX_SETS];
  70. } xfs_mac_label_t;
  71. /* MSEN label type names. Choose an upper case ASCII character. */
  72. #define XFS_MSEN_ADMIN_LABEL 'A' /* Admin: low<admin != tcsec<high */
  73. #define XFS_MSEN_EQUAL_LABEL 'E' /* Wildcard - always equal */
  74. #define XFS_MSEN_HIGH_LABEL 'H' /* System High - always dominates */
  75. #define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */
  76. #define XFS_MSEN_LOW_LABEL 'L' /* System Low - always dominated */
  77. #define XFS_MSEN_MLD_LABEL 'M' /* TCSEC label on a multi-level dir */
  78. #define XFS_MSEN_MLD_LOW_LABEL 'N' /* System Low, multi-level dir */
  79. #define XFS_MSEN_TCSEC_LABEL 'T' /* TCSEC label */
  80. #define XFS_MSEN_UNKNOWN_LABEL 'U' /* unknown label */
  81. /* MINT label type names. Choose a lower case ASCII character. */
  82. #define XFS_MINT_BIBA_LABEL 'b' /* Dual of a TCSEC label */
  83. #define XFS_MINT_EQUAL_LABEL 'e' /* Wildcard - always equal */
  84. #define XFS_MINT_HIGH_LABEL 'h' /* High Grade - always dominates */
  85. #define XFS_MINT_LOW_LABEL 'l' /* Low Grade - always dominated */
  86. /* On-disk XFS extended attribute names */
  87. #define SGI_MAC_FILE "SGI_MAC_FILE"
  88. #define SGI_MAC_FILE_SIZE (sizeof(SGI_MAC_FILE)-1)
  89. #ifdef __KERNEL__
  90. #ifdef CONFIG_FS_POSIX_MAC
  91. /* NOT YET IMPLEMENTED */
  92. #define MACEXEC 00100
  93. #define MACWRITE 00200
  94. #define MACREAD 00400
  95. struct xfs_inode;
  96. extern int xfs_mac_iaccess(struct xfs_inode *, mode_t, cred_t *);
  97. #define _MAC_XFS_IACCESS(i,m,c) (xfs_mac_iaccess(i,m,c))
  98. #define _MAC_VACCESS(v,c,m) (xfs_mac_vaccess(v,c,m))
  99. #define _MAC_EXISTS xfs_mac_vhaslabel
  100. #else
  101. #define _MAC_XFS_IACCESS(i,m,c) (0)
  102. #define _MAC_VACCESS(v,c,m) (0)
  103. #define _MAC_EXISTS (NULL)
  104. #endif
  105. #endif /* __KERNEL__ */
  106. #endif /* __XFS_MAC_H__ */