From 7dc26c0f0ccde5dd8f273c2f6e91f6f663aff337 Mon Sep 17 00:00:00 2001 From: itohy Date: Thu, 9 Nov 2000 03:53:31 +0000 Subject: Dual stack (IPv6) support. Make "skkserv_port:" line in skk.conf accept the service name as well as the port number. --- japanese/skkfep/files/patch-sum | 4 +- japanese/skkfep/patches/patch-bb | 94 +++++++++++++++++++++++++++++++++++----- japanese/skkfep/pkg/INSTALL | 21 +++++---- 3 files changed, 97 insertions(+), 22 deletions(-) (limited to 'japanese') diff --git a/japanese/skkfep/files/patch-sum b/japanese/skkfep/files/patch-sum index c251af08cfa..90c6e2d3088 100644 --- a/japanese/skkfep/files/patch-sum +++ b/japanese/skkfep/files/patch-sum @@ -1,10 +1,10 @@ -$NetBSD: patch-sum,v 1.2 1999/12/26 23:13:35 itohy Exp $ +$NetBSD: patch-sum,v 1.3 2000/11/09 03:53:31 itohy Exp $ MD5 (patch-aa) = 84c103884bd79f318a3546dd4977981e MD5 (patch-ab) = e9414c89e920656dfd758331a7b9d422 MD5 (patch-ac) = 1cd030d9e8c852e50e4c11699228b5e2 MD5 (patch-ba) = 59fac3f97502a5438a748f84faf0e4a8 -MD5 (patch-bb) = 8cd6def270742eddc486e20d1589b2f1 +MD5 (patch-bb) = 8e47d3981b353b5ba348ea4a5040a016 MD5 (patch-bc) = af0017e03a4e4296bb1e3aee9669115d MD5 (patch-bd) = f9d9674136b815f656a7596eb7c21672 MD5 (patch-be) = 94f4c81f3a01a6f6487fcb0733b31274 diff --git a/japanese/skkfep/patches/patch-bb b/japanese/skkfep/patches/patch-bb index d3310515a3c..870991b5ac0 100644 --- a/japanese/skkfep/patches/patch-bb +++ b/japanese/skkfep/patches/patch-bb @@ -1,19 +1,49 @@ -$NetBSD: patch-bb,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $ +$NetBSD: patch-bb,v 1.2 2000/11/09 03:53:31 itohy Exp $ --- connserv.c.orig Tue Jul 7 00:31:16 1998 -+++ connserv.c Fri Dec 24 00:25:24 1999 -@@ -40,8 +40,33 @@ ++++ connserv.c Tue Nov 7 20:58:57 2000 +@@ -14,6 +14,10 @@ + #include + #include + ++#ifdef PF_INET6 ++# define HAVE_GETADDRINFO ++#endif ++ + #define SKK_PORT_NUMBER 1178 + #define SKK_SERVICENAME "skkserv" + +@@ -36,50 +40,112 @@ + int sock; + int i; + unsigned short port; ++#ifdef HAVE_GETADDRINFO ++ struct addrinfo aihint, *ai0, *ai; ++ int error; ++#else + struct sockaddr_in hostaddr; struct hostent *entry; struct servent *serv; struct protoent *proto; - int a1,a2,a3,a4; ++#endif char *hostname; +- +- serv = getservbyname(SKK_SERVICENAME,"tcp"); +- fillzero((char*)&hostaddr,sizeof(struct sockaddr_in)); +- if ((proto = getprotobyname("tcp")) == NULL) { +- return -1; +- } +- +- if ((sock = socket(AF_INET,SOCK_STREAM,proto->p_proto)) < 0) { +- return -1; +#ifdef SKK_CONF /* use skk.conf */ + FILE *conffp; + char line[128]; + char hostbuf[128]; ++ char servbuf[128]; + char *confhost = NULL; -+ int confport = 0; ++ char *confport = SKK_SERVICENAME; + + if ((conffp = fopen(SKK_CONF, "r")) != NULL) { + char *p, *data; @@ -29,15 +59,15 @@ $NetBSD: patch-bb,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $ + strcpy(hostbuf, data); + confhost = hostbuf; + } else if (!strcmp(p, "skkserv_port")) { -+ confport = atoi(data); ++ strcpy(servbuf, data); ++ confport = servbuf; + } + } -+ } + } ++# undef SKK_SERVICENAME ++# define SKK_SERVICENAME confport +#endif - serv = getservbyname(SKK_SERVICENAME,"tcp"); - fillzero((char*)&hostaddr,sizeof(struct sockaddr_in)); -@@ -56,27 +81,27 @@ if (SKKServerHost) hostname = SKKServerHost; else if ((hostname = getenv("SKKSERVER")) == NULL) { @@ -56,8 +86,43 @@ $NetBSD: patch-bb,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $ - } - a1 = (a1<<24)|(a2<<16)|(a3<<8)|a4; - hostaddr.sin_addr.s_addr = htonl(a1); -- } ++ ++#ifdef HAVE_GETADDRINFO ++ fillzero((char*)&aihint, sizeof aihint); ++ aihint.ai_family = PF_UNSPEC; ++ aihint.ai_socktype = SOCK_STREAM; ++ aihint.ai_flags = AI_CANONNAME; ++ error = getaddrinfo(hostname, SKK_SERVICENAME, &aihint, &ai0); ++ if (error) { ++ printf("%s: %s\r\n", gai_strerror(error), hostname); ++ return -1; ++ } ++ ++ sock = -1; ++ for (ai = ai0; ai; ai = ai->ai_next) { ++ sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); ++ if (sock >= 0 && ++ connect(sock, ai->ai_addr, ai->ai_addrlen) == 0) ++ break; ++ close(sock); ++ sock = -1; ++ } ++ if (sock < 0) { ++ perror(hostname); ++ return -1; ++ } ++#else ++ serv = getservbyname(SKK_SERVICENAME,"tcp"); ++ fillzero((char*)&hostaddr,sizeof(struct sockaddr_in)); ++ if ((proto = getprotobyname("tcp")) == NULL) { ++ return -1; + } - else { ++ ++ if ((sock = socket(AF_INET,SOCK_STREAM,proto->p_proto)) < 0) { ++ return -1; ++ } ++ + if ((hostaddr.sin_addr.s_addr = inet_addr(hostname)) == INADDR_NONE) { if ((entry = gethostbyname(hostname)) == NULL) { return -1; @@ -67,10 +132,15 @@ $NetBSD: patch-bb,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $ hostaddr.sin_family = AF_INET; - hostaddr.sin_port = serv ? serv->s_port : htons(SKK_PORT_NUMBER); + hostaddr.sin_port = ++ serv ? serv->s_port : +#ifdef SKK_CONF -+ confport ? htons(confport) : ++ (i = atoi(confport)) > 0 ? htons(i) : +#endif -+ serv ? serv->s_port : htons(SKK_PORT_NUMBER); ++ htons(SKK_PORT_NUMBER); if (connect(sock,(struct sockaddr *)&hostaddr,sizeof(struct sockaddr_in)) < 0) { return -1; } ++#endif + printf("SKKSERVER=%s\r\n",hostname); + skkservsock = sock; + rserv = fdopen(sock,"r"); diff --git a/japanese/skkfep/pkg/INSTALL b/japanese/skkfep/pkg/INSTALL index 7856bf67eec..e8ca664f037 100644 --- a/japanese/skkfep/pkg/INSTALL +++ b/japanese/skkfep/pkg/INSTALL @@ -1,19 +1,23 @@ #! /bin/sh -# $NetBSD: INSTALL,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $ +# $NetBSD: INSTALL,v 1.2 2000/11/09 03:53:31 itohy Exp $ + +conf=@PKGBASE@/etc/skk.conf case "$2" in POST-INSTALL) # install skkserv port number - if egrep '^skkserv[ ]' /etc/services >/dev/null; then + if grep '^skkserv[ ]' /etc/services >/dev/null; then : else echo ' skkserv 1178/tcp # SKK server' >>/etc/services fi - # install skk.cf - if [ ! -f @PKGBASE@/etc/skk.conf ]; then - cat <<'END' >@PKGBASE@/etc/skk.conf + # install skk.conf + if [ -f $conf ] && grep -v -e '^#' -e '^$' $conf >/dev/null; then + : file exists and it seems to have some configurations + else + cat <<'END' >$conf # skk.conf - configuration file for SKK client programs # Syntax @@ -22,12 +26,13 @@ skkserv 1178/tcp # SKK server' >>/etc/services # skkserv_host: # Host which skkserv is running on. # # default: localhost # -# skkserv_port: # TCP port number of skkserv. -# # default: lookup "skkserv" in services +# skkserv_port: # TCP service name or port number of skkserv. +# # default: skkserv # # skkserv_host: localhost -# skkserv_port: 1178 +# skkserv_port: skkserv +# skkserv_port: 1178 END fi ;; -- cgit v1.2.3