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

PRIVMSG nick@server is broken #253

Open
aaronmdjones opened this issue Jul 19, 2021 · 3 comments
Open

PRIVMSG nick@server is broken #253

aaronmdjones opened this issue Jul 19, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@aaronmdjones
Copy link
Member

if((server = strchr(nick, '@')) != NULL)
{
if((target_p = find_server(source_p, server + 1)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), server + 1);
return;
}
if(!IsOper(source_p))
{
if(strchr(nick, '%') || (strncmp(nick, "opers", 5) == 0))
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), nick);
return;
}
}
/* somewhere else.. */
if(!IsMe(target_p))
{
sendto_one(target_p, ":%s %s %s :%s",
get_id(source_p, target_p), cmdname[msgtype], nick, text);
return;
}
/* Check if someones msg'ing [email protected] */
if(strncmp(nick, "opers@", 6) == 0)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "To opers: From: %s: %s",
source_p->name, text);
return;
}
/* This was not very useful except for bypassing certain
* restrictions. Note that we still allow sending to
* remote servers this way, for messaging pseudoservers
* securely whether they have a service{} block or not.
* -- jilles
*/
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), nick);
return;
}

Line 971 uses the whole value of nick (i.e. the @ is not replaced with \0), so on the destination server, it will hit line 989.

@aaronmdjones aaronmdjones added the bug Something isn't working label Jul 19, 2021
@aaronmdjones
Copy link
Member Author

This should be adjusted to confirm that the nick is on the server in question, and then strip the @. This will also avoid handle_special getting called unnecessarily on every server in the chain.

@aaronmdjones
Copy link
Member Author

Alternatively, if we only want to support this for services, which I think is what the comment at the bottom is trying to get at, we should make the code reflect that reality: check if the server is u:lined, check if the nick is on it, and unconditionally reply with ERR_NOSUCHNICK otherwise on the sending client's server. Again there's no real need to call this on every server in the chain.

@edk0
Copy link
Contributor

edk0 commented Sep 8, 2021

The comment there seems like an entirely reasonable rationale for the current behaviour; we don't support it as a destination but do relay it for the benefit of pseudoservers that do. I don't think there's any particular need to assume everything with a service block supports user@server. We could make the error message in this case indicate that user@server isn't supported for normal users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants