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.

115 lines
3.7 KiB

  1. //--------------------------------------------------------------------------------------------
  2. //
  3. // Copyright (c) Microsoft Corporation, 1996
  4. //
  5. // Description:
  6. //
  7. // Microsoft Internet LDAP Client private header
  8. //
  9. // History:
  10. // davidsan 05/08/96 Created
  11. //
  12. //--------------------------------------------------------------------------------------------
  13. #ifndef _LDAPCLIP_H
  14. #define _LDAPCLIP_H
  15. // transaction type
  16. const DWORD xtypeNil = 0;
  17. const DWORD xtypeBind = 1;
  18. const DWORD xtypeSearch = 2;
  19. const DWORD xtypeUnbind = 3;
  20. const DWORD xtypeAbandon = 4;
  21. const DWORD xtypeBindSSPINegotiate = 5;
  22. const DWORD xtypeBindSSPIResponse = 6;
  23. const DWORD xtypeModify = 7;
  24. const DWORD xtypeAdd = 8;
  25. const DWORD xtypeModifyRDN = 9;
  26. const DWORD xtypeCompare = 10;
  27. const DWORD xtypeDelete = 11;
  28. class CLdapClient : public ILdapClient
  29. {
  30. public:
  31. CLdapClient(int iVerLdap);
  32. ~CLdapClient();
  33. STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR *ppvObj);
  34. STDMETHODIMP_(ULONG) AddRef(void);
  35. STDMETHODIMP_(ULONG) Release(void);
  36. STDMETHODIMP HrConnect(char *szServer, USHORT usPort);
  37. STDMETHODIMP HrDisconnect(void);
  38. STDMETHODIMP HrIsConnected(void);
  39. STDMETHODIMP HrBindSimple(char *szDN, char *szPass, PXID pxid);
  40. STDMETHODIMP HrGetBindResponse(XID xid, DWORD timeout);
  41. STDMETHODIMP HrUnbind(void);
  42. STDMETHODIMP HrBindSSPI(char *szDN, char *szUser, char *szPass, BOOL fPrompt, DWORD timeout);
  43. STDMETHODIMP HrSendSSPINegotiate(char *szDN, char *szUser, char *szPass, BOOL fPrompt, PXID pxid);
  44. STDMETHODIMP HrGetSSPIChallenge(XID xid, BYTE *pbBuf, int cbBuf, int *pcbChallenge, DWORD timeout);
  45. STDMETHODIMP HrSendSSPIResponse(BYTE *pbChallenge, int cbChallenge, PXID pxid);
  46. STDMETHODIMP HrSearch(PSP psp, PXID pxid);
  47. STDMETHODIMP HrGetSearchResponse(XID xid, DWORD timeout, POBJ *ppobj);
  48. STDMETHODIMP HrFreePobjList(POBJ pobj);
  49. STDMETHODIMP HrModify(char *szDN, PMOD pmod, PXID pxid);
  50. STDMETHODIMP HrGetModifyResponse(XID xid, DWORD timeout);
  51. STDMETHODIMP HrAdd(char *szDN, PATTR pattr, PXID pxid);
  52. STDMETHODIMP HrGetAddResponse(XID xid, DWORD timeout);
  53. STDMETHODIMP HrDelete(char *szDN, PXID pxid);
  54. STDMETHODIMP HrGetDeleteResponse(XID xid, DWORD timeout);
  55. STDMETHODIMP HrModifyRDN(char *szDN, char *szNewRDN, BOOL fDeleteOldRDN, PXID pxid);
  56. STDMETHODIMP HrGetModifyRDNResponse(XID xid, DWORD timeout);
  57. STDMETHODIMP HrCompare(char *szDN, char *szAttrib, char *szValue, PXID pxid);
  58. STDMETHODIMP HrGetCompareResponse(XID xid, DWORD timeout);
  59. STDMETHODIMP HrCancelXid(XID xid);
  60. protected:
  61. friend void ReceiveData(PVOID, PVOID, int, int *);
  62. void ReceiveData(PVOID pv, int cb, int *pcbReceived);
  63. private:
  64. HRESULT HrEncodeFilter(LBER *plber, PFILTER pfilter);
  65. HRESULT HrEncodePattr(LBER *plber, PATTR pattr);
  66. HRESULT HrEncodePmod(LBER *plber, PMOD pmod);
  67. HRESULT HrWaitForPxd(PXD pxd, DWORD timeout, BOOL *pfDel);
  68. HRESULT HrGetSimpleResponse(XID xid, DWORD xtype, ULONG ulTagResult, DWORD timeout);
  69. HRESULT HrFromLdapResult(int iResult);
  70. CRITICAL_SECTION m_cs;
  71. CRITICAL_SECTION m_csRef;
  72. PSOCK m_psock;
  73. BOOL m_fConnected;
  74. ULONG m_cRef;
  75. int m_iVerLdap;
  76. char m_szServer[MAX_PATH];
  77. // SSPI stuff
  78. HRESULT HrGetCredentials(char *szUser, char *szPass);
  79. HRESULT HrSendBindMsg(XID xid, char *szDN, int iAuth, void *pv, int cb);
  80. CredHandle m_hCred;
  81. CtxtHandle m_hCtxt;
  82. BOOL m_fHasCred;
  83. BOOL m_fHasCtxt;
  84. };
  85. #define VERIFY(fncall) \
  86. if (FAILED(hr = fncall)) \
  87. { \
  88. Assert(FALSE); \
  89. goto LBail; \
  90. }
  91. #endif // _LDAPCLIP_H