proto: specify that Configure messages must be sent before connection

There's a very limited use for configure messages after client
connection. The name is already static after connect anyway, and
the ability to drop capabilities after connect would just complicate the
EIS implementations unnecessary.
This commit is contained in:
Peter Hutterer 2022-07-27 10:23:31 +10:00
parent 61213f3a26
commit 2ec3ced24c
2 changed files with 9 additions and 9 deletions

View file

@ -37,15 +37,15 @@ syntax = "proto3";
* ----------------------------
*
* Where a proxy is in place (e.g. a portal), the client connection can be
* preconfigured to match the permissions model. The proxy would open a
* socket to the server, write the Configure* messages onto that socket and
* then pass the fd to the client to create a libei context from that.
* pre-configured to match the permissions model. The proxy opens or obtains a
* socket to the server, writes the Configure* messages onto that socket and
* then passes the fd to the client to create a libei context from that.
*
* The proxy can force a client name and/or restrict other options. This is
* invisible to the client, it does not know what restrictions are in place.
*
* Configure messages may come at any time but they can only ever *reduce*
* the current capabilities, not increase them.
* Configure messages may only be sent before the client connection. Sending
* Configure messages after a client has connected will be silently ignored.
*/
/* ConfigureName *must* be sent before the Connect event */

View file

@ -469,11 +469,11 @@ client_msg_configure_name(struct eis_client *client, const char *name)
static int
client_msg_configure_capabilities(struct eis_client *client, uint32_t allowed_caps)
{
client->restrictions.cap_allow_mask = allowed_caps;
/* We silently ignore wrong configure messages */
if (client->state != EIS_CLIENT_STATE_NEW)
return 0;
/* FIXME: if something is disallowed now, we should disconnect
* accordingly.
*/
client->restrictions.cap_allow_mask = allowed_caps;
return 0;
}