[cvslog] (2002-09-21 20:55:35 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Sat Sep 21 15:56:01 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2002-09-21 20:55:35 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/dcc.c src/net.c src/patch.h

Log message:

Fixed a problem with 'connect' and 'control' where the script would abort prematurely. Patch by [sL].

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.408 eggdrop1.6/doc/UPDATES1.6:1.409
--- eggdrop1.6/doc/UPDATES1.6:1.408	Sat Sep 21 15:40:56 2002
+++ eggdrop1.6/doc/UPDATES1.6	Sat Sep 21 15:55:24 2002
@@ -1,10 +1,12 @@
-$Id: UPDATES1.6,v 1.408 2002/09/21 20:40:56 wcc Exp $
+$Id: UPDATES1.6,v 1.409 2002/09/21 20:55:24 wcc Exp $
 
 Changes in Eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.13
 Found by  Fixed by  What...
+various   [sL]      fixed a problem with 'connect' and 'control' where the script
+                    would abort prematurely
           BarkerJr  don't "want ops" in modeless (+) channels
 guppy     Wcc       tell the user to set 'my-ip' when hostname self-lookup fails
 ridens    Wcc       improved access checking in -host/+host
Index: eggdrop1.6/src/dcc.c
diff -u eggdrop1.6/src/dcc.c:1.55 eggdrop1.6/src/dcc.c:1.56
--- eggdrop1.6/src/dcc.c:1.55	Thu Mar 21 21:53:56 2002
+++ eggdrop1.6/src/dcc.c	Sat Sep 21 15:55:24 2002
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.55 2002/03/22 03:53:56 guppy Exp $
+ * $Id: dcc.c,v 1.56 2002/09/21 20:55:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -541,10 +541,16 @@
 {
   if (!atr)
     return;
+
   strip_telnet(dcc[idx].sock, buf, &atr);
-  atr = dcc[idx].user ? dcc[idx].user->flags : 0;
+
+  if (buf[0] == 0 || buf == NULL)
+    return;
+
 
   /* Check for MD5 digest from remote _bot_. <cybah> */
+
+  atr = dcc[idx].user ? dcc[idx].user->flags : 0;
   if ((atr & USER_BOT) && !egg_strncasecmp(buf, "digest ", 7)) {
     if(dcc_bot_check_digest(idx, buf+7)) {
       nfree(dcc[idx].u.chat);
Index: eggdrop1.6/src/net.c
diff -u eggdrop1.6/src/net.c:1.43 eggdrop1.6/src/net.c:1.44
--- eggdrop1.6/src/net.c:1.43	Sun Sep 15 14:26:35 2002
+++ eggdrop1.6/src/net.c	Sat Sep 21 15:55:25 2002
@@ -2,7 +2,7 @@
  * net.c -- handles:
  *   all raw network i/o
  * 
- * $Id: net.c,v 1.43 2002/09/15 19:26:35 wcc Exp $
+ * $Id: net.c,v 1.44 2002/09/21 20:55:25 wcc Exp $
  */
 /* 
  * This is hereby released into the public domain.
@@ -199,6 +199,32 @@
   }
 }
 
+/* copy of strip_telnet but just for any defined text */
+static void strip_telnet_codes(char *buf, int *len)
+{
+  unsigned char *p = (unsigned char *) buf, *o = (unsigned char *) buf;
+  int mark;
+        
+  while (*p != 0) {
+    while ((*p != TLN_IAC) && (*p != 0))
+      *o++ = *p++;
+    if (*p == TLN_IAC) {
+      p++;
+      mark = 2;
+      if (!*p)
+        mark = 1;               /* bogus */
+      if ((*p >= TLN_WILL) && (*p <= TLN_DONT)) {
+        mark = 3;
+        if (!*(p + 1))
+          mark = 2;             /* bogus */
+      }
+      p += mark - 1;
+      *len = *len - mark;
+    }
+  }
+  *o = *p;
+}
+
 /* Sets/Unsets options for a specific socket.
  * 
  * Returns:  0   - on success
@@ -747,7 +773,9 @@
 int sockgets(char *s, int *len)
 {
   char xx[514], *p, *px;
+  char tmps[514];
   int ret, i, data = 0;
+  int atra = 0, chk = 0;
 
   for (i = 0; i < MAXSOCKS; i++) {
     /* Check for stored-up data waiting to be processed */
@@ -755,29 +783,54 @@
 	!(socklist[i].flags & SOCK_BUFFER) && (socklist[i].inbuf != NULL)) {
       if (!(socklist[i].flags & SOCK_BINARY)) {
 	/* look for \r too cos windows can't follow RFCs */
-	p = strchr(socklist[i].inbuf, '\n');
-	if (p == NULL)
-	  p = strchr(socklist[i].inbuf, '\r');
-	if (p != NULL) {
-	  *p = 0;
-	  if (strlen(socklist[i].inbuf) > 510)
-	    socklist[i].inbuf[510] = 0;
-	  strcpy(s, socklist[i].inbuf);
-	  px = (char *) nmalloc(strlen(p + 1) + 1);
-	  strcpy(px, p + 1);
-	  nfree(socklist[i].inbuf);
-	  if (px[0])
-	    socklist[i].inbuf = px;
-	  else {
-	    nfree(px);
-	    socklist[i].inbuf = NULL;
-	  }
-	  /* Strip CR if this was CR/LF combo */
-	  if (s[strlen(s) - 1] == '\r')
-	    s[strlen(s) - 1] = 0;
-	  *len = strlen(s);
-	  return socklist[i].sock;
-	}
+        while (chk == 0) {
+	  p = strchr(socklist[i].inbuf, '\n');
+	  if (p == NULL)
+	    p = strchr(socklist[i].inbuf, '\r');
+	  if (p != NULL) {
+	    *p = 0;
+	    if (strlen(socklist[i].inbuf) > 510)
+	      socklist[i].inbuf[510] = 0;
+	    strcpy(s, socklist[i].inbuf);
+	    px = (char *) nmalloc(strlen(p + 1) + 1);
+	    strcpy(px, p + 1);
+	    nfree(socklist[i].inbuf);
+	    if (px[0])
+	      socklist[i].inbuf = px;
+	    else {
+	      nfree(px);
+	      socklist[i].inbuf = NULL;
+	    }
+	    /* Strip CR if this was CR/LF combo */
+	    if (s[strlen(s) - 1] == '\r')
+	      s[strlen(s) - 1] = 0;
+            /* if s is null, we can't use it... */
+	    if (((s[0] == 0) || (s == NULL)) && (socklist[i].inbuf == NULL)) {
+              return -3;
+            } else
+              chk = 1;
+            if (chk) {
+              *len = strlen(s);
+       	      return socklist[i].sock;
+  	    }
+          } else {
+ 	    if (((s[0] == 0) || (s == NULL)) && (socklist[i].inbuf != NULL)) {
+              if (strlen(socklist[i].inbuf) > 510)
+                socklist[i].inbuf[510] = 0;
+              *len = socklist[i].inbuflen;
+	      strcpy(s, socklist[i].inbuf);
+              nfree(socklist[i].inbuf);
+              socklist[i].inbuf = NULL;
+              socklist[i].inbuflen = 0;
+	      strcpy(tmps, s);
+	      strip_telnet_codes(tmps, &atra);
+	      if ((tmps[0] == 0) || (tmps == NULL))
+		return -3;
+              return socklist[i].sock;
+            }
+            chk = 1;
+          }
+        }
       } else {
 	/* Handling buffered binary data (must have been SOCK_BUFFER before). */
 	if (socklist[i].inbuflen <= 510) {
@@ -793,7 +846,7 @@
 	  egg_memcpy(socklist[i].inbuf, socklist[i].inbuf + *len, *len);
 	  socklist[i].inbuflen -= *len;
 	  socklist[i].inbuf = nrealloc(socklist[i].inbuf,
-				       socklist[i].inbuflen);
+				       socklist[i].inbuflen + 1);
 	}
 	return socklist[i].sock;
       }
@@ -894,9 +947,9 @@
   *len = strlen(s);
   /* Anything left that needs to be saved? */
   if (!xx[0]) {
-    if (data)
+    if (data) {
       return socklist[ret].sock;
-    else
+    } else
       return -3;
   }
   /* Prepend old data back */
@@ -908,11 +961,26 @@
     strcat(socklist[ret].inbuf, p);
     nfree(p);
   } else {
+    if (xx[0] && (data != 1))
+      data = 1;
     socklist[ret].inbuflen = strlen(xx);
     socklist[ret].inbuf = (char *) nmalloc(socklist[ret].inbuflen + 1);
     strcpy(socklist[ret].inbuf, xx);
   }
   if (data) {
+    if (((s[0] == 0) || (s == NULL)) && (socklist[ret].inbuf != NULL)) {
+      if (strlen(socklist[ret].inbuf) > 510)
+        socklist[ret].inbuf[510] = 0;
+      *len = socklist[ret].inbuflen;
+      strcpy(s, socklist[ret].inbuf);
+      nfree(socklist[ret].inbuf);
+      socklist[ret].inbuf = NULL;
+      socklist[ret].inbuflen = 0;
+      strcpy(tmps, s);
+      strip_telnet_codes(tmps, &atra);
+      if ((tmps[0] == 0) || (tmps == NULL))
+        return -3;
+    }
     return socklist[ret].sock;
   } else {
     return -3;
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.822 eggdrop1.6/src/patch.h:1.823
--- eggdrop1.6/src/patch.h:1.822	Sat Sep 21 15:40:56 2002
+++ eggdrop1.6/src/patch.h	Sat Sep 21 15:55:25 2002
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.822 2002/09/21 20:40:56 wcc Exp $
+ * $Id: patch.h,v 1.823 2002/09/21 20:55:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1032640636");		/* current unixtime */
+patch("1032641245");		/* current unixtime */
 /*
  *
  *
  */
-patch("modeless-wantops");
+patch("sockfix6");
 /*
  *
  *
----------------------- End of diff -----------------------



More information about the Changes mailing list