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.

66 lines
2.2 KiB

  1. #pragma once
  2. #include <memory>
  3. #include "Resource.h"
  4. #include "ADMTCrypt.h"
  5. //---------------------------------------------------------------------------
  6. // CPasswordMigration
  7. //---------------------------------------------------------------------------
  8. class ATL_NO_VTABLE CPasswordMigration :
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CPasswordMigration, &CLSID_PasswordMigration>,
  11. public ISupportErrorInfoImpl<&IID_IPasswordMigration>,
  12. public IDispatchImpl<IPasswordMigration, &IID_IPasswordMigration, &LIBID_MsPwdMig>
  13. {
  14. public:
  15. CPasswordMigration();
  16. ~CPasswordMigration();
  17. DECLARE_REGISTRY_RESOURCEID(IDR_PASSWORDMIGRATION)
  18. DECLARE_NOT_AGGREGATABLE(CPasswordMigration)
  19. DECLARE_PROTECT_FINAL_CONSTRUCT()
  20. BEGIN_COM_MAP(CPasswordMigration)
  21. COM_INTERFACE_ENTRY(IPasswordMigration)
  22. COM_INTERFACE_ENTRY(IDispatch)
  23. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  24. END_COM_MAP()
  25. // IPasswordMigration
  26. STDMETHOD(EstablishSession)(BSTR bstrSourceServer, BSTR bstrTargetServer);
  27. STDMETHOD(CopyPassword)(BSTR bstrSourceAccount, BSTR bstrTargetAccount, BSTR bstrTargetPassword);
  28. STDMETHOD(GenerateKey)(BSTR bstrSourceDomainName, BSTR bstrKeyFilePath, BSTR bstrPassword);
  29. protected:
  30. void GenerateKeyImpl(LPCTSTR pszDomain, LPCTSTR pszFile, LPCTSTR pszPassword);
  31. void CheckPasswordDC(LPCWSTR srcServer, LPCWSTR tgtServer);
  32. void CopyPasswordImpl(LPCTSTR pszSourceAccount, LPCTSTR pszTargetAccount, LPCTSTR pszPassword);
  33. void CheckPreWindows2000CompatibleAccessGroupMembers(bool& bEveryone, bool& bAnonymous);
  34. static _bstr_t GetPathToPreW2KCAGroup();
  35. static BOOL DoesAnonymousHaveEveryoneAccess(LPCWSTR tgtServer);
  36. static void GetDomainName(LPCTSTR pszServer, _bstr_t& strNameDNS, _bstr_t& strNameFlat);
  37. static _bstr_t GetDefaultNamingContext(_bstr_t strDomain);
  38. protected:
  39. bool m_bSessionEstablished;
  40. handle_t m_hBinding;
  41. _TCHAR* m_sBinding;
  42. _bstr_t m_strSourceServer;
  43. _bstr_t m_strTargetServer;
  44. _bstr_t m_strSourceDomainDNS;
  45. _bstr_t m_strSourceDomainFlat;
  46. _bstr_t m_strTargetDomainDNS;
  47. _bstr_t m_strTargetDomainFlat;
  48. CTargetCrypt* m_pTargetCrypt;
  49. };