cifsacl.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * fs/cifs/cifsacl.h
  3. *
  4. * Copyright (c) International Business Machines Corp., 2007
  5. * Author(s): Steve French (sfrench@us.ibm.com)
  6. *
  7. * This library is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published
  9. * by the Free Software Foundation; either version 2.1 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  15. * the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef _CIFSACL_H
  22. #define _CIFSACL_H
  23. #define NUM_AUTHS 6 /* number of authority fields */
  24. #define NUM_SUBAUTHS 5 /* number of sub authority fields */
  25. #define NUM_WK_SIDS 7 /* number of well known sids */
  26. #define SIDNAMELENGTH 20 /* long enough for the ones we care about */
  27. #define DEFSECDESCLEN 192 /* sec desc len contaiting a dacl with three aces */
  28. #define READ_BIT 0x4
  29. #define WRITE_BIT 0x2
  30. #define EXEC_BIT 0x1
  31. #define UBITSHIFT 6
  32. #define GBITSHIFT 3
  33. #define ACCESS_ALLOWED 0
  34. #define ACCESS_DENIED 1
  35. #define SIDOWNER 1
  36. #define SIDGROUP 2
  37. #define SIDLEN 150 /* S- 1 revision- 6 authorities- max 5 sub authorities */
  38. #define SID_ID_MAPPED 0
  39. #define SID_ID_PENDING 1
  40. #define SID_MAP_EXPIRE (3600 * HZ) /* map entry expires after one hour */
  41. #define SID_MAP_RETRY (300 * HZ) /* wait 5 minutes for next attempt to map */
  42. struct cifs_ntsd {
  43. __le16 revision; /* revision level */
  44. __le16 type;
  45. __le32 osidoffset;
  46. __le32 gsidoffset;
  47. __le32 sacloffset;
  48. __le32 dacloffset;
  49. } __attribute__((packed));
  50. struct cifs_sid {
  51. __u8 revision; /* revision level */
  52. __u8 num_subauth;
  53. __u8 authority[6];
  54. __le32 sub_auth[5]; /* sub_auth[num_subauth] */
  55. } __attribute__((packed));
  56. struct cifs_acl {
  57. __le16 revision; /* revision level */
  58. __le16 size;
  59. __le32 num_aces;
  60. } __attribute__((packed));
  61. struct cifs_ace {
  62. __u8 type;
  63. __u8 flags;
  64. __le16 size;
  65. __le32 access_req;
  66. struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
  67. } __attribute__((packed));
  68. struct cifs_wksid {
  69. struct cifs_sid cifssid;
  70. char sidname[SIDNAMELENGTH];
  71. } __attribute__((packed));
  72. struct cifs_sid_id {
  73. unsigned int refcount; /* increment with spinlock, decrement without */
  74. unsigned long id;
  75. unsigned long time;
  76. unsigned long state;
  77. char *sidstr;
  78. struct rb_node rbnode;
  79. struct cifs_sid sid;
  80. };
  81. #ifdef __KERNEL__
  82. extern struct key_type cifs_idmap_key_type;
  83. extern const struct cred *root_cred;
  84. #endif /* KERNEL */
  85. extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *);
  86. #endif /* _CIFSACL_H */