socsvn commit: r239475 - soc2012/exxo/patches
exxo at FreeBSD.org
exxo at FreeBSD.org
Mon Jul 16 17:20:17 UTC 2012
Author: exxo
Date: Mon Jul 16 17:20:13 2012
New Revision: 239475
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239475
Log:
Add ypwhich patch and update openssl one
Added:
soc2012/exxo/patches/ypwhich.patch
Modified:
soc2012/exxo/patches/openssl-1.0.1c.patch
Modified: soc2012/exxo/patches/openssl-1.0.1c.patch
==============================================================================
--- soc2012/exxo/patches/openssl-1.0.1c.patch Mon Jul 16 17:07:21 2012 (r239474)
+++ soc2012/exxo/patches/openssl-1.0.1c.patch Mon Jul 16 17:20:13 2012 (r239475)
@@ -1,4 +1,4 @@
-diff -rpu -X diff-exclude openssl-1.0.1c/Configure gsoc/openssl-1.0.1c/Configure
+diff -r -pu -X diff-exclude openssl-1.0.1c/Configure gsoc/openssl-1.0.1c/Configure
--- openssl-1.0.1c/Configure 2012-03-14 23:20:40.000000000 +0100
+++ gsoc/openssl-1.0.1c/Configure 2012-06-26 02:18:50.000000000 +0200
@@ -168,8 +168,8 @@ my %table=(
@@ -65,7 +65,7 @@
# iPhoneOS/iOS
"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_apps.h gsoc/openssl-1.0.1c/apps/s_apps.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/apps/s_apps.h gsoc/openssl-1.0.1c/apps/s_apps.h
--- openssl-1.0.1c/apps/s_apps.h 2009-09-04 19:42:04.000000000 +0200
+++ gsoc/openssl-1.0.1c/apps/s_apps.h 2012-06-26 01:10:06.000000000 +0200
@@ -148,7 +148,7 @@ typedef fd_mask fd_set;
@@ -89,9 +89,9 @@
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
int argi, long argl, long ret);
-diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_client.c gsoc/openssl-1.0.1c/apps/s_client.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/apps/s_client.c gsoc/openssl-1.0.1c/apps/s_client.c
--- openssl-1.0.1c/apps/s_client.c 2012-03-18 19:16:05.000000000 +0100
-+++ gsoc/openssl-1.0.1c/apps/s_client.c 2012-06-26 02:24:47.000000000 +0200
++++ gsoc/openssl-1.0.1c/apps/s_client.c 2012-07-16 17:02:41.000000000 +0200
@@ -287,6 +287,10 @@ static void sc_usage(void)
BIO_printf(bio_err,"\n");
BIO_printf(bio_err," -host host - use -connect instead\n");
@@ -126,7 +126,7 @@
argc--;
argv++;
while (argc >= 1)
-@@ -664,13 +675,19 @@ int MAIN(int argc, char **argv)
+@@ -664,13 +675,18 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv,"-port") == 0)
{
if (--argc < 1) goto bad;
@@ -144,12 +144,11 @@
{
if (--argc < 1) goto bad;
- if (!extract_host_port(*(++argv),&host,NULL,&port))
-+ /* TODO
-+ if (!extract_host_port(*(++argv),&host,NULL,&port)) */
++ if (!BIO_extract_addr(*(++argv),&host,&port,NULL))
goto bad;
}
else if (strcmp(*argv,"-verify") == 0)
-@@ -1252,10 +1269,9 @@ bad:
+@@ -1252,10 +1268,9 @@ bad:
re_start:
@@ -162,7 +161,7 @@
goto end;
}
BIO_printf(bio_c_out,"CONNECTED(%08X)\n",s);
-diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_server.c gsoc/openssl-1.0.1c/apps/s_server.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/apps/s_server.c gsoc/openssl-1.0.1c/apps/s_server.c
--- openssl-1.0.1c/apps/s_server.c 2012-03-18 19:16:05.000000000 +0100
+++ gsoc/openssl-1.0.1c/apps/s_server.c 2012-06-26 01:24:25.000000000 +0200
@@ -460,6 +460,10 @@ static void sv_usage(void)
@@ -230,7 +229,7 @@
print_stats(bio_s_out,ctx);
ret=0;
end:
-diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_socket.c gsoc/openssl-1.0.1c/apps/s_socket.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/apps/s_socket.c gsoc/openssl-1.0.1c/apps/s_socket.c
--- openssl-1.0.1c/apps/s_socket.c 2011-12-02 15:39:40.000000000 +0100
+++ gsoc/openssl-1.0.1c/apps/s_socket.c 2012-06-26 02:04:07.000000000 +0200
@@ -97,16 +97,15 @@ typedef unsigned int u_int;
@@ -631,15 +630,14 @@
+#endif
#endif
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/bio/b_sock.c gsoc/openssl-1.0.1c/crypto/bio/b_sock.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/bio/b_sock.c gsoc/openssl-1.0.1c/crypto/bio/b_sock.c
--- openssl-1.0.1c/crypto/bio/b_sock.c 2012-04-16 19:43:14.000000000 +0200
-+++ gsoc/openssl-1.0.1c/crypto/bio/b_sock.c 2012-06-26 02:08:30.000000000 +0200
-@@ -113,21 +113,40 @@ static struct ghbn_cache_st
++++ gsoc/openssl-1.0.1c/crypto/bio/b_sock.c 2012-07-16 17:14:45.000000000 +0200
+@@ -113,21 +113,39 @@ static struct ghbn_cache_st
#endif
static int get_ip(const char *str,unsigned char *ip);
-+static int parse_ip(char *str, char **host, char **port, int *is_inet6);
-+static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local);
++static int fill_addr(union sa_storage *sa, const char *host, const char *port, int is_inet6, int is_local);
#if 0
static void ghbn_free(struct hostent *a);
static struct hostent *ghbn_dup(struct hostent *a);
@@ -677,7 +675,7 @@
goto err;
}
-@@ -138,38 +157,93 @@ int BIO_get_host_ip(const char *str, uns
+@@ -138,38 +156,93 @@ int BIO_get_host_ip(const char *str, uns
/* If the string actually contained an IP address, we need not do
anything more */
@@ -785,7 +783,7 @@
}
int BIO_get_port(const char *str, unsigned short *port_ptr)
-@@ -467,9 +541,90 @@ end:
+@@ -467,9 +540,90 @@ end:
#endif
}
@@ -877,12 +875,12 @@
#ifdef OPENSSL_SYS_WINDOWS
static struct WSAData wsa_state;
-@@ -619,121 +774,151 @@ static int get_ip(const char *str, unsig
+@@ -619,121 +773,153 @@ static int get_ip(const char *str, unsig
return(1);
}
-int BIO_get_accept_socket(char *host, int bind_mode)
-+static int parse_ip(char *str, char **host, char **port, int *is_inet6)
++int BIO_extract_addr(char *addr, char **host, char **port, int *is_inet6)
{
- int ret=0;
- union {
@@ -913,36 +911,38 @@
+ char *h = *host = NULL;
+ char *p = *port = NULL;
+
-+ *is_inet6 = 0;
-+ if (*str == '\0')
++ if (is_inet6)
++ *is_inet6 = 0;
++ if (*addr == '\0')
+ return (0);
-+ if (*str == '[' && (tmp = strchr(str + 1, ']')))
++ if (*addr == '[' && (tmp = strchr(addr + 1, ']')))
+ {
-+ h = str + 1;
++ h = addr + 1;
+ *tmp++ = '\0';
+ if (*tmp == ':')
+ p = tmp + 1;
+ else if (*tmp != '\0')
+ return (0);
-+ *is_inet6 = 1;
++ if (is_inet6)
++ *is_inet6 = 1;
+ }
+ else
+ {
-+ if ((tmp = strchr(str, ':')))
++ if ((tmp = strchr(addr, ':')))
{
- p=e;
-+ h = str;
++ h = addr;
+ *tmp++ = '\0';
+ p = tmp;
}
- else if (*e == '/')
-+ else if ((tmp = strchr(str, '/')))
++ else if ((tmp = strchr(addr, '/')))
{
- *e='\0';
- break;
+ if (*(tmp + 1) != '\0')
+ return (0);
-+ p = str;
++ p = addr;
+ *tmp = '\0';
}
- }
@@ -961,7 +961,7 @@
- } p_freeaddrinfo = {NULL};
- struct addrinfo *res,hint;
+ else
-+ h = str;
++ h = addr;
+ }
+ if (h && (*h == '\0' || !strcmp(h, "*")))
+ h = NULL;
@@ -979,7 +979,7 @@
- p_getaddrinfo.p=(void*)-1;
- }
- if (p_getaddrinfo.p==(void *)-1) break;
-+static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local)
++static int fill_addr(union sa_storage *sa, const char *host, const char *port, int is_inet6, int is_local)
+ {
+ unsigned short p;
+ int sa_len = 0;
@@ -1076,7 +1076,7 @@
+ int is_inet6 = 0;
- if (!BIO_get_port(p,&port)) goto err;
-+ if (parse_ip(host, &h, &p, &is_inet6) != 1)
++ if (BIO_extract_addr(host, &h, &p, &is_inet6) != 1)
+ {
+ BIOerr(BIO_F_BIO_GET_HOST_ADDR,BIO_R_INVALID_IP_ADDRESS);
+ return (0);
@@ -1106,7 +1106,7 @@
- else
+ if (BIO_sock_init() != 1) return(INVALID_SOCKET);
+ if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET);
-+ if (parse_ip(str, &h, &p, &is_inet6) != 1)
++ if (BIO_extract_addr(str, &h, &p, &is_inet6) != 1)
{
- if (!BIO_get_host_ip(h,&(ip[0]))) goto err;
- l=(unsigned long)
@@ -1124,7 +1124,7 @@
again:
s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
if (s == INVALID_SOCKET)
-@@ -768,7 +953,7 @@ again:
+@@ -768,7 +954,7 @@ again:
#endif
{
client = server;
@@ -1133,7 +1133,7 @@
{
#if OPENSSL_USE_IPV6
if (client.sa.sa_family == AF_INET6)
-@@ -830,6 +1015,9 @@ int BIO_accept(int sock, char **addr)
+@@ -830,6 +1016,9 @@ int BIO_accept(int sock, char **addr)
unsigned long l;
unsigned short port;
char *p;
@@ -1143,7 +1143,7 @@
struct {
/*
-@@ -854,13 +1042,7 @@ int BIO_accept(int sock, char **addr)
+@@ -854,13 +1043,7 @@ int BIO_accept(int sock, char **addr)
* <appro>
*/
union { size_t s; int i; } len;
@@ -1158,7 +1158,7 @@
} sa;
sa.len.s=0;
-@@ -883,43 +1065,27 @@ int BIO_accept(int sock, char **addr)
+@@ -883,43 +1066,27 @@ int BIO_accept(int sock, char **addr)
if (addr == NULL) goto end;
@@ -1221,22 +1221,24 @@
if (sa.from.sa.sa_family != AF_INET) goto end;
l=ntohl(sa.from.sa_in.sin_addr.s_addr);
port=ntohs(sa.from.sa_in.sin_port);
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/bio/bio.h gsoc/openssl-1.0.1c/crypto/bio/bio.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/bio/bio.h gsoc/openssl-1.0.1c/crypto/bio/bio.h
--- openssl-1.0.1c/crypto/bio/bio.h 2012-03-06 14:47:26.000000000 +0100
-+++ gsoc/openssl-1.0.1c/crypto/bio/bio.h 2012-06-26 02:07:31.000000000 +0200
-@@ -76,6 +76,11 @@
++++ gsoc/openssl-1.0.1c/crypto/bio/bio.h 2012-07-16 17:18:33.000000000 +0200
+@@ -76,6 +76,13 @@
# endif
#endif
-+/* TODO Under which conditions include the following ? */
++/* TODO Under which conditions include the following OPENSSL_SYS_UNIX ? */
++#ifdef OPENSSL_SYS_UNIX
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
++#endif
+
#ifdef __cplusplus
extern "C" {
#endif
-@@ -715,11 +720,66 @@ struct hostent *BIO_gethostbyname(const
+@@ -715,11 +722,67 @@ struct hostent *BIO_gethostbyname(const
* substructures; if the buffer does not suffice, NULL is returned
* and an appropriate error code is set).
*/
@@ -1300,10 +1302,11 @@
int BIO_get_port(const char *str, unsigned short *port_ptr);
int BIO_get_host_ip(const char *str, unsigned char *ip);
+int BIO_get_host_ip6(const char *str, unsigned char *ip, unsigned char mode);
++int BIO_extract_addr(char *addr, char **host, char **port, int *is_inet6);
int BIO_get_accept_socket(char *host_port,int mode);
int BIO_accept(int sock,char **ip_port);
int BIO_sock_init(void );
-@@ -782,9 +842,14 @@ void ERR_load_BIO_strings(void);
+@@ -782,9 +845,14 @@ void ERR_load_BIO_strings(void);
#define BIO_F_BIO_CALLBACK_CTRL 131
#define BIO_F_BIO_CTRL 103
#define BIO_F_BIO_GETHOSTBYNAME 120
@@ -1318,7 +1321,7 @@
#define BIO_F_BIO_GET_PORT 107
#define BIO_F_BIO_MAKE_PAIR 121
#define BIO_F_BIO_NEW 108
-@@ -814,6 +879,7 @@ void ERR_load_BIO_strings(void);
+@@ -814,6 +882,7 @@ void ERR_load_BIO_strings(void);
#define BIO_R_ACCEPT_ERROR 100
#define BIO_R_BAD_FOPEN_MODE 101
#define BIO_R_BAD_HOSTNAME_LOOKUP 102
@@ -1326,7 +1329,7 @@
#define BIO_R_BROKEN_PIPE 124
#define BIO_R_CONNECT_ERROR 103
#define BIO_R_EOF_ON_MEMORY_BIO 127
-@@ -840,6 +906,7 @@ void ERR_load_BIO_strings(void);
+@@ -840,6 +909,7 @@ void ERR_load_BIO_strings(void);
#define BIO_R_UNSUPPORTED_METHOD 121
#define BIO_R_WRITE_TO_READ_ONLY_BIO 126
#define BIO_R_WSASTARTUP 122
@@ -1334,7 +1337,7 @@
#ifdef __cplusplus
}
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/bio/bio_err.c gsoc/openssl-1.0.1c/crypto/bio/bio_err.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/bio/bio_err.c gsoc/openssl-1.0.1c/crypto/bio/bio_err.c
--- openssl-1.0.1c/crypto/bio/bio_err.c 2011-12-27 15:37:43.000000000 +0100
+++ gsoc/openssl-1.0.1c/crypto/bio/bio_err.c 2012-06-25 12:36:42.000000000 +0200
@@ -76,9 +76,14 @@ static ERR_STRING_DATA BIO_str_functs[]=
@@ -1368,7 +1371,7 @@
{0,NULL}
};
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/bio/bss_dgram.c gsoc/openssl-1.0.1c/crypto/bio/bss_dgram.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/bio/bss_dgram.c gsoc/openssl-1.0.1c/crypto/bio/bss_dgram.c
--- openssl-1.0.1c/crypto/bio/bss_dgram.c 2012-03-06 14:47:26.000000000 +0100
+++ gsoc/openssl-1.0.1c/crypto/bio/bss_dgram.c 2012-06-25 19:05:34.000000000 +0200
@@ -143,13 +143,7 @@ static BIO_METHOD methods_dgramp_sctp=
@@ -1431,7 +1434,7 @@
#endif
data = (bio_dgram_data *)b->ptr;
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/crypto.h gsoc/openssl-1.0.1c/crypto/crypto.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/crypto.h gsoc/openssl-1.0.1c/crypto/crypto.h
--- openssl-1.0.1c/crypto/crypto.h 2011-06-01 18:54:03.000000000 +0200
+++ gsoc/openssl-1.0.1c/crypto/crypto.h 2012-06-10 01:01:26.000000000 +0200
@@ -222,6 +222,7 @@ typedef struct openssl_item_st
@@ -1442,7 +1445,7 @@
#define CRYPTO_LOCK 1
#define CRYPTO_UNLOCK 2
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/err/err.c gsoc/openssl-1.0.1c/crypto/err/err.c
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/err/err.c gsoc/openssl-1.0.1c/crypto/err/err.c
--- openssl-1.0.1c/crypto/err/err.c 2011-01-14 16:13:59.000000000 +0100
+++ gsoc/openssl-1.0.1c/crypto/err/err.c 2012-06-26 01:41:28.000000000 +0200
@@ -174,6 +174,7 @@ static ERR_STRING_DATA ERR_str_functs[]=
@@ -1453,7 +1456,7 @@
{0,NULL},
};
-diff -rpu -X diff-exclude openssl-1.0.1c/crypto/err/err.h gsoc/openssl-1.0.1c/crypto/err/err.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/crypto/err/err.h gsoc/openssl-1.0.1c/crypto/err/err.h
--- openssl-1.0.1c/crypto/err/err.h 2011-06-06 13:49:35.000000000 +0200
+++ gsoc/openssl-1.0.1c/crypto/err/err.h 2012-06-26 01:41:21.000000000 +0200
@@ -258,6 +258,7 @@ typedef struct err_state_st
@@ -1464,22 +1467,24 @@
/* reasons */
-diff -rpu -X diff-exclude openssl-1.0.1c/include/openssl/bio.h gsoc/openssl-1.0.1c/include/openssl/bio.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/include/openssl/bio.h gsoc/openssl-1.0.1c/include/openssl/bio.h
--- openssl-1.0.1c/include/openssl/bio.h 2012-03-06 14:47:26.000000000 +0100
-+++ gsoc/openssl-1.0.1c/include/openssl/bio.h 2012-06-26 02:07:31.000000000 +0200
-@@ -76,6 +76,11 @@
++++ gsoc/openssl-1.0.1c/include/openssl/bio.h 2012-07-16 17:18:33.000000000 +0200
+@@ -76,6 +76,13 @@
# endif
#endif
-+/* TODO Under which conditions include the following ? */
++/* TODO Under which conditions include the following OPENSSL_SYS_UNIX ? */
++#ifdef OPENSSL_SYS_UNIX
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
++#endif
+
#ifdef __cplusplus
extern "C" {
#endif
-@@ -715,11 +720,66 @@ struct hostent *BIO_gethostbyname(const
+@@ -715,11 +722,67 @@ struct hostent *BIO_gethostbyname(const
* substructures; if the buffer does not suffice, NULL is returned
* and an appropriate error code is set).
*/
@@ -1543,10 +1548,11 @@
int BIO_get_port(const char *str, unsigned short *port_ptr);
int BIO_get_host_ip(const char *str, unsigned char *ip);
+int BIO_get_host_ip6(const char *str, unsigned char *ip, unsigned char mode);
++int BIO_extract_addr(char *addr, char **host, char **port, int *is_inet6);
int BIO_get_accept_socket(char *host_port,int mode);
int BIO_accept(int sock,char **ip_port);
int BIO_sock_init(void );
-@@ -782,9 +842,14 @@ void ERR_load_BIO_strings(void);
+@@ -782,9 +845,14 @@ void ERR_load_BIO_strings(void);
#define BIO_F_BIO_CALLBACK_CTRL 131
#define BIO_F_BIO_CTRL 103
#define BIO_F_BIO_GETHOSTBYNAME 120
@@ -1561,7 +1567,7 @@
#define BIO_F_BIO_GET_PORT 107
#define BIO_F_BIO_MAKE_PAIR 121
#define BIO_F_BIO_NEW 108
-@@ -814,6 +879,7 @@ void ERR_load_BIO_strings(void);
+@@ -814,6 +882,7 @@ void ERR_load_BIO_strings(void);
#define BIO_R_ACCEPT_ERROR 100
#define BIO_R_BAD_FOPEN_MODE 101
#define BIO_R_BAD_HOSTNAME_LOOKUP 102
@@ -1569,7 +1575,7 @@
#define BIO_R_BROKEN_PIPE 124
#define BIO_R_CONNECT_ERROR 103
#define BIO_R_EOF_ON_MEMORY_BIO 127
-@@ -840,6 +906,7 @@ void ERR_load_BIO_strings(void);
+@@ -840,6 +909,7 @@ void ERR_load_BIO_strings(void);
#define BIO_R_UNSUPPORTED_METHOD 121
#define BIO_R_WRITE_TO_READ_ONLY_BIO 126
#define BIO_R_WSASTARTUP 122
@@ -1577,7 +1583,7 @@
#ifdef __cplusplus
}
-diff -rpu -X diff-exclude openssl-1.0.1c/include/openssl/crypto.h gsoc/openssl-1.0.1c/include/openssl/crypto.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/include/openssl/crypto.h gsoc/openssl-1.0.1c/include/openssl/crypto.h
--- openssl-1.0.1c/include/openssl/crypto.h 2011-06-01 18:54:03.000000000 +0200
+++ gsoc/openssl-1.0.1c/include/openssl/crypto.h 2012-06-10 01:01:26.000000000 +0200
@@ -222,6 +222,7 @@ typedef struct openssl_item_st
@@ -1588,7 +1594,7 @@
#define CRYPTO_LOCK 1
#define CRYPTO_UNLOCK 2
-diff -rpu -X diff-exclude openssl-1.0.1c/include/openssl/err.h gsoc/openssl-1.0.1c/include/openssl/err.h
+diff -r -pu -X diff-exclude openssl-1.0.1c/include/openssl/err.h gsoc/openssl-1.0.1c/include/openssl/err.h
--- openssl-1.0.1c/include/openssl/err.h 2011-06-06 13:49:35.000000000 +0200
+++ gsoc/openssl-1.0.1c/include/openssl/err.h 2012-06-26 01:41:21.000000000 +0200
@@ -258,6 +258,7 @@ typedef struct err_state_st
Added: soc2012/exxo/patches/ypwhich.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2012/exxo/patches/ypwhich.patch Mon Jul 16 17:20:13 2012 (r239475)
@@ -0,0 +1,170 @@
+Index: freebsd-head/usr.bin/ypwhich/ypwhich.c
+===================================================================
+--- freebsd-head/usr.bin/ypwhich/ypwhich.c (revision 239326)
++++ freebsd-head/usr.bin/ypwhich/ypwhich.c (working copy)
+@@ -83,26 +83,39 @@ usage(void)
+ exit(ERR_USAGE);
+ }
+
++#define ypb_family ypbr.ypbind_respbody.ypbind_bindinfo.ypbind_binding_family
++#define ypb_addr ypbr.ypbind_respbody.ypbind_bindinfo.ypbind_binding_addr
++#ifdef INET6
++# define ADDRSTRLEN INET6_ADDRSTRLEN
++#else
++# define ADDRSTRLEN INET_ADDRSTRLEN
++#endif
+
+ /*
+ * Like yp_bind except can query a specific host
+ */
+ static int
+-bind_host(char *dom, struct sockaddr_in *lsin)
++bind_host(char *dom, const char *host)
+ {
+ struct hostent *hent = NULL;
+ struct ypbind_resp ypbr;
+ struct timeval tv;
+ CLIENT *client;
+- int sock, r;
+- struct in_addr ss_addr;
++ int r;
++ char str[ADDRSTRLEN];
++ size_t len;
++ union {
++ struct in_addr in;
++#ifdef INET6
++ struct in6_addr in6;
++#endif
++ } ss_addr;
+
+- sock = RPC_ANYSOCK;
+ tv.tv_sec = 15;
+ tv.tv_usec = 0;
+- client = clntudp_create(lsin, YPBINDPROG, YPBINDVERS, tv, &sock);
++ client = clnt_create_timed(host, YPBINDPROG, YPBINDVERS, "udp", &tv);
+ if (client == NULL) {
+- warnx("can't clntudp_create: %s", yperr_string(YPERR_YPBIND));
++ warnx("can't clnt_create_timed: %s", yperr_string(YPERR_YPBIND));
+ return (YPERR_YPBIND);
+ }
+
+@@ -124,14 +137,18 @@ bind_host(char *dom, struct sockaddr_in
+ }
+ }
+ clnt_destroy(client);
+-
+- ss_addr = ypbr.ypbind_respbody.ypbind_bindinfo.ypbind_binding_addr;
+- /*printf("%08x\n", ss_addr);*/
+- hent = gethostbyaddr((char *)&ss_addr, sizeof(ss_addr), AF_INET);
++ bcopy(&ypb_addr, &ss_addr, sizeof(ss_addr));
++#ifdef INET6
++ if (ypb_family == AF_INET6)
++ len = sizeof(ss_addr.in6);
++ else /* AF_INET */
++#endif
++ len = sizeof(ss_addr.in);
++ hent = gethostbyaddr((char *)&ss_addr, len, ypb_family);
+ if (hent)
+ printf("%s\n", hent->h_name);
+ else
+- printf("%s\n", inet_ntoa(ss_addr));
++ printf("%s\n", inet_ntop(ypb_family, &ss_addr, str, ADDRSTRLEN));
+ return (0);
+ }
+
+@@ -141,8 +158,7 @@ main(int argc, char *argv[])
+ char *domnam = NULL, *master;
+ char *map = NULL;
+ struct ypmaplist *ypml, *y;
+- struct hostent *hent;
+- struct sockaddr_in lsin;
++ char *host;
+ int notrans, mode;
+ int c, r;
+ u_int i;
+@@ -166,38 +182,20 @@ main(int argc, char *argv[])
+ mode++;
+ break;
+ default:
+- usage();
++ usage();
+ }
+
+ if (!domnam)
+ yp_get_default_domain(&domnam);
+
+ if (mode == 0) {
+- switch (argc-optind) {
+- case 0:
+- bzero(&lsin, sizeof lsin);
+- lsin.sin_family = AF_INET;
+- lsin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+-
+- if (bind_host(domnam, &lsin))
++ if (argc-optind == 0 || argc-optind == 1) {
++ host = argc-optind ? argv[optind] : "127.0.0.1";
++ if (bind_host(domnam, host))
+ exit(ERR_NOBINDING);
+- break;
+- case 1:
+- bzero(&lsin, sizeof lsin);
+- lsin.sin_family = AF_INET;
+- if ((lsin.sin_addr.s_addr = inet_addr(argv[optind])) == INADDR_NONE) {
+- hent = gethostbyname(argv[optind]);
+- if (!hent)
+- errx(ERR_NOSUCHHOST, "host %s unknown", argv[optind]);
+- bcopy((char *)hent->h_addr_list[0],
+- (char *)&lsin.sin_addr, sizeof lsin.sin_addr);
+- }
+- if (bind_host(domnam, &lsin))
+- exit(ERR_NOBINDING);
+- break;
+- default:
+- usage();
+ }
++ else
++ usage();
+ exit(0);
+ }
+
+Index: freebsd-head/usr.bin/ypwhich/Makefile
+===================================================================
+--- freebsd-head/usr.bin/ypwhich/Makefile (revision 239326)
++++ freebsd-head/usr.bin/ypwhich/Makefile (working copy)
+@@ -5,4 +5,8 @@ PROG= ypwhich
+
+ WARNS?= 2
+
++.if ${MK_INET6_SUPPORT} != "no"
++CFLAGS+= -DINET6
++.endif
++
+ .include <bsd.prog.mk>
+Index: freebsd-head/include/rpcsvc/yp_prot.h
+===================================================================
+--- freebsd-head/include/rpcsvc/yp_prot.h (revision 239326)
++++ freebsd-head/include/rpcsvc/yp_prot.h (working copy)
+@@ -199,7 +199,7 @@ struct ypresp_maplist {
+ struct dom_binding {
+ struct dom_binding *dom_pnext;
+ char dom_domain[YPMAXDOMAIN + 1];
+- struct sockaddr_in dom_server_addr;
++ struct sockaddr_storage dom_server_addr;
+ u_short dom_server_port;
+ int dom_socket;
+ CLIENT *dom_client;
+@@ -238,7 +238,13 @@ enum ypbind_resptype {
+
+ /* network order, of course */
+ struct ypbind_binding {
+- struct in_addr ypbind_binding_addr;
++ sa_family_t ypbind_binding_family;
++ union {
++ struct in_addr in;
++#ifdef INET6
++ struct in6_addr in6;
++#endif
++ } ypbind_binding_addr;
+ u_short ypbind_binding_port;
+ };
+
More information about the svn-soc-all
mailing list