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.

125 lines
6.1 KiB

  1. // P3AdminWorker.h: interface for the CP3AdminWorker class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_P3ADMINWORKER_H__66B0B77E_555D_4F2B_81EF_661DA3B066B2__INCLUDED_)
  5. #define AFX_P3ADMINWORKER_H__66B0B77E_555D_4F2B_81EF_661DA3B066B2__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #define ADS_SMTPDOMAIN_PATH_LOCAL L"IIS://LocalHost/SMTPSVC/1/Domain"
  10. #define ADS_SMTPDOMAIN_PATH_REMOTE L"IIS://%s/SMTPSVC/1/Domain"
  11. #define LOCKRENAME_FILENAME L"kcoL"
  12. struct IAuthMethods; //forward declaration
  13. struct IAuthMethod; //forward declaration
  14. #include <Iads.h> // TODO: dougb this is temporary code to force AD to cache for us, should be removed
  15. class CP3AdminWorker
  16. {
  17. public:
  18. CP3AdminWorker();
  19. virtual ~CP3AdminWorker();
  20. // Implementation
  21. public:
  22. // Authentication
  23. HRESULT GetAuthenticationMethods( IAuthMethods* *ppIAuthMethods ) const;
  24. HRESULT GetCurrentAuthentication( IAuthMethod* *ppIAuthMethod ) const;
  25. // Domain
  26. HRESULT AddDomain( LPWSTR psDomainName );
  27. HRESULT GetDomainCount( ULONG *piCount );
  28. HRESULT GetDomainEnum( IEnumVARIANT **pp );
  29. HRESULT GetDomainLock( LPWSTR psDomainName, BOOL *pisLocked );
  30. bool IsDomainLocked( LPWSTR psDomainName );
  31. HRESULT RemoveDomain( LPWSTR psDomainName );
  32. HRESULT SetDomainLock( LPWSTR psDomainName, BOOL bLock );
  33. HRESULT ValidateDomain( LPWSTR psDomainName ) const;
  34. // User
  35. HRESULT AddUser( LPWSTR psDomainName, LPWSTR psUserName );
  36. HRESULT GetUserCount( LPWSTR psDomainName, long *plCount );
  37. HRESULT GetUserLock( LPWSTR psDomainName, LPWSTR psUserName, BOOL *pisLocked );
  38. HRESULT GetUserMessageDiskUsage( LPWSTR psDomainName, LPWSTR psUserName, long *plFactor, long *plUsage );
  39. HRESULT GetUserMessageCount( LPWSTR psDomainName, LPWSTR psUserName, long *plCount );
  40. HRESULT RemoveUser( LPWSTR psDomainName, LPWSTR psUserName );
  41. HRESULT SetUserLock( LPWSTR psDomainName, LPWSTR psUserName, BOOL bLock );
  42. // Quota
  43. HRESULT CreateQuotaSIDFile( LPWSTR psDomainName, LPWSTR psMailboxName, BSTR bstrAuthType, LPWSTR psMachineName, LPWSTR psUserName );
  44. HRESULT GetQuotaSID( BSTR bstrAuthType, LPWSTR psUserName, LPWSTR psMachineName, PSID *ppSIDOwner, LPDWORD pdwOwnerSID );
  45. // Other
  46. HRESULT BuildEmailAddr( LPCWSTR psDomainName, LPCWSTR psUserName, LPWSTR psEmailAddr, DWORD dwBufferSize ) const;
  47. HRESULT ControlService( LPWSTR psService, DWORD dwControl );
  48. HRESULT EnablePOP3SVC();
  49. HRESULT GetConfirmAddUser( BOOL *pbConfirm );
  50. HRESULT GetLoggingLevel( long *plLoggingLevel );
  51. HRESULT GetMachineName( LPWSTR psMachineName, DWORD dwSize );
  52. HRESULT GetMailroot( LPWSTR psMailRoot, DWORD dwSize, bool bUNC = true );
  53. HRESULT GetNextUser( HANDLE& hfSearch, LPCWSTR psDomainName, LPWSTR psBuffer, DWORD dwBufferSize );
  54. HRESULT GetPort( long *plPort );
  55. HRESULT GetServiceStatus( LPWSTR psService, LPDWORD plStatus );
  56. HRESULT GetSocketBacklog( long *plBacklog );
  57. HRESULT GetSocketMax( long *plMax );
  58. HRESULT GetSocketMin( long *plMin );
  59. HRESULT GetSocketThreshold( long *plThreshold );
  60. HRESULT GetSPARequired( BOOL *pbSPARequired );
  61. HRESULT GetThreadCountPerCPU( long *plCount );
  62. HRESULT InitFindFirstUser( HANDLE& hfSearch, LPCWSTR psDomainName, LPWSTR psBuffer, DWORD dwBufferSize );
  63. HRESULT MailboxSetRemote();
  64. HRESULT MailboxResetRemote();
  65. HRESULT SearchDomainsForMailbox( LPWSTR psUserName, LPWSTR *ppsDomain = NULL );
  66. HRESULT SetConfirmAddUser( BOOL bConfirm );
  67. HRESULT SetIISConfig( bool bBindSink );
  68. HRESULT SetLoggingLevel( long lLoggingLevel );
  69. HRESULT SetMachineName( LPWSTR psMachineName );
  70. HRESULT SetMailroot( LPWSTR psMailRoot );
  71. HRESULT SetPort( long lPort );
  72. HRESULT SetSockets( long lMax, long lMin, long lThreshold, long lBacklog );
  73. HRESULT SetThreadCountPerCPU( long lCount );
  74. HRESULT SetSPARequired( BOOL bSPARequired );
  75. HRESULT StartService( LPWSTR psService );
  76. HRESULT StopService( LPWSTR psService );
  77. protected:
  78. // Domain
  79. HRESULT AddSMTPDomain( LPWSTR psDomainName );
  80. HRESULT AddStoreDomain( LPWSTR psDomainName );
  81. HRESULT BuildDomainPath( LPCWSTR psDomainName, LPWSTR psBuffer, DWORD dwBufferSize ) const;
  82. HRESULT CreateDomainMutex( LPWSTR psDomainName, HANDLE *phMutex );
  83. bool ExistsDomain( LPWSTR psDomainName ) const;
  84. HRESULT ExistsSMTPDomain( LPWSTR psDomainName ) const;
  85. HRESULT ExistsStoreDomain( LPWSTR psDomainName ) const;
  86. HRESULT GetSMTPDomainPath( LPWSTR psBuffer, LPWSTR psSuffix, DWORD dwBufferSize ) const;
  87. HRESULT LockDomain( LPWSTR psDomainName, bool bVerifyNotInUse = false );
  88. HRESULT LockDomainForDelete( LPWSTR psDomainName ){ return LockDomain( psDomainName, true ); }
  89. HRESULT RemoveSMTPDomain( LPWSTR psDomainName );
  90. HRESULT RemoveStoreDomain( LPWSTR psDomainName );
  91. HRESULT UnlockDomain( LPWSTR psDomainName );
  92. // User
  93. HRESULT BuildUserPath( LPCWSTR psDomainName, LPCWSTR psUserName, LPWSTR psBuffer, DWORD dwBufferSize ) const;
  94. HRESULT CreateUserMutex( LPWSTR psDomainName, LPWSTR psUserName, HANDLE *phMutex );
  95. bool isUserLocked( LPWSTR psDomainName, LPWSTR psUserName );
  96. bool isValidMailboxName( LPWSTR psMailbox );
  97. HRESULT LockUser( LPWSTR psDomainName, LPWSTR psUserName );
  98. HRESULT UnlockUser( LPWSTR psDomainName, LPWSTR psUserName );
  99. // Other
  100. HRESULT BuildEmailAddrW2A( LPCWSTR psDomainName, LPCWSTR psUserName, LPSTR psEmailAddr, DWORD dwBufferSize ) const;
  101. // Attributes
  102. protected:
  103. LPWSTR m_psMachineName;
  104. LPWSTR m_psMachineMailRoot; // Path to remote machine's mailroot
  105. bool m_bImpersonation;
  106. bool m_isPOP3Installed; // If this interfaces (P3ADMIN) are being used and POP3 Service is not installed
  107. // then all SMTP checking is bi-passed.
  108. // This solves the problem of using this with the Pop2Exch utility.
  109. CComPtr<IADs> m_spTemporaryFixIADs;
  110. };
  111. #endif // !defined(AFX_P3ADMINWORKER_H__66B0B77E_555D_4F2B_81EF_661DA3B066B2__INCLUDED_)