imapserver: check for UIDNEXT overflow when adding a message to a mailbox

Return an error, with instructions so a user may be able to work around the
issue.
This commit is contained in:
Mechiel Lukkien
2025-04-11 18:22:29 +02:00
parent 507ca73b96
commit 1a6d268e1d
3 changed files with 21 additions and 6 deletions

View File

@ -473,7 +473,8 @@ func (x XOps) MessageMoveTx(ctx context.Context, log mlog.Log, acc *store.Accoun
nm := om
nm.MailboxID = mbDst.ID
nm.UID = mbDst.UIDNext
mbDst.UIDNext++
err := mbDst.UIDNextAdd(1)
x.Checkf(ctx, err, "adding uid")
nm.ModSeq = *modseq
nm.CreateSeq = *modseq
nm.SaveDate = &now
@ -490,7 +491,7 @@ func (x XOps) MessageMoveTx(ctx context.Context, log mlog.Log, acc *store.Accoun
nm.JunkFlagsForMailbox(mbDst, accConf)
err := tx.Update(&nm)
err = tx.Update(&nm)
x.Checkf(ctx, err, "updating message with new mailbox")
mbDst.Add(nm.MailboxCounts())