diff options
Diffstat (limited to 'news/knews/patches')
-rw-r--r-- | news/knews/patches/patch-af | 10 | ||||
-rw-r--r-- | news/knews/patches/patch-ag | 76 | ||||
-rw-r--r-- | news/knews/patches/patch-ah | 24 | ||||
-rw-r--r-- | news/knews/patches/patch-ai | 57 |
4 files changed, 100 insertions, 67 deletions
diff --git a/news/knews/patches/patch-af b/news/knews/patches/patch-af index 66a17b429c8..0aae44cb9d1 100644 --- a/news/knews/patches/patch-af +++ b/news/knews/patches/patch-af @@ -1,7 +1,7 @@ -$NetBSD: patch-af,v 1.3 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-af,v 1.4 2001/02/24 22:40:40 tron Exp $ --- src/sysdeps.h.orig Fri Jan 9 18:16:24 1998 -+++ src/sysdeps.h Fri Feb 23 22:08:23 2001 ++++ src/sysdeps.h Sat Feb 24 23:30:34 2001 @@ -2,7 +2,11 @@ * Copyright (C) 1995, 1996 Karl-Johan Johnsson. */ @@ -14,12 +14,14 @@ $NetBSD: patch-af,v 1.3 2001/02/23 22:19:42 tron Exp $ #define NNTP_PORT 119 #define FTP_PORT 21 -@@ -14,7 +18,7 @@ +@@ -14,7 +18,9 @@ extern void abort_callback(Widget, XtPointer, XtPointer); extern SERV_ADDR *get_host(char*, unsigned short, int); -extern int open_socket(void); -+extern int open_socket(int); ++extern SERV_ADDR *next_addr(SERV_ADDR *); ++extern void free_addr(SERV_ADDR *); ++extern int open_socket(SERV_ADDR *); extern int connect_socket(int, SERV_ADDR*); extern int open_duplex(int*); extern int bind_and_listen(int); diff --git a/news/knews/patches/patch-ag b/news/knews/patches/patch-ag index 0e7aefcfbbb..aa808b74119 100644 --- a/news/knews/patches/patch-ag +++ b/news/knews/patches/patch-ag @@ -1,7 +1,7 @@ -$NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ag,v 1.4 2001/02/24 22:40:40 tron Exp $ --- src/sysdeps.c.orig Tue Dec 29 11:46:52 1998 -+++ src/sysdeps.c Fri Feb 23 23:11:36 2001 ++++ src/sysdeps.c Sat Feb 24 23:31:43 2001 @@ -20,8 +20,8 @@ #include <netinet/in.h> #include <arpa/inet.h> @@ -64,7 +64,7 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ SERV_ADDR *ret; struct in_addr addr; unsigned short port; -@@ -332,14 +359,15 @@ +@@ -332,14 +359,38 @@ ret->port = port; return ret; @@ -72,53 +72,57 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ } -int open_socket(void) -+int open_socket(int family) ++SERV_ADDR *next_addr(SERV_ADDR *addr) ++ ++{ ++#ifdef USE_INET6 ++ return addr->ai_next; ++#else ++ return NULL; ++#endif ++} ++void free_addr(SERV_ADDR *addr) ++ ++{ ++#ifdef USE_INET6 ++ freeaddrinfo(addr); ++#else ++ XtFree((char *)addr); ++#endif ++} ++ ++int open_socket(SERV_ADDR *addr) { int fd, tmp; do { - fd = socket(PF_INET, SOCK_STREAM, 0); -+ fd = socket(family, SOCK_STREAM, 0); ++#ifdef USE_INET6 ++ fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); ++#else ++ fd = socket(AF_INET, SOCK_STREAM, 0); ++#endif } while (fd < 0 && errno == EINTR); if (fd < 0) { -@@ -372,6 +400,35 @@ +@@ -372,8 +423,15 @@ int connect_socket(int fd, SERV_ADDR *addr) { +- struct sockaddr_in serv_addr; + int tmp; +#ifdef USE_INET6 -+ int family; -+ -+ family = AF_INET; -+ while (addr) { -+ if (family != addr->ai_family) { -+ int newsocket; -+ -+ newsocket = open_socket(addr->ai_family); -+ if (newsocket < 0) -+ return -1; -+ if (dup2(newsocket, fd) < 0) -+ close(newsocket); ++ do { ++ tmp = connect(fd, addr->ai_addr, addr->ai_addrlen); ++ } while (tmp < 0 && errno == EINTR); + -+ close(newsocket); -+ family = addr->ai_family; -+ } -+ -+ do { -+ if ((connect(fd, addr->ai_addr, addr->ai_addrlen) == 0) || -+ (errno == EISCONN)) -+ return 0; -+ } while (would_block(fd, errno)); -+ -+ addr = addr->ai_next; -+ } -+ -+ return -1; ++ return tmp; +#else - struct sockaddr_in serv_addr; - int tmp; ++ struct sockaddr_in serv_addr; -@@ -390,6 +447,7 @@ + if (!addr) { + fputs("knews: connect_socket: addr is NULL!!!\n", stderr); +@@ -390,6 +448,7 @@ } while (tmp < 0 && errno == EINTR); return tmp; @@ -126,7 +130,7 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ } #if 0 /* Misc stuff for ftp routines */ -@@ -548,7 +606,7 @@ +@@ -548,7 +607,7 @@ char *get_mailhostname(void) { struct utsname un = {{0,},}; diff --git a/news/knews/patches/patch-ah b/news/knews/patches/patch-ah index d3c4b634d5f..8e7a7243620 100644 --- a/news/knews/patches/patch-ah +++ b/news/knews/patches/patch-ah @@ -1,7 +1,7 @@ -$NetBSD: patch-ah,v 1.1 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ah,v 1.2 2001/02/24 22:40:40 tron Exp $ --- src/xutil.c.orig Fri Jan 9 18:16:20 1998 -+++ src/xutil.c Fri Feb 23 22:44:30 2001 ++++ src/xutil.c Sat Feb 24 23:32:58 2001 @@ -18,6 +18,7 @@ #include "resource.h" #include "save.h" @@ -10,26 +10,12 @@ $NetBSD: patch-ah,v 1.1 2001/02/23 22:19:42 tron Exp $ #include "server.h" #include "tag.h" #include "thread.h" -@@ -40,6 +41,10 @@ - #include <X11/xpm.h> - #endif - -+#if defined(USE_INET6) -+#include <netdb.h> -+#endif -+ - void set_curr_art(ARTICLE *art, int center) - { - if (global.mode == NewsModeThread) { -@@ -343,7 +348,11 @@ +@@ -343,7 +344,7 @@ qf(main_server); server_close(main_server); -+#if defined(USE_INET6) -+ freeaddrinfo(global.serv_addr); -+#else - XtFree(global.serv_addr); -+#endif +- XtFree(global.serv_addr); ++ free_addr(global.serv_addr); global.serv_addr = NULL; clear_thread_context(main_thr); diff --git a/news/knews/patches/patch-ai b/news/knews/patches/patch-ai index dd50db50ba2..ea5f798cea7 100644 --- a/news/knews/patches/patch-ai +++ b/news/knews/patches/patch-ai @@ -1,7 +1,7 @@ -$NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ai,v 1.2 2001/02/24 22:40:40 tron Exp $ --- src/server.c.orig Fri Jan 9 18:16:22 1998 -+++ src/server.c Fri Feb 23 22:41:48 2001 ++++ src/server.c Sat Feb 24 23:24:45 2001 @@ -2,19 +2,21 @@ * Copyright (C) 1995, 1996 Karl-Johan Johnsson. */ @@ -26,7 +26,7 @@ $NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ struct SERVER { int fd; char *buffer; -@@ -128,12 +130,12 @@ +@@ -128,30 +130,35 @@ * tell != 0 means tell about errors * tell > 1 means say what you're doing */ @@ -35,9 +35,50 @@ $NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ { long tmp; - server_close(server); +- server_close(server); - server->fd = open_socket(); -+ server->fd = open_socket(AF_INET); - if (server->fd < 0) { - set_message("Error: Failed to create socket!", True); - return -1; +- if (server->fd < 0) { +- set_message("Error: Failed to create socket!", True); +- return -1; +- } +- +- if (tell > 1) +- set_message("Server contacted, waiting for response...", False); +- +- tmp = connect_socket(server->fd, addr); +- +- if (tmp < 0 && would_block(server->fd, errno)) { +- if (tell == 0) +- return 0; /* don't block */ +- +- tmp = 0; +- do_wait(&server->fd, True, server->quit_func, server); +- if (server->fd < 0) ++ while (addr) { ++ server_close(server); ++ server->fd = open_socket(addr); ++ if (server->fd < 0) { ++ set_message("Error: Failed to create socket!", True); + return -1; ++ } ++ ++ if (tell > 1) ++ set_message("Server contacted, waiting for response...", False); ++ ++ tmp = connect_socket(server->fd, addr); ++ ++ if (tmp < 0 && would_block(server->fd, errno)) { ++ if (tell == 0) ++ return 0; /* don't block */ ++ ++ tmp = 0; ++ do_wait(&server->fd, True, server->quit_func, server); ++ if (server->fd >= 0) ++ break; ++ ++ } ++ ++ addr = next_addr(addr); + } + + server->buffer[0] = '\0'; |