فهرست منبع

* Fixed being able to 'chsecpass' a bot.
* Fixed cmd_chsecpass to use whois_access() (#120)


svn: 2343

Bryan Drewery 21 سال پیش
والد
کامیت
916cac1a19
2فایلهای تغییر یافته به همراه13 افزوده شده و 14 حذف شده
  1. 2 0
      doc/UPDATES
  2. 11 14
      src/cmds.c

+ 2 - 0
doc/UPDATES

@@ -18,6 +18,8 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * (eggdrop1.6) Fixed bot not requesting topic after reseting channel.
 * Fixed hubs not updating NODENAME/OS/USERNAME, which broke updating on new nets.
 * Added var 'auth-chan' which allows disabling auth cmds in all channels.
+* Fixed being able to 'chsecpass' a bot.
+* Fixed cmd_chsecpass to use whois_access() (#120)
 
 1.2.6
 * (REVERTED FROM 1.2.3) Disabled all memory allocations after a segfault (Fixes CPU spinning)

+ 11 - 14
src/cmds.c

@@ -1165,18 +1165,15 @@ static void cmd_chpass(int idx, char *par)
     return;
   }
   char *handle = NULL;
-  int atr = dcc[idx].user ? dcc[idx].user->flags : 0;
   struct userrec *u = NULL;
 
   handle = newsplit(&par);
   if (!(u = get_user_by_handle(userlist, handle))) 
     dprintf(idx, "No such user.\n");
-  else if (u->bot)
-    dprintf(idx, "Bots do not have passwords.\n");
-  else if (u->bot && !(atr & USER_OWNER))
-    dprintf(idx, "You can't change a bot's password.\n");
   else if (!whois_access(dcc[idx].user, u))
     dprintf(idx, "No such user.\n");
+  else if (u->bot)
+    dprintf(idx, "Bots do not have passwords.\n");
   else if (!par[0]) {
     putlog(LOG_CMDS, "*", "#%s# chpass %s [nothing]", dcc[idx].nick, handle);
     set_user(&USERENTRY_PASS, u, NULL);
@@ -1217,20 +1214,20 @@ static void cmd_chsecpass(int idx, char *par)
     return;
   }
   char *handle = NULL;
-  int atr = dcc[idx].user ? dcc[idx].user->flags : 0;
   struct userrec *u = NULL;
 
   handle = newsplit(&par);
   if (!(u = get_user_by_handle(userlist, handle))) 
     dprintf(idx, "No such user.\n");
-  else if (!(atr & USER_MASTER) && !u->bot)
-    dprintf(idx, "You can't change passwords for non-bots.\n");
-  else if (u->bot && !(atr & USER_OWNER))
-    dprintf(idx, "You can't change a bot's password.\n");
-  else if ((u->flags & USER_OWNER) && !(atr & USER_OWNER) && egg_strcasecmp(handle, dcc[idx].nick))
-    dprintf(idx, "You can't change a bot owner's secpass.\n");
-  else if (isowner(handle) && egg_strcasecmp(dcc[idx].nick, handle))
-    dprintf(idx, "You can't change a permanent bot owner's secpass.\n");
+  else if (!whois_access(dcc[idx].user, u))
+    dprintf(idx, "No such user.\n");
+  else if (u->bot)
+    dprintf(idx, "Bots do not have secpasses.\n");
+//  int atr = dcc[idx].user ? dcc[idx].user->flags : 0;
+//  else if ((u->flags & USER_OWNER) && !(atr & USER_OWNER) && egg_strcasecmp(handle, dcc[idx].nick))
+//    dprintf(idx, "You can't change a bot owner's secpass.\n");
+//  else if (isowner(handle) && egg_strcasecmp(dcc[idx].nick, handle))
+//    dprintf(idx, "You can't change a permanent bot owner's secpass.\n");
   else if (!par[0]) {
     putlog(LOG_CMDS, "*", "#%s# chsecpass %s [nothing]", dcc[idx].nick, handle);
     set_user(&USERENTRY_SECPASS, u, NULL);