Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. dsacls.h
  5. Abstract:
  6. The main header file for the dsacls tool
  7. Author:
  8. Mac McLain (MacM) 10-02-96
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. #ifndef _DSACLS_H
  14. #define _DSACLS_H
  15. #include <caclsmsg.h>
  16. #include "accctrl.h"
  17. #define FLAG_ON(flags,bit) ((flags) & (bit))
  18. //Some Error Checking Macros
  19. #define CHECK_NULL( ptr, jump_loc ) \
  20. if( ptr == NULL ) \
  21. { \
  22. dwErr = ERROR_NOT_ENOUGH_MEMORY; \
  23. goto jump_loc; \
  24. }
  25. #define CHECK_HR( hr, jump_loc ) \
  26. if( hr != S_OK ) \
  27. { \
  28. dwErr = HRESULT_CODE( hr ); \
  29. goto jump_loc; \
  30. } \
  31. //
  32. // Local prototypes
  33. //
  34. #if DSACL_DBG
  35. ULONG gfDebug;
  36. #endif
  37. //
  38. // Type of operation to perform
  39. //
  40. typedef enum _DSACLS_OP
  41. {
  42. REVOKE = 0,
  43. GRANT,
  44. DENY
  45. } DSACLS_OP;
  46. #define DSACLS_EXTRA_INFO_NONE 0
  47. #define DSACLS_EXTRA_INFO_REQUIRED 1
  48. #define DSACLS_EXTRA_INFO_OPTIONAL 2
  49. typedef struct _DSACLS_ARG {
  50. ULONG ResourceId;
  51. PWSTR String;
  52. ULONG Length;
  53. ULONG StartIndex;
  54. ULONG Flag;
  55. ULONG SkipCount;
  56. BOOLEAN SkipNonFlag;
  57. WORD ExtraInfo;
  58. } DSACLS_ARG, *PDSACLS_ARG;
  59. typedef struct _DSACLS_INHERIT {
  60. ULONG ResourceId;
  61. PWSTR String;
  62. ULONG Length;
  63. BOOLEAN ValidForInput;
  64. ULONG InheritFlag;
  65. } DSACLS_INHERIT, *PDSACLS_INHERIT;
  66. typedef struct _DSACLS_RIGHTS {
  67. ULONG ResourceId;
  68. PWSTR String;
  69. ULONG ResourceIdEx;
  70. PWSTR StringEx;
  71. ULONG Length;
  72. ULONG Right;
  73. } DSACLS_RIGHTS, *PDSACLS_RIGHTS;
  74. typedef struct _DSACLS_PROTECT {
  75. ULONG ResourceId;
  76. PWSTR String;
  77. ULONG Length;
  78. ULONG Right;
  79. } DSACLS_PROTECT, *PDSACLS_PROTECT;
  80. extern LPWSTR g_szSchemaNamingContext;
  81. extern LPWSTR g_szConfigurationNamingContext;
  82. extern HMODULE g_hInstance;
  83. extern LPWSTR g_szServerName;
  84. extern CCache *g_Cache;
  85. //
  86. // Prototypes from dsacls.c
  87. //
  88. DWORD
  89. InitializeGlobalArrays();
  90. DWORD
  91. ConvertArgvToUnicode( LPWSTR * wargv,
  92. char ** argv,
  93. int argc ) ;
  94. DWORD
  95. WriteObjectSecurity( IN LPWSTR pszObject,
  96. IN SECURITY_INFORMATION si,
  97. IN PSECURITY_DESCRIPTOR pSD );
  98. //
  99. // prototypes from refresh.c
  100. //
  101. DWORD
  102. SetDefaultSecurityOnObjectTree(
  103. IN PWSTR ObjectPath,
  104. IN BOOLEAN Propagate,
  105. IN SECURITY_INFORMATION Protection
  106. );
  107. void MapGeneric( ACCESS_MASK * pMask );
  108. void DisplayAccessRights( UINT nSpace, ACCESS_MASK m_Mask );
  109. void ConvertAccessMaskToGenericString( ACCESS_MASK m_Mask, LPWSTR szLoadBuffer, UINT nBuffer );
  110. DWORD BuildExplicitAccess( IN PSID pSid,
  111. IN GUID* pGuidObject,
  112. IN GUID* pGuidInherit,
  113. IN ACCESS_MODE AccessMode,
  114. IN ULONG Access,
  115. IN ULONG Inheritance,
  116. OUT PEXPLICIT_ACCESS pExplicitAccess );
  117. DWORD ParseUserAndPermissons( IN LPWSTR pszArgument,
  118. IN DSACLS_OP Op,
  119. IN ULONG RightsListCount,
  120. IN PDSACLS_RIGHTS RightsList,
  121. OUT LPWSTR * ppszTrusteeName,
  122. OUT PULONG pAccess,
  123. OUT LPWSTR * ppszObjectId,
  124. OUT LPWSTR * ppszInheritId );
  125. //
  126. // Define the rights used in the DS
  127. //
  128. #define RIGHT_DS_CREATE_CHILD ACTRL_DS_CREATE_CHILD
  129. #define RIGHT_DS_DELETE_CHILD ACTRL_DS_DELETE_CHILD
  130. #define RIGHT_DS_DELETE_SELF DELETE
  131. #define RIGHT_DS_LIST_CONTENTS ACTRL_DS_LIST
  132. #define RIGHT_DS_WRITE_PROPERTY_EXTENDED ACTRL_DS_SELF
  133. #define RIGHT_DS_READ_PROPERTY ACTRL_DS_READ_PROP
  134. #define RIGHT_DS_WRITE_PROPERTY ACTRL_DS_WRITE_PROP
  135. #define RIGHT_DS_DELETE_TREE ACTRL_DS_DELETE_TREE
  136. #define RIGHT_DS_LIST_OBJECT ACTRL_DS_LIST_OBJECT
  137. #ifndef ACTRL_DS_CONTROL_ACCESS
  138. #define ACTRL_DS_CONTROL_ACCESS ACTRL_PERM_9
  139. #endif
  140. #define RIGHT_DS_CONTROL_ACCESS ACTRL_DS_CONTROL_ACCESS
  141. //
  142. // Define the generic rights
  143. //
  144. // generic read
  145. #define GENERIC_READ_MAPPING ((STANDARD_RIGHTS_READ) | \
  146. (RIGHT_DS_LIST_CONTENTS) | \
  147. (RIGHT_DS_READ_PROPERTY) | \
  148. (RIGHT_DS_LIST_OBJECT))
  149. // generic execute
  150. #define GENERIC_EXECUTE_MAPPING ((STANDARD_RIGHTS_EXECUTE) | \
  151. (RIGHT_DS_LIST_CONTENTS))
  152. // generic right
  153. #define GENERIC_WRITE_MAPPING ((STANDARD_RIGHTS_WRITE) | \
  154. (RIGHT_DS_WRITE_PROPERTY_EXTENDED) | \
  155. (RIGHT_DS_WRITE_PROPERTY))
  156. // generic all
  157. #define GENERIC_ALL_MAPPING ((STANDARD_RIGHTS_REQUIRED) | \
  158. (RIGHT_DS_CREATE_CHILD) | \
  159. (RIGHT_DS_DELETE_CHILD) | \
  160. (RIGHT_DS_DELETE_TREE) | \
  161. (RIGHT_DS_READ_PROPERTY) | \
  162. (RIGHT_DS_WRITE_PROPERTY) | \
  163. (RIGHT_DS_LIST_CONTENTS) | \
  164. (RIGHT_DS_LIST_OBJECT) | \
  165. (RIGHT_DS_CONTROL_ACCESS) | \
  166. (RIGHT_DS_WRITE_PROPERTY_EXTENDED))
  167. //
  168. // Standard DS generic access rights mapping
  169. //
  170. #define DS_GENERIC_MAPPING {GENERIC_READ_MAPPING, \
  171. GENERIC_WRITE_MAPPING, \
  172. GENERIC_EXECUTE_MAPPING, \
  173. GENERIC_ALL_MAPPING}
  174. #endif