mirror of
https://github.com/matrix-construct/construct
synced 2024-12-01 19:22:53 +01:00
UID/EUID: Check that the UID starts with the server's SID.
If not, the local link that sent the command is broken, as with syntactically invalid UIDs.
This commit is contained in:
parent
9cbf72447c
commit
561d7efc44
1 changed files with 7 additions and 4 deletions
|
@ -94,7 +94,7 @@ static int change_remote_nick(struct Client *, struct Client *, time_t,
|
|||
static int clean_nick(const char *, int loc_client);
|
||||
static int clean_username(const char *);
|
||||
static int clean_host(const char *);
|
||||
static int clean_uid(const char *uid);
|
||||
static int clean_uid(const char *uid, const char *sid);
|
||||
|
||||
static void set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick);
|
||||
static void change_local_nick(struct Client *client_p, struct Client *source_p, char *nick, int);
|
||||
|
@ -362,7 +362,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!clean_uid(parv[8]))
|
||||
if(!clean_uid(parv[8], source_p->id))
|
||||
{
|
||||
rb_snprintf(squitreason, sizeof squitreason,
|
||||
"Invalid UID %s for nick %s on %s",
|
||||
|
@ -453,7 +453,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!clean_uid(parv[8]))
|
||||
if(!clean_uid(parv[8], source_p->id))
|
||||
{
|
||||
rb_snprintf(squitreason, sizeof squitreason,
|
||||
"Invalid UID %s for nick %s on %s",
|
||||
|
@ -623,10 +623,13 @@ clean_host(const char *host)
|
|||
}
|
||||
|
||||
static int
|
||||
clean_uid(const char *uid)
|
||||
clean_uid(const char *uid, const char *sid)
|
||||
{
|
||||
int len = 1;
|
||||
|
||||
if(strncmp(uid, sid, strlen(sid)))
|
||||
return 0;
|
||||
|
||||
if(!IsDigit(*uid++))
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue