projects
/
mgsmtp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Listen on user-specified addresses
[mgsmtp.git]
/
Listener.pas
diff --git
a/Listener.pas
b/Listener.pas
index b37662b15302704304dfaa0ad059ea99ab4337ec..fc92edd86a77c31ac0a808354e03fc3710940c71 100644
(file)
--- a/
Listener.pas
+++ b/
Listener.pas
@@
-1,6
+1,6
@@
{
MegaBrutal's SMTP Server (MgSMTP)
{
MegaBrutal's SMTP Server (MgSMTP)
- Copyright (C) 2010-201
4
MegaBrutal
+ Copyright (C) 2010-201
8
MegaBrutal
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@
-38,7
+38,7
@@
uses SysUtils, Classes, Base64, Network, NetRFC, RFCSMTP,
type
TMgSMTPListener = class(TTCPListener)
type
TMgSMTPListener = class(TTCPListener)
- constructor Create(Port: word);
+ constructor Create(
const Address: string;
Port: word);
protected
procedure HandleClient(Connection: TTCPConnection); override;
procedure ReceiveEMailData(TCP: TTCPRFCConnection; Response: TRFCReply; SpoolObject: TSpoolObjectCreator);
protected
procedure HandleClient(Connection: TTCPConnection); override;
procedure ReceiveEMailData(TCP: TTCPRFCConnection; Response: TRFCReply; SpoolObject: TSpoolObjectCreator);
@@
-57,11
+57,12
@@
var
procedure StartListeners;
procedure StartListeners;
-var i: integer;
+var i: integer;
address, port: string;
begin
begin
- SetLength(MgSMTPListeners, MainServerConfig.Listen
Port
s.Count);
+ SetLength(MgSMTPListeners, MainServerConfig.Listen
Addresse
s.Count);
for i:= 0 to Length(MgSMTPListeners) - 1 do begin
for i:= 0 to Length(MgSMTPListeners) - 1 do begin
- MgSMTPListeners[i]:= TMgSMTPListener.Create(StrToIntDef(MainServerConfig.ListenPorts.Strings[i], STANDARD_SMTP_PORT));
+ SplitParameters(MainServerConfig.ListenAddresses.Strings[i], address, port, ':');
+ MgSMTPListeners[i]:= TMgSMTPListener.Create(address, StrToIntDef(port, STANDARD_SMTP_PORT));
MgSMTPListeners[i].StartListen;
end;
end;
MgSMTPListeners[i].StartListen;
end;
end;
@@
-127,11
+128,11
@@
begin
end;
end;
-constructor TMgSMTPListener.Create(Port: word);
+constructor TMgSMTPListener.Create(
const Address: string;
Port: word);
begin
{ Request connection objects with support for RFC-style commands & responses. }
begin
{ Request connection objects with support for RFC-style commands & responses. }
- inherited Create(Port, NET_TCP_RFCSUPPORT);
- Logger.AddLine('Server', 'Listening on
port:
' + IntToStr(Port));
+ inherited Create(
Address,
Port, NET_TCP_RFCSUPPORT);
+ Logger.AddLine('Server', 'Listening on
address: ' + Address + ':
' + IntToStr(Port));
end;
end;