projects
/
mgsmtp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use getaddrinfo & getnameinfo
[mgsmtp.git]
/
MgSMTP.pas
diff --git
a/MgSMTP.pas
b/MgSMTP.pas
index 808a90ddaafe2298f6f22dc280e56f78a742c9f9..a9c51e7d2e1ca64260742f5b1888f195d81b0ade 100644
(file)
--- a/
MgSMTP.pas
+++ b/
MgSMTP.pas
@@
-1,6
+1,6
@@
{
MegaBrutal's SMTP Server (MgSMTP)
{
MegaBrutal's SMTP Server (MgSMTP)
- Copyright (C) 2010-201
5
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
@@
-49,7
+49,7
@@
const
document what bugfix/feature are you testing with the actual build.
This will be logged to help you differentiate outputs of subsequent
builds in your logs. If left empty, it won't be added to the logs. }
document what bugfix/feature are you testing with the actual build.
This will be logged to help you differentiate outputs of subsequent
builds in your logs. If left empty, it won't be added to the logs. }
- DEVCOMMENT = '
New feature to add "Reply-To" to forwarded messages
';
+ DEVCOMMENT = '
Use getaddrinfo & getnameinfo
';
var
var
@@
-130,6
+130,16
@@
begin
end;
end;
end;
end;
+function ConsoleCtrlHandler(Signal: dword): longbool; stdcall;
+{ Handle CTRL-C event in user mode. }
+begin
+ if Signal = CTRL_C_EVENT then begin
+ Out.writeln('Caught CTRL-C signal.');
+ Stopping:= true;
+ end;
+ Result:= true;
+end;
+
procedure Service(Argc: dword; Argv: pointer); stdcall;
var ProposedExitCode: integer;
begin
procedure Service(Argc: dword; Argv: pointer); stdcall;
var ProposedExitCode: integer;
begin
@@
-169,13
+179,18
@@
begin
SpoolManager:= TSpoolManager.Create(Config);
PolicyManager:= TPolicyManager.Create(Config);
SpoolManager:= TSpoolManager.Create(Config);
PolicyManager:= TPolicyManager.Create(Config);
+ AddDevComment(Logger);
+
+ if (Config.ReadString('Server', 'ListenAddress', '') = '')
+ and (Config.ReadString('Server', 'ListenPort', '') <> '') then
+ Logger.AddStdLine('WARNING! Server\ListenPort is deprecated. Use ListenAddress instead!');
+
if Config.ReadBool('Spool', 'KeepProcessedEnvelopes', false)
or Config.ReadBool('Spool', 'KeepProcessedEMails', false) then
if not DirectoryExists('processed') then CreateDir('processed');
Config.Free;
if Config.ReadBool('Spool', 'KeepProcessedEnvelopes', false)
or Config.ReadBool('Spool', 'KeepProcessedEMails', false) then
if not DirectoryExists('processed') then CreateDir('processed');
Config.Free;
- AddDevComment(Logger);
Logger.AddStdLine('Primary server name: ' + MainServerConfig.Name);
Logger.AddStdLine('FCrDNS policy: ' + FCrDNSPolicyToStr(PolicyManager.FCrDNSPolicy));
if MailboxManager.DomainSpecific then
Logger.AddStdLine('Primary server name: ' + MainServerConfig.Name);
Logger.AddStdLine('FCrDNS policy: ' + FCrDNSPolicyToStr(PolicyManager.FCrDNSPolicy));
if MailboxManager.DomainSpecific then
@@
-221,7
+236,7
@@
begin
end
else begin
Config.Free;
end
else begin
Config.Free;
- Out.writeln('Error: Server
/
Name is a mandatory configuration entry.'#13#10
+ Out.writeln('Error: Server
\
Name is a mandatory configuration entry.'#13#10
+ 'Please configure the application properly, refer to the manual.');
ReportSvcStatus(SERVICE_STOPPED, 2, 0);
end;
+ 'Please configure the application properly, refer to the manual.');
ReportSvcStatus(SERVICE_STOPPED, 2, 0);
end;
@@
-236,7
+251,7
@@
end;
begin
Out.writeln('MegaBrutal''s SMTP Server, version ' + VERSION_STR + ', ' + IntToStr(PLATFORM_BITS) + ' bits');
begin
Out.writeln('MegaBrutal''s SMTP Server, version ' + VERSION_STR + ', ' + IntToStr(PLATFORM_BITS) + ' bits');
- Out.writeln('Copyright (C) 2010-201
4
MegaBrutal');
+ Out.writeln('Copyright (C) 2010-201
8
MegaBrutal');
AddDevComment(Out);
Out.writeln;
AddDevComment(Out);
Out.writeln;
@@
-302,6
+317,7
@@
begin
else begin
if Cmdline.IsPresent('USERMODE') then begin
Out.writeln('Starting MgSMTP in user mode...');
else begin
if Cmdline.IsPresent('USERMODE') then begin
Out.writeln('Starting MgSMTP in user mode...');
+ SetConsoleCtrlHandler(ConsoleCtrlHandler, true);
Service(0, nil);
end
else begin
Service(0, nil);
end
else begin