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.

281 lines
10 KiB

  1. #ifndef _NTDSAPIP_H_
  2. #define _NTDSAPIP_H_
  3. // Private definitions related to sdk\inc\ntdsapi.h.
  4. // The following are DS_NAME_FORMATs which we don't want to publish
  5. // in ntdsapi.h. Although DS_NAME_FORMAT is an enumerated type, we
  6. // pass vanilla DWORDs on the wire such that RPC doesn't complain about
  7. // enumerated type values out of range or unknown. These should be
  8. // defined at the high end of the range so we can extend DS_NAME_FORMAT
  9. // in future versions w/o holes which will leave people wondering and
  10. // experimenting what those "unused" values are used for.
  11. #define DS_LIST_SITES 0xffffffff
  12. #define DS_LIST_SERVERS_IN_SITE 0xfffffffe
  13. #define DS_LIST_DOMAINS_IN_SITE 0xfffffffd
  14. #define DS_LIST_SERVERS_FOR_DOMAIN_IN_SITE 0xfffffffc
  15. #define DS_LIST_INFO_FOR_SERVER 0xfffffffb
  16. #define DS_LIST_ROLES 0xfffffffa
  17. #define DS_NT4_ACCOUNT_NAME_SANS_DOMAIN 0xfffffff9
  18. #define DS_MAP_SCHEMA_GUID 0xfffffff8
  19. #define DS_LIST_DOMAINS 0xfffffff7
  20. #define DS_LIST_NCS 0xfffffff6
  21. #define DS_ALT_SECURITY_IDENTITIES_NAME 0xfffffff5
  22. #define DS_STRING_SID_NAME 0xfffffff4
  23. #define DS_LIST_SERVERS_WITH_DCS_IN_SITE 0xfffffff3
  24. #define DS_USER_PRINCIPAL_NAME_FOR_LOGON 0xfffffff2
  25. #define DS_LIST_GLOBAL_CATALOG_SERVERS 0xfffffff1
  26. #define DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX 0xfffffff0
  27. #define DS_USER_PRINCIPAL_NAME_AND_ALTSECID 0xffffffef
  28. // following should always be equal to lowest private #define
  29. #define DS_NAME_FORMAT_PRIVATE_BEGIN 0xffffffef
  30. // The following are DS_NAME_ERRORs which we don't want to publish
  31. // in ntdsapi.h. Same reasoning as above.
  32. #define DS_NAME_ERROR_IS_FPO 0xffffffff
  33. #define DS_NAME_ERROR_SCHEMA_GUID_NOT_FOUND 0xfffffffe
  34. #define DS_NAME_ERROR_SCHEMA_GUID_ATTR 0xfffffffd
  35. #define DS_NAME_ERROR_SCHEMA_GUID_ATTR_SET 0xfffffffc
  36. #define DS_NAME_ERROR_SCHEMA_GUID_CLASS 0xfffffffb
  37. #define DS_NAME_ERROR_SCHEMA_GUID_CONTROL_RIGHT 0xfffffffa
  38. #define DS_NAME_ERROR_IS_SID_USER 0xfffffff9
  39. #define DS_NAME_ERROR_IS_SID_GROUP 0xfffffff8
  40. #define DS_NAME_ERROR_IS_SID_ALIAS 0xfffffff7
  41. #define DS_NAME_ERROR_IS_SID_UNKNOWN 0xfffffff6
  42. #define DS_NAME_ERROR_IS_SID_HISTORY_USER 0xfffffff5
  43. #define DS_NAME_ERROR_IS_SID_HISTORY_GROUP 0xfffffff4
  44. #define DS_NAME_ERROR_IS_SID_HISTORY_ALIAS 0xfffffff3
  45. #define DS_NAME_ERROR_IS_SID_HISTORY_UNKNOWN 0xfffffff2
  46. // following should always be equal to lowest private #define
  47. #define DS_NAME_ERROR_PRIVATE_BEGIN 0xfffffff2
  48. // The following are DS_NAME_FLAGs which we don't want to publish
  49. // in ntdsapi.h. Same reasoning as above. Remember that the flags
  50. // field is a bit map, not an enumeration.
  51. #define DS_NAME_FLAG_PRIVATE_PURE_SYNTACTIC 0x40000000
  52. #define DS_NAME_FLAG_PRIVATE_RESOLVE_FPOS 0x80000000
  53. // following should always be equal to lowest private #define
  54. #define DS_NAME_FLAG_PRIVATE_BEGIN 0x80000000
  55. // The following are DS_ADDSID_FLAGs which we don't want to publish
  56. // in ntdsapi.h. Same reasoning as above. Remember that the flags
  57. // field is a bit map, not an enumeration.
  58. #define DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ 0x80000000
  59. #define DS_ADDSID_FLAG_PRIVATE_CHK_SECURE 0x40000000
  60. // following should always be equal to lowest private #define
  61. #define DS_ADDSID_FLAG_PRIVATE_BEGIN 0x40000000
  62. // The following are dc info infolevels that we don't want to publish.
  63. // While the published APIs are used to get information from the set of
  64. // DCs published in a domain, some of these private infolevels are used
  65. // to get information from a single domain controller. These private
  66. // infolevels are intended mostly for debugging and monitoring.
  67. #define DS_DCINFO_LEVEL_FFFFFFFF 0xffffffff
  68. // following should always be equal to lowest private #define
  69. #define DS_DCINFO_LEVEL_PRIVATE_BEGIN 0xffffffff
  70. // For DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF. This retrieves the ldap
  71. // connection list from a single domain controller.
  72. typedef struct _DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW {
  73. DWORD IPAddress; // IP Address of client
  74. DWORD NotificationCount; // number of outstanding notifications
  75. DWORD secTimeConnected; // total time in seconds connected
  76. DWORD Flags; // Connection properties. defined below.
  77. DWORD TotalRequests; // Total number of requests made
  78. DWORD Reserved1; // Unused
  79. #ifdef MIDL_PASS
  80. [string,unique] WCHAR *UserName;
  81. #else
  82. LPWSTR UserName; // the security principal used to bind
  83. #endif
  84. } DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW, *PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW;
  85. typedef struct _DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA {
  86. DWORD IPAddress; // IP Address of client
  87. DWORD NotificationCount; // number of outstanding notifications
  88. DWORD secTimeConnected; // total time in seconds connected
  89. DWORD Flags; // Connection properties. defined below.
  90. DWORD TotalRequests; // Total number of requests made
  91. DWORD Reserved1; // Unused
  92. #ifdef MIDL_PASS
  93. [string,unique] CHAR *UserName;
  94. #else
  95. LPSTR UserName; // the security principal used to bind
  96. #endif
  97. } DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA, *PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA;
  98. //
  99. // connection flags
  100. //
  101. #define LDAP_CONN_FLAG_BOUND 0x00000001 // bound connection
  102. #define LDAP_CONN_FLAG_SSL 0x00000002 // connect using SSL
  103. #define LDAP_CONN_FLAG_UDP 0x00000004 // UDP connection
  104. #define LDAP_CONN_FLAG_GC 0x00000008 // came through the GC port
  105. #define LDAP_CONN_FLAG_GSSAPI 0x00000010 // used gssapi
  106. #define LDAP_CONN_FLAG_SPNEGO 0x00000020 // used spnego
  107. #define LDAP_CONN_FLAG_SIMPLE 0x00000040 // used simple
  108. #define LDAP_CONN_FLAG_DIGEST 0x00000080 // used Digest-MD5
  109. #define LDAP_CONN_FLAG_SIGN 0x00000100 // signing on
  110. #define LDAP_CONN_FLAG_SEAL 0x00000200 // sealing on
  111. #ifdef UNICODE
  112. #define DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
  113. #define PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFF PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
  114. #else
  115. #define DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA
  116. #define PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFF PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA
  117. #endif
  118. // ==========================================================
  119. // DsCrackSpn2() -- parse a counted-length SPN into the ServiceClass,
  120. // ServiceName, and InstanceName (and InstancePort) pieces.
  121. // An SPN is passed in, along with a pointer to the maximum length
  122. // for each piece and a pointer to a buffer where each piece should go.
  123. // On exit, the maximum lengths are updated to the actual length for each piece
  124. // and the buffer contain the appropriate piece. The InstancePort is 0 if not
  125. // present.
  126. //
  127. // DWORD DsCrackSpn(
  128. // IN LPTSTR pszSPN, // the SPN to parse
  129. // IN DWORD cSpn, // length of pszSPN
  130. // IN OUT PUSHORT pcServiceClass, // input -- max length of ServiceClass;
  131. // output -- actual length
  132. // OUT LPCTSTR ServiceClass, // the ServiceClass part of the SPN
  133. // IN OUT PUSHORT pcServiceName, // input -- max length of ServiceName;
  134. // output -- actual length
  135. // OUT LPCTSTR ServiceName, // the ServiceName part of the SPN
  136. // IN OUT PUSHORT pcInstance, // input -- max length of ServiceClass;
  137. // output -- actual length
  138. // OUT LPCTSTR InstanceName, // the InstanceName part of the SPN
  139. // OUT PUSHORT InstancePort // instance port
  140. //
  141. // Note: lengths are in characters; all string lengths include terminators
  142. // All arguments except pszSpn are optional.
  143. //
  144. NTDSAPI
  145. DWORD
  146. WINAPI
  147. DsCrackSpn2A(
  148. IN LPCSTR pszSpn,
  149. IN DWORD cSpn,
  150. IN OUT LPDWORD pcServiceClass,
  151. OUT LPSTR ServiceClass,
  152. IN OUT LPDWORD pcServiceName,
  153. OUT LPSTR ServiceName,
  154. IN OUT LPDWORD pcInstanceName,
  155. OUT LPSTR InstanceName,
  156. OUT USHORT *pInstancePort
  157. );
  158. NTDSAPI
  159. DWORD
  160. WINAPI
  161. DsCrackSpn2W(
  162. IN LPCWSTR pszSpn,
  163. IN DWORD cSpn,
  164. IN OUT DWORD *pcServiceClass,
  165. OUT LPWSTR ServiceClass,
  166. IN OUT DWORD *pcServiceName,
  167. OUT LPWSTR ServiceName,
  168. IN OUT DWORD *pcInstanceName,
  169. OUT LPWSTR InstanceName,
  170. OUT USHORT *pInstancePort
  171. );
  172. NTDSAPI
  173. DWORD
  174. WINAPI
  175. DsCrackSpn3W(
  176. IN LPCWSTR pszSpn,
  177. IN DWORD cSpn,
  178. IN OUT DWORD *pcHostName,
  179. OUT LPWSTR HostName,
  180. IN OUT DWORD *pcInstanceName,
  181. OUT LPWSTR InstanceName,
  182. OUT USHORT *pPortNumber,
  183. IN OUT DWORD *pcDomainName,
  184. OUT LPWSTR DomainName,
  185. IN OUT DWORD *pcRealmName,
  186. OUT LPWSTR RealmName
  187. );
  188. #ifdef UNICODE
  189. #define DsCrackSpn2 DsCrackSpn2W
  190. #else
  191. #define DsCrackSpn2 DsCrackSpn2A
  192. #endif
  193. #ifndef MIDL_PASS
  194. DWORD
  195. DsaopExecuteScript (
  196. IN PVOID phAsync,
  197. IN RPC_BINDING_HANDLE hRpc,
  198. IN DWORD cbPassword,
  199. IN BYTE *pbPassword,
  200. OUT DWORD *dwOutVersion,
  201. OUT PVOID reply
  202. );
  203. DWORD
  204. DsaopPrepareScript (
  205. IN PVOID phAsync,
  206. IN RPC_BINDING_HANDLE hRpc,
  207. OUT DWORD *dwOutVersion,
  208. OUT PVOID reply
  209. );
  210. DWORD
  211. DsaopBind(
  212. IN LPCWSTR DomainControllerName,
  213. IN LPCWSTR DnsDomainName,
  214. IN ULONG AuthnSvc,
  215. IN ULONG AuthnLevel,
  216. OUT RPC_BINDING_HANDLE *phRpc
  217. );
  218. DWORD
  219. DsaopBindWithCred(
  220. IN LPCWSTR DomainControllerName,
  221. IN LPCWSTR DnsDomainName,
  222. IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
  223. IN ULONG AuthnSvc,
  224. IN ULONG AuthnLevel,
  225. OUT RPC_BINDING_HANDLE *phRpc
  226. );
  227. DWORD
  228. DsaopBindWithSpn(
  229. IN LPCWSTR DomainControllerName,
  230. IN LPCWSTR DnsDomainName,
  231. IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
  232. IN ULONG AuthnSvc,
  233. IN ULONG AuthnLevel,
  234. IN LPCWSTR ServicePrincipalName,
  235. OUT RPC_BINDING_HANDLE *phRpc
  236. );
  237. DWORD
  238. DsaopUnBind(
  239. RPC_BINDING_HANDLE *phRpc
  240. );
  241. #endif
  242. #endif // _NTDSAPIP_H_