[cvslog] [CVS] Module eggdrop1.8: Change committed

cvs at eggheads.org cvs at eggheads.org
Wed Oct 20 07:07:24 CST 2010


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.8
Commit time: 2010-10-20 13:07:23 UTC
Committer  : Rumen Stoyanov <pseudo at egg6.net>

Modified files:
     aclocal.m4 configure doc/Changes1.8 doc/TLS src/dcc.c src/net.c
     src/patch.h src/proto.h src/tcldcc.c src/mod/module.h
     src/mod/filesys.mod/filesys.c

Log message:

Clarified the OpenSSL version requirements.
Rewrote open_telnet() to make it more useful.
Replaced some calls to open_telnet_raw() with open_telnet().

---------------------- diff included ----------------------
Index: eggdrop1.8/aclocal.m4
diff -u eggdrop1.8/aclocal.m4:1.9 eggdrop1.8/aclocal.m4:1.10
--- eggdrop1.8/aclocal.m4:1.9	Tue Oct 19 08:20:56 2010
+++ eggdrop1.8/aclocal.m4	Wed Oct 20 07:07:13 2010
@@ -16,7 +16,7 @@
 dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl
-dnl $Id: aclocal.m4,v 1.9 2010/10/19 14:20:56 pseudo Exp $
+dnl $Id: aclocal.m4,v 1.10 2010/10/20 13:07:13 pseudo Exp $
 dnl
 
 
@@ -2007,7 +2007,7 @@
     fi
     AC_MSG_CHECKING([for OpenSSL])
     if test "$havesslinc" = "no" || test "$havessllib" = "no"; then
-      AC_MSG_RESULT([no])
+      AC_MSG_RESULT([no (make sure you have version 0.9.8 or higher installed)])
       LIBS="$save_LIBS"
     else
       AC_MSG_RESULT([yes])
Index: eggdrop1.8/configure
diff -u eggdrop1.8/configure:1.10 eggdrop1.8/configure:1.11
--- eggdrop1.8/configure:1.10	Tue Oct 19 08:20:56 2010
+++ eggdrop1.8/configure	Wed Oct 20 07:07:13 2010
@@ -8543,8 +8543,8 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5
 $as_echo_n "checking for OpenSSL... " >&6; }
     if test "$havesslinc" = "no" || test "$havessllib" = "no"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (make sure you have version 0.9.8 or higher installed)" >&5
+$as_echo "no (make sure you have version 0.9.8 or higher installed)" >&6; }
       LIBS="$save_LIBS"
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
Index: eggdrop1.8/doc/Changes1.8
diff -u eggdrop1.8/doc/Changes1.8:1.21 eggdrop1.8/doc/Changes1.8:1.22
--- eggdrop1.8/doc/Changes1.8:1.21	Tue Oct 19 08:20:56 2010
+++ eggdrop1.8/doc/Changes1.8	Wed Oct 20 07:07:13 2010
@@ -1,4 +1,4 @@
-$Id: Changes1.8,v 1.21 2010/10/19 14:20:56 pseudo Exp $
+$Id: Changes1.8,v 1.22 2010/10/20 13:07:13 pseudo Exp $
 
 Eggdrop Changes (since version 1.8.0)
 
@@ -6,6 +6,11 @@
 
 1.8.0 (CVS):
 
+  - Clarified the OpenSSL version requirements.
+  - Rewrote open_telnet() to make it more useful.
+  - Replaced some calls to open_telnet_raw() with open_telnet().
+    Patch by: pseudo
+
   - Added few autoconf checks for ssl.
   - Added tls to tcl_status()
     Patch by: pseudo
Index: eggdrop1.8/doc/TLS
diff -u eggdrop1.8/doc/TLS:1.1 eggdrop1.8/doc/TLS:1.2
--- eggdrop1.8/doc/TLS:1.1	Tue Oct 19 06:13:32 2010
+++ eggdrop1.8/doc/TLS	Wed Oct 20 07:07:13 2010
@@ -1,4 +1,4 @@
-$Id: TLS,v 1.1 2010/10/19 12:13:32 pseudo Exp $
+$Id: TLS,v 1.2 2010/10/20 13:07:13 pseudo Exp $
 
 TLS support
 Last revised: Oct 17, 2010
@@ -24,8 +24,8 @@
 
   1. About
 
-    Eggdrop can be optionally compiled with TLS support. This requires a
-    recent version of the OpenSSL library installed on your system.
+    Eggdrop can be optionally compiled with TLS support. This requires OpenSSL
+    0.9.8 or more recent installed on your system.
     TLS support includes encryption for IRC, DCC, botnet, telnet and scripted
     connections as well as certificate authentication for users and bots.
 
Index: eggdrop1.8/src/dcc.c
diff -u eggdrop1.8/src/dcc.c:1.4 eggdrop1.8/src/dcc.c:1.5
--- eggdrop1.8/src/dcc.c:1.4	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/dcc.c	Wed Oct 20 07:07:13 2010
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.4 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: dcc.c,v 1.5 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -283,12 +283,8 @@
 
   /* Try next port */
   killsock(dcc[idx].sock);
-  dcc[idx].port++;
   dcc[idx].timeval = now;
-  dcc[idx].sock = getsock(setsockname(&dcc[idx].sockname, dcc[idx].host,
-                                      dcc[idx].port, 1), SOCK_STRONGCONN);
-  if (dcc[idx].sock < 0 ||
-      open_telnet_raw(dcc[idx].sock, &dcc[idx].sockname) < 0)
+  if (open_telnet(idx, dcc[idx].host, dcc[idx].port + 1) < 0)
     failed_link(idx);
 }
 
Index: eggdrop1.8/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.8/src/mod/filesys.mod/filesys.c:1.4 eggdrop1.8/src/mod/filesys.mod/filesys.c:1.5
--- eggdrop1.8/src/mod/filesys.mod/filesys.c:1.4	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/mod/filesys.mod/filesys.c	Wed Oct 20 07:07:13 2010
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.4 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: filesys.c,v 1.5 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -847,7 +847,7 @@
                             char *object, char *keyword, char *text)
 {
   char *param, *ip, *prt, buf[512], *msg = buf;
-  int i, sock;
+  int i;
   struct userrec *u = get_user_by_handle(userlist, handle);
   struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
@@ -889,27 +889,24 @@
   } else {
     ip = newsplit(&msg);
     prt = newsplit(&msg);
+    if (atoi(prt) < 1024 || atoi(prt) > 65535) {
+      /* Invalid port */
+      if (!quiet_reject)
+        dprintf(DP_HELP, "NOTICE %s :%s (invalid port)\n", nick,
+                DCC_CONNECTFAILED1);
+      putlog(LOG_FILES, "*", "%s: %s!%s", DCC_REFUSED7, nick, from);
+      return 1;
+    }
     i = new_dcc(&DCC_FILES_PASS, sizeof(struct file_info));
-    dcc[i].port = atoi(prt);
-    (void) setsockname(&dcc[i].sockname, ip, dcc[i].port, 0);
-    sock = getsock(dcc[i].sockname.family, 0);
-    if (sock < 0 || open_telnet_raw(sock, &dcc[i].sockname) < 0) {
+    dcc[i].sock = open_telnet(i, ip, atoi(prt));
+    if (dcc[i].sock < 0) {
       lostdcc(i);
       if (!quiet_reject)
         dprintf(DP_HELP, "NOTICE %s :%s (%s)\n", nick, DCC_CONNECTFAILED1, strerror(errno));
       putlog(LOG_MISC, "*", "%s: CHAT(file) (%s!%s)", DCC_CONNECTFAILED2, nick,
              from);
       putlog(LOG_MISC, "*", "    (%s)", strerror(errno));
-      killsock(sock);
-    } else if (atoi(prt) < 1024 || atoi(prt) > 65535) {
-      /* Invalid port */
-      if (!quiet_reject)
-        dprintf(DP_HELP, "NOTICE %s :%s (invalid port)\n", nick,
-                DCC_CONNECTFAILED1);
-      putlog(LOG_FILES, "*", "%s: %s!%s", DCC_REFUSED7, nick, from);
-
     } else {
-      dcc[i].sock = sock;
       strcpy(dcc[i].nick, u->handle);
       strcpy(dcc[i].host, from);
       dcc[i].status = STAT_ECHO;
Index: eggdrop1.8/src/mod/module.h
diff -u eggdrop1.8/src/mod/module.h:1.3 eggdrop1.8/src/mod/module.h:1.4
--- eggdrop1.8/src/mod/module.h:1.3	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/mod/module.h	Wed Oct 20 07:07:13 2010
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.3 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: module.h,v 1.4 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -208,7 +208,7 @@
 #define open_listen ((int (*) (int *))global[84])
 #define getdccaddr ((int (*) (sockname_t *, char *, socklen_t))global[85])
 #define get_data_ptr(x) ((void *(*)(int,char*,int))global[86])(x,__FILE__,__LINE__)
-#define open_telnet ((int (*) (char *, int))global[87])
+#define open_telnet ((int (*) (int, char *, int))global[87])
 /* 88 - 91 */
 #define check_tcl_event ((void * (*) (const char *))global[88])
 #define my_memcpy ((void * (*) (void *, const void *, size_t))global[89])
Index: eggdrop1.8/src/net.c
diff -u eggdrop1.8/src/net.c:1.5 eggdrop1.8/src/net.c:1.6
--- eggdrop1.8/src/net.c:1.5	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/net.c	Wed Oct 20 07:07:13 2010
@@ -2,7 +2,7 @@
  * net.c -- handles:
  *   all raw network i/o
  *
- * $Id: net.c,v 1.5 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: net.c,v 1.6 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * This is hereby released into the public domain.
@@ -504,21 +504,22 @@
  *   >=0: connect successful, returned is the socket number
  *    -1: look at errno or use strerror()
  *    -2: lookup failed or server is not a valid IP string
+ *    -3: could not allocate socket
  */
-int open_telnet(char *server, int port)
+int open_telnet(int idx, char *server, int port)
 {
-  int ret, sock;
-  sockname_t name;
+  int ret;
   
-  ret = setsockname(&name, server, port, 1);
+  ret = setsockname(&dcc[idx].sockname, server, port, 1);
   if (ret == AF_UNSPEC)
     return -2;
-  sock = getsock(ret, 0);
-  if (sock < 0)
-    return -1;
-  ret = open_telnet_raw(sock, &name);
+  dcc[idx].port = port;
+  dcc[idx].sock = getsock(ret, 0);
+  if (dcc[idx].sock < 0)
+    return -3;
+  ret = open_telnet_raw(dcc[idx].sock, &dcc[idx].sockname);
   if (ret < 0)
-    killsock(sock);
+    killsock(dcc[idx].sock);
   return ret;
 }
 
Index: eggdrop1.8/src/patch.h
diff -u eggdrop1.8/src/patch.h:1.12 eggdrop1.8/src/patch.h:1.13
--- eggdrop1.8/src/patch.h:1.12	Tue Oct 19 08:20:56 2010
+++ eggdrop1.8/src/patch.h	Wed Oct 20 07:07:13 2010
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.12 2010/10/19 14:20:56 pseudo Exp $
+ * $Id: patch.h,v 1.13 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1287498044");            /* current unixtime */
+patch("1287576554");            /* current unixtime */
 /*
  *
  *
  */
-patch("tlsa2i");
+patch("opentelnet");
 /*
  *
  *
Index: eggdrop1.8/src/proto.h
diff -u eggdrop1.8/src/proto.h:1.4 eggdrop1.8/src/proto.h:1.5
--- eggdrop1.8/src/proto.h:1.4	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/proto.h	Wed Oct 20 07:07:13 2010
@@ -7,7 +7,7 @@
  * because they use structures in those
  * (saves including those .h files EVERY time) - Beldin
  *
- * $Id: proto.h,v 1.4 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: proto.h,v 1.5 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -276,7 +276,7 @@
 int setsockname(sockname_t *, char *, int, int);
 int open_address_listen(sockname_t *);
 int open_telnet_raw(int, sockname_t *);
-int open_telnet(char *, int);
+int open_telnet(int, char *, int);
 int answer(int, sockname_t *, unsigned short *, int);
 int getdccaddr(sockname_t *, char *, size_t);
 void tputs(int, char *, unsigned int);
Index: eggdrop1.8/src/tcldcc.c
diff -u eggdrop1.8/src/tcldcc.c:1.3 eggdrop1.8/src/tcldcc.c:1.4
--- eggdrop1.8/src/tcldcc.c:1.3	Tue Oct 19 06:13:33 2010
+++ eggdrop1.8/src/tcldcc.c	Wed Oct 20 07:07:13 2010
@@ -2,7 +2,7 @@
  * tcldcc.c -- handles:
  *   Tcl stubs for the dcc commands
  *
- * $Id: tcldcc.c,v 1.3 2010/10/19 12:13:33 pseudo Exp $
+ * $Id: tcldcc.c,v 1.4 2010/10/20 13:07:13 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -859,16 +859,18 @@
 
 static int tcl_connect STDVAR
 {
-  int i, z, sock;
+  int i, sock;
   char s[81];
-
+  
   BADARGS(3, 3, " hostname port");
 
   if (dcc_total == max_dcc && increase_socks_max()) {
     Tcl_AppendResult(irp, "out of dcc table space", NULL);
     return TCL_ERROR;
   }
-  sock = z = open_telnet(argv[1], atoi(argv[2]));
+
+  i = new_dcc(&DCC_SOCKET, 0);
+  sock = open_telnet(i, argv[1], atoi(argv[2]));
   if (sock < 0) {
     switch (sock) {
       case -3:
@@ -880,23 +882,21 @@
       default:
         Tcl_AppendResult(irp, strerror(errno), NULL);
     }
+    lostdcc(i);
     return TCL_ERROR;
   }            
 #ifdef TLS
-  if (*argv[2] == '+' && ssl_handshake(sock, TLS_CONNECT, 0, LOG_MISC, NULL, NULL)) {
-    killsock(sock);
-    strncpyz(s, "Failed to establish a TLS session", sizeof s);
-    Tcl_AppendResult(irp, s, NULL);
-    return TCL_ERROR;
+  if (*argv[2] == '+') {
+    if (ssl_handshake(sock, TLS_CONNECT, 0, LOG_MISC, NULL, NULL)) {
+      killsock(sock);
+      lostdcc(i);
+      strncpyz(s, "Failed to establish a TLS session", sizeof s);
+      Tcl_AppendResult(irp, s, NULL);
+      return TCL_ERROR;
+    } else
+      dcc[i].ssl = 1;
   }
 #endif
-  i = new_dcc(&DCC_SOCKET, 0);
-  dcc[i].sock = sock;
-  dcc[i].port = atoi(argv[2]);
-#ifdef TLS
-  if (*argv[2] == '+')
-    dcc[i].ssl = 1;
-#endif
   strcpy(dcc[i].nick, "*");
   strncpyz(dcc[i].host, argv[1], UHOSTMAX);
   egg_snprintf(s, sizeof s, "%d", sock);
----------------------- End of diff -----------------------


More information about the Changes mailing list