In imapserver with RENAME of Inbox, we didn't check for the metadata quota.

Rename of Inbox is special, it copies the mailbox including metadata.
This commit is contained in:
Mechiel Lukkien 2025-03-02 16:46:06 +01:00
parent f5b67b5d3d
commit bc50c3bf7f
No known key found for this signature in database
2 changed files with 25 additions and 19 deletions

View File

@ -283,6 +283,23 @@ func (c *conn) cmdSetmetadata(tag, cmd string, p *parser) {
xcheckf(err, "updating metadata annotation")
}
c.xcheckMetadataSize(tx)
// ../rfc/7162:1335
if mb.ID != 0 && modseq != 0 {
mb.ModSeq = modseq
err := tx.Update(&mb)
xcheckf(err, "updating mailbox with modseq")
}
})
c.broadcast(changes)
})
c.ok(tag, cmd)
}
func (c *conn) xcheckMetadataSize(tx *bstore.Tx) {
// Check for total size. We allow a total of 1000 entries, with total capacity of 1MB.
// ../rfc/5464:383
var n int
@ -302,17 +319,4 @@ func (c *conn) cmdSetmetadata(tag, cmd string, p *parser) {
return nil
})
xcheckf(err, "checking metadata annotation size")
// ../rfc/7162:1335
if mb.ID != 0 && modseq != 0 {
mb.ModSeq = modseq
err := tx.Update(&mb)
xcheckf(err, "updating mailbox with modseq")
}
})
c.broadcast(changes)
})
c.ok(tag, cmd)
}

View File

@ -3037,6 +3037,8 @@ func (c *conn) cmdRename(tag, cmd string, p *parser) {
xcheckf(err, "copy annotation to destination mailbox")
}
c.xcheckMetadataSize(tx)
changes[0] = store.ChangeRemoveUIDs{MailboxID: srcMB.ID, UIDs: oldUIDs, ModSeq: modseq}
changes[1] = store.ChangeAddMailbox{Mailbox: dstMB, Flags: dstFlags, ModSeq: modseq}
// changes[2:...] are ChangeAddUIDs