Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-04-01 02:15:09 UTC
Modified files:
Tag: u2_10_12_branch
ircd/s_user.c ircd/m_mode.c ChangeLog
Log message:
Move some permission checks from set_user_mode() to its callers.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.173 ircu2.10/ChangeLog:1.710.2.174
--- ircu2.10/ChangeLog:1.710.2.173 Sat Mar 31 19:11:41 2007
+++ ircu2.10/ChangeLog Sat Mar 31 19:14:59 2007
@@ -1,5 +1,13 @@
2007-03-31 Michael Poole <[EMAIL PROTECTED]>
+ * 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 <[EMAIL PROTECTED]>
+
* include/ircd_events.h (struct Generators): Convert elements to
be struct GenHeader*.
(timer_next): Update to match.
Index: ircu2.10/ircd/m_mode.c
diff -u ircu2.10/ircd/m_mode.c:1.15.2.4 ircu2.10/ircd/m_mode.c:1.15.2.5
--- ircu2.10/ircd/m_mode.c:1.15.2.4 Sun Jan 14 19:08:23 2007
+++ ircu2.10/ircd/m_mode.c Sat Mar 31 19:14:59 2007
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_mode.c,v 1.15.2.4 2007/01/15 03:08:23 entrope Exp $
+ * $Id: m_mode.c,v 1.15.2.5 2007/04/01 02:14:59 entrope Exp $
*/
/*
@@ -113,7 +113,22 @@
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);
@@ -168,7 +183,23 @@
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);
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.99.2.3 ircu2.10/ircd/s_user.c:1.99.2.4
--- ircu2.10/ircd/s_user.c:1.99.2.3 Sat Jan 13 10:43:41 2007
+++ ircu2.10/ircd/s_user.c Sat Mar 31 19:14:59 2007
@@ -22,7 +22,7 @@
*/
/** @file
* @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.99.2.3 2007/01/13 18:43:41 entrope Exp $
+ * @version $Id: s_user.c,v 1.99.2.4 2007/04/01 02:14:59 entrope Exp $
*/
#include "config.h"
@@ -984,7 +984,6 @@
{
char** p;
char* m;
- struct Client *acptr;
int what;
int i;
struct Flags setflags;
@@ -996,27 +995,6 @@
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;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches