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.

54 lines
1.8 KiB

  1. #ifndef __POP3_AUTH_MD5_HASH_H__
  2. #define __POP3_AUTH_MD5_HASH_H__
  3. #include "resource.h"
  4. #define UnicodeToAnsi(A, cA, U, cU) WideCharToMultiByte(CP_ACP,0,(U),(cU),(A),(cA),NULL,NULL)
  5. #define AnsiToUnicode(A, cA, U, cU) MultiByteToWideChar(CP_ACP,0,(A),(cA),(U),(cU))
  6. #define HASH_BUFFER_SIZE 1024
  7. #define MD5_HASH_SIZE 32
  8. class ATL_NO_VTABLE CAuthMD5Hash :
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CAuthMD5Hash, &CLSID_AuthMD5Hash>,
  11. public IDispatchImpl<IAuthMethod, &IID_IAuthMethod, &LIBID_Pop3Auth>
  12. {
  13. public:
  14. CAuthMD5Hash();
  15. virtual ~CAuthMD5Hash();
  16. DECLARE_REGISTRY_RESOURCEID(IDR_AUTHMD5HASH)
  17. DECLARE_PROTECT_FINAL_CONSTRUCT()
  18. BEGIN_COM_MAP(CAuthMD5Hash)
  19. COM_INTERFACE_ENTRY(IAuthMethod)
  20. COM_INTERFACE_ENTRY(IDispatch)
  21. END_COM_MAP()
  22. public:
  23. STDMETHOD(Authenticate)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vPassword);
  24. STDMETHOD(get_Name)(/*[out]*/BSTR *pVal);
  25. STDMETHOD(get_ID)(/*[out]*/BSTR *pVal);
  26. STDMETHOD(Get)(/*[in]*/BSTR bstrName, /*[out]*/VARIANT *pVal);
  27. STDMETHOD(Put)(/*[in]*/BSTR bstrName, /*[in]*/VARIANT vVal);
  28. STDMETHOD(CreateUser)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vPassword);
  29. STDMETHOD(DeleteUser)(/*[in]*/BSTR bstrUserName);
  30. STDMETHOD(ChangePassword)(/*[in]*/BSTR bstrUserName,/*[in]*/VARIANT vNewPassword,/*[in]*/VARIANT vOldPassword);
  31. STDMETHOD(AssociateEmailWithUser)(/*[in]*/BSTR bstrEmailAddr);
  32. STDMETHOD(UnassociateEmailWithUser)(/*[in]*/BSTR bstrEmailAddr);
  33. private:
  34. CRITICAL_SECTION m_csConfig;
  35. WCHAR m_wszMailRoot[POP3_MAX_MAILROOT_LENGTH];
  36. BSTR m_bstrServerName;
  37. BOOL MD5Hash(const unsigned char *pOriginal, WCHAR wszResult[MD5_HASH_SIZE+1]);
  38. HRESULT GetPassword(BSTR bstrUserName, char szPassword[MAX_PATH]);
  39. HRESULT SetPassword(BSTR bstrUserName, VARIANT vPassword);
  40. };
  41. #endif