about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-mode.c7
-rw-r--r--src/ngircd/login.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index fe981213..79ab2ebe 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -68,6 +68,13 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
 
 	_IRC_GET_SENDER_OR_RETURN_(origin, Req, Client)
 
+	/* Test for "fake" MODE commands injected by this local instance,
+	 * for example when handling the "DefaultUserModes" settings.
+	 * This doesn't harm real commands, because prefixes of regular
+	 * clients are checked in Validate_Prefix() and can't be faked. */
+	if (Req->prefix && Client_Search(Req->prefix) == Client_ThisServer())
+		Client = Client_Search(Req->prefix);
+
 	/* Channel or user mode? */
 	cl = NULL; chan = NULL;
 	if (Client_IsValidNick(Req->argv[0]))
diff --git a/src/ngircd/login.c b/src/ngircd/login.c
index 7f427a3a..64cc8125 100644
--- a/src/ngircd/login.c
+++ b/src/ngircd/login.c
@@ -192,7 +192,7 @@ Login_User_PostAuth(CLIENT *Client)
 	/* Set default user modes */
 	if (Conf_DefaultUserModes[0]) {
 		snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes);
-		Req.prefix = Client_ThisServer();
+		Req.prefix = Client_ID(Client_ThisServer());
 		Req.command = "MODE";
 		Req.argc = 2;
 		Req.argv[0] = Client_ID(Client);