mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
Merge branch 'release/v1.3.X' into devel
This commit is contained in:
@ -29,6 +29,7 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||
"github.com/emersion/go-imap"
|
||||
goIMAPBackend "github.com/emersion/go-imap/backend"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type panicHandler interface {
|
||||
@ -219,3 +220,11 @@ func (ib *imapBackend) monitorDisconnectedUsers() {
|
||||
ib.deleteUser(address)
|
||||
}
|
||||
}
|
||||
|
||||
func (ib *imapBackend) upgradeError(err error) {
|
||||
logrus.WithError(err).Error("IMAP connection couldn't be upgraded to TLS during STARTTLS")
|
||||
|
||||
if strings.Contains(err.Error(), "remote error: tls: bad certificate") {
|
||||
ib.eventListener.Emit(events.IMAPTLSBadCert, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ func NewIMAPServer(debugClient, debugServer bool, port int, tls *tls.Config, ima
|
||||
s.AllowInsecureAuth = true
|
||||
s.ErrorLog = newServerErrorLogger("server-imap")
|
||||
s.AutoLogout = 30 * time.Minute
|
||||
s.UpgradeError = imapBackend.upgradeError
|
||||
|
||||
serverID := imapid.ID{
|
||||
imapid.FieldName: "ProtonMail",
|
||||
|
||||
Reference in New Issue
Block a user