diff options
| author | Alexander Barton <alex@barton.de> | 2015-04-12 20:59:43 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2015-04-12 20:59:43 +0200 |
| commit | c5da48368569383d064a2325ab3b99d10287a085 (patch) | |
| tree | 53253cfb1eeeabd114c7d7bf97c90a5c288cd812 /src | |
| parent | 4330f5d1c9119c4461c8fb7c8cf1f78a3ea53e4d (diff) | |
| download | ngircd-c5da48368569383d064a2325ab3b99d10287a085.tar.gz ngircd-c5da48368569383d064a2325ab3b99d10287a085.zip | |
Make sure that the target user is able to join a local channel
Implement ERR_USERNOTONSERV(504) numeric and make sure that the
target user is on the same server when inviting other users to
local ("&") channels.
ircd-ratbox uses the ERR_USERNOTONSERV(504) numeric for this, and I
think this is a good idea -- other IRC daemons (like ircu) silently
drop such impossible invites, but thats not a big benefit ...
Idea by Cahata, thanks! Closes #183.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/irc-op.c | 8 | ||||
| -rw-r--r-- | src/ngircd/messages.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ngircd/irc-op.c b/src/ngircd/irc-op.c index b75841a8..2e5c680a 100644 --- a/src/ngircd/irc-op.c +++ b/src/ngircd/irc-op.c @@ -150,6 +150,14 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req) return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->argv[0]); + if (Req->argv[1][0] == '&') { + /* Local channel. Make sure the target user is on this server! */ + if (Client_Conn(target) == NONE) + return IRC_WriteErrClient(from, ERR_USERNOTONSERV_MSG, + Client_ID(Client), + Req->argv[0]); + } + chan = Channel_Search(Req->argv[1]); if (chan) { /* Channel exists. Is the user a valid member of the channel? */ diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h index 75c67b0b..a5bc2c7a 100644 --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -156,6 +156,7 @@ #define ERR_UMODEUNKNOWNFLAG_MSG "501 %s :Unknown mode" #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\"" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" +#define ERR_USERNOTONSERV_MSG "504 %s %s :User is not on this server" #define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)" #ifdef ZLIB |