Skip to content

Commit a5907af

Browse files
Fix the minor defects found by adversarial review of the 6.2.13 diff
An adversarial multi-agent review of the release diff returned no blocking or major findings; these are the two minor items in the new code plus two format conformance nits. No functional change to the server core. - DBUpdater recorded UpgradeSucceeded only after ReleaseComObject and Reinitialize, so a COM/RPC failure during that cleanup reported a schema upgrade that had already committed as a failure (and the installer then showed the new "could not be created or upgraded" error). Success is now recorded immediately after CommitTransaction succeeds. - DBSetup returned void, so the installer's new exit-code check was inert on the external-database branch and a cancelled or incomplete interactive setup still reported install success. Main now returns 0 only when the wizard reached its final page (a page advances only when its task succeeded), 3 when authentication is cancelled, else 1. - SpamAssassinClient formatted the widened __int64 Content-length and the size-mismatch log value with %d; both now use %I64d. The emitted values were correct on x64, so this is conformance only. Deferred to 6.2.14 (raised by the same review, not a regression): the PTR prefetch task shares the bounded asynchronous work queue with message finalization, so many simultaneous connections from addresses with unresponsive reverse DNS can delay delivery responses. It is strictly better than 6.2.12, which blocked the shared IO pool. The fix is a dedicated queue or a bounded DnsQueryEx timeout. Verified: server and tools build clean (server /WX, tools -warnaserror); full regression suite 1026 of 1026 passing against the rebuilt 6.2.13 service.
1 parent ca2b3cf commit a5907af

4 files changed

Lines changed: 32 additions & 8 deletions

File tree

hmailserver/source/Server/Common/AntiSpam/SpamAssassin/SpamAssassinClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace HM
5959
EnqueueWrite("PROCESS SPAMC/1.2\r\n");
6060
//LOG_DEBUG("SENT: PROCESS SPAMC/1.2");
6161
String sConLen;
62-
sConLen.Format(_T("Content-length: %d\r\n"), message_size_);
62+
sConLen.Format(_T("Content-length: %I64d\r\n"), message_size_);
6363
EnqueueWrite(sConLen);
6464
EnqueueWrite("\r\n");
6565
SendFileContents_(message_file_);
@@ -240,7 +240,7 @@ namespace HM
240240
else
241241
{
242242
String logMessage;
243-
logMessage.Format(_T("SA: Temp file size did not match what Spamd reported! (temp: %d, spamd: %d). Reverting to original message file."),FileUtilities::FileSize(sTempFile),spam_dsize_);
243+
logMessage.Format(_T("SA: Temp file size did not match what Spamd reported! (temp: %d, spamd: %I64d). Reverting to original message file."),FileUtilities::FileSize(sTempFile),spam_dsize_);
244244
LOG_DEBUG(logMessage);
245245
}
246246

hmailserver/source/Tools/DBSetup/Program.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,33 @@ namespace DBSetup
1111
{
1212
static class Program
1313
{
14+
// Exit codes consumed by the installer: a cancelled or incomplete database
15+
// setup must not look like a successful install.
16+
private const int ExitSuccess = 0;
17+
private const int ExitSetupIncomplete = 1;
18+
private const int ExitAuthenticationCancelled = 3;
19+
1420
/// <summary>
1521
/// The main entry point for the application.
1622
/// </summary>
1723
[STAThread]
18-
static void Main()
24+
static int Main()
1925
{
2026
ToolApplication.Initialize();
2127

2228
CommandLineParser.Parse();
23-
29+
2430
hMailServer.Application application = new hMailServer.Application();
2531
if (!Authenticator.AuthenticateUser(application))
26-
return;
32+
return ExitAuthenticationCancelled;
2733

2834
Globals.SetApp(application);
2935

30-
Application.Run(new formMain());
36+
formMain main = new formMain();
37+
Application.Run(main);
38+
39+
// Closing the wizard before it finished leaves the database unconfigured.
40+
return main.SetupCompleted ? ExitSuccess : ExitSetupIncomplete;
3141
}
3242
}
3343
}

hmailserver/source/Tools/DBSetup/formMain.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ namespace DBSetup
1414
{
1515
public partial class formMain : Form
1616
{
17+
/// <summary>
18+
/// True once the wizard reached its final page. A page only advances when
19+
/// IWizardPage.OnLeavePage succeeds, so reaching the last page means the
20+
/// create/update task actually completed. Program.Main turns this into the
21+
/// process exit code the installer checks.
22+
/// </summary>
23+
public bool SetupCompleted { get; private set; }
24+
1725
public formMain()
1826
{
1927
InitializeComponent();
@@ -42,6 +50,9 @@ private void formMain_Shown(object sender, EventArgs e)
4250
private void wizard_PageChanged(int currentPage, int lastPage)
4351
{
4452
this.Text = "hMailServer Database Setup - Step " + currentPage + " of " + lastPage;
53+
54+
if (currentPage == lastPage)
55+
SetupCompleted = true;
4556
}
4657
}
4758
}

hmailserver/source/Tools/DBUpdater/formMain.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,18 @@ public void DoUpgrade()
405405
return;
406406
}
407407

408+
// The schema is committed from here on, so record success before the
409+
// cleanup below: a COM/RPC failure while reinitializing must not report
410+
// an upgrade that did happen as a failure.
411+
UpgradeSucceeded = true;
412+
408413
Marshal.ReleaseComObject(database);
409414

410415
// Database has been upgraded. Reinitialize the connections.
411416
_application.Reinitialize();
412417

413418
RemoveErrorLog();
414419

415-
UpgradeSucceeded = true;
416-
417420
buttonClose.Enabled = true;
418421
}
419422

0 commit comments

Comments
 (0)