+2007-03-31 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/m_mode.c (m_mode): Check and report target/source
+ violations before calling set_user_mode().
+ (ms_mode): Likewise.
+
+ * ircd/s_user.c (set_user_mode): Remove those checks from here.
+
2007-03-31 Michael Poole <mdpoole@troilus.org>
* include/ircd_events.h (struct Generators): Convert elements to
return need_more_params(sptr, "MODE");
if (!IsChannelName(parv[1]) || !(chptr = FindChannel(parv[1])))
+ {
+ struct Client *acptr;
+
+ acptr = FindUser(parv[1]);
+ if (!acptr)
+ {
+ send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]);
+ return 0;
+ }
+ else if (sptr != acptr)
+ {
+ send_reply(sptr, ERR_USERSDONTMATCH);
+ return 0;
+ }
return set_user_mode(cptr, sptr, parc, parv);
+ }
ClrFlag(sptr, FLAG_TS8);
return 0;
if (!(chptr = FindChannel(parv[1])))
+ {
+ struct Client *acptr;
+
+ acptr = FindUser(parv[1]);
+ if (!acptr)
+ {
+ return 0;
+ }
+ else if (sptr != acptr)
+ {
+ sendwallto_group_butone(&me, WALL_WALLOPS, 0,
+ "MODE for User %s from %s!%s", parv[1],
+ cli_name(cptr), cli_name(sptr));
+ return 0;
+ }
return set_user_mode(cptr, sptr, parc, parv);
+ }
ClrFlag(sptr, FLAG_TS8);
{
char** p;
char* m;
- struct Client *acptr;
int what;
int i;
struct Flags setflags;
what = MODE_ADD;
- if (parc < 2)
- return need_more_params(sptr, "MODE");
-
- if (!(acptr = FindUser(parv[1])))
- {
- if (MyConnect(sptr))
- send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]);
- return 0;
- }
-
- if (IsServer(sptr) || sptr != acptr)
- {
- if (IsServer(cptr))
- sendwallto_group_butone(&me, WALL_WALLOPS, 0,
- "MODE for User %s from %s!%s", parv[1],
- cli_name(cptr), cli_name(sptr));
- else
- send_reply(sptr, ERR_USERSDONTMATCH);
- return 0;
- }
-
if (parc < 3)
{
m = buf;