修复审查发现的认证配置邮件协议及前端问题

补齐安全运行时清理、配置候选恢复、泛域名证书事务提交、邮件副本与协议边界、插件隐私和安装回滚回归,并更新修复状态及待验收清单。
This commit is contained in:
xuans committed 2026-09-06 13:02:02 +08:00
1 parent addfcea1cd
commit 6f79441585
71 files changed
+2853 -664

No files matched your search

+18 -13
View File
@@ -129,13 +129,17 @@ $adminBackup = Join-Path $backupRoot "smail-admin.exe"
$serviceCreated = $false
try {
$mainInstalled = $false
$adminInstalled = $false
Stop-SmailService
Copy-Item -LiteralPath $mainSource -Destination (Join-Path $transactionRoot "smail.exe")
Copy-Item -LiteralPath $adminSource -Destination (Join-Path $transactionRoot "smail-admin.exe")
if (Test-Path -LiteralPath $mainTarget) { Move-Item -LiteralPath $mainTarget -Destination $mainBackup }
if (Test-Path -LiteralPath $adminTarget) { Move-Item -LiteralPath $adminTarget -Destination $adminBackup }
Move-Item -LiteralPath (Join-Path $transactionRoot "smail.exe") -Destination $mainTarget
$mainInstalled = $true
Move-Item -LiteralPath (Join-Path $transactionRoot "smail-admin.exe") -Destination $adminTarget
$adminInstalled = $true
$service = Get-Service -Name "Smail" -ErrorAction SilentlyContinue
if ($null -eq $service) {
$binaryPath = '"' + $mainTarget + '"'
@@ -169,10 +173,10 @@ try {
Write-Output "主服务保持停止状态,请完成配置后再手动启动。"
}
} catch {
if (Test-Path -LiteralPath $mainTarget) {
if ($mainInstalled -and (Test-Path -LiteralPath $mainTarget)) {
Remove-Item -LiteralPath $mainTarget -Force
}
if (Test-Path -LiteralPath $adminTarget) {
if ($adminInstalled -and (Test-Path -LiteralPath $adminTarget)) {
Remove-Item -LiteralPath $adminTarget -Force
}
if (Test-Path -LiteralPath $mainBackup) {
@@ -185,18 +189,19 @@ try {
$deleteArguments = @("delete", "Smail")
Invoke-Native -FilePath "sc.exe" -Arguments $deleteArguments
}
if (Test-Path -LiteralPath $transactionRoot) {
Remove-Item -LiteralPath $transactionRoot -Recurse -Force
}
if (Test-Path -LiteralPath $backupRoot) {
Remove-Item -LiteralPath $backupRoot -Recurse -Force
}
# 失败时保留事务目录和备份,回滚再次失败时也不能丢失唯一恢复材料。
throw
}
if (Test-Path -LiteralPath $transactionRoot) {
Remove-Item -LiteralPath $transactionRoot -Recurse -Force
}
if (Test-Path -LiteralPath $backupRoot) {
Remove-Item -LiteralPath $backupRoot -Recurse -Force
foreach ($temporaryRoot in @($transactionRoot, $backupRoot)) {
if (Test-Path -LiteralPath $temporaryRoot) {
$resolvedTemporaryRoot = (Resolve-Path -LiteralPath $temporaryRoot).Path
if ([IO.Path]::GetDirectoryName($resolvedTemporaryRoot) -ne $resolvedInstallRoot.TrimEnd('\')) {
throw "事务目录超出安装目录,拒绝清理:$resolvedTemporaryRoot"
}
if ((Get-Item -LiteralPath $resolvedTemporaryRoot).Attributes -band [IO.FileAttributes]::ReparsePoint) {
throw "事务目录不能是重解析点,拒绝清理:$resolvedTemporaryRoot"
}
Remove-Item -LiteralPath $resolvedTemporaryRoot -Recurse -Force
}
}