Преглед на файлове

* Fixed NICKLEN/NICKMAX business

svn: 344
Bryan Drewery преди 22 години
родител
ревизия
18d2386b71
променени са 4 файла, в които са добавени 6 реда и са изтрити 26 реда
  1. 1 1
      src/mod/channels.mod/channels.c
  2. 4 4
      src/mod/irc.mod/mode.c
  3. 1 2
      src/mod/irc.mod/msgcmds.c
  4. 0 19
      src/mod/server.mod/servmsg.c

+ 1 - 1
src/mod/channels.mod/channels.c

@@ -237,7 +237,7 @@ void got_kl(char *botnick, char *code, char *par)
     struct chanset_t *ch;
     struct chanset_t *ch;
     for (ch = chanset; ch; ch = ch->next)
     for (ch = chanset; ch; ch = ch->next)
       do_chanset(ch, STR("+closed +backup +bitch"), 1);
       do_chanset(ch, STR("+closed +backup +bitch"), 1);
-  /* botnet_send_zapf_broad(-1, botnetnick, NULL, "rn"); */
+  /* FIXME: we should randomize nick here ... */
   }
   }
 #endif /* S_AUTOLOCK */
 #endif /* S_AUTOLOCK */
 }
 }

+ 4 - 4
src/mod/irc.mod/mode.c

@@ -1356,7 +1356,7 @@ static int gotmode(char *from, char *msg)
           }
           }
         }
         }
         if (isbadop) {
         if (isbadop) {
-          char trg[NICKLEN + 1] = "";
+          char trg[NICKLEN] = "";
 
 
           n = i = 0;
           n = i = 0;
           switch (role) {
           switch (role) {
@@ -1384,7 +1384,7 @@ static int gotmode(char *from, char *msg)
                 i++;
                 i++;
             }
             }
             if (!n) {
             if (!n) {
-              strcpy(trg, (char *) &modes[i][3]);
+              strncpyz(trg, (char *) &modes[i][3], NICKLEN);
               m = ismember(chan, trg);
               m = ismember(chan, trg);
               if (m) {
               if (m) {
                 if (!(m->flags & CHANOP)) {
                 if (!(m->flags & CHANOP)) {
@@ -1410,7 +1410,7 @@ static int gotmode(char *from, char *msg)
       }
       }
       if ((ops) && chan && !channel_manop(chan) && (ufrom) &&
       if ((ops) && chan && !channel_manop(chan) && (ufrom) &&
           !(ufrom->flags & USER_BOT)) {
           !(ufrom->flags & USER_BOT)) {
-        char trg[NICKLEN + 1] = "";
+        char trg[NICKLEN] = "";
         n = i = 0;
         n = i = 0;
 
 
         switch (role) {
         switch (role) {
@@ -1438,7 +1438,7 @@ static int gotmode(char *from, char *msg)
               i++;
               i++;
           }
           }
           if (!n) {
           if (!n) {
-            strcpy(trg, (char *) &modes[i][3]);
+            strncpyz(trg, (char *) &modes[i][3], NICKLEN);
             m = ismember(chan, trg);
             m = ismember(chan, trg);
             if (m) {
             if (m) {
               if (!(m->flags & CHANOP) && (rfc_casecmp(botname, trg))) {
               if (!(m->flags & CHANOP) && (rfc_casecmp(botname, trg))) {

+ 1 - 2
src/mod/irc.mod/msgcmds.c

@@ -67,8 +67,7 @@ static int msg_ident(char *nick, char *host, struct userrec *u, char *par)
   if (!par[0])
   if (!par[0])
     strcpy(who, nick);
     strcpy(who, nick);
   else {
   else {
-    strncpy(who, par, NICKMAX);
-    who[NICKMAX] = 0;
+    strncpyz(who, par, NICKLEN);
   }
   }
   u2 = get_user_by_handle(userlist, who);
   u2 = get_user_by_handle(userlist, who);
   if (!u2) {
   if (!u2) {

+ 0 - 19
src/mod/server.mod/servmsg.c

@@ -1073,25 +1073,6 @@ int ismdop(char *mode)
   }
   }
   return (cnt >= 3);
   return (cnt >= 3);
 }
 }
-/*
-void got_rsn(char *botnick, char *code, char *par) {
-  if (strcmp(origbotname, botname)) {
-    randuse = 0;
-    dprintf(DP_MODE, STR("NICK %s\n"), origbotname);
-  }
-}
-
-void got_rn(char *botnick, char *code, char *par) {
-  int l = (random() % 4) + 6, i;
-  char newnick[NICKLEN+1];
-  for (i=0;i<l;i++)
-    newnick[i]=(random() % 2) * 32 + 65 + random() % 26;
-  newnick[l]=0;
-  randuse = 1;
-  //havealt = 1;
-  dprintf(DP_MODE, STR("NICK %s\n"), newnick);
-}
-*/
 
 
 static void server_activity(int idx, char *msg, int len)
 static void server_activity(int idx, char *msg, int len)
 {
 {