SMTP config + timeout configurable. Additional MPL debug logging, record format change for SMTP stuff

This commit is contained in:
mysticbbs 2012-02-27 11:14:27 -05:00
parent 5acfa19f37
commit 75a6b7fb2c
9 changed files with 133 additions and 22 deletions

View File

@ -588,6 +588,7 @@ Begin
Config.inetTNNodes := MaxNode;
Config.inetSMTPDupes := 1;
Config.inetSMTPTimeout := 120;
Config.inetPOP3Dupes := 1;
Config.inetPOP3Delete := False;
@ -1193,17 +1194,17 @@ Begin
WarningDisplay;
//COMMENT this out if mystic.dat is being converted:
Assign (ConfigFile, 'mystic.dat');
Reset (ConfigFile);
Read (ConfigFile, Config);
Close (ConfigFile);
// Assign (ConfigFile, 'mystic.dat');
// Reset (ConfigFile);
// Read (ConfigFile, Config);
// Close (ConfigFile);
// ConvertConfig; //1.10a11
ConvertConfig; //1.10a11
// ConvertUsers; //1.10a11
//ConvertSecurity; //1.10a11
//ConvertFileLists; //1.10a11
//ConvertFileBases; //1.10a11
ConvertMessageBases; //1.10a11
//ConvertMessageBases; //1.10a11
// ConvertArchives; //1.10a1
// ConvertGroups; //1.10a1

View File

@ -3900,3 +3900,5 @@
+ Added new ANSI message base editor.
+ Added new ANSI security level editor.
+ SMTP server now has a configurable timeout value per session (in seconds)

View File

@ -243,6 +243,7 @@ Begin
'1' : Configuration_TelnetServer;
'2' : Configuration_FTPServer;
'3' : Configuration_POP3Server;
'4' : Configuration_SMTPServer;
'X' : Break;
Else
MenuPtr := 0;

View File

@ -14,6 +14,7 @@ Procedure Configuration_Internet;
Procedure Configuration_FTPServer;
Procedure Configuration_TelnetServer;
Procedure Configuration_POP3Server;
Procedure Configuration_SMTPServer;
Implementation
@ -414,4 +415,34 @@ Begin
Box.Free;
End;
Procedure Configuration_SMTPServer;
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
Topic : String[80];
Begin
Topic := '|03(|09SMTP Server|03) |01-|09> |15';
Box := TAnsiMenuBox.Create;
Form := TAnsiMenuForm.Create;
Box.Header := ' SMTP Server ';
Box.Open (27, 8, 53, 16);
VerticalLine (45, 10, 14);
Form.AddBol ('U', ' Use Server', 33, 10, 47, 10, 12, 3, @Config.inetSMTPUse, Topic + 'Enable SMTP server');
Form.AddWord ('P', ' Server Port', 32, 11, 47, 11, 13, 5, 0, 65535, @Config.inetSMTPPort, Topic + 'Server port');
Form.AddByte ('N', ' Max Connections', 28, 12, 47, 12, 17, 3, 1, 255, @Config.inetSMTPMax, Topic + 'Max Connections');
Form.AddByte ('I', ' Dupe IP Limit', 30, 13, 47, 13, 15, 3, 1, 255, @Config.inetSMTPDupes, Topic + 'Max connections with same IP');
Form.AddWord ('T', ' Timeout', 36, 14, 47, 14, 9, 5, 0, 65535, @Config.inetSMTPTimeout, Topic + 'Connection timeout (seconds)');
Form.Execute;
Form.Free;
Box.Close;
Box.Free;
End;
End.

View File

@ -52,8 +52,7 @@ Type
Implementation
Const
SMTPTimeOut = 120; { MCFG }
SMTPHackThresh = 10000;
SMTPHackThresh = 10000;
re_Goodbye = '221 Goodbye';
re_UnknownCmd = '502 Unknown command';
@ -292,7 +291,7 @@ Begin
Client.WriteLine('220 ' + bbsConfig.iNetDomain + ' Mystic SMTP Ready');
Repeat
If Client.WaitForData(SMTPTimeOut * 1000) = 0 Then Break;
If Client.WaitForData(bbsConfig.inetSMTPTimeout * 1000) = 0 Then Break;
If Terminated Then Exit;

View File

@ -43,6 +43,9 @@ Type
SavedMCI : Boolean;
SavedGroup : Boolean;
SavedArrow : Boolean;
{$IFDEF LOGGING}
Depth : LongInt;
{$ENDIF}
Function GetErrorMsg : String;
Procedure Error (Err: Byte; Str: String);
@ -98,6 +101,10 @@ Type
Constructor Create (O: Pointer);
Destructor Destroy; Override;
Function Execute (FN: String) : Byte;
{$IFDEF LOGGING}
Procedure LogVarInformation (Num: LongInt);
{$ENDIF}
End;
Function ExecuteMPL (Owner: Pointer; Str: String) : Byte;
@ -116,6 +123,35 @@ Uses
{$I MPL_COMMON.PAS}
{$IFDEF LOGGING}
Procedure TInterpEngine.LogVarInformation (Num: LongInt);
Begin
Session.SystemLog(' DUMP VAR ' + strI2S(Num));
With VarData[Num]^ Do Begin
Session.SystemLog(' ID: ' + strI2S(VarID));
Session.SystemLog(' Type: ' + strI2S(Ord(vType)));
Session.SystemLog(' DataSize: ' + strI2S(DataSize));
Session.SystemLog(' VarSize: ' + strI2S(VarSize));
Session.SystemLog(' Kill: ' + strI2S(Ord(Kill)));
If Data <> NIL Then
Session.SystemLog(' Data: Assigned')
Else
Session.SystemLog(' Data: NIL');
End;
// Params : Array[1..mplMaxProcParams] of Char;
// NumParams : Byte;
// pID : Array[1..mplMaxProcParams] of Word;
// ProcPos : LongInt;
// Data : PStack;
// ArrPos : Byte;
// ArrDim : TArrayInfo;
End;
{$ENDIF}
Procedure TInterpEngine.GetUserVars (Var U: RecUser);
Begin
Move (U.PermIdx, VarData[IdxVarUser ]^.Data^, SizeOf(U.PermIdx));
@ -261,6 +297,10 @@ Begin
ErrStr := '';
Ch := #0;
W := 0;
{$IFDEF LOGGING}
Depth := 0;
{$ENDIF}
End;
Destructor TInterpEngine.Destroy;
@ -1116,6 +1156,10 @@ Begin
// or a predefined procedure from mpl_common.
If VarData[VarNum]^.ProcPos > 0 Then Begin
{$IFDEF LOGGING}
Session.SystemLog(' Custom Proc: ' + strI2S(ProcID));
{$ENDIF}
Sub := CurFilePos;
SavedVar := CurVarNum;
@ -1209,7 +1253,7 @@ Begin
// execution speed?
{$IFDEF LOGGING}
Session.SystemLog('MPE ProcID: ' + strI2S(ProcID));
Session.SystemLog(' Internal Proc: ' + strI2S(ProcID));
{$ENDIF}
Case ProcID of
@ -1983,6 +2027,11 @@ Var
Begin
Result := 0;
{$IFDEF LOGGING}
Inc(Depth);
Session.SystemLog('[' + strI2S(Depth) + '] ExecBlock BEGIN Var: ' + strI2S(StartVar) + ' Rec: ' + strI2S(StartRec));
{$ENDIF}
NextChar; // block begin character... can we ignore it? at least for case_else
NextWord; // or just have case else ignore the begin at the compiler level
// but still output the begin
@ -2060,19 +2109,31 @@ Begin
Until (ErrNum <> 0) or Done or DataFile^.EOF;
{$IFDEF LOGGING}
Session.SystemLog('MPE: Kill Block Vars');
Session.SystemLog('[' + strI2S(Depth) + '] ExecBlock KILL VAR: ' + strI2S(CurVarNum) + ' to ' + strI2S(StartVar + 1));
{$ENDIF}
For Count := CurVarNum DownTo StartVar + 1 Do Begin
If (VarData[Count]^.Kill) And (VarData[Count]^.Data <> NIL) Then begin
{$IFDEF LOGGING}
LogVarInformation(Count);
{$ENDIF}
If (VarData[Count]^.Kill) And (VarData[Count]^.Data <> NIL) Then Begin
FreeMem(VarData[Count]^.Data, VarData[Count]^.DataSize);
end;
{$IFDEF LOGGING}
Session.SystemLog(' FreeMem ' + strI2S(Count));
{$ENDIF}
End;
{$IFDEF LOGGING}
Session.SystemLog(' Dispose ' + strI2S(Count));
{$ENDIF}
Dispose (VarData[Count]);
End;
{$IFDEF LOGGING}
Session.SystemLog('MPE: Kill Block Done');
Session.SystemLog('[' + strI2S(Depth) + '] ExecBlock KILL REC: ' + strI2S(CurRecNum) + ' to ' + strI2S(StartRec + 1));
{$ENDIF}
For Count := CurRecNum DownTo StartRec + 1 Do
@ -2082,6 +2143,11 @@ Begin
CurVarNum := StartVar;
CurRecNum := StartRec;
{$IFDEF LOGGING}
Session.SystemLog('[' + strI2S(Depth) + '] ExecBlock END');
Dec (Depth);
{$ENDIF}
End;
Function TInterpEngine.Execute (FN: String) : Byte;
@ -2119,6 +2185,7 @@ Begin
If Not DataFile^.Open(FN) Then Begin
Dispose(DataFile, Done);
Exit;
End;
@ -2126,8 +2193,10 @@ Begin
If DataFile^.FileSize < mplVerLength Then Begin
DataFile^.Close;
Error (mpxInvalidFile, FN);
Error (mpxInvalidFile, FN);
Dispose (DataFile, Done);
Exit;
End;
@ -2136,8 +2205,10 @@ Begin
If VerStr <> mplVersion Then Begin
DataFile^.Close;
Error (mpxVerMismatch, VerStr);
Error (mpxVerMismatch, VerStr);
Dispose (DataFile, Done);
Exit;
End;

View File

@ -119,12 +119,14 @@ Begin
DirClean (Session.TempPath, '');
{$IFNDEF UNIX}
Screen.TextAttr := 14;
Screen.SetWindow (1, 1, 80, 25, False);
Screen.ClearScreen;
{$IFNDEF LOGGING}
{$IFNDEF UNIX}
Screen.TextAttr := 14;
Screen.SetWindow (1, 1, 80, 25, False);
Screen.ClearScreen;
Screen.WriteLine ('Exiting with Errorlevel ' + strI2S(ExitCode));
Screen.WriteLine ('Exiting with Errorlevel ' + strI2S(ExitCode));
{$ENDIF}
{$ENDIF}
DisposeClasses;

View File

@ -219,6 +219,7 @@ Type
inetSMTPPort : Word;
inetSMTPMax : Word;
inetSMTPDupes : Byte;
inetSMTPTimeOut : Word;
inetPOP3Use : Boolean;
inetPOP3Port : Word;
inetPOP3Max : Word;
@ -242,7 +243,7 @@ Type
inetNNTPMax : Word;
inetNNTPDupes : Byte;
// UNSORTED
Reserved : Array[1..486] of Char;
Reserved : Array[1..484] of Char;
End;
Const

View File

@ -19,6 +19,9 @@ BUGS AND POSSIBLE ISSUES
the CPU requirement for new versions. Or just tell people the code is
already available GPL and let them compile it if it is a problem?
! RAR internal viewer does not work with files that have embedded comments
! Investigate strange crashing when Mystic is built in the FPC editor vs
the makewin script. Something is out of whack with compiler options? OR
FPC BUG? DirAttr is suspect in MPL is it 1 byte or 4 in size?
FUTURE / IDEAS / WORK IN PROGRESS / NOTES
=========================================