[FIX/WIP] Fix bug where banned users could be invited.

There seems to be another, much more annoying bug going down with
one of the servers I've tested on, but I don't know how to fix it
as of now.
This commit is contained in:
lda 2024-05-24 16:52:31 +02:00
parent 879e51c169
commit c1630247b1

View file

@ -310,10 +310,9 @@ RoomPopulate(Room *room, User *user, RoomCreateRequest *req, ServerPart s)
JsonFree(RoomEventSend(room, event));
JsonFree(event);
/* TODO: The rest of the events mandated by the specification on
* POST /createRoom, and error management. */
Free(sender_str);
/* TODO: Error management (and invite_3pid, later) */
}
Room *
RoomCreate(Db * db, User *user, RoomCreateRequest * req, ServerPart s)
@ -676,7 +675,8 @@ PopulateEventV1(Room * room, HashMap * event, PduV1 * pdu, ServerPart serv)
ArrayAdd(pdu->prev_events, JsonValueDuplicate(event_id));
}
/* TODO: Signature and alldat. */
/* TODO: Signatures.
* We currently *don't* have an Ed25519 implementation. */
return false;
}
@ -998,7 +998,7 @@ AuthorizeInviteMembershipV1(Room * room, PduV1 pdu, HashMap *state)
}
/* Step 5.3.3: If target users current membership state is join or ban, reject. */
if (RoomUserHasMembership(room, state, pdu.state_key, "join") ||
RoomUserHasMembership(room, state, pdu.state_key, "join"))
RoomUserHasMembership(room, state, pdu.state_key, "ban"))
{
return false;
}