Leaked source code of windows server 2003
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.

223 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. delegate.h
  5. Abstract:
  6. The main header file for the delegate tool
  7. Author:
  8. Mac McLain (MacM) 10-02-96
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. //
  14. // Windows Headers
  15. //
  16. #include <windows.h>
  17. #include <rpc.h>
  18. #include <aclapi.h>
  19. #include <aclapip.h>
  20. #include <winldap.h>
  21. #include <ntdsapi.h>
  22. //
  23. // C-Runtime Header
  24. //
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. //
  28. // Macro to help determine if a given argument is a swith or not
  29. //
  30. #define IS_ARG_SWITCH(arg) (arg[0] == '/' || arg[0] == '-')
  31. //
  32. // Type of operation to perform
  33. //
  34. typedef enum _DELEGATE_OP
  35. {
  36. REVOKE = 0,
  37. GRANT,
  38. DENY
  39. } DELEGATE_OP;
  40. //
  41. // Type of object ID we're dealing with
  42. //
  43. typedef enum _DELEGATE_OBJ_ID
  44. {
  45. USER_ID = 0,
  46. GROUP_ID,
  47. PRINT_ID,
  48. VOLUME_ID,
  49. OU_ID,
  50. MEMBER_ID,
  51. PASSWD_ID,
  52. ACCTCTRL_ID,
  53. LOCALGRP_ID,
  54. UNKNOWN_ID // This ALWAYS has to be the last item in the enumeration
  55. } DELEGATE_OBJ_ID, *PDELEGATE_OBJ_ID;
  56. #define MAX_DEF_ACCESS_ID OU_ID // Last item we need to get the
  57. // default access for
  58. //
  59. // List of permissions to be granted/denied
  60. //
  61. #define D_ALL "All"
  62. #define D_USER "User"
  63. #define D_GROUP "Group"
  64. #define D_PRINT "Print"
  65. #define D_VOL "Volume"
  66. #define D_OU "OU"
  67. #define D_MEMBERS "Members"
  68. #define D_PASSWD "Password"
  69. #define D_ENABLE "EnableAccount"
  70. //
  71. // Options flags
  72. //
  73. #define D_REPLACE 0x00000001L
  74. #define D_INHERIT 0x00000002L
  75. #define D_PROTECT 0x00000004L
  76. //
  77. // Function prototypes (delegate.c)
  78. //
  79. VOID
  80. DumpAccess (
  81. IN PWSTR pwszObject,
  82. IN PACTRL_ACCESSW pAccess,
  83. IN PWSTR *ppwszIDs
  84. );
  85. VOID
  86. Usage (
  87. );
  88. DWORD
  89. ConvertStringAToStringW (
  90. IN PSTR pszString,
  91. OUT PWSTR *ppwszString
  92. );
  93. DWORD
  94. ConvertStringWToStringA (
  95. IN PWSTR pwszString,
  96. OUT PSTR *ppszString
  97. );
  98. DWORD
  99. InitializeIdAndAccessLists (
  100. IN PWSTR pwszOU,
  101. IN PWSTR *ppwszObjIdList,
  102. IN PACTRL_ACCESS *ppDefObjAccessList
  103. );
  104. VOID
  105. FreeIdAndAccessList (
  106. IN PWSTR *ppwszObjIdList,
  107. IN PACTRL_ACCESS *ppDefObjAccessList
  108. );
  109. DWORD
  110. ProcessCmdlineUsers (
  111. IN PACTRL_ACCESSW pAccessList,
  112. IN CHAR *argv[],
  113. IN INT argc,
  114. IN DWORD iStart,
  115. IN DELEGATE_OP Op,
  116. IN ULONG fFlags,
  117. IN PWSTR *ppwszIDs,
  118. IN PACTRL_ACCESS *ppDefObjAccessList,
  119. OUT PDWORD pcUsed,
  120. OUT PACTRL_ACCESSW *ppNewAccess
  121. );
  122. DWORD
  123. GetUserInfoFromCmdlineString (
  124. IN PSTR pszUserInfo,
  125. OUT PWSTR *ppwszUser,
  126. OUT PSTR *ppszAccessStart
  127. );
  128. DWORD
  129. AddAccessEntry (
  130. IN PACTRL_ACCESSW pAccessList,
  131. IN PSTR pszAccess,
  132. IN PWSTR pwszTrustee,
  133. IN DELEGATE_OP Op,
  134. IN PWSTR *ppwszIDs,
  135. IN PACTRL_ACCESS *ppDefObjAccessList,
  136. IN ULONG fFlags,
  137. OUT PACTRL_ACCESSW *ppNewAccess
  138. );
  139. DWORD
  140. IsPathOU (
  141. IN PWSTR pwszOU,
  142. OUT PBOOL pfIsOU
  143. );
  144. //
  145. // Function prototypes (ldap.c)
  146. //
  147. DWORD
  148. LDAPReadAttribute (
  149. IN PSTR pszOU,
  150. IN PSTR pszAttribute,
  151. IN PLDAP pLDAP,
  152. OUT PDWORD pcValues,
  153. OUT PSTR **pppszValues
  154. );
  155. VOID
  156. LDAPFreeValues (
  157. IN PSTR *ppszValues
  158. );
  159. DWORD
  160. LDAPReadSchemaPath (
  161. IN PWSTR pwszOU,
  162. OUT PSTR *ppszSchemaPath,
  163. OUT PLDAP *ppLDAP
  164. );
  165. DWORD
  166. LDAPReadSecAndObjIdAsString (
  167. IN PLDAP pLDAP,
  168. IN PSTR pszSchemaPath,
  169. IN PSTR pszObject,
  170. OUT PWSTR *ppwszObjIdAsString,
  171. OUT PACTRL_ACCESS *ppAccess
  172. );
  173. DWORD
  174. LDAPBind (
  175. IN PSTR pszObject,
  176. OUT PLDAP *ppLDAP
  177. );
  178. VOID
  179. LDAPUnbind (
  180. IN PLDAP pLDAP
  181. );