+2007-03-31 Michael Poole <mdpoole@troilus.org>
+
+ * doc/readme.iauth (IAuth M): Document new command.
+
+ * ircd/m_user.c (m_user): Recognize RFC 2812 mode request and a
+ saner usermode request.
+
+ * ircd/s_auth.c (iauth_cmd_usermode): New command.
+ (iauth_parse): Dispatch to it.
+
+ * ircd/s_user.c (set_user_mode): Only broadcast usermode changes
+ for registered clients.
+
+ * tools/iauth-test (127.0.1.3): Test the new M command.
+
2007-03-31 Michael Poole <mdpoole@troilus.org>
* ircd/m_mode.c (m_mode): Check and report target/source
Compatibility: This is an Undernet extension and ircd does not support
this message.
+M - Adjust User Mode
+Syntax: M <id> <remoteip> <remoteport> +<mode changes>
+Example: M 5 192.168.1.10 23367 +iwg
+States: REGISTER, HURRY
+Next State: -
+Comments: Indicates a set of user mode changes to be applied to the
+ client.
+Compatibility: This is an Undernet extension and ircd does not support
+ this message.
+
C - Challenge User
Syntax: C <id> <remoteip> <remoteport> :<challenge string>
Example: C 5 192.168.1.10 23367 :In which year did Columbus sail the ocean blue?
int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
char* username;
+ char* term;
const char* info;
+ unsigned int mode_request;
assert(0 != cptr);
assert(cptr == sptr);
else
username = "NoUser";
+ if ((mode_request = strtoul(parv[2], &term, 10)) != 0
+ && term != NULL && *term != '\0')
+ {
+ /* These bitmask values are codified in RFC 2812, showing
+ * ... well, something that is probably best not said.
+ */
+ if (mode_request & 8)
+ SetInvisible(cptr);
+ if (mode_request & 4)
+ SetWallops(cptr);
+ }
+ else if (parv[2][0] == '+')
+ {
+ char *user_modes[4];
+ user_modes[0] = NULL;
+ user_modes[1] = NULL;
+ user_modes[2] = parv[2];
+ user_modes[3] = NULL;
+ set_user_mode(cptr, sptr, 3, user_modes);
+ }
+
info = (EmptyString(parv[4])) ? "No Info" : parv[4];
return auth_set_user(cli_auth(cptr), username, parv[2], parv[3], info);
return 0;
}
+/** Change a client's usermode.
+ * @param[in] iauth Active IAuth session.
+ * @param[in] cli Client referenced by command.
+ * @param[in] parc Number of parameters (at least one).
+ * @param[in] params Usermode arguments for client (with the first
+ * starting with '+').
+ * @return Zero.
+ */
+static int iauth_cmd_usermode(struct IAuth *iauth, struct Client *cli,
+ int parc, char **params)
+{
+ if (params[0][0] == '+')
+ {
+ set_user_mode(cli, cli, parc + 2, params - 2);
+ }
+ return 0;
+}
+
+
/** Send a challenge string to the client.
* @param[in] iauth Active IAuth session.
* @param[in] cli Client referenced by command.
case 'u': handler = iauth_cmd_username_bad; has_cli = 1; break;
case 'N': handler = iauth_cmd_hostname; has_cli = 1; break;
case 'I': handler = iauth_cmd_ip_address; has_cli = 1; break;
+ case 'M': handler = iauth_cmd_usermode; has_cli = 1; break;
case 'C': handler = iauth_cmd_challenge; has_cli = 1; break;
case 'D': handler = iauth_cmd_done_client; has_cli = 1; break;
case 'R': handler = iauth_cmd_done_account; has_cli = 1; break;
++UserStats.inv_clients;
if (!FlagHas(&setflags, FLAG_HIDDENHOST) && do_host_hiding)
hide_hostmask(sptr, FLAG_HIDDENHOST);
- send_umode_out(cptr, sptr, &setflags, prop);
+ if (IsRegistered(sptr))
+ send_umode_out(cptr, sptr, &setflags, prop);
return 0;
}
'127.0.0.33' => { T_reply => 'R account-3' },
'127.0.0.34' => { T_reply => 'k' },
'127.0.0.35' => { T_reply => 'K' },
- # 127.0.1.x: io/iU/iu functionality.
+ # 127.0.1.x: io/iU/iu/iM functionality.
'127.0.1.0' => { C_reply => 'o forced',
H_reply => 'D' },
'127.0.1.1' => { C_reply => 'U trusted',
H_reply => 'D' },
'127.0.1.2' => { C_reply => 'u untrusted',
H_reply => 'D' },
+ '127.0.1.3' => { C_reply => 'M +i',
+ H_reply => 'D' },
# 127.0.2.x: iI/iN functionality.
'127.0.2.0' => { C_reply => 'N iauth.assigned.host',
H_reply => 'D' },