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

View File

@ -3900,3 +3900,5 @@
+ Added new ANSI message base editor. + Added new ANSI message base editor.
+ Added new ANSI security level 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; '1' : Configuration_TelnetServer;
'2' : Configuration_FTPServer; '2' : Configuration_FTPServer;
'3' : Configuration_POP3Server; '3' : Configuration_POP3Server;
'4' : Configuration_SMTPServer;
'X' : Break; 'X' : Break;
Else Else
MenuPtr := 0; MenuPtr := 0;

View File

@ -14,6 +14,7 @@ Procedure Configuration_Internet;
Procedure Configuration_FTPServer; Procedure Configuration_FTPServer;
Procedure Configuration_TelnetServer; Procedure Configuration_TelnetServer;
Procedure Configuration_POP3Server; Procedure Configuration_POP3Server;
Procedure Configuration_SMTPServer;
Implementation Implementation
@ -414,4 +415,34 @@ Begin
Box.Free; Box.Free;
End; 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. End.

View File

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

View File

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

View File

@ -119,12 +119,14 @@ Begin
DirClean (Session.TempPath, ''); DirClean (Session.TempPath, '');
{$IFNDEF UNIX} {$IFNDEF LOGGING}
Screen.TextAttr := 14; {$IFNDEF UNIX}
Screen.SetWindow (1, 1, 80, 25, False); Screen.TextAttr := 14;
Screen.ClearScreen; 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} {$ENDIF}
DisposeClasses; DisposeClasses;

View File

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

View File

@ -19,6 +19,9 @@ BUGS AND POSSIBLE ISSUES
the CPU requirement for new versions. Or just tell people the code is 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? 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 ! 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 FUTURE / IDEAS / WORK IN PROGRESS / NOTES
========================================= =========================================