authd: substitute * if rewritten user is empty

We remove characters like ^ and ~ from the ident string after checking
if it's valid. If it consisted entirely of those, we'd try to send an
empty string to ircd, which would break the protocol, so don't let that
happen.
This commit is contained in:
Ed Kellett 2021-05-29 16:47:17 +01:00
parent 888d20da6d
commit 396edc6fbd

View file

@ -159,6 +159,12 @@ read_ident_reply(rb_fde_t *F, void *data)
message = REPORT_INVALID;
}
if (*auth->username == '\0')
{
auth->username[0] = '*';
auth->username[1] = '\0';
}
if(s == NULL)
client_fail(auth, message);
else