Просмотр исходного кода

* 'strict-host' is now '1'; ident is now parsed CORRECTLY, *!ident@host will no longer match *!~ident@host.
* Bots will auto add hostname with ~ when needed


svn: 1408

Bryan Drewery 21 лет назад
Родитель
Сommit
96581b8660
7 измененных файлов с 12 добавлено и 56 удалено
  1. 1 0
      doc/UPDATES
  2. 4 7
      src/misc.c
  3. 1 1
      src/mod/irc.mod/chan.c
  4. 2 8
      src/mod/irc.mod/cmdsirc.c
  5. 1 5
      src/mod/irc.mod/irc.c
  6. 2 33
      src/userrec.c
  7. 1 2
      src/userrec.h

+ 1 - 0
doc/UPDATES

@@ -53,6 +53,7 @@ This is a summary of ChangeLog basically.
 * Bots will auto-restart if 150 or more bogus fd are detected.
 * Conf/uname email now includes binary path.
 * After changing conf with -C, binary is now moved to binpath/binname.
+* 'strict-host' is now '1'; ident is now parsed CORRECTLY, *!ident@host will no longer match *!~ident@host.
 
 1.1.9
 

+ 4 - 7
src/misc.c

@@ -177,13 +177,10 @@ void maskhost(const char *s, char *nw)
     } else
       i = 0;
     while (*p != '@') {
-      if (!fl && strchr("~+-^=", *p)) {
-        if (strict_host)
-	  nw[i] = '?';
-	else
-	  i--;
-      } else
-	nw[i] = *p;
+      if (!fl && strchr("~+-^=", *p))
+       nw[i] = '?';
+      else
+        nw[i] = *p;
       fl++;
       p++;
       i++;

+ 1 - 1
src/mod/irc.mod/chan.c

@@ -966,7 +966,7 @@ void check_this_user(char *hand, int del, char *host)
       sprintf(s, "%s!%s", m->nick, m->userhost);
       u = m->user ? m->user : get_user_by_host(s);
       if ((u && !egg_strcasecmp(u->handle, hand) && del < 2) ||
-	  (!u && del == 2 && wild_match(host, fixfrom(s)))) {
+	  (!u && del == 2 && wild_match(host, s))) {
 	u = del ? NULL : u;
 	get_user_flagrec(u, &fr, chan->dname);
 	check_this_member(chan, m->nick, &fr);

+ 2 - 8
src/mod/irc.mod/cmdsirc.c

@@ -1550,14 +1550,8 @@ static void cmd_adduser(int idx, char *par)
   else {
     strncpyz(s1, s, sizeof s1);
     p1 = strchr(s1, '!');
-    if (strchr("~^+=-", p1[1])) {
-      if (strict_host)
-	p1[1] = '?';
-      else {
-	p1[1] = '!';
-	p1++;
-      }
-    }
+    if (strchr("~^+=-", p1[1]))
+      p1[1] = '?';
     p1--;
     p1[0] = '*';
   }

+ 1 - 5
src/mod/irc.mod/irc.c

@@ -460,11 +460,7 @@ check_hostmask()
 
   checked_hostmask = 1;
 
-  if (tmp[0] == '~' && !strict_host) {	/* crappy *! method */
-    tmp++;
-    sprintf(s, "*!?%s", tmp);
-  } else
-    sprintf(s, "*!%s", tmp);		/* else just add actual user@ident, regardless of ~ */
+  sprintf(s, "*!%s", tmp);		/* just add actual user@ident, regardless of ~ */
 
   for (struct list_type *q = (struct list_type *) get_user(&USERENTRY_HOSTS, conf.bot->u); q; q = q->next) {
     if (!egg_strcasecmp(q->extra, s))

+ 2 - 33
src/userrec.c

@@ -34,7 +34,6 @@ maskrec		*global_bans = NULL,
 struct igrec	*global_ign = NULL;
 int		cache_hit = 0,
 		cache_miss = 0;		/* temporary cache accounting	    */
-bool		strict_host = 0;
 int		userfile_perm = 0600;	/* Userfile permissions,
 					   default rw-------		    */
 
@@ -52,28 +51,6 @@ int count_users(struct userrec *bu)
   return tot;
 }
 
-/* Removes a username prefix (~+-^=) from a userhost.
- * e.g, "nick!~user@host" -> "nick!user@host"
- */
-char *fixfrom(char *s)
-{
-  if (!s || !*s || strict_host)
-    return s;
-
-  char *p = NULL;
-
-  if ((p = strchr(s, '!'))) {
-    if (!*(++p))
-      return s; /* There's nothing following "!". */
-  } else
-    p = s; /* There's no nick. */
-
-  if (strchr("~+-^=", *p) && *(p + 1) != '@')
-    memmove(p, p + 1, strlen(p)); /* NUL is included without +1. */
-
-  return s;
-}
-
 static struct userrec *check_dcclist_hand(char *handle)
 {
   for (int i = 0; i < dcc_total; i++)
@@ -217,7 +194,7 @@ struct userrec *get_user_by_host(char *host)
 
   cache_miss++;
   strncpyz(host2, host, sizeof host2);
-  host = fixfrom(host);
+
   for (u = userlist; u; u = u->next) {
     q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
     for (; q; q = q->next) {
@@ -480,15 +457,7 @@ struct userrec *adduser(struct userrec *bu, char *handle, char *host, char *pass
   set_user(&USERENTRY_PASS, u, pass);
   /* Strip out commas -- they're illegal */
   if (host && host[0]) {
-    char *p = NULL;
-
-    /* About this fixfrom():
-     *   We should use this fixfrom before every call of adduser()
-     *   but its much easier to use here...  (drummer)
-     *   Only use it if we have a host :) (dw)
-     */
-    host = fixfrom(host);
-    p = strchr(host, ',');
+    char *p = strchr(host, ',');
 
     while (p != NULL) {
       *p = '?';

+ 1 - 2
src/userrec.h

@@ -19,9 +19,8 @@ int write_userfile(int);
 #endif /* HUB */
 void touch_laston(struct userrec *, char *, time_t);
 void user_del_chan(char *);
-char *fixfrom(char *);
 
 extern struct userrec  		*userlist, *lastuser;
 extern int			cache_hit, cache_miss, userfile_perm;
-extern bool			strict_host, noshare;
+extern bool			noshare;
 #endif /* !_USERREC_H */