Source code of Windows XP (NT5)
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.

1305 lines
41 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. smtpinst.hxx
  5. Abstract:
  6. This file contains type definitions for multiple instance
  7. support.
  8. Author:
  9. Johnson Apacible (JohnsonA) Jun-04-1996
  10. Revision History:
  11. Rohan Phillips (RohanP) Feb-05-1997 - modified for SMTP
  12. David Howell (Dhowell) May - 1997 - added Etrn Logic
  13. Nimish Khanolkar(NimishK) Jan - 1998 - modified for CAPI store cert
  14. --*/
  15. #ifndef _SMTPINST_H_
  16. #define _SMTPINST_H_
  17. #include <iiscert.hxx>
  18. #include <iisctl.hxx>
  19. #include <capiutil.hxx>
  20. #include <certnotf.hxx>
  21. #include <sslinfo.hxx>
  22. #include "dirnot.hxx"
  23. #include "conn.hxx"
  24. #include "shash.hxx"
  25. #include <asynccon.hxx>
  26. #include "asyncmx.hxx"
  27. #include <cdns.h>
  28. #include "smtpdns.hxx"
  29. #include <mapctxt.h>
  30. #include <smtpevent.h>
  31. #include "cpropbag.h"
  32. #include "seomgr.h"
  33. //
  34. // Service name to use for KERBEROS Authentication service names
  35. //
  36. #define SMTP_SERVICE_PRINCIPAL_PREFIX "SMTP"
  37. interface IEventRouter;
  38. interface IEventManager;
  39. class SMTP_ENDPOINT;
  40. class FILTER_LIST;
  41. class INSTANCE_INFO_LIST;
  42. //
  43. // Maximum IP address stored for the instance, 20 seems to be a commonly
  44. // used value both for DNS and remoteq
  45. //
  46. #define _MAX_HOSTENT_IP_ADDRESSES 20
  47. //
  48. // Callback function to use when SSL key info changes
  49. //
  50. extern SERVICE_MAPPING_CONTEXT g_SmtpSMC;
  51. typedef BOOL (*PFN_SF_NOTIFY)(DWORD dwNotificationCode, PVOID pvInstance);
  52. extern PFN_SF_NOTIFY g_pSslKeysNotify;
  53. #define CERT_STATUS_UNKNOWN 0
  54. #define CERT_STATUS_VALID 1
  55. #define CERT_STATUS_INVALID 2
  56. //
  57. // This is the SMTP version of the IIS_SERVER
  58. //
  59. static const CHAR *szConnectResponseDefault = "";
  60. typedef struct _SMTP_VROOT_ENTRY {
  61. char szVRoot[MAX_PATH];
  62. LIST_ENTRY list;
  63. } SMTP_VROOT_ENTRY, *PSMTP_VROOT_ENTRY;
  64. class SMTP_IIS_SERVICE : public IIS_SERVICE {
  65. public:
  66. //
  67. // Virtuals
  68. //
  69. virtual BOOL AddInstanceInfo(
  70. IN DWORD dwInstance,
  71. IN BOOL fMigrateRoots
  72. );
  73. virtual DWORD DisconnectUsersByInstance(
  74. IN IIS_SERVER_INSTANCE * pInstance
  75. );
  76. virtual VOID SMTP_IIS_SERVICE::MDChangeNotify(
  77. MD_CHANGE_OBJECT * pcoChangeList
  78. );
  79. virtual DWORD GetServiceConfigInfoSize(IN DWORD dwLevel);
  80. void AcquireServiceShareLock(void)
  81. {
  82. m_Lock.ShareLock();
  83. }
  84. void ReleaseServiceShareLock(void)
  85. {
  86. m_Lock.ShareUnlock();
  87. }
  88. void AcquireServiceExclusiveLock(void)
  89. {
  90. m_Lock.ExclusiveLock();
  91. }
  92. void ReleaseServiceExclusiveLock(void)
  93. {
  94. m_Lock.ExclusiveUnlock();
  95. }
  96. void StartHintFunction(void);
  97. SMTP_IIS_SERVICE(
  98. IN LPCTSTR lpszServiceName,
  99. IN LPCSTR lpszModuleName,
  100. IN LPCSTR lpszRegParamKey,
  101. IN DWORD dwServiceId,
  102. IN ULONGLONG SvcLocId,
  103. IN BOOL MultipleInstanceSupport,
  104. IN DWORD cbAcceptExRecvBuffer,
  105. IN ATQ_CONNECT_CALLBACK pfnConnect,
  106. IN ATQ_COMPLETION pfnConnectEx,
  107. IN ATQ_COMPLETION pfnIoCompletion
  108. );
  109. PLIST_ENTRY GetInfoList() {return &m_InstanceInfoList;}
  110. char * QueryTcpipName() {return m_szTcpipName;}
  111. void SetTcpipName(char * str) {lstrcpyn(m_szTcpipName, str, MAX_PATH);}
  112. void DecSystemRoutingThreads(void) {InterlockedDecrement(&m_cCurrentSystemRoutingThreads);}
  113. BOOL IncSystemRoutingThreads(void)
  114. {
  115. DWORD NewValue;
  116. NewValue = InterlockedIncrement(&m_cCurrentSystemRoutingThreads);
  117. if (NewValue > m_cMaxSystemRoutingThreads) {
  118. InterlockedDecrement(&m_cCurrentSystemRoutingThreads);
  119. return FALSE;
  120. }
  121. return TRUE;
  122. }
  123. BOOL AggregateStatistics(
  124. IN PCHAR pDestination,
  125. IN PCHAR pSource
  126. );
  127. BOOL ResetServicePrincipalNames()
  128. {
  129. m_Lock.ExclusiveLock();
  130. if (!m_fHaveResetPrincipalNames)
  131. m_fHaveResetPrincipalNames =
  132. CSecurityCtx::ResetServicePrincipalNames(SMTP_SERVICE_PRINCIPAL_PREFIX);
  133. m_Lock.ExclusiveUnlock();
  134. return (m_fHaveResetPrincipalNames);
  135. }
  136. APIERR LoadAdvancedQueueingDll();
  137. protected:
  138. virtual ~SMTP_IIS_SERVICE();
  139. CShareLockNH m_Lock;
  140. private:
  141. DWORD m_OldMaxPoolThreadValue;
  142. LONG m_cCurrentSystemRoutingThreads;
  143. DWORD m_cMaxSystemRoutingThreads;
  144. DWORD m_dwStartHint;
  145. //
  146. // List containing some useful info including id and
  147. // ptr to statistics for each Instance.
  148. //
  149. LIST_ENTRY m_InstanceInfoList;
  150. char m_szTcpipName[MAX_PATH + 1];
  151. BOOL m_fHaveResetPrincipalNames;
  152. BOOL m_fCreatingInstance; //An instance is just being created in the
  153. //metabase... we shouldn't start it.
  154. };
  155. typedef SMTP_IIS_SERVICE *PSMTP_IIS_SERVICE;
  156. typedef struct SMTP_INSTANCE_LIST_ENTRY {
  157. DWORD dwInstanceId;
  158. LPSMTP_SERVER_STATISTICS pSmtpServerStatsObj;
  159. LIST_ENTRY ListEntry;
  160. } SMTP_INSTANCE_LIST_ENTRY, *PSMTP_INSTANCE_LIST_ENTRY;
  161. //
  162. // This is the SMTP version of the instance. Will contain all the
  163. // SMTP specific operations.
  164. //
  165. class SMTP_SERVER_INSTANCE : public IIS_SERVER_INSTANCE {
  166. friend DWORD EnumAllDomains(VOID *ptr);
  167. private:
  168. //
  169. // signature
  170. //
  171. DWORD m_signature;
  172. //
  173. // Should we use host name?
  174. //
  175. DWORD m_dwUseHostName;
  176. DWORD m_SmtpInitializeStatus;
  177. // Constants, defaults, mins, maxs, etc.
  178. //
  179. // Connections related data
  180. //
  181. // m_cMaxConnections: max connections permitted by config
  182. // m_cCurrentConnections: count of currently connected users
  183. // m_cMaxCurrentConnections: max connections seen in this session
  184. // Always m_cCurrentConnections
  185. // <= m_cMaxCurrentConnections
  186. // <= m_cMaxConnections;
  187. //
  188. // DWORD m_cMaxConnections;
  189. // replaced by TSVC_INFO::QueryMaxConnections()
  190. DWORD m_cCurrentConnections;
  191. DWORD m_cCurrentOutConnections;
  192. DWORD m_cMaxCurrentConnections;
  193. DWORD m_cMaxOutConnections;
  194. DWORD m_cMaxOutConnectionsPerDomain;
  195. DWORD m_dwNextInboundClientId;
  196. DWORD m_dwNextOutboundClientId;
  197. DWORD m_dwStopHint;
  198. // Connection protocol settings
  199. DWORD m_cMaxRemoteTimeOut;
  200. DWORD m_cMaxErrors;
  201. // Size information
  202. DWORD m_cbMaxMsgSize;
  203. DWORD m_cbMaxMsgSizeBeforeClose;
  204. DWORD m_cMaxRcpts;
  205. // DNS lookup
  206. DWORD m_dwNameResolution;
  207. // DWORD m_fEnableReverseLookup;
  208. // BOOL m_fDisconnectOnRDNSFail;
  209. DWORD m_RDNSOptions;
  210. // CPool info
  211. DWORD m_cMaxAddressObjects;
  212. DWORD m_cMaxMailObjects;
  213. // Mail loop settings
  214. DWORD m_cMaxHopCount;
  215. // Delivery settings
  216. DWORD m_fShouldDelete;
  217. DWORD m_fRelayForAuthUsers;
  218. DWORD m_fShouldPickupMail;
  219. DWORD m_cMaxRoutingThreads;
  220. DWORD m_cMaxRemoteQThreads;
  221. DWORD m_cMaxLocalQThreads;
  222. LONG m_cCurrentRoutingThreads;
  223. DWORD m_cMaxDirBuffers;
  224. DWORD m_cMaxDirChangeIoSize;
  225. DWORD m_cMaxDirPendingIos;
  226. DWORD m_cRetryAttempts;
  227. DWORD m_cRetryMinutes;
  228. DWORD m_cRemoteRetryAttempts;
  229. DWORD m_cRemoteRetryMinutes;
  230. // Raid 174038
  231. DWORD m_fDisablePickupDotStuff;
  232. //Comma separated string of at most 4 numbers
  233. DWORD m_cbProgressiveRetryMinutes;
  234. char m_szProgressiveRetryMinutes[MAX_PATH + 1];
  235. // Pipelining info
  236. DWORD m_fShouldPipelineOut;
  237. DWORD m_fShouldPipelineIn;
  238. // Advertise Verify and Expand
  239. DWORD m_fAllowVerify;
  240. DWORD m_fAllowExpand;
  241. // Advertise DSN
  242. DWORD m_fDSN;
  243. //////
  244. //Flags that determine what commands anre supported at inbound and
  245. //under what circumstances
  246. DWORD m_InboundCmdOptions;
  247. DWORD m_OutboundCmdOptions;
  248. BOOL m_fAddNoHdrs;
  249. // Smart host settings
  250. DWORD m_fSmartHostType;
  251. DWORD m_fFlushMailFiles;
  252. //remote port to connect to
  253. DWORD m_RemoteSmtpPort;
  254. DWORD m_RemoteSmtpSecurePort;
  255. // Msgs to Admin
  256. DWORD m_fSendNDRToAdmin;
  257. DWORD m_fSendBadToAdmin;
  258. // Domain information
  259. DWORD m_fDefaultDomainExists;
  260. //number of connection objects
  261. //allocated per instance
  262. LONG m_cNumConnInObjsAlloced;
  263. LONG m_cNumConnOutObjsAlloced;
  264. LONG m_cNumCBufferObjsAlloced;
  265. LONG m_cNumAsyncObjsAlloced;
  266. LONG m_cNumAsyncDnsObjsAlloced;
  267. // Sizes, etc.
  268. DWORD m_cchConnectResponse;
  269. DWORD m_cchMailQueueDir;
  270. DWORD m_cchMailPickupDir;
  271. DWORD m_cchMailDropDir;
  272. DWORD m_cchMyHostName;
  273. //Msg batching
  274. DWORD m_fBatchMsgs;
  275. DWORD m_cMaxBatchLimit;
  276. //logging flags
  277. DWORD m_CmdLogFlags;
  278. //auth stuff
  279. DWORD m_dwAuth;
  280. DWORD m_dwMaxLogonFailures;
  281. DWORD m_DefaultRouteAction;
  282. DWORD m_ConnectTimeout;
  283. DWORD m_MailFromTimeout;
  284. DWORD m_RcptToTimeout;
  285. DWORD m_DataTimeout;
  286. DWORD m_AuthTimeout;
  287. DWORD m_SaslTimeout;
  288. DWORD m_BdatTimeout;
  289. DWORD m_HeloTimeout;
  290. DWORD m_RSetTimeout;
  291. DWORD m_TurnTimeout;
  292. DWORD m_QuitTimeout;
  293. //
  294. // TRUE to use host name to build redirection indication
  295. //
  296. BOOL m_fUseHostName;
  297. BOOL m_dwDnsFlags;
  298. BOOL m_fHaveRegisteredPrincipalNames;
  299. //
  300. // Are there any secure filters loaded?
  301. //
  302. BOOL m_fAnySecureFilters;
  303. //retry queue variables
  304. BOOL m_fIgnoreTime;
  305. BOOL m_fStartRetry;
  306. //Require SSL / 128Bit SSL on client connections
  307. BOOL m_fRequiresSSL;
  308. BOOL m_fRequires128Bits;
  309. BOOL m_fRequiresCertVerifySubject;
  310. BOOL m_fRequiresCertVerifyIssuer;
  311. DWORD m_CertStatus;
  312. // Server certificate object
  313. IIS_SSL_INFO *m_pSSLInfo;
  314. //Require SASL on client connections
  315. BOOL m_fRequiresSASL;
  316. //use to limit remote connections
  317. BOOL m_fLimitRemoteConnections;
  318. BOOL m_fShutdownCalled;
  319. BOOL m_InstBooted;
  320. BOOL m_fStoreDrvStartEventCalled;
  321. BOOL m_fStoreDrvPrepShutDownEventCalled;
  322. BOOL m_fScheduledConnection;
  323. BOOL m_fIsRoutingTable;
  324. BOOL m_fIsRelayEnabled;
  325. BOOL m_fHelloNoDomain;
  326. BOOL m_fMailFromNoHello;
  327. BOOL m_fNagleIn;
  328. BOOL m_fNagleOut;
  329. //Internet address/domain validation
  330. BOOL m_fHelloNoValidate;
  331. BOOL m_fMailNoValidate;
  332. BOOL m_fRcptNoValidate;
  333. BOOL m_fEtrnNoValidate;
  334. BOOL m_fPickupNoValidate;
  335. HANDLE m_QStopEvent;
  336. HANDLE m_hEnumBuildQ;
  337. //The server bindings
  338. MULTISZ m_ServerBindings;
  339. TCP_AUTHENT_INFO m_TcpAuthentInfo ;
  340. //
  341. // SDK: SEO Configuration
  342. //
  343. CSMTPSeoMgr m_CSMTPSeoMgr;
  344. //
  345. // used to store instance info that we wish to make accessible via
  346. // a global linked list
  347. //
  348. PSMTP_INSTANCE_LIST_ENTRY m_pSmtpInfo;
  349. //
  350. // used to store statistics for SMTP instance
  351. //
  352. LPSMTP_SERVER_STATISTICS m_pSmtpStats;
  353. TIME_ZONE_INFORMATION m_tzInfo;
  354. PERSIST_QUEUE * m_RemoteQ;
  355. BOOL m_IsShuttingDown;
  356. BOOL m_QIsShuttingDown;
  357. BOOL m_RetryQIsShuttingDown;
  358. char m_AdminName[MAX_INTERNET_NAME + 1];
  359. char m_BadMailName[MAX_INTERNET_NAME + 1];
  360. //routing thread counter
  361. LONG m_cProcessClientThreads;
  362. BOOL m_fShouldStartAcceptingConnections;
  363. BOOL m_IsFileSystemNtfs;
  364. //Directory pickup
  365. SMTP_DIRNOT * SmtpDir;
  366. HANDLE DirPickupThreadHandle;
  367. HANDLE StopHandle;
  368. // Enum Domain Thread Handle
  369. HANDLE m_hEnumDomainThreadHandle;
  370. BOOL m_fEnumThreadStarted;
  371. ADDRESS_CHECK m_acCheck;
  372. //masquerade
  373. DWORD m_fMasquerade;
  374. CHAR m_szMasqueradeName [AB_MAX_DOMAIN + 1];
  375. //Turn Table
  376. CTURN_ACCESS_TABLE m_TurnAccessList;
  377. // support the Etrn @ extension. (on by default)
  378. BOOL m_fAllowEtrnSubDomains;
  379. //directory stuff
  380. CHAR m_szMailQueueDir[MAX_PATH + 1];
  381. CHAR m_szMailPickupDir[MAX_PATH + 1];
  382. CHAR m_szMailDropDir[MAX_PATH + 1];
  383. CHAR m_szBadMailDir[MAX_PATH + 1];
  384. CHAR m_szMyDomain[MAX_PATH + 1];
  385. CHAR m_szDefaultDomain[MAX_PATH + 1];
  386. CHAR m_szFQDomainName[MAX_PATH + 1];
  387. CHAR m_szConnectResponse[RESPONSE_BUFF_SIZE];
  388. CHAR m_szSmartHostName[MAX_PATH + 1];
  389. CHAR m_szDefaultLogonDomain[MAX_SERVER_NAME_LEN + 1]; // for clear-text auth
  390. CHAR m_DefaultRemoteUserName[MAX_INTERNET_NAME + 1];
  391. CHAR m_DefaultRemotePassword[MAX_PATH + 1];
  392. LIST_ENTRY m_ConnectionsList; // list of all connections
  393. LIST_ENTRY m_OutConnectionsList; // list of all connections
  394. LIST_ENTRY m_leVRoots; // list of vroots (used by admin)
  395. LIST_ENTRY m_AsynConnectList; // list of all Async connections
  396. LIST_ENTRY m_AsyncDnsList; // list of all Async Dnsconnections
  397. CRITICAL_SECTION m_csLock; // used for updating this object
  398. CRITICAL_SECTION m_critBoot; // used to synchronize start/stop
  399. CRITICAL_SECTION m_csAsyncDns; // used for updating async dns list
  400. CRITICAL_SECTION m_csAsyncConnect; // used for updating async connect list
  401. //
  402. // We use m_fInitAsyncCS to track whether the 2 previous critsecs (m_csAsyncDns
  403. // and m_csAsyncConnect) were intialized properly before deinitializing them
  404. // and vice versa. This is in an effort to track any bugs or erroneous assumptions
  405. // we make about the underlying IIS code which controls initializing and deinitializing
  406. // these variables (as part or initializing and deinitializing SMTP_SERVER_INSTANCE).
  407. //
  408. BOOL m_fInitAsyncCS;
  409. CShareLockNH m_OutLock;
  410. CShareLockNH m_GenLock;
  411. METADATA_REF_HANDLER m_rfAccessCheck;
  412. METADATA_REF_HANDLER m_RelayAccessCheck;
  413. //
  414. // Instance-specific cleartext auth package name
  415. //
  416. char m_szCleartextAuthPackage[MAX_PATH + 1];
  417. char m_szMembershipBroker[MAX_PATH + 1];
  418. DWORD m_cbCleartextAuthPackage;
  419. PAUTH_BLOCK m_ProviderPackages;
  420. char m_ProviderNames[MAX_PATH + 1];
  421. DWORD m_cProviderPackages;
  422. BOOL SetProviderPackages();
  423. // Save the pointer of change object
  424. MD_CHANGE_OBJECT *m_pChangeObject;
  425. BOOL m_fDefaultInRt;
  426. IAdvQueue *m_IAQ;
  427. PVOID m_pvAQInstanceContext;
  428. IAdvQueueConfig *m_pIAdvQueueConfig;
  429. IConnectionManager *m_ICM;
  430. BOOL fInitializedStoreDriver;
  431. BOOL fInitializedAQ;
  432. ISMTPServer *m_ComSmtpServer;
  433. // Protocol Events IServer
  434. CMailMsgLoggingPropertyBag m_InstancePropertyBag;
  435. // eventlog level
  436. DWORD m_dwEventlogLevel;
  437. public:
  438. SMTP_SERVER_INSTANCE(
  439. IN PSMTP_IIS_SERVICE pService,
  440. IN DWORD dwInstanceId,
  441. IN USHORT Port,
  442. IN LPCSTR lpszRegParamKey,
  443. IN LPWSTR lpwszAnonPasswordSecretName,
  444. IN LPWSTR lpwszVirtualRootsSecretName,
  445. IN BOOL fMigrateRoots = FALSE
  446. );
  447. virtual ~SMTP_SERVER_INSTANCE( );
  448. virtual DWORD StopInstance(void);
  449. virtual DWORD StartInstance(void);
  450. virtual DWORD PauseInstance(void);
  451. METADATA_REF_HANDLER* QueryMetaDataRefHandler() { return &m_rfAccessCheck;}
  452. METADATA_REF_HANDLER* QueryRelayMetaDataRefHandler() { return &m_RelayAccessCheck;}
  453. void ResetRelayIpSecList(void)
  454. {
  455. m_RelayAccessCheck.Reset( (IMDCOM*)g_pInetSvc->QueryMDObject() );
  456. }
  457. void SetRelayIpSecList(LPVOID pV, DWORD dwS, DWORD dwR )
  458. {
  459. if(m_RelayAccessCheck.GetPtr()) //can't leak memory
  460. {
  461. delete [] m_RelayAccessCheck.GetPtr();
  462. m_RelayAccessCheck.Set(NULL, 0, 0);
  463. }
  464. m_RelayAccessCheck.Set(pV, dwS, dwR);
  465. }
  466. // added by andreik
  467. IEventRouter * GetRouter() { return m_CSMTPSeoMgr.GetRouter(); }
  468. //
  469. // Protocol events
  470. //
  471. HRESULT HrSetWellKnownIServerProps();
  472. IUnknown *GetInstancePropertyBag() { return ((IUnknown *)(IMailMsgLoggingPropertyBag *)(&m_InstancePropertyBag));}
  473. //
  474. // read smtp parameters
  475. //
  476. void GetServerBindings(void);
  477. BOOL IsShuttingDown(void){return m_IsShuttingDown || g_IsShuttingDown;}
  478. BOOL QIsShuttingDown(void){return m_QIsShuttingDown;}
  479. BOOL IsRetryQShuttingDown(void) {return m_RetryQIsShuttingDown;}
  480. //
  481. // SSP security check
  482. //
  483. BOOL CheckSSPPackage(IN LPCSTR pszAuthString);
  484. //
  485. // Server-side SSL object
  486. //
  487. IIS_SSL_INFO* QueryAndReferenceSSLInfoObj();
  488. static VOID ResetSSLInfo( LPVOID pvParam );
  489. void LogCertStatus(void);
  490. void LogCTLStatus(void);
  491. BOOL InitQueues(void);
  492. BOOL IsFileSystemNtfs(void){ return m_IsFileSystemNtfs;}
  493. void SetShutdownFlag(void) {m_fShutdownCalled = TRUE;}
  494. SMTP_DIRNOT * QueryDirnotObj() { return SmtpDir;}
  495. PERSIST_QUEUE * QueryRemoteQObj() { return m_RemoteQ;}
  496. char * QueryAdminName(void) {return m_AdminName;}
  497. char * QueryBadMailName (void) {return m_BadMailName;}
  498. void SetAcceptConnBool(void) {m_fShouldStartAcceptingConnections = TRUE;}
  499. BOOL GetAcceptConnBool(void) { return m_fShouldStartAcceptingConnections; }
  500. //
  501. // Keep track of Statistics counters for this instance
  502. //
  503. LPSMTP_SERVER_STATISTICS QueryStatsObj() { return m_pSmtpStats;}
  504. ADDRESS_CHECK* QueryAccessCheck() { return &m_acCheck;}
  505. //
  506. // VIRTUALS for service specific params/RPC admin
  507. //
  508. virtual BOOL SetServiceConfig(IN PCHAR pConfig );
  509. virtual BOOL GetServiceConfig(IN OUT PCHAR pConfig,IN DWORD dwLevel);
  510. virtual BOOL GetStatistics( IN DWORD dwLevel, OUT PCHAR *pBuffer);
  511. virtual BOOL ClearStatistics( );
  512. virtual BOOL DisconnectUser( IN DWORD dwIdUser );
  513. virtual BOOL EnumerateUsers( OUT PCHAR* pBuffer, OUT PDWORD nRead );
  514. virtual VOID MDChangeNotify( MD_CHANGE_OBJECT * pco );
  515. DWORD QueryEncCaps(void);
  516. BOOL InitFromRegistry(void);
  517. void StopHint();
  518. void SetStopHint(DWORD StopHint) {m_dwStopHint = StopHint;}
  519. CAddr * AppendLocalDomain (CAddr * OldAddress);
  520. //Using 821 addr validation
  521. BOOL AppendLocalDomain (char * Address);
  522. BOOL MoveToBadMail ( IMailMsgProperties *pIMsg, BOOL fUseIMsg, char * MailFile, char * FilePath);
  523. VOID LockConfig( VOID) {EnterCriticalSection( &m_csLock);}
  524. VOID UnLockConfig( VOID) {LeaveCriticalSection( &m_csLock);}
  525. //these are excluse locks
  526. VOID ExclusiveLockGenCrit( VOID) {m_GenLock.ExclusiveLock();}
  527. VOID ExclusiveUnLockGenCrit( VOID) {m_GenLock.ExclusiveUnlock();}
  528. //these are shared locks
  529. VOID LockGenCrit( VOID) {m_GenLock.ShareLock();}
  530. VOID UnLockGenCrit( VOID) {m_GenLock.ShareUnlock();}
  531. DWORD GetMaxConnectionsPerDomain(void) const {return m_cMaxOutConnectionsPerDomain;}
  532. DWORD GetCurrentConnectionsCount(void) const {return m_cCurrentConnections;}
  533. PLIST_ENTRY GetConnectionList(void) {return &m_ConnectionsList;}
  534. DWORD GetMaxCurrentConnectionsCount(void) const {return m_cMaxCurrentConnections;}
  535. DWORD GetMaxRcpts(void) const { return m_cMaxRcpts;}
  536. CLIENT_CONNECTION * CreateNewConnection( IN CLIENT_CONN_PARAMS * pParams);
  537. VOID DisconnectAllConnections( VOID);
  538. VOID RemoveConnection( IN OUT CLIENT_CONNECTION * pcc);
  539. BOOL InsertNewOutboundConnection( IN OUT CLIENT_CONNECTION * pcc, BOOL ByPassLimitCheck = FALSE);
  540. VOID RemoveOutboundConnection( IN OUT CLIENT_CONNECTION * pConn);
  541. VOID DisconnectAllOutboundConnections( VOID);
  542. BOOL WriteRegParams(SMTP_CONFIG_INFO *pconfig);
  543. // Changed by KeithLau on 7/15/96 to remove the fInit flag
  544. BOOL ReadRegParams(FIELD_CONTROL fc, BOOL fRebuild, BOOL fShowEvents = TRUE);
  545. // Added by KeithLau on 7/15/96
  546. BOOL ReadStartupRegParams(VOID);
  547. BOOL RemoveRegParams(const char * DomainName);
  548. DWORD GetDnsFlags(void) const {return m_dwDnsFlags;}
  549. BOOL AllowVerify(DWORD dwConnectionStatus) const{
  550. if (m_InboundCmdOptions & SMTP_I_SUPPORT_VRFY)
  551. return TRUE;
  552. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_VRFY_ON_SSL) && (dwConnectionStatus & SMTP_IS_SSL_CONNECTION))
  553. return TRUE;
  554. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_VRFY_ON_AUTH) && (dwConnectionStatus & SMTP_IS_AUTH_CONNECTION))
  555. return TRUE;
  556. else return FALSE;
  557. }
  558. BOOL AllowExpand(DWORD dwConnectionStatus) const {
  559. if (m_InboundCmdOptions & SMTP_I_SUPPORT_EXPN)
  560. return TRUE;
  561. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_EXPN_ON_SSL) && (dwConnectionStatus & SMTP_IS_SSL_CONNECTION))
  562. return TRUE;
  563. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_EXPN_ON_AUTH) && (dwConnectionStatus & SMTP_IS_AUTH_CONNECTION))
  564. return TRUE;
  565. else return FALSE;
  566. }
  567. BOOL AllowLogin(DWORD dwConnectionStatus) const {
  568. if (!(m_dwAuth & INET_INFO_AUTH_CLEARTEXT))
  569. return FALSE;
  570. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_LOGIN) && !(m_InboundCmdOptions & SMTP_I_SUPPORT_LOGIN_ON_SSL))
  571. return TRUE;
  572. else if ((m_InboundCmdOptions & SMTP_I_SUPPORT_LOGIN_ON_SSL) && (dwConnectionStatus & SMTP_IS_SSL_CONNECTION))
  573. return TRUE;
  574. else return FALSE;
  575. }
  576. BOOL AllowEightBitMime() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_8BITMIME);}
  577. BOOL AllowDSN() const { return (m_InboundCmdOptions & SMTP_I_SUPPORT_DSN);}
  578. BOOL AllowBinaryMime() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_BMIME);}
  579. BOOL AllowChunking() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_CHUNK);}
  580. BOOL AllowETRN() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_ETRN);}
  581. BOOL AllowTURN() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_TURN);}
  582. BOOL AllowAuth() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_AUTH);}
  583. BOOL AllowEnhancedCodes() const {return (m_InboundCmdOptions & SMTP_I_SUPPORT_ECODES);}
  584. /*
  585. BOOL AllowSSL() const {
  586. CEncryptCtx EncryptCtx(FASLE);
  587. if(m_CertStatus == CERT_STATUS_UNKNOWN)
  588. {
  589. if (!EncryptCtx.CheckServerCert(
  590. (LPSTR) QueryLocalHostName(),
  591. (LPSTR) QueryLocalPortName(),
  592. (LPVOID) this,
  593. QueryInstanceId()))
  594. {
  595. m_CertStatus = CERT_STATUS_INVALID;
  596. }
  597. else
  598. {
  599. m_CertStatus = CERT_STATUS_VALID;
  600. }
  601. }
  602. if(m_CertStatus == CERT_STATUS_INVALID)
  603. return FALSE;
  604. else
  605. return TRUE;
  606. }
  607. */
  608. BOOL AllowOutboundDSN() const {return (m_OutboundCmdOptions & SMTP_0_SUPPORT_DSN);}
  609. BOOL AllowOutboundBMIME() const {return (m_OutboundCmdOptions & SMTP_0_SUPPORT_BMIME);}
  610. BOOL ShouldChunkOut() const {return (m_OutboundCmdOptions & SMTP_0_FORCE_CHUNK);}
  611. BOOL ShouldPipeLineIn(void) const { return m_fShouldPipelineIn;}
  612. BOOL ShouldPipeLineOut(void) const { return m_fShouldPipelineOut;}
  613. BOOL ShouldDelete(void) const { return m_fShouldDelete;}
  614. BOOL ShouldParseHdrs(void) const { return (!m_fAddNoHdrs);}
  615. DWORD GetMaxHopCount(void) const { return m_cMaxHopCount;}
  616. DWORD GetMaxAddrObjects(void) const { return m_cMaxAddressObjects;}
  617. DWORD GetMaxMailObjects(void) const { return m_cMaxMailObjects;}
  618. DWORD GetMaxOutConnections(void) const {return m_cMaxOutConnections;}
  619. DWORD GetRetryAttempts(void) const {return m_cRetryAttempts;}
  620. DWORD GetRetryMinutes(void) const {return m_cRetryMinutes;}
  621. DWORD GetRemoteSmtpPort(void) const {return m_RemoteSmtpPort;}
  622. DWORD GetRemoteSmtpSecurePort(void) const {return m_RemoteSmtpSecurePort;}
  623. DWORD GetRemoteRetryAttempts(void) const {return m_cRemoteRetryAttempts;}
  624. DWORD GetRemoteRetryMinutes(void) const {return m_cRemoteRetryMinutes;}
  625. DWORD GetMaxErrors(void) const {return m_cMaxErrors;}
  626. DWORD GetRemoteTimeOut(void) const {return m_cMaxRemoteTimeOut;}
  627. DWORD GetMaxMsgSize(void) const {return m_cbMaxMsgSize;}
  628. DWORD GetMailBagLimit(void) const {return m_cMaxBatchLimit;}
  629. DWORD GetMaxMsgSizeBeforeClose(void) const {return m_cbMaxMsgSizeBeforeClose;}
  630. DWORD GetConnectTimeout(void) const {return m_ConnectTimeout;}
  631. DWORD GetMailFromTimeout (void) const {return m_MailFromTimeout;}
  632. DWORD GetRcptToTimeout (void) const {return m_RcptToTimeout;}
  633. DWORD GetDataTimeout (void) const {return m_DataTimeout;}
  634. DWORD GetAuthTimeout (void) const {return m_AuthTimeout;}
  635. DWORD GetSaslTimeout (void) const {return m_SaslTimeout;}
  636. DWORD GetBdatTimeout (void) const {return m_BdatTimeout;}
  637. DWORD GetHeloTimeout (void) const {return m_HeloTimeout;}
  638. DWORD GetRSetTimeout (void) const {return m_RSetTimeout;}
  639. DWORD GetTurnTimeout (void) const {return m_TurnTimeout;}
  640. DWORD GetQuitTimeout (void) const {return m_QuitTimeout;}
  641. void DecRoutingThreads(void) {InterlockedDecrement(&m_cCurrentRoutingThreads);}
  642. BOOL IncRoutingThreads(void)
  643. {
  644. DWORD NewValue;
  645. NewValue = InterlockedIncrement(&m_cCurrentRoutingThreads);
  646. if (NewValue > m_cMaxRoutingThreads)
  647. {
  648. InterlockedDecrement(&m_cCurrentRoutingThreads);
  649. return FALSE;
  650. }
  651. return TRUE;
  652. }
  653. DWORD GetNumDirBuffers(void) const {return m_cMaxDirBuffers;}
  654. DWORD GetDirBufferSize(void) const {return m_cMaxDirChangeIoSize;}
  655. DWORD GetMaxPendingDirIos(void) const {return m_cMaxDirPendingIos;}
  656. CHAR * GetBadMailDir(void) const {return (CHAR *) m_szBadMailDir;}
  657. CHAR * GetMailQueueDir(void) const {return (CHAR *)m_szMailQueueDir;}
  658. CHAR * GetMailPickupDir(void) const {return (CHAR *)m_szMailPickupDir;}
  659. BOOL GetMailDropDir(char * OutputDropDir)
  660. {
  661. BOOL fRet = TRUE;
  662. m_GenLock.ShareLock();
  663. if (m_szMailDropDir[0] != '\0')
  664. lstrcpy(OutputDropDir,m_szMailDropDir);
  665. else
  666. fRet = FALSE;
  667. m_GenLock.ShareUnlock();
  668. if (!fRet)
  669. SetLastError(ERROR_DIRECTORY);
  670. return fRet;
  671. }
  672. DWORD GetNameResolution(void) const {return m_dwNameResolution;}
  673. DWORD GetMaxRemoteQThreads(void) const {return m_cMaxRemoteQThreads;}
  674. DWORD GetMaxLocalQThreads(void) const {return m_cMaxLocalQThreads;}
  675. DWORD GetMailQueueDirLength(void) const {return m_cchMailQueueDir;}
  676. DWORD GetMailPickupDirLength(void) const {return m_cchMailPickupDir;}
  677. DWORD GetMailDropDirLength(void) const {return m_cchMailDropDir;}
  678. CHAR * GetConnectResponse(void) const {return (char *) m_szConnectResponse;}
  679. DWORD GetConnRespSize(void) const {return m_cchConnectResponse;}
  680. BOOL IsReverseLookupEnabled(void) const {return (m_RDNSOptions & SMTP_I_HELOEHLO_RDNS);}
  681. BOOL fDisconnectOnRDNSFail(void) const {return (m_RDNSOptions & SMTP_I_HELOEHLO_RDNS_DISCONNECT);}
  682. BOOL IsRDNSEnabledForMAIL(void) const {return (m_RDNSOptions & SMTP_I_MAILFROM_RDNS);}
  683. void VerifyFQDNWithBindings(void);
  684. BOOL UseGetHostByName(void) const {return (m_dwNameResolution == RESOLUTION_GETHOSTBYNAME);}
  685. BOOL GetSendNDRToAdmin(void) const {return m_fSendNDRToAdmin;}
  686. BOOL GetSendBadToAdmin(void) const {return m_fSendBadToAdmin;}
  687. BOOL RelayForAuthUsers(void) const {return m_fRelayForAuthUsers;}
  688. BOOL ShouldMasquerade(void) const {return m_fMasquerade;}
  689. BOOL ShouldAcceptNoDomain (void) const {return m_fHelloNoDomain;}
  690. BOOL AllowMailFromNoHello (void) const {return m_fMailFromNoHello;}
  691. BOOL IsInboundNagleOn(void) const {return m_fNagleIn;}
  692. BOOL IsOutBoundNagleOn(void) const {return m_fNagleOut;}
  693. BOOL ShouldValidateHeloDomain(void){return !m_fHelloNoValidate;}
  694. CAddr * MasqueradeDomain (CAddr * OldAddress);
  695. BOOL MasqueradeDomain (char * Address, char * DomainPtr);
  696. // Removed by KeithLau on 7/23/96
  697. // BOOL ShouldRetry(void) const {return m_fShouldRetry;}
  698. // Changed by keithlau per rohanp
  699. BOOL BadMailExists(void) const {return (m_szBadMailDir[0] == '\0')?FALSE:TRUE;}
  700. BOOL FlushMailFiles(void) const {return m_fFlushMailFiles;}
  701. BOOL BatchMsgs(void) const {return m_fBatchMsgs;}
  702. BOOL ShouldPickupMail(void) const {return m_fShouldPickupMail;}
  703. BOOL AlwaysUseSmartHost(void) const {return (m_fSmartHostType == smarthostAlways);}
  704. BOOL UseSmartHostAfterFail(void) const {return (m_fSmartHostType == smarthostAfterFail);}
  705. DWORD GetSmartHostType(void) const {return m_fSmartHostType;}
  706. BOOL GetSmartHost(char *SmartHostBuffer)
  707. {
  708. BOOL fRet = FALSE;
  709. m_GenLock.ShareLock();
  710. if (m_szSmartHostName[0] != '\0') {
  711. lstrcpy(SmartHostBuffer, m_szSmartHostName);
  712. fRet = TRUE;
  713. }
  714. m_GenLock.ShareUnlock();
  715. return fRet;
  716. }
  717. BOOL GetDefaultUserName(char *UserNameBuff)
  718. {
  719. BOOL fRet = FALSE;
  720. m_GenLock.ShareLock();
  721. if (m_DefaultRemoteUserName[0] != '\0') {
  722. lstrcpy(UserNameBuff, m_DefaultRemoteUserName);
  723. fRet = TRUE;
  724. }
  725. m_GenLock.ShareUnlock();
  726. return fRet;
  727. }
  728. BOOL GetDefaultPassword(char *PasswordBuff)
  729. {
  730. BOOL fRet = FALSE;
  731. m_GenLock.ShareLock();
  732. if (m_DefaultRemotePassword[0] != '\0') {
  733. lstrcpy(PasswordBuff, m_DefaultRemotePassword);
  734. fRet = TRUE;
  735. }
  736. m_GenLock.ShareUnlock();
  737. return fRet;
  738. }
  739. CHAR * GetFQDomainName(void) const {return (char *) m_szFQDomainName;}
  740. CHAR * GetDefaultDomain(void) const {return (char *)m_szDefaultDomain;}
  741. BOOL FDefaultDomainExists(void) const {return m_fDefaultDomainExists;}
  742. DWORD GetCmdLogFlags(VOID) const { return m_CmdLogFlags;}
  743. DWORD GetDefaultRouteAction(VOID) const { return m_DefaultRouteAction;}
  744. void FreeVRootList(PLIST_ENTRY pleHead);
  745. BOOL FindBestVRoot(LPSTR szVRoot);
  746. BOOL IsAddressMine(DWORD IpAddress, DWORD ConnectedPort = 25);
  747. //directory pickup
  748. void SetDirnotStopHandle (HANDLE SHandle) {StopHandle = SHandle;}
  749. HANDLE GetDirnotStopHandle(void) const {return StopHandle;}
  750. BOOL InitDirectoryNotification(void);
  751. void DestroyDirectoryNotification(void);
  752. //
  753. // TCP authent info
  754. //
  755. PTCP_AUTHENT_INFO QueryAuthentInfo()
  756. { return &m_TcpAuthentInfo;}
  757. LONG GetProcessClientThreads(void) const {return m_cProcessClientThreads;}
  758. void IncProcessClientThreads (void) {InterlockedIncrement(&m_cProcessClientThreads);}
  759. void DecProcessClientThreads (void) {InterlockedDecrement(&m_cProcessClientThreads);}
  760. LONG GetConnInAllocCount(void) const {return m_cNumConnInObjsAlloced;}
  761. void IncConnInObjs (void) {InterlockedIncrement(&m_cNumConnInObjsAlloced);}
  762. void DecConnInObjs (void) {InterlockedDecrement(&m_cNumConnInObjsAlloced);}
  763. LONG GetCBufferAllocCount(void) const {return m_cNumCBufferObjsAlloced;}
  764. void IncCBufferObjs (void) {InterlockedIncrement(&m_cNumCBufferObjsAlloced);}
  765. void DecCBufferObjs (void) {InterlockedDecrement(&m_cNumCBufferObjsAlloced);}
  766. LONG GetConnOutAllocCount(void) const {return m_cNumConnOutObjsAlloced;}
  767. void IncConnOutObjs (void) {InterlockedIncrement(&m_cNumConnOutObjsAlloced);}
  768. void DecConnOutObjs (void) {InterlockedDecrement(&m_cNumConnOutObjsAlloced);}
  769. LONG GetAsyncMxOutAllocCount(void) const {return m_cNumAsyncObjsAlloced;}
  770. void IncAsyncMxOutObjs (void) {InterlockedIncrement(&m_cNumAsyncObjsAlloced);}
  771. void DecAsyncMxOutObjs (void) {InterlockedDecrement(&m_cNumAsyncObjsAlloced);}
  772. LONG GetAsyncDnsAllocCount(void) const {return m_cNumAsyncDnsObjsAlloced;}
  773. void IncAsyncDnsObjs (void) {InterlockedIncrement(&m_cNumAsyncDnsObjsAlloced);}
  774. void DecAsyncDnsObjs (void) {InterlockedDecrement(&m_cNumAsyncDnsObjsAlloced);}
  775. // Allow Etrn Subdomains (the @ extension to Etrn)
  776. BOOL AllowEtrnSubDomains() { return m_fAllowEtrnSubDomains;}
  777. // Domain Info
  778. HRESULT HrGetDomainInfoFlags(
  779. IN LPSTR szDomainName,
  780. OUT DWORD *pdwDomainInfoFlags);
  781. BOOL IsALocalDomain(char * szDomainName)
  782. {
  783. BOOL fFound = FALSE;
  784. HRESULT hr = S_OK;
  785. DWORD dwDomainInfoFlags;
  786. hr = HrGetDomainInfoFlags(szDomainName, &dwDomainInfoFlags);
  787. if (SUCCEEDED(hr)) {
  788. if ( (dwDomainInfoFlags & DOMAIN_INFO_LOCAL_MAILBOX) ||
  789. (dwDomainInfoFlags & DOMAIN_INFO_ALIAS) ||
  790. (dwDomainInfoFlags & DOMAIN_INFO_LOCAL_DROP)) {
  791. fFound = TRUE;
  792. }
  793. }
  794. return fFound;
  795. }
  796. BOOL IsADefaultOrAliasDropDomain(char * szDomainName)
  797. {
  798. BOOL fFound = FALSE;
  799. HRESULT hr = S_OK;
  800. DWORD dwDomainInfoFlags;
  801. //If there is no default drop directory, then this domain cannot
  802. //be a default/alias drop domain
  803. if ('\0' == m_szMailDropDir[0])
  804. return FALSE;
  805. hr = HrGetDomainInfoFlags(szDomainName, &dwDomainInfoFlags);
  806. if (SUCCEEDED(hr)) {
  807. if ( (dwDomainInfoFlags & DOMAIN_INFO_LOCAL_DROP) ||
  808. (dwDomainInfoFlags & DOMAIN_INFO_ALIAS)) {
  809. fFound = TRUE;
  810. }
  811. }
  812. return fFound;
  813. }
  814. BOOL IsUserInTurnTable(const char * UserName, MULTISZ * pmsz)
  815. {
  816. BOOL Found = FALSE;
  817. CTurnData * pEntry = NULL;
  818. pEntry = (CTurnData *) m_TurnAccessList.FindHashData(UserName, TRUE, pmsz);
  819. if(pEntry)
  820. {
  821. pEntry->DecRefCount();
  822. Found = TRUE;
  823. }
  824. return Found;
  825. }
  826. BOOL Stop(void);
  827. BOOL IsRelayEnabled (void) const {return m_fIsRelayEnabled;}
  828. HANDLE GetQStopEvent (void) {return m_QStopEvent;}
  829. BOOL InitiateStartup(void);
  830. void InitiateShutDown(void);
  831. void InitializeClassVariables(void);
  832. BOOL RequiresSSL(void) const {return m_fRequiresSSL;}
  833. BOOL Requires128Bits(void) const {return m_fRequires128Bits;}
  834. BOOL RequiresSSLCertVerifySubject(void) const {return m_fRequiresCertVerifySubject; }
  835. BOOL RequiresSSLCertVerifyIssuer(void) const {return m_fRequiresCertVerifyIssuer; }
  836. BOOL CompareIpAddress(DWORD IpAddress);
  837. BOOL ReadIpSecList(void);
  838. void SetRouteDomainParameters(MB &mb,
  839. char *szDomainName,
  840. char *szRoutePath,
  841. char szActionType [MAX_PATH + 1],
  842. char szUserName [MAX_INTERNET_NAME + 1],
  843. char szEtrnDomain [MAX_INTERNET_NAME + 1],
  844. char szPassword [MAX_PATH + 1],
  845. char szTargetName [MAX_PATH + 1],
  846. DomainInfo *pLocalDomainInfo);
  847. BOOL AddDomainEntry(MB& CurrentMetabase, char * DomainName);
  848. BOOL DeleteDomainEntry(const char * DomainName);
  849. BOOL GetRouteDomains(MB& CurrentMetabase, char * DomainName, BOOL fRebuild);
  850. // Instance-specific cleartext authentication informaiton
  851. LPSTR GetCleartextAuthPackage(void) { return m_szCleartextAuthPackage; }
  852. LPSTR GetMembershipBroker(void) { return m_szMembershipBroker;}
  853. DWORD GetProviderPackagesCount(void) { return m_cProviderPackages; }
  854. PAUTH_BLOCK GetProviderPackages(void) { return m_ProviderPackages; }
  855. LPSTR GetProviderNames(void) { return m_ProviderNames; }
  856. DWORD QueryAuthentication(void) { return m_dwAuth; }
  857. BOOL RequiresSASL(void) const {return m_fRequiresSASL;}
  858. LPCSTR GetDefaultLogonDomain(void) const { return (LPCSTR) m_szDefaultLogonDomain; }
  859. DWORD GetMaxLogonFailures(void) const {return m_dwMaxLogonFailures;}
  860. BOOL IsScheduledConnection(void) const {return m_fScheduledConnection;}
  861. BOOL IsRoutingTable (void) const {return m_fIsRoutingTable;}
  862. void BuildTurnTable(MULTISZ& msz, char * szDomainName);
  863. BOOL ReadRouteDomainIpSecList(MB& mb);
  864. DWORD ReadAuthentInfo(void);
  865. BOOL IsDefaultInRt(void) {return m_fDefaultInRt;}
  866. IAdvQueue * GetAdvQueuePtr(void) {return m_IAQ;}
  867. IConnectionManager * GetConnManPtr(void) {return m_ICM;}
  868. BOOL StartAdvancedQueueing(void);
  869. BOOL StopQDrivers(void);
  870. BOOL InsertAsyncObject( IN OUT CAsyncMx *pcc);
  871. VOID RemoveAsyncObject( IN OUT CAsyncMx *pcc);
  872. VOID DisconnectAllAsyncConnections( VOID);
  873. BOOL InsertAsyncDnsObject( IN OUT CAsyncSmtpDns *pcc);
  874. VOID RemoveAsyncDnsObject( IN OUT CAsyncSmtpDns *pcc);
  875. VOID DisconnectAllAsyncDnsConnections( VOID);
  876. BOOL RegisterServicePrincipalNames(BOOL fLock);
  877. PSMTP_INSTANCE_LIST_ENTRY GetSmtpInstanceInfo(void);
  878. BOOL AllocNewMessage(SMTP_ALLOC_PARAMS * Params);
  879. BOOL InsertIntoQueue(IMailMsgProperties * pImsg)
  880. {
  881. HRESULT hr = S_OK;
  882. MSG_TRACK_INFO msgTrackInfo;
  883. ZeroMemory( &msgTrackInfo, sizeof( msgTrackInfo ) );
  884. msgTrackInfo.dwEventId = MTE_SUBMIT_MESSAGE_TO_AQ;
  885. WriteLog( &msgTrackInfo, pImsg, NULL, NULL );
  886. hr = m_IAQ->SubmitMessage(pImsg);
  887. if(!FAILED(hr))
  888. {
  889. return TRUE;
  890. }
  891. else
  892. {
  893. return FALSE;
  894. }
  895. }
  896. BOOL SubmitFailedMessage(IMailMsgProperties * pImsg, DWORD dwFailedDesc, HRESULT hrFailureCode)
  897. {
  898. HRESULT hr = S_OK;
  899. hr = m_IAQ->HandleFailedMessage(pImsg, TRUE, NULL, dwFailedDesc, hrFailureCode);
  900. if(!FAILED(hr))
  901. {
  902. return TRUE;
  903. }
  904. else
  905. {
  906. return FALSE;
  907. }
  908. }
  909. HRESULT InsertIntoAdvQueue(IMailMsgProperties * pImsg)
  910. {
  911. HRESULT hr = S_OK;
  912. MSG_TRACK_INFO msgTrackInfo;
  913. ZeroMemory( &msgTrackInfo, sizeof( msgTrackInfo ) );
  914. msgTrackInfo.dwEventId = MTE_SUBMIT_MESSAGE_TO_AQ;
  915. WriteLog( &msgTrackInfo, pImsg, NULL, NULL );
  916. hr = m_IAQ->SubmitMessage(pImsg);
  917. return hr;
  918. }
  919. const char * GetInstancePath(void) const {return QueryMDPath();}
  920. HRESULT TriggerLocalDelivery(IMailMsgProperties *pMsg, DWORD dwRecipientCount, DWORD * pdwRecipIndexes, IMailMsgNotify *pNotify);
  921. HRESULT TriggerDirectoryDrop(IMailMsgProperties *pMsg,
  922. DWORD dwRecipientCount,
  923. DWORD * pdwRecipIndexes,
  924. LPCSTR DropDirectory);
  925. HRESULT TriggerDnsResolverEvent( LPSTR HostName,
  926. LPSTR MyFQDNName,
  927. DWORD dwVirtualServerId,
  928. IDnsResolverRecord **ppIDnsResolverRecord );
  929. HRESULT TriggerMaxMsgSizeEvent( IUnknown *pIUnknown, IMailMsgProperties *pIMsg, BOOL *pfShouldImposeLimit );
  930. HRESULT TriggerStoreServerEvent(DWORD EventType);
  931. HRESULT TriggerServerEvent(DWORD dwEventType, PVOID pvContext);
  932. void SinkSmtpServerStartHintFunc(void);
  933. void SinkSmtpServerStopHintFunc(void);
  934. HRESULT SinkReadMetabaseDword(DWORD MetabaseId, DWORD * dwValue);
  935. void WriteLog( LPMSG_TRACK_INFO pMsgTrackInfo,
  936. IMailMsgProperties *pMsgProps,
  937. LPEVENT_LOG_INFO pEventLogInfo,
  938. LPSTR pszProtocolLog );
  939. HRESULT TriggerLogEvent(
  940. IN DWORD idMessage,
  941. IN WORD idCategory,
  942. IN WORD cSubstrings,
  943. IN LPCSTR *rgszSubstrings,
  944. IN WORD wType,
  945. IN DWORD errCode,
  946. IN WORD iDebugLevel,
  947. IN LPCSTR szKey,
  948. IN DWORD dwOptions,
  949. IN DWORD iMessageString,
  950. IN HMODULE hModule);
  951. HRESULT ResetLogEvent(
  952. IN DWORD idMessage,
  953. IN LPCSTR szKey);
  954. HRESULT HrTriggerGetAuxDomainInfoFlagsEvent(
  955. IN LPCSTR pszDomainName,
  956. OUT DWORD *pdwDomainInfoFlags);
  957. HRESULT SinkReadMetabaseString(DWORD MetabaseId, char * Buffer, DWORD * BufferSize, BOOL fSecure);
  958. HRESULT SinkReadMetabaseData(DWORD MetabaseId, BYTE *Buffer, DWORD * BufferSize);
  959. BOOL GetCatInfo(MB& mb, AQConfigInfo& AQConfig);
  960. IAdvQueueConfig * QueryAqConfigPtr (void) { return m_pIAdvQueueConfig;}
  961. BOOL IsDropDirQuotaCheckingEnabled()
  962. {
  963. return ((GetDefaultRouteAction() & SMTP_DISABLE_DROP_QUOTA) ? FALSE : TRUE);
  964. }
  965. BOOL IsDropDirQuotaExceeded();
  966. // Raid 174038
  967. BOOL DisablePickupDotStuff(void) const {return m_fDisablePickupDotStuff;}
  968. };
  969. typedef SMTP_SERVER_INSTANCE *PSMTP_SERVER_INSTANCE;
  970. //
  971. // signatures
  972. //
  973. #define SMTP_INSTANCE_SIGNATURE 'uSMT'
  974. #define SMTP_INSTANCE_SIGNATURE_FREE 'fSMT'
  975. //
  976. // externs
  977. //
  978. DWORD
  979. InitializeInstances(
  980. PSMTP_IIS_SERVICE pService
  981. );
  982. DWORD
  983. ActivateSmtpEndpoints(
  984. VOID
  985. );
  986. #endif // _SMTPINST_H_