cifsacl.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. struct cifs_ntsd {
  36. __le16 revision; /* revision level */
  37. __le16 type;
  38. __le32 osidoffset;
  39. __le32 gsidoffset;
  40. __le32 sacloffset;
  41. __le32 dacloffset;
  42. } __attribute__((packed));
  43. struct cifs_sid {
  44. __u8 revision; /* revision level */
  45. __u8 num_subauth;
  46. __u8 authority[6];
  47. __le32 sub_auth[5]; /* sub_auth[num_subauth] */
  48. } __attribute__((packed));
  49. struct cifs_acl {
  50. __le16 revision; /* revision level */
  51. __le16 size;
  52. __le32 num_aces;
  53. } __attribute__((packed));
  54. struct cifs_ace {
  55. __u8 type;
  56. __u8 flags;
  57. __le16 size;
  58. __le32 access_req;
  59. struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
  60. } __attribute__((packed));
  61. struct cifs_wksid {
  62. struct cifs_sid cifssid;
  63. char sidname[SIDNAMELENGTH];
  64. } __attribute__((packed));
  65. #ifdef CONFIG_CIFS_EXPERIMENTAL
  66. extern int match_sid(struct cifs_sid *);
  67. extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *);
  68. #endif /* CONFIG_CIFS_EXPERIMENTAL */
  69. #endif /* _CIFSACL_H */