Return bad-request for disco attempts on MUC occupants

This commit is contained in:
Bohdan Horbeshko 2025-06-27 15:43:29 -04:00
parent 541acdf372
commit 06645eaa8c

View file

@ -916,6 +916,14 @@ func handleGetDiscoInfo(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoInfo) {
answer.Payload = disco
toID, toOk, toIsGroup := toToID(iq.To)
if toIsGroup {
toJid, err := stanza.NewJid(iq.To)
if err == nil && toJid.Resource != "" {
iqAnswerSetError(answer, 400)
return
}
}
if di.Node == "" {
var isMuc bool
bare, _, fromOk := gateway.SplitJID(iq.From)
@ -1033,7 +1041,15 @@ func handleGetDiscoItems(s xmpp.Sender, iq *stanza.IQ, di *stanza.DiscoItems) {
log.Debugf("discoItems: %#v", di)
toID, toOk, _ := toToID(iq.To)
toID, toOk, toIsGroup := toToID(iq.To)
if toIsGroup {
toJid, err := stanza.NewJid(iq.To)
if err == nil && toJid.Resource != "" {
iqAnswerSetError(answer, 400)
return
}
}
disco := answer.DiscoItems()