mirror of
https://github.com/pissnet/pissircd.git
synced 2024-06-05 07:48:44 +01:00
Make $client.details follow the ident rules in the handshake too.
Post-handshake this was working fine, but before register_user() it was always using nick!user@host, never using the ident and never ~ prefixing. Now it just uses the usual rules that we have, which are: prefixing with a ~ if ident lookups are enabled and failed, and without a ~ prefix if ident lookup succeeded or set::options::identd-check is off. Reported by k4be.
This commit is contained in:
parent
75a55de785
commit
7468018a7d
1 changed files with 29 additions and 1 deletions
30
src/json.c
30
src/json.c
|
@ -240,7 +240,35 @@ void json_expand_client(json_t *j, const char *key, Client *client, int detail)
|
|||
*/
|
||||
if (client->user)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, client->user->username, client->user->realhost);
|
||||
if (IsUser(client) || !MyConnect(client))
|
||||
{
|
||||
/* Post-handshake, after register_user(), it is easy: */
|
||||
snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, client->user->username, client->user->realhost);
|
||||
} else
|
||||
{
|
||||
/* In the handshake, more possibilities (ident could still be ongoing)
|
||||
* and more speculative (a later class block may want to ignore ident,
|
||||
* but we don't know that, so we assume that is not the case).
|
||||
*/
|
||||
const char *ident;
|
||||
char temp[USERLEN+1];
|
||||
if (IDENT_CHECK)
|
||||
{
|
||||
if (IsIdentSuccess(client))
|
||||
{
|
||||
/* ident succeeded means: use the identd and no ~ prefix */
|
||||
ident = client->ident;
|
||||
} else {
|
||||
/* ident check failed means ~ prefix */
|
||||
snprintf(temp, sizeof(temp), "~%s", client->user->username);
|
||||
ident = temp;
|
||||
}
|
||||
} else {
|
||||
/* no ident check means no ~ prefix */
|
||||
ident = client->user->username;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, ident, client->user->realhost);
|
||||
}
|
||||
json_object_set_new(child, "details", json_string_unreal(buf));
|
||||
} else if (client->ip) {
|
||||
if (*client->name)
|
||||
|
|
Loading…
Reference in a new issue