Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter [ out of Rejecting K-Lined user snote #433

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ircd/s_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,23 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
return (i);
}

/*
* Remove all occurences of needle from haystack in-place.
*
* inputs - string to filter
* - character to remove
* side effect - all occurences of needle removed from haystack
*/
static void
filter_string(char *haystack, char needle)
{
int o = 0;
for (int i = 0; haystack[i] != '\0'; i++)
if (haystack[i] != needle)
haystack[o++] = haystack[i];
haystack[o] = '\0';
}

/*
* verify_access
*
Expand Down Expand Up @@ -367,6 +384,9 @@ verify_access(struct Client *client_p, const char *username)
me.name, client_p->name,
get_user_ban_reason(aconf));

// this snote is sent before username has been cleaned
filter_string(client_p->username, '[');

sendto_realops_snomask(SNO_BANNED, L_NETWIDE,
"Rejecting K-Lined user %s [%s] (%s@%s)", get_client_name(client_p, HIDE_IP),
show_ip(NULL, client_p) ? client_p->sockhost : "255.255.255.255", aconf->user, aconf->host);
Expand Down
Loading