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.

157 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. frssup.h
  5. Abstract:
  6. Collection of functions used by ntfrsapi and other frs tools.
  7. An attempt to reduce duplication of code.
  8. Author:
  9. Sudarshan Chitre 20-Mar-2001
  10. Environment
  11. User mode winnt
  12. --*/
  13. typedef struct _FRS_LDAP_SEARCH_CONTEXT {
  14. ULONG EntriesInPage; // Number of entries in the current page.
  15. ULONG CurrentEntry; // Location of the pointer into the page.
  16. LDAPMessage * LdapMsg; // Returned from ldap_search_ext_s()
  17. LDAPMessage * CurrentLdapMsg; // Current entry from current page.
  18. PWCHAR Filter; // Filter to add to the DS query.
  19. PWCHAR BaseDn; // Dn to start the query from.
  20. DWORD Scope; // Scope of the search.
  21. PWCHAR * Attrs; // Attributes requested by the search.
  22. } FRS_LDAP_SEARCH_CONTEXT, *PFRS_LDAP_SEARCH_CONTEXT;
  23. #define MK_ATTRS_1(_attr_, _a1) \
  24. _attr_[0] = _a1; _attr_[1] = NULL;
  25. #define MK_ATTRS_2(_attr_, _a1, _a2) \
  26. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = NULL;
  27. #define MK_ATTRS_3(_attr_, _a1, _a2, _a3) \
  28. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = NULL;
  29. #define MK_ATTRS_4(_attr_, _a1, _a2, _a3, _a4) \
  30. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = _a4; \
  31. _attr_[4] = NULL;
  32. #define MK_ATTRS_5(_attr_, _a1, _a2, _a3, _a4, _a5) \
  33. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = _a4; \
  34. _attr_[4] = _a5; _attr_[5] = NULL;
  35. #define MK_ATTRS_6(_attr_, _a1, _a2, _a3, _a4, _a5, _a6) \
  36. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = _a4; \
  37. _attr_[4] = _a5; _attr_[5] = _a6; _attr_[6] = NULL;
  38. #define MK_ATTRS_7(_attr_, _a1, _a2, _a3, _a4, _a5, _a6, _a7) \
  39. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = _a4; \
  40. _attr_[4] = _a5; _attr_[5] = _a6; _attr_[6] = _a7; _attr_[7] = NULL;
  41. #define MK_ATTRS_8(_attr_, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \
  42. _attr_[0] = _a1; _attr_[1] = _a2; _attr_[2] = _a3; _attr_[3] = _a4; \
  43. _attr_[4] = _a5; _attr_[5] = _a6; _attr_[6] = _a7; _attr_[7] = _a8; \
  44. _attr_[8] = NULL;
  45. #define FRS_SUP_FREE(_x_) { if (_x_) { free(_x_); (_x_) = NULL; } }
  46. DWORD
  47. FrsSupBindToDC (
  48. IN PWCHAR pszDC,
  49. IN PSEC_WINNT_AUTH_IDENTITY_W pCreds,
  50. OUT PLDAP *ppLDAP
  51. );
  52. PVOID *
  53. FrsSupFindValues(
  54. IN PLDAP Ldap,
  55. IN PLDAPMessage Entry,
  56. IN PWCHAR DesiredAttr,
  57. IN BOOL DoBerVals
  58. );
  59. PWCHAR
  60. FrsSupWcsDup(
  61. PWCHAR OldStr
  62. );
  63. PWCHAR
  64. FrsSupFindValue(
  65. IN PLDAP Ldap,
  66. IN PLDAPMessage Entry,
  67. IN PWCHAR DesiredAttr
  68. );
  69. BOOL
  70. FrsSupLdapSearch(
  71. IN PLDAP Ldap,
  72. IN PWCHAR Base,
  73. IN ULONG Scope,
  74. IN PWCHAR Filter,
  75. IN PWCHAR Attrs[],
  76. IN ULONG AttrsOnly,
  77. IN LDAPMessage **Msg
  78. );
  79. PWCHAR *
  80. FrsSupGetValues(
  81. IN PLDAP Ldap,
  82. IN PWCHAR Base,
  83. IN PWCHAR DesiredAttr
  84. );
  85. PWCHAR
  86. FrsSupExtendDn(
  87. IN PWCHAR Dn,
  88. IN PWCHAR Cn
  89. );
  90. PWCHAR
  91. FrsSupGetRootDn(
  92. PLDAP Ldap,
  93. PWCHAR NamingContext
  94. );
  95. BOOL
  96. FrsSupLdapSearchInit(
  97. PLDAP ldap,
  98. PWCHAR Base,
  99. ULONG Scope,
  100. PWCHAR Filter,
  101. PWCHAR Attrs[],
  102. ULONG AttrsOnly,
  103. PFRS_LDAP_SEARCH_CONTEXT FrsSearchContext
  104. );
  105. PLDAPMessage
  106. FrsSupLdapSearchGetNextEntry(
  107. PLDAP ldap,
  108. PFRS_LDAP_SEARCH_CONTEXT FrsSearchContext
  109. );
  110. DWORD
  111. FrsSupLdapSearchGetNextPage(
  112. PLDAP ldap,
  113. PFRS_LDAP_SEARCH_CONTEXT FrsSearchContext
  114. );
  115. PLDAPMessage
  116. FrsSupLdapSearchNext(
  117. PLDAP ldap,
  118. PFRS_LDAP_SEARCH_CONTEXT FrsSearchContext
  119. );
  120. VOID
  121. FrsSupLdapSearchClose(
  122. PFRS_LDAP_SEARCH_CONTEXT FrsSearchContext
  123. );