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

cvs at eggheads.org cvs at eggheads.org
Mon Aug 23 15:27:50 CST 2010


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.8
Commit time: 2010-08-23 21:27:50 UTC
Committer  : Rumen Stoyanov <pseudo at egg6.net>

Modified files:
     doc/Changes1.8 src/net.c src/tcl.c src/compat/gethostbyname2.c
     src/compat/gethostbyname2.h src/compat/inet_ntop.c
     src/compat/inet_ntop.h src/compat/inet_pton.c

Log message:

Modified src/compat/ replacements of gethostbyname2() and inet_ntop() to not compile when IPv6 is disabled.
Added a missing header preventing gethostbyname2() from compiling on FreeBSD.
Fixed few lines with wrong indentation.

---------------------- diff included ----------------------
Index: eggdrop1.8/doc/Changes1.8
diff -u eggdrop1.8/doc/Changes1.8:1.7 eggdrop1.8/doc/Changes1.8:1.8
--- eggdrop1.8/doc/Changes1.8:1.7	Wed Aug 11 09:58:19 2010
+++ eggdrop1.8/doc/Changes1.8	Mon Aug 23 15:27:40 2010
@@ -1,4 +1,4 @@
-$Id: Changes1.8,v 1.7 2010/08/11 15:58:19 thommey Exp $
+$Id: Changes1.8,v 1.8 2010/08/23 21:27:40 pseudo Exp $
 
 Eggdrop Changes (since version 1.8.0)
 
@@ -6,6 +6,13 @@
 
 1.8.0 (CVS):
 
+  - Modified src/compat/ replacements of gethostbyname2() and inet_ntop()
+    to not compile when IPv6 is disabled.
+  - Added a missing header preventing gethostbyname2() from compiling on
+    FreeBSD.
+  - Fixed few lines with wrong indentation.
+    Patch by: pseudo
+
   - Reran autotools.
   - Added detection of Tcl_NotifierProcs members to ensure the notifier can
     be replaced. Fixes compilation against Tcl 8.2 and 8.3.
Index: eggdrop1.8/src/compat/gethostbyname2.c
diff -u eggdrop1.8/src/compat/gethostbyname2.c:1.1 eggdrop1.8/src/compat/gethostbyname2.c:1.2
--- eggdrop1.8/src/compat/gethostbyname2.c:1.1	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/compat/gethostbyname2.c	Mon Aug 23 15:27:40 2010
@@ -1,7 +1,7 @@
 /*
  * gethostbyname2.c -- provide a dummy gethostbyname2 replacement
  *
- * $Id: gethostbyname2.c,v 1.1 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: gethostbyname2.c,v 1.2 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Copyright (C) 2010 Eggheads Development Team
@@ -23,13 +23,19 @@
 
 #include "gethostbyname2.h"
 
-#ifndef HAVE_GETHOSTBYNAME2
+#if defined IPV6 && !defined HAVE_GETHOSTBYNAME2
 struct hostent *gethostbyname2(const char *name, int af)
 {
-  if(af != AF_INET) {
+  struct hostent *h;
+  
+  h = gethostbyname(name);
+  if (!h)
+    return NULL;
+  if (h->h_addrtype != af) {
     h_errno = NO_RECOVERY;
-    return 0;
+    return NULL;
   }
-  return gethostbyname(name);
+
+  return h;
 }
 #endif
Index: eggdrop1.8/src/compat/gethostbyname2.h
diff -u eggdrop1.8/src/compat/gethostbyname2.h:1.1 eggdrop1.8/src/compat/gethostbyname2.h:1.2
--- eggdrop1.8/src/compat/gethostbyname2.h:1.1	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/compat/gethostbyname2.h	Mon Aug 23 15:27:40 2010
@@ -2,7 +2,7 @@
  * gethostbyname2.h
  *   prototypes for gethostbyname2.c
  *
- * $Id: gethostbyname2.h,v 1.1 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: gethostbyname2.h,v 1.2 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Copyright (C) 2010 Eggheads Development Team
@@ -27,8 +27,11 @@
 #endif
 
 #include <netdb.h>
+#ifdef HAVE_SYS_SOCKET_H
+#  include <sys/socket.h>
+#endif
 #include <netinet/in.h>
 
-#ifndef HAVE_GETHOSTBYNAME2
+#if defined IPV6 && !defined HAVE_GETHOSTBYNAME2
 struct hostent *gethostbyname2(const char *name, int af);
 #endif
Index: eggdrop1.8/src/compat/inet_ntop.c
diff -u eggdrop1.8/src/compat/inet_ntop.c:1.1 eggdrop1.8/src/compat/inet_ntop.c:1.2
--- eggdrop1.8/src/compat/inet_ntop.c:1.1	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/compat/inet_ntop.c	Mon Aug 23 15:27:40 2010
@@ -1,7 +1,7 @@
 /*
  * inet_ntop.c -- provides inet_ntop() if necessary
  *
- * $Id: inet_ntop.c,v 1.1 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: inet_ntop.c,v 1.2 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Portions Copyright (C) 2010 Eggheads Development Team
@@ -23,7 +23,7 @@
 
 #include "inet_ntop.h"
 
-#ifndef HAVE_INET_NTOP
+#if defined IPV6 && !defined HAVE_INET_NTOP
 /*
  * Copyright (c) 1996-1999 by Internet Software Consortium.
  *
Index: eggdrop1.8/src/compat/inet_ntop.h
diff -u eggdrop1.8/src/compat/inet_ntop.h:1.1 eggdrop1.8/src/compat/inet_ntop.h:1.2
--- eggdrop1.8/src/compat/inet_ntop.h:1.1	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/compat/inet_ntop.h	Mon Aug 23 15:27:40 2010
@@ -2,7 +2,7 @@
  * inet_ntop.h
  *   prototypes for inet_ntop.c
  *
- * $Id: inet_ntop.h,v 1.1 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: inet_ntop.h,v 1.2 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Copyright (C) 2010 Eggheads Development Team
@@ -33,6 +33,6 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#ifndef HAVE_INET_NTOP
+#if defined IPV6 && !defined HAVE_INET_NTOP
 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
 #endif
Index: eggdrop1.8/src/compat/inet_pton.c
diff -u eggdrop1.8/src/compat/inet_pton.c:1.1 eggdrop1.8/src/compat/inet_pton.c:1.2
--- eggdrop1.8/src/compat/inet_pton.c:1.1	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/compat/inet_pton.c	Mon Aug 23 15:27:40 2010
@@ -1,7 +1,7 @@
 /*
  * inet_pton.c -- provides inet_pton() if necessary
  *
- * $Id: inet_pton.c,v 1.1 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: inet_pton.c,v 1.2 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Portions Copyright (C) 2010 Eggheads Development Team
@@ -23,7 +23,7 @@
 
 #include "inet_pton.h"
 
-#ifndef HAVE_INET_NTOP
+#ifndef HAVE_INET_PTON
 /*
  * Copyright (c) 1996,1999 by Internet Software Consortium.
  *
@@ -51,7 +51,9 @@
 #define NS_INT16SZ      2       /* #/bytes of data in a u_int16_t */
 
 static int inet_pton4 (const char *src, u_char *dst);
+#ifdef IPV6
 static int inet_pton6 (const char *src, u_char *dst);
+#endif
 
 /* int
  * inet_pton(af, src, dst)
@@ -232,4 +234,4 @@
 }
 #endif /* IPV6 */
 
-#endif /* HAVE_INET_NTOP */
+#endif /* HAVE_INET_PTON */
Index: eggdrop1.8/src/net.c
diff -u eggdrop1.8/src/net.c:1.2 eggdrop1.8/src/net.c:1.3
--- eggdrop1.8/src/net.c:1.2	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/net.c	Mon Aug 23 15:27:40 2010
@@ -2,7 +2,7 @@
  * net.c -- handles:
  *   all raw network i/o
  *
- * $Id: net.c,v 1.2 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: net.c,v 1.3 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * This is hereby released into the public domain.
@@ -60,9 +60,9 @@
 
 char natip[121] = "";         /* Public IPv4 to report for systems behind NAT */
 char listen_ip[121] = "";     /* IP (or hostname) for listening sockets       */
-char vhost[121] = "";          /* IPv4 vhost for outgoing connections         */
+char vhost[121] = "";         /* IPv4 vhost for outgoing connections          */
 #ifdef IPV6
-char vhost6[121] = "";         /* IPv6 vhost for outgoing connections         */
+char vhost6[121] = "";        /* IPv6 vhost for outgoing connections          */
 int pref_af = 0;              /* Prefer IPv6 over IPv4?                       */
 #endif
 char firewall[121] = "";      /* Socks server for firewall.                   */
@@ -627,7 +627,7 @@
     if (IN6_IS_ADDR_V4MAPPED(&r->addr.s6.sin6_addr) ||
         IN6_IS_ADDR_UNSPECIFIED(&r->addr.s6.sin6_addr))
       snprintf(s, l, "%lu", natip[0] ? iptolong(inet_addr(natip)) :
-               ntohl((IP) &r->addr.s6.sin6_addr.s6_addr[12]));
+               ntohl(*(IP *) &r->addr.s6.sin6_addr.s6_addr[12]));
     else
       inet_ntop(AF_INET6, &r->addr.s6.sin6_addr, s, l);
   } else
Index: eggdrop1.8/src/tcl.c
diff -u eggdrop1.8/src/tcl.c:1.2 eggdrop1.8/src/tcl.c:1.3
--- eggdrop1.8/src/tcl.c:1.2	Thu Aug  5 12:12:05 2010
+++ eggdrop1.8/src/tcl.c	Mon Aug 23 15:27:40 2010
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.2 2010/08/05 18:12:05 pseudo Exp $
+ * $Id: tcl.c,v 1.3 2010/08/23 21:27:40 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -563,7 +563,7 @@
   {"debug-output",          &debug_output,         0}, /* compat */
   {"use-console-r",         &use_console_r,        0}, /* compat */
 #ifdef IPV6
-  {"prefer-ipv6",	    &pref_af,		   0},
+  {"prefer-ipv6",           &pref_af,              0},
 #endif
   {NULL,                    NULL,                  0}
 };
----------------------- End of diff -----------------------


More information about the Changes mailing list