Skip to content
Snippets Groups Projects
Commit 997bdf15 authored by rswindell's avatar rswindell
Browse files

Added controls to configure MaxRecipients and LinesPerYield.

Created DNSBL tab for all DNSBL-related options.
parent 058c8b36
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,7 @@
#include "MainFormUnit.h"
#include "MailCfgDlgUnit.h"
#include "TextFileEditUnit.h"
#include <stdio.h> // sprintf()
#include <mmsystem.h> // sndPlaySound()
//---------------------------------------------------------------------
......@@ -87,6 +88,8 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
}
MaxClientsEdit->Text=AnsiString(MainForm->mail_startup.max_clients);
MaxInactivityEdit->Text=AnsiString(MainForm->mail_startup.max_inactivity);
MaxRecipientsEdit->Text=AnsiString(MainForm->mail_startup.max_recipients);
LinesPerYieldEdit->Text=AnsiString(MainForm->mail_startup.lines_per_yield);
AutoStartCheckBox->Checked=MainForm->MailAutoStart;
LogFileCheckBox->Checked=MainForm->MailLogFile;
......@@ -105,8 +108,8 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
=AnsiString(MainForm->mail_startup.max_delivery_attempts);
RescanFreqEdit->Text=AnsiString(MainForm->mail_startup.rescan_frequency);
DefaultUserEdit->Text=AnsiString(MainForm->mail_startup.default_user);
BLMailFlagEdit->Text=AnsiString(MainForm->mail_startup.dnsbl_flag);
BLMailFlagEdit->Enabled=false;
BLSubjectEdit->Text=AnsiString(MainForm->mail_startup.dnsbl_tag);
BLHeaderEdit->Text=AnsiString(MainForm->mail_startup.dnsbl_hdr);
DebugTXCheckBox->Checked=MainForm->mail_startup.options
&MAIL_OPT_DEBUG_TX;
......@@ -123,18 +126,20 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
AllowRelayCheckBox->Checked=MainForm->mail_startup.options
&MAIL_OPT_ALLOW_RELAY;
if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_REFUSE)
BLMailRefuseRadioButton->Checked=true;
BLRefuseRadioButton->Checked=true;
else if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_BADUSER)
BLBadUserRadioButton->Checked=true;
else if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_IGNORE)
BLMailIgnoreRadioButton->Checked=true;
else {
BLMailFlagRadioButton->Checked=true;
BLMailFlagEdit->Enabled=true;
}
BLIgnoreRadioButton->Checked=true;
else
BLTagRadioButton->Checked=true;
TcpDnsCheckBox->Checked=MainForm->mail_startup.options
&MAIL_OPT_USE_TCP_DNS;
SendMailCheckBox->Checked=
!(MainForm->mail_startup.options&MAIL_OPT_NO_SENDMAIL);
DNSBLRadioButtonClick(Sender);
DNSRadioButtonClick(Sender);
POP3EnabledCheckBoxClick(Sender);
SendMailCheckBoxClick(Sender);
......@@ -170,9 +175,11 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
MainForm->mail_startup.relay_port=RelayPortEdit->Text.ToIntDef(25);
MainForm->mail_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10);
MainForm->mail_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(120);
MainForm->mail_startup.max_recipients=MaxRecipientsEdit->Text.ToIntDef(100);
MainForm->mail_startup.max_delivery_attempts
=DeliveryAttemptsEdit->Text.ToIntDef(10);
MainForm->mail_startup.rescan_frequency=RescanFreqEdit->Text.ToIntDef(300);
MainForm->mail_startup.lines_per_yield=LinesPerYieldEdit->Text.ToIntDef(100);
SAFECOPY(MainForm->mail_startup.default_user
,DefaultUserEdit->Text.c_str());
......@@ -186,8 +193,10 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
,OutboundSoundEdit->Text.c_str());
SAFECOPY(MainForm->mail_startup.pop3_sound
,POP3SoundEdit->Text.c_str());
SAFECOPY(MainForm->mail_startup.dnsbl_flag
,BLMailFlagEdit->Text.c_str());
SAFECOPY(MainForm->mail_startup.dnsbl_tag
,BLSubjectEdit->Text.c_str());
SAFECOPY(MainForm->mail_startup.dnsbl_hdr
,BLHeaderEdit->Text.c_str());
if(RelayRadioButton->Checked==true)
MainForm->mail_startup.options|=MAIL_OPT_RELAY_TX;
......@@ -218,11 +227,13 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
else
MainForm->mail_startup.options&=~MAIL_OPT_ALLOW_RELAY;
MainForm->mail_startup.options&=
~(MAIL_OPT_DNSBL_IGNORE|MAIL_OPT_DNSBL_REFUSE);
if(BLMailIgnoreRadioButton->Checked==true)
~(MAIL_OPT_DNSBL_IGNORE|MAIL_OPT_DNSBL_REFUSE|MAIL_OPT_DNSBL_BADUSER);
if(BLIgnoreRadioButton->Checked==true)
MainForm->mail_startup.options|=MAIL_OPT_DNSBL_IGNORE;
else if(BLMailRefuseRadioButton->Checked==true)
else if(BLRefuseRadioButton->Checked==true)
MainForm->mail_startup.options|=MAIL_OPT_DNSBL_REFUSE;
else if(BLBadUserRadioButton->Checked==true)
MainForm->mail_startup.options|=MAIL_OPT_DNSBL_BADUSER;
if(HostnameCheckBox->Checked==false)
MainForm->mail_startup.options|=MAIL_OPT_NO_HOST_LOOKUP;
else
......@@ -301,9 +312,39 @@ void __fastcall TMailCfgDlg::SendMailCheckBoxClick(TObject *Sender)
//---------------------------------------------------------------------------
void __fastcall TMailCfgDlg::BLMailFlagRadioButtonClick(TObject *Sender)
void __fastcall TMailCfgDlg::DNSBLRadioButtonClick(TObject *Sender)
{
BLSubjectEdit->Enabled=BLTagRadioButton->Checked;
BLHeaderEdit->Enabled=BLTagRadioButton->Checked;
BLSubjectLabel->Enabled=BLTagRadioButton->Checked;
BLHeaderLabel->Enabled=BLTagRadioButton->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TMailCfgDlg::DNSBLServersButtonClick(TObject *Sender)
{
char filename[MAX_PATH+1];
sprintf(filename,"%sdns_blacklist.cfg",MainForm->cfg.ctrl_dir);
Application->CreateForm(__classid(TTextFileEditForm), &TextFileEditForm);
TextFileEditForm->Filename=AnsiString(filename);
TextFileEditForm->Caption="Services Configuration";
TextFileEditForm->ShowModal();
delete TextFileEditForm;
}
//---------------------------------------------------------------------------
void __fastcall TMailCfgDlg::DNSBLExemptionsButtonClick(TObject *Sender)
{
BLMailFlagEdit->Enabled=BLMailFlagRadioButton->Checked;
char filename[MAX_PATH+1];
sprintf(filename,"%sdnsbl_exempt.cfg",MainForm->cfg.ctrl_dir);
Application->CreateForm(__classid(TTextFileEditForm), &TextFileEditForm);
TextFileEditForm->Filename=AnsiString(filename);
TextFileEditForm->Caption="Services Configuration";
TextFileEditForm->ShowModal();
delete TextFileEditForm;
}
//---------------------------------------------------------------------------
object MailCfgDlg: TMailCfgDlg
Left = 635
Top = 312
Left = 619
Top = 465
BorderStyle = bsDialog
Caption = 'Mail Server Configuration'
ClientHeight = 303
......@@ -53,8 +53,8 @@ object MailCfgDlg: TMailCfgDlg
Top = 4
Width = 342
Height = 245
ActivePage = SMTPTabSheet
TabIndex = 1
ActivePage = DNSBLTabSheet
TabIndex = 5
TabOrder = 3
object GeneralTabSheet: TTabSheet
Caption = 'General'
......@@ -84,6 +84,14 @@ object MailCfgDlg: TMailCfgDlg
AutoSize = False
Caption = 'Max Inactivity'
end
object LinesPerYieldLabel: TLabel
Left = 9
Top = 140
Width = 104
Height = 24
AutoSize = False
Caption = 'Lines Per Yield'
end
object AutoStartCheckBox: TCheckBox
Left = 9
Top = 12
......@@ -144,51 +152,63 @@ object MailCfgDlg: TMailCfgDlg
Left = 185
Top = 76
Width = 146
Height = 26
Height = 24
Hint = 'Log all transmitted mail commands and responses (for debugging)'
Caption = 'Log TX'
ParentShowHint = False
ShowHint = True
TabOrder = 5
TabOrder = 6
end
object LogFileCheckBox: TCheckBox
Left = 185
Top = 108
Width = 146
Height = 26
Height = 24
Hint = 'Save log entries to a file (in your DATA directory)'
Caption = 'Log to Disk'
ParentShowHint = False
ShowHint = True
TabOrder = 6
TabOrder = 7
end
object LinesPerYieldEdit: TEdit
Left = 113
Top = 140
Width = 48
Height = 24
Hint =
'Number of lines of message text sent/received between time-slice' +
' yields'
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
end
object SMTPTabSheet: TTabSheet
Caption = 'SMTP'
ImageIndex = 1
object BlacklistedMailLabel: TLabel
object TelnetPortLabel: TLabel
Left = 9
Top = 76
Top = 12
Width = 104
Height = 24
AutoSize = False
Caption = 'Blacklisted Mail'
Caption = 'Listening Port'
end
object TelnetPortLabel: TLabel
object DefaultUserLabel: TLabel
Left = 9
Top = 12
Top = 76
Width = 104
Height = 24
AutoSize = False
Caption = 'Listening Port'
Caption = 'Default User'
end
object DefaultUserLabel: TLabel
object MaxRecipientsLabel: TLabel
Left = 9
Top = 44
Width = 104
Height = 24
AutoSize = False
Caption = 'Default User'
Caption = 'Max Recipients'
end
object SMTPPortEdit: TEdit
Left = 113
......@@ -202,7 +222,7 @@ object MailCfgDlg: TMailCfgDlg
end
object UserNumberCheckBox: TCheckBox
Left = 9
Top = 130
Top = 108
Width = 288
Height = 24
Hint =
......@@ -211,22 +231,22 @@ object MailCfgDlg: TMailCfgDlg
Caption = 'Allow Mail Addressed by User Number'
ParentShowHint = False
ShowHint = True
TabOrder = 1
TabOrder = 4
end
object DebugHeadersCheckBox: TCheckBox
Left = 185
Top = 12
Width = 146
Height = 26
Height = 24
Hint = 'Log all received mail headers (for debugging)'
Caption = 'Log Headers'
ParentShowHint = False
ShowHint = True
TabOrder = 3
TabOrder = 1
end
object DefaultUserEdit: TEdit
Left = 113
Top = 44
Top = 76
Width = 185
Height = 24
Hint =
......@@ -234,64 +254,28 @@ object MailCfgDlg: TMailCfgDlg
'ysop")'
ParentShowHint = False
ShowHint = True
TabOrder = 2
TabOrder = 3
end
object AllowRelayCheckBox: TCheckBox
Left = 9
Top = 162
Top = 140
Width = 288
Height = 24
Hint = 'Allow mail to be relayed for authenticated users'
Caption = 'Allow Authenticated Users to Relay Mail'
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
object BLMailFlagRadioButton: TRadioButton
Left = 112
Top = 76
Width = 57
Height = 24
Hint = 'Flag DNS-blacklisted mail with an X-RBL header'
Caption = 'Flag'
ParentShowHint = False
ShowHint = True
TabOrder = 5
OnClick = BLMailFlagRadioButtonClick
end
object BLMailIgnoreRadioButton: TRadioButton
Left = 176
Top = 76
Width = 57
Height = 24
Hint = 'Pretend to receive DNS-blacklisted mail '
Caption = 'Ignore'
ParentShowHint = False
ShowHint = True
TabOrder = 6
OnClick = BLMailFlagRadioButtonClick
end
object BLMailRefuseRadioButton: TRadioButton
Left = 248
Top = 76
Width = 73
Height = 24
Hint = 'Refuse mail session with DNS-blacklisted servers'
Caption = 'Refuse'
ParentShowHint = False
ShowHint = True
TabOrder = 7
OnClick = BLMailFlagRadioButtonClick
end
object BLMailFlagEdit: TEdit
object MaxRecipientsEdit: TEdit
Left = 113
Top = 100
Width = 185
Top = 44
Width = 48
Height = 24
Hint = 'Flag to add to subject of DNS-blacklisted mail'
Hint = 'Maximum number of recipients for a single message'
ParentShowHint = False
ShowHint = True
TabOrder = 8
TabOrder = 2
end
end
object POP3TabSheet: TTabSheet
......@@ -399,7 +383,7 @@ object MailCfgDlg: TMailCfgDlg
Left = 250
Top = 108
Width = 65
Height = 26
Height = 24
Hint = 'Use TCP packets (instead of UDP) for DNS queries'
Caption = 'TCP'
ParentShowHint = False
......@@ -558,6 +542,131 @@ object MailCfgDlg: TMailCfgDlg
OnClick = OutboundSoundButtonClick
end
end
object DNSBLTabSheet: TTabSheet
Caption = 'DNSBL'
ImageIndex = 5
ParentShowHint = False
ShowHint = True
object Label1: TLabel
Left = 128
Top = 104
Width = 41
Height = 16
Caption = 'Label1'
end
object DNSBLServersButton: TButton
Left = 8
Top = 8
Width = 113
Height = 26
Hint = 'DNS-based Blacklists'
Caption = 'Blacklists'
TabOrder = 0
OnClick = DNSBLServersButtonClick
end
object DNSBLGroupBox: TGroupBox
Left = 8
Top = 40
Width = 321
Height = 161
Caption = 'Mail from Blacklisted Servers:'
ParentShowHint = False
ShowHint = True
TabOrder = 1
object BLSubjectLabel: TLabel
Left = 16
Top = 92
Width = 80
Height = 26
AutoSize = False
Caption = 'Subject'
end
object BLHeaderLabel: TLabel
Left = 16
Top = 121
Width = 80
Height = 26
AutoSize = False
Caption = 'Header'
end
object BLRefuseRadioButton: TRadioButton
Left = 16
Top = 28
Width = 153
Height = 24
Hint = 'Refuse mail session with blacklisted servers'
Caption = 'Refuse Session'
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = DNSBLRadioButtonClick
end
object BLIgnoreRadioButton: TRadioButton
Left = 16
Top = 57
Width = 161
Height = 24
Hint = 'Pretend to receive blacklisted mail'
Caption = 'Silently Ignore'
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = DNSBLRadioButtonClick
end
object BLBadUserRadioButton: TRadioButton
Left = 168
Top = 28
Width = 129
Height = 24
Hint = 'Refuse mail address from blacklisted servers'
Caption = 'Refuse Mail'
TabOrder = 1
OnClick = DNSBLRadioButtonClick
end
object BLTagRadioButton: TRadioButton
Left = 168
Top = 57
Width = 97
Height = 24
Hint = 'Tag blacklisted mail with header and/or subject'
Caption = 'Tag with:'
ParentShowHint = False
ShowHint = True
TabOrder = 3
OnClick = DNSBLRadioButtonClick
end
object BLSubjectEdit: TEdit
Left = 105
Top = 92
Width = 185
Height = 24
Hint = 'Flag to add to subject of DNS-blacklisted mail'
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
object BLHeaderEdit: TEdit
Left = 105
Top = 121
Width = 185
Height = 24
Hint = 'Flag to add to subject of DNS-blacklisted mail'
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
end
object DNSBLExemptionsButton: TButton
Left = 128
Top = 8
Width = 113
Height = 26
Hint = 'Blacklist Exempted IP addresses'
Caption = 'Exempt IPs'
TabOrder = 2
OnClick = DNSBLExemptionsButtonClick
end
end
end
object OpenDialog: TOpenDialog
Filter = 'Wave Files|*.wav'
......
......@@ -67,7 +67,6 @@ __published:
TLabel *MaxInactivityLabel;
TEdit *MaxInactivityEdit;
TTabSheet *SMTPTabSheet;
TLabel *BlacklistedMailLabel;
TLabel *TelnetPortLabel;
TEdit *SMTPPortEdit;
TCheckBox *UserNumberCheckBox;
......@@ -106,10 +105,23 @@ __published:
TLabel *DefaultUserLabel;
TEdit *DefaultUserEdit;
TCheckBox *AllowRelayCheckBox;
TRadioButton *BLMailFlagRadioButton;
TRadioButton *BLMailIgnoreRadioButton;
TRadioButton *BLMailRefuseRadioButton;
TEdit *BLMailFlagEdit;
TTabSheet *DNSBLTabSheet;
TButton *DNSBLServersButton;
TLabel *Label1;
TGroupBox *DNSBLGroupBox;
TRadioButton *BLRefuseRadioButton;
TRadioButton *BLIgnoreRadioButton;
TRadioButton *BLBadUserRadioButton;
TRadioButton *BLTagRadioButton;
TEdit *BLSubjectEdit;
TEdit *BLHeaderEdit;
TLabel *BLSubjectLabel;
TLabel *BLHeaderLabel;
TEdit *LinesPerYieldEdit;
TLabel *LinesPerYieldLabel;
TLabel *MaxRecipientsLabel;
TEdit *MaxRecipientsEdit;
TButton *DNSBLExemptionsButton;
void __fastcall InboundSoundButtonClick(TObject *Sender);
void __fastcall OutboundSoundButtonClick(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
......@@ -118,7 +130,9 @@ __published:
void __fastcall DNSRadioButtonClick(TObject *Sender);
void __fastcall POP3EnabledCheckBoxClick(TObject *Sender);
void __fastcall SendMailCheckBoxClick(TObject *Sender);
void __fastcall BLMailFlagRadioButtonClick(TObject *Sender);
void __fastcall DNSBLRadioButtonClick(TObject *Sender);
void __fastcall DNSBLServersButtonClick(TObject *Sender);
void __fastcall DNSBLExemptionsButtonClick(TObject *Sender);
private:
public:
virtual __fastcall TMailCfgDlg(TComponent* AOwner);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment