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.

60 lines
2.2 KiB

  1. #ifndef __POP3_AUTH_DOMAIN_ACCOUNT_H__
  2. #define __POP3_AUTH_DOMAIN_ACCOUNT_H__
  3. #include "resource.h"
  4. #include <Dsgetdc.h>
  5. #include <IADs.h>
  6. #include <Adshlp.h>
  7. #include <NTLDAP.h>
  8. #include <ntdsapi.h>
  9. #define SZ_LDAP_UPN_NAME L"userPrincipalName"
  10. #define SZ_LDAP_EMAIL L"mail"
  11. #define SZ_LDAP_SAM_NAME L"sAMAccountName"
  12. class ATL_NO_VTABLE CAuthDomainAccount :
  13. public CComObjectRootEx<CComSingleThreadModel>,
  14. public CComCoClass<CAuthDomainAccount, &CLSID_AuthDomainAccount>,
  15. public IDispatchImpl<IAuthMethod, &IID_IAuthMethod, &LIBID_Pop3Auth>
  16. {
  17. public:
  18. CAuthDomainAccount();
  19. virtual ~CAuthDomainAccount();
  20. DECLARE_REGISTRY_RESOURCEID(IDR_AUTHDOMAINACCOUNT)
  21. DECLARE_PROTECT_FINAL_CONSTRUCT()
  22. BEGIN_COM_MAP(CAuthDomainAccount)
  23. COM_INTERFACE_ENTRY(IAuthMethod)
  24. COM_INTERFACE_ENTRY(IDispatch)
  25. END_COM_MAP()
  26. public:
  27. STDMETHOD(Authenticate)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vPassword);
  28. STDMETHOD(get_Name)(/*[out]*/BSTR *pVal);
  29. STDMETHOD(get_ID)(/*[out]*/BSTR *pVal);
  30. STDMETHOD(Get)(/*[in]*/BSTR bstrName, /*[out]*/VARIANT *pVal);
  31. STDMETHOD(Put)(/*[in]*/BSTR bstrName, /*[in]*/VARIANT vVal);
  32. STDMETHOD(CreateUser)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vPassword);
  33. STDMETHOD(DeleteUser)(/*[in]*/BSTR bstrUserName);
  34. STDMETHOD(ChangePassword)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vNewPassword,/*[in]*/VARIANT vOldPassword);
  35. STDMETHOD(AssociateEmailWithUser)(/*[in]*/BSTR bstrEmailAddr);
  36. STDMETHOD(UnassociateEmailWithUser)(/*[in]*/BSTR bstrEmailAddr);
  37. private:
  38. HRESULT ADGetUserObject(/*[in]*/LPWSTR wszUserName,/*[in, out]*/ IADs **ppUserObj, DS_NAME_FORMAT formatUserName=DS_UNKNOWN_NAME);
  39. HRESULT ADSetUserProp(/*[in]*/LPWSTR wszValue, /*[in]*/LPWSTR wszLdapPropName);
  40. HRESULT ADGetUserProp(/*[in]*/LPWSTR wszUserName, /*[in]*/LPWSTR wszPropName, /*[in, out]*/ VARIANT *pVar);
  41. HRESULT CheckDS(BOOL bForceReconnect);
  42. HRESULT ConnectDS();
  43. void CleanDS();
  44. BOOL FindSAMName(/*[in]*/LPWSTR wszEmailAddr,/*[out]*/ LPWSTR wszSAMName);
  45. BSTR m_bstrServerName;
  46. HANDLE m_hDS;
  47. PDOMAIN_CONTROLLER_INFO m_pDCInfo;
  48. CRITICAL_SECTION m_DSLock;
  49. };
  50. #endif //__POP3_AUTH_DOMAIN_ACCOUNT_H__