Skip to content
Snippets Groups Projects
Commit 548be7e7 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add option to no mark POP3-retrieved mail as READ

When the option is not set, messages "READ" flag is set when the message is
retrieved via POP3. Setting this option defeats that behavior - as requested
by Keyop via IRC.

Since I'm out of option flags, remove the "receive by user number" option.
The receive by user number option was never a good idea and hopefully no
one is actually depending on/using that setting. Uesr numbers in the alias.cfg
file still work.
parent 2a609bb2
No related branches found
No related tags found
No related merge requests found
Pipeline #8297 failed
...@@ -142,10 +142,6 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender) ...@@ -142,10 +142,6 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
RelayAuthCramMD5RadioButton->Checked=MainForm->mail_startup.options RelayAuthCramMD5RadioButton->Checked=MainForm->mail_startup.options
&MAIL_OPT_RELAY_AUTH_CRAM_MD5; &MAIL_OPT_RELAY_AUTH_CRAM_MD5;
#if 0 /* this is a stupid option */
UserNumberCheckBox->Checked=MainForm->mail_startup.options
&MAIL_OPT_ALLOW_RX_BY_NUMBER;
#endif
AuthViaIpCheckBox->Checked=MainForm->mail_startup.options AuthViaIpCheckBox->Checked=MainForm->mail_startup.options
&MAIL_OPT_SMTP_AUTH_VIA_IP; &MAIL_OPT_SMTP_AUTH_VIA_IP;
if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_REFUSE) if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_REFUSE)
...@@ -169,8 +165,6 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender) ...@@ -169,8 +165,6 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
=(MainForm->mail_startup.options&MAIL_OPT_SEND_INTRANSIT); =(MainForm->mail_startup.options&MAIL_OPT_SEND_INTRANSIT);
AdvancedCheckListBox->Checked[i++] AdvancedCheckListBox->Checked[i++]
=(MainForm->mail_startup.options&MAIL_OPT_DEBUG_RX_BODY); =(MainForm->mail_startup.options&MAIL_OPT_DEBUG_RX_BODY);
AdvancedCheckListBox->Checked[i++]
=(MainForm->mail_startup.options&MAIL_OPT_ALLOW_RX_BY_NUMBER);
AdvancedCheckListBox->Checked[i++] AdvancedCheckListBox->Checked[i++]
=(MainForm->mail_startup.options&MAIL_OPT_ALLOW_SYSOP_ALIASES); =(MainForm->mail_startup.options&MAIL_OPT_ALLOW_SYSOP_ALIASES);
AdvancedCheckListBox->Checked[i++] AdvancedCheckListBox->Checked[i++]
...@@ -182,6 +176,8 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender) ...@@ -182,6 +176,8 @@ void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
=(MainForm->mail_startup.options&MAIL_OPT_DNSBL_THROTTLE); =(MainForm->mail_startup.options&MAIL_OPT_DNSBL_THROTTLE);
AdvancedCheckListBox->Checked[i++] AdvancedCheckListBox->Checked[i++]
=!(MainForm->mail_startup.options&MAIL_OPT_NO_AUTO_EXEMPT); =!(MainForm->mail_startup.options&MAIL_OPT_NO_AUTO_EXEMPT);
AdvancedCheckListBox->Checked[i++]
=!(MainForm->mail_startup.options&MAIL_OPT_NO_READ_POP3);
AdvancedCheckListBox->Checked[i++] AdvancedCheckListBox->Checked[i++]
=(MainForm->mail_startup.options&MAIL_OPT_KILL_READ_SPAM); =(MainForm->mail_startup.options&MAIL_OPT_KILL_READ_SPAM);
...@@ -334,9 +330,6 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender) ...@@ -334,9 +330,6 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
setBit(&MainForm->mail_startup.options setBit(&MainForm->mail_startup.options
,MAIL_OPT_DEBUG_RX_BODY ,MAIL_OPT_DEBUG_RX_BODY
,AdvancedCheckListBox->Checked[i++]); ,AdvancedCheckListBox->Checked[i++]);
setBit(&MainForm->mail_startup.options
,MAIL_OPT_ALLOW_RX_BY_NUMBER
,AdvancedCheckListBox->Checked[i++]);
setBit(&MainForm->mail_startup.options setBit(&MainForm->mail_startup.options
,MAIL_OPT_ALLOW_SYSOP_ALIASES ,MAIL_OPT_ALLOW_SYSOP_ALIASES
,AdvancedCheckListBox->Checked[i++]); ,AdvancedCheckListBox->Checked[i++]);
...@@ -352,6 +345,9 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender) ...@@ -352,6 +345,9 @@ void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
setBit(&MainForm->mail_startup.options setBit(&MainForm->mail_startup.options
,MAIL_OPT_NO_AUTO_EXEMPT ,MAIL_OPT_NO_AUTO_EXEMPT
,!AdvancedCheckListBox->Checked[i++]); ,!AdvancedCheckListBox->Checked[i++]);
setBit(&MainForm->mail_startup.options
,MAIL_OPT_NO_READ_POP3
,!AdvancedCheckListBox->Checked[i++]);
setBit(&MainForm->mail_startup.options setBit(&MainForm->mail_startup.options
,MAIL_OPT_KILL_READ_SPAM ,MAIL_OPT_KILL_READ_SPAM
,AdvancedCheckListBox->Checked[i++]); ,AdvancedCheckListBox->Checked[i++]);
......
...@@ -953,12 +953,12 @@ object MailCfgDlg: TMailCfgDlg ...@@ -953,12 +953,12 @@ object MailCfgDlg: TMailCfgDlg
Items.Strings = ( Items.Strings = (
'SendMail: Ignore '#39'in transit'#39' attribute' 'SendMail: Ignore '#39'in transit'#39' attribute'
'Retain received mail files (in temp directory)' 'Retain received mail files (in temp directory)'
'Allow receipt of mail by user number'
'Allow receipt of mail to '#39'sysop'#39' and '#39'postmaster'#39 'Allow receipt of mail to '#39'sysop'#39' and '#39'postmaster'#39
'Allow authenticated users to relay mail' 'Allow authenticated users to relay mail'
'Check '#39'Received'#39' header fields against DNSBL' 'Check '#39'Received'#39' header fields against DNSBL'
'Throttle DNS blacklisted server sessions' 'Throttle DNS blacklisted server sessions'
'Auto-exempt sent-mail recipients from DNSBL' 'Auto-exempt sent-mail recipients from DNSBL'
'Set Read attribute on POP3-retrieved messages')
'Set Kill-Read attribute on received SPAM') 'Set Kill-Read attribute on received SPAM')
TabOrder = 0 TabOrder = 0
end end
......
...@@ -1675,6 +1675,7 @@ static bool pop3_client_thread(pop3_t* pop3) ...@@ -1675,6 +1675,7 @@ static bool pop3_client_thread(pop3_t* pop3)
lprintf(LOG_DEBUG, "%04d %s <%s> message transfer complete (%lu lines) from %s" lprintf(LOG_DEBUG, "%04d %s <%s> message transfer complete (%lu lines) from %s"
, socket, client.protocol, user.alias, lines_sent, msg.from); , socket, client.protocol, user.alias, lines_sent, msg.from);
if (!(startup->options & MAIL_OPT_NO_READ_POP3)) {
if ((i = smb_locksmbhdr(&smb)) != SMB_SUCCESS) { if ((i = smb_locksmbhdr(&smb)) != SMB_SUCCESS) {
errprintf(LOG_ERR, WHERE, "%04d %s <%s> !ERROR %d (%s) locking message base" errprintf(LOG_ERR, WHERE, "%04d %s <%s> !ERROR %d (%s) locking message base"
, socket, client.protocol, user.alias, i, smb.last_error); , socket, client.protocol, user.alias, i, smb.last_error);
...@@ -1696,6 +1697,7 @@ static bool pop3_client_thread(pop3_t* pop3) ...@@ -1696,6 +1697,7 @@ static bool pop3_client_thread(pop3_t* pop3)
smb_unlocksmbhdr(&smb); smb_unlocksmbhdr(&smb);
} }
} }
}
smb_freemsgmem(&msg); smb_freemsgmem(&msg);
smb_freemsgtxt(msgtxt); smb_freemsgtxt(msgtxt);
continue; continue;
...@@ -4838,7 +4840,7 @@ static bool smtp_client_thread(smtp_t* smtp) ...@@ -4838,7 +4840,7 @@ static bool smtp_client_thread(smtp_t* smtp)
} }
} }
if ((p == alias_buf || p == name_alias_buf || startup->options & MAIL_OPT_ALLOW_RX_BY_NUMBER) if ((p == alias_buf || p == name_alias_buf)
&& IS_DIGIT(*p)) { && IS_DIGIT(*p)) {
usernum = atoi(p); /* RX by user number */ usernum = atoi(p); /* RX by user number */
/* verify usernum */ /* verify usernum */
......
...@@ -106,7 +106,7 @@ static struct init_field mail_init_fields[] = { ...@@ -106,7 +106,7 @@ static struct init_field mail_init_fields[] = {
#define MAIL_OPT_DEBUG_RX_RSP (1 << 4) #define MAIL_OPT_DEBUG_RX_RSP (1 << 4)
#define MAIL_OPT_RELAY_TX (1 << 5) /* Use SMTP relay server */ #define MAIL_OPT_RELAY_TX (1 << 5) /* Use SMTP relay server */
#define MAIL_OPT_DEBUG_POP3 (1 << 6) #define MAIL_OPT_DEBUG_POP3 (1 << 6)
#define MAIL_OPT_ALLOW_RX_BY_NUMBER (1 << 7) /* Receive mail sent to user # */ #define MAIL_OPT_NO_READ_POP3 (1 << 7) /* Don't set READ msg attribute when RETR'd via POP3 */
#define MAIL_OPT_NO_NOTIFY (1 << 8) /* Don't notify local recipients */ #define MAIL_OPT_NO_NOTIFY (1 << 8) /* Don't notify local recipients */
#define MAIL_OPT_ALLOW_SYSOP_ALIASES (1 << 9) /* Receive mail sent to built-in sysop aliases (i.e. "sysop" and "postmaster") */ #define MAIL_OPT_ALLOW_SYSOP_ALIASES (1 << 9) /* Receive mail sent to built-in sysop aliases (i.e. "sysop" and "postmaster") */
#define MAIL_OPT_USE_SUBMISSION_PORT (1 << 10) /* Listen on the "MSA" service port for mail submissions */ #define MAIL_OPT_USE_SUBMISSION_PORT (1 << 10) /* Listen on the "MSA" service port for mail submissions */
...@@ -147,7 +147,7 @@ static ini_bitdesc_t mail_options[] = { ...@@ -147,7 +147,7 @@ static ini_bitdesc_t mail_options[] = {
{ MAIL_OPT_DEBUG_RX_RSP, "DEBUG_RX_RSP" }, { MAIL_OPT_DEBUG_RX_RSP, "DEBUG_RX_RSP" },
{ MAIL_OPT_RELAY_TX, "RELAY_TX" }, { MAIL_OPT_RELAY_TX, "RELAY_TX" },
{ MAIL_OPT_DEBUG_POP3, "DEBUG_POP3" }, { MAIL_OPT_DEBUG_POP3, "DEBUG_POP3" },
{ MAIL_OPT_ALLOW_RX_BY_NUMBER, "ALLOW_RX_BY_NUMBER" }, { MAIL_OPT_NO_READ_POP3, "NO_READ_POP3" },
{ MAIL_OPT_ALLOW_SYSOP_ALIASES, "ALLOW_SYSOP_ALIASES" }, { MAIL_OPT_ALLOW_SYSOP_ALIASES, "ALLOW_SYSOP_ALIASES" },
{ MAIL_OPT_USE_SUBMISSION_PORT, "USE_SUBMISSION_PORT" }, { MAIL_OPT_USE_SUBMISSION_PORT, "USE_SUBMISSION_PORT" },
{ MAIL_OPT_NO_NOTIFY, "NO_NOTIFY" }, { MAIL_OPT_NO_NOTIFY, "NO_NOTIFY" },
......
...@@ -1641,6 +1641,7 @@ static void mailsrvr_cfg(void) ...@@ -1641,6 +1641,7 @@ static void mailsrvr_cfg(void)
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "POP3 Support", startup.options & MAIL_OPT_ALLOW_POP3 ? str : strDisabled); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "POP3 Support", startup.options & MAIL_OPT_ALLOW_POP3 ? str : strDisabled);
snprintf(str, sizeof str, "Port %u", startup.pop3s_port); snprintf(str, sizeof str, "Port %u", startup.pop3s_port);
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "POP3/TLS Support", startup.options & MAIL_OPT_TLS_POP3 ? str : strDisabled); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "POP3/TLS Support", startup.options & MAIL_OPT_TLS_POP3 ? str : strDisabled);
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Mark Retrieved Mail as Read", startup.options & MAIL_OPT_NO_READ_POP3 ? "No" : "Yes");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Clients", maximum(startup.max_clients)); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Clients", maximum(startup.max_clients));
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Inactivity", vduration(startup.max_inactivity)); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Inactivity", vduration(startup.max_inactivity));
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Concurrent Connections", maximum(startup.max_concurrent_connections)); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Max Concurrent Connections", maximum(startup.max_concurrent_connections));
...@@ -1649,7 +1650,6 @@ static void mailsrvr_cfg(void) ...@@ -1649,7 +1650,6 @@ static void mailsrvr_cfg(void)
snprintf(opt[i++], MAX_OPLN, "%-30s%s bytes", "Max Receive Message Size", byte_count_to_str(startup.max_msg_size, tmp, sizeof(tmp))); snprintf(opt[i++], MAX_OPLN, "%-30s%s bytes", "Max Receive Message Size", byte_count_to_str(startup.max_msg_size, tmp, sizeof(tmp)));
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Post Recipient", startup.post_to); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Post Recipient", startup.post_to);
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Default Recipient", startup.default_user); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Default Recipient", startup.default_user);
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Receive By User Number", startup.options & MAIL_OPT_ALLOW_RX_BY_NUMBER ? "Yes" : "No");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Receive By Sysop Aliases", startup.options & MAIL_OPT_ALLOW_SYSOP_ALIASES ? "Yes" : "No"); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Receive By Sysop Aliases", startup.options & MAIL_OPT_ALLOW_SYSOP_ALIASES ? "Yes" : "No");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Notify Local Recipients", startup.options & MAIL_OPT_NO_NOTIFY ? "No" : "Yes"); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Notify Local Recipients", startup.options & MAIL_OPT_NO_NOTIFY ? "No" : "Yes");
snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Notify Offline Recipients", startup.options & MAIL_OPT_NO_NOTIFY ? "N/A" : (startup.notify_offline_users ? "Yes" : "No")); snprintf(opt[i++], MAX_OPLN, "%-30s%s", "Notify Offline Recipients", startup.options & MAIL_OPT_NO_NOTIFY ? "N/A" : (startup.notify_offline_users ? "Yes" : "No"));
...@@ -1733,46 +1733,46 @@ static void mailsrvr_cfg(void) ...@@ -1733,46 +1733,46 @@ static void mailsrvr_cfg(void)
pop3s_srvr_cfg(&startup); pop3s_srvr_cfg(&startup);
break; break;
case 9: case 9:
startup.options ^= MAIL_OPT_NO_READ_POP3;
break;
case 10:
SAFECOPY(str, maximum(startup.max_clients)); SAFECOPY(str, maximum(startup.max_clients));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Client Count (0=Unlimited)", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Client Count (0=Unlimited)", str, 10, K_EDIT) > 0)
startup.max_clients = atoi(str); startup.max_clients = atoi(str);
break; break;
case 10: case 11:
SAFECOPY(str, duration(startup.max_inactivity, false)); SAFECOPY(str, duration(startup.max_inactivity, false));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Client Inactivity", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Client Inactivity", str, 10, K_EDIT) > 0)
startup.max_inactivity = (uint16_t)parse_duration(str); startup.max_inactivity = (uint16_t)parse_duration(str);
break; break;
case 11: case 12:
SAFECOPY(str, maximum(startup.max_concurrent_connections)); SAFECOPY(str, maximum(startup.max_concurrent_connections));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Concurrent (Unauthenticated) Connections", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Concurrent (Unauthenticated) Connections", str, 10, K_EDIT) > 0)
startup.max_concurrent_connections = atoi(str); startup.max_concurrent_connections = atoi(str);
break; break;
case 12: case 13:
SAFECOPY(str, maximum(startup.max_recipients)); SAFECOPY(str, maximum(startup.max_recipients));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Recipients per Message", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Recipients per Message", str, 10, K_EDIT) > 0)
startup.max_recipients = atoi(str); startup.max_recipients = atoi(str);
break; break;
case 13: case 14:
SAFECOPY(str, maximum(startup.max_msgs_waiting)); SAFECOPY(str, maximum(startup.max_msgs_waiting));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Messages Waiting per User", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Messages Waiting per User", str, 10, K_EDIT) > 0)
startup.max_msgs_waiting = atoi(str); startup.max_msgs_waiting = atoi(str);
break; break;
case 14: case 15:
byte_count_to_str(startup.max_msg_size, str, sizeof(str)); byte_count_to_str(startup.max_msg_size, str, sizeof(str));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Received Message Size (in bytes)", str, 10, K_EDIT) > 0) if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Maximum Received Message Size (in bytes)", str, 10, K_EDIT) > 0)
startup.max_msg_size = (uint32_t)parse_byte_count(str, 1); startup.max_msg_size = (uint32_t)parse_byte_count(str, 1);
break; break;
case 15: case 16:
uifc.input(WIN_MID | WIN_SAV, 0, 0, "Override Recipient of SMTP Posts" uifc.input(WIN_MID | WIN_SAV, 0, 0, "Override Recipient of SMTP Posts"
, startup.post_to, sizeof startup.post_to -1, K_EDIT); , startup.post_to, sizeof startup.post_to -1, K_EDIT);
break; break;
case 16: case 17:
uifc.input(WIN_MID | WIN_SAV, 0, 0, "Default Recipient (user alias)" uifc.input(WIN_MID | WIN_SAV, 0, 0, "Default Recipient (user alias)"
, startup.default_user, sizeof(startup.default_user) - 1, K_EDIT); , startup.default_user, sizeof(startup.default_user) - 1, K_EDIT);
break; break;
case 17:
startup.options ^= MAIL_OPT_ALLOW_RX_BY_NUMBER;
break;
case 18: case 18:
startup.options ^= MAIL_OPT_ALLOW_SYSOP_ALIASES; startup.options ^= MAIL_OPT_ALLOW_SYSOP_ALIASES;
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment