forked from rpms/openssl
fix s_server with new glibc when no global IPv6 address (#839031)
This commit is contained in:
parent
18ccae20f6
commit
254f85a5c0
@ -1,6 +1,6 @@
|
|||||||
diff -up openssl-1.0.1-beta2/apps/s_apps.h.ipv6-apps openssl-1.0.1-beta2/apps/s_apps.h
|
diff -up openssl-1.0.1c/apps/s_apps.h.ipv6-apps openssl-1.0.1c/apps/s_apps.h
|
||||||
--- openssl-1.0.1-beta2/apps/s_apps.h.ipv6-apps 2012-02-02 12:56:27.216889198 +0100
|
--- openssl-1.0.1c/apps/s_apps.h.ipv6-apps 2012-07-11 22:46:02.409221206 +0200
|
||||||
+++ openssl-1.0.1-beta2/apps/s_apps.h 2012-02-02 12:56:27.257889552 +0100
|
+++ openssl-1.0.1c/apps/s_apps.h 2012-07-11 22:46:02.451222165 +0200
|
||||||
@@ -148,7 +148,7 @@ typedef fd_mask fd_set;
|
@@ -148,7 +148,7 @@ typedef fd_mask fd_set;
|
||||||
#define PORT_STR "4433"
|
#define PORT_STR "4433"
|
||||||
#define PROTOCOL "tcp"
|
#define PROTOCOL "tcp"
|
||||||
@ -23,9 +23,9 @@ diff -up openssl-1.0.1-beta2/apps/s_apps.h.ipv6-apps openssl-1.0.1-beta2/apps/s_
|
|||||||
|
|
||||||
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
|
||||||
int argi, long argl, long ret);
|
int argi, long argl, long ret);
|
||||||
diff -up openssl-1.0.1-beta2/apps/s_client.c.ipv6-apps openssl-1.0.1-beta2/apps/s_client.c
|
diff -up openssl-1.0.1c/apps/s_client.c.ipv6-apps openssl-1.0.1c/apps/s_client.c
|
||||||
--- openssl-1.0.1-beta2/apps/s_client.c.ipv6-apps 2012-02-02 12:56:27.238889388 +0100
|
--- openssl-1.0.1c/apps/s_client.c.ipv6-apps 2012-07-11 22:46:02.433221754 +0200
|
||||||
+++ openssl-1.0.1-beta2/apps/s_client.c 2012-02-02 12:56:27.258889561 +0100
|
+++ openssl-1.0.1c/apps/s_client.c 2012-07-11 22:46:02.452222187 +0200
|
||||||
@@ -563,7 +563,7 @@ int MAIN(int argc, char **argv)
|
@@ -563,7 +563,7 @@ int MAIN(int argc, char **argv)
|
||||||
int cbuf_len,cbuf_off;
|
int cbuf_len,cbuf_off;
|
||||||
int sbuf_len,sbuf_off;
|
int sbuf_len,sbuf_off;
|
||||||
@ -35,7 +35,7 @@ diff -up openssl-1.0.1-beta2/apps/s_client.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
int full_log=1;
|
int full_log=1;
|
||||||
char *host=SSL_HOST_NAME;
|
char *host=SSL_HOST_NAME;
|
||||||
char *cert_file=NULL,*key_file=NULL;
|
char *cert_file=NULL,*key_file=NULL;
|
||||||
@@ -670,13 +670,12 @@ int MAIN(int argc, char **argv)
|
@@ -664,13 +664,12 @@ int MAIN(int argc, char **argv)
|
||||||
else if (strcmp(*argv,"-port") == 0)
|
else if (strcmp(*argv,"-port") == 0)
|
||||||
{
|
{
|
||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
@ -51,7 +51,7 @@ diff -up openssl-1.0.1-beta2/apps/s_client.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
else if (strcmp(*argv,"-verify") == 0)
|
else if (strcmp(*argv,"-verify") == 0)
|
||||||
@@ -1260,7 +1259,7 @@ bad:
|
@@ -1253,7 +1252,7 @@ bad:
|
||||||
|
|
||||||
re_start:
|
re_start:
|
||||||
|
|
||||||
@ -60,9 +60,9 @@ diff -up openssl-1.0.1-beta2/apps/s_client.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
{
|
{
|
||||||
BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
|
BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
|
||||||
SHUTDOWN(s);
|
SHUTDOWN(s);
|
||||||
diff -up openssl-1.0.1-beta2/apps/s_server.c.ipv6-apps openssl-1.0.1-beta2/apps/s_server.c
|
diff -up openssl-1.0.1c/apps/s_server.c.ipv6-apps openssl-1.0.1c/apps/s_server.c
|
||||||
--- openssl-1.0.1-beta2/apps/s_server.c.ipv6-apps 2012-02-02 12:56:27.239889397 +0100
|
--- openssl-1.0.1c/apps/s_server.c.ipv6-apps 2012-07-11 22:46:02.434221777 +0200
|
||||||
+++ openssl-1.0.1-beta2/apps/s_server.c 2012-02-02 12:56:27.259889570 +0100
|
+++ openssl-1.0.1c/apps/s_server.c 2012-07-11 22:46:02.453222210 +0200
|
||||||
@@ -929,7 +929,7 @@ int MAIN(int argc, char *argv[])
|
@@ -929,7 +929,7 @@ int MAIN(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
X509_VERIFY_PARAM *vpm = NULL;
|
X509_VERIFY_PARAM *vpm = NULL;
|
||||||
@ -72,7 +72,7 @@ diff -up openssl-1.0.1-beta2/apps/s_server.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
char *CApath=NULL,*CAfile=NULL;
|
char *CApath=NULL,*CAfile=NULL;
|
||||||
unsigned char *context = NULL;
|
unsigned char *context = NULL;
|
||||||
char *dhfile = NULL;
|
char *dhfile = NULL;
|
||||||
@@ -1010,8 +1010,7 @@ int MAIN(int argc, char *argv[])
|
@@ -1000,8 +1000,7 @@ int MAIN(int argc, char *argv[])
|
||||||
(strcmp(*argv,"-accept") == 0))
|
(strcmp(*argv,"-accept") == 0))
|
||||||
{
|
{
|
||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
@ -82,7 +82,7 @@ diff -up openssl-1.0.1-beta2/apps/s_server.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
}
|
}
|
||||||
else if (strcmp(*argv,"-verify") == 0)
|
else if (strcmp(*argv,"-verify") == 0)
|
||||||
{
|
{
|
||||||
@@ -1888,9 +1887,9 @@ bad:
|
@@ -1878,9 +1877,9 @@ bad:
|
||||||
BIO_printf(bio_s_out,"ACCEPT\n");
|
BIO_printf(bio_s_out,"ACCEPT\n");
|
||||||
(void)BIO_flush(bio_s_out);
|
(void)BIO_flush(bio_s_out);
|
||||||
if (www)
|
if (www)
|
||||||
@ -94,9 +94,9 @@ diff -up openssl-1.0.1-beta2/apps/s_server.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
print_stats(bio_s_out,ctx);
|
print_stats(bio_s_out,ctx);
|
||||||
ret=0;
|
ret=0;
|
||||||
end:
|
end:
|
||||||
diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/s_socket.c
|
diff -up openssl-1.0.1c/apps/s_socket.c.ipv6-apps openssl-1.0.1c/apps/s_socket.c
|
||||||
--- openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps 2011-12-02 15:39:40.000000000 +0100
|
--- openssl-1.0.1c/apps/s_socket.c.ipv6-apps 2011-12-02 15:39:40.000000000 +0100
|
||||||
+++ openssl-1.0.1-beta2/apps/s_socket.c 2012-01-19 14:53:30.000000000 +0100
|
+++ openssl-1.0.1c/apps/s_socket.c 2012-07-11 22:49:05.411400450 +0200
|
||||||
@@ -102,9 +102,7 @@ static struct hostent *GetHostByName(cha
|
@@ -102,9 +102,7 @@ static struct hostent *GetHostByName(cha
|
||||||
static void ssl_sock_cleanup(void);
|
static void ssl_sock_cleanup(void);
|
||||||
#endif
|
#endif
|
||||||
@ -216,7 +216,7 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
{
|
{
|
||||||
int sock;
|
int sock;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
@@ -322,33 +333,45 @@ int do_server(int port, int type, int *r
|
@@ -322,33 +333,50 @@ int do_server(int port, int type, int *r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
- int s= -1;
|
- int s= -1;
|
||||||
+ struct addrinfo *res, *res0 = NULL, hints;
|
+ struct addrinfo *res, *res0 = NULL, hints;
|
||||||
+ char * failed_call = NULL;
|
+ char * failed_call = NULL;
|
||||||
+ int s;
|
+ int s = INVALID_SOCKET;
|
||||||
+ int e;
|
+ int e;
|
||||||
|
|
||||||
if (!ssl_sock_init()) return(0);
|
if (!ssl_sock_init()) return(0);
|
||||||
@ -249,7 +249,7 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
+ hints.ai_family = AF_INET6;
|
+ hints.ai_family = AF_INET6;
|
||||||
+tryipv4:
|
+tryipv4:
|
||||||
+ hints.ai_socktype = type;
|
+ hints.ai_socktype = type;
|
||||||
+ hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
|
+ hints.ai_flags = AI_PASSIVE;
|
||||||
|
|
||||||
- if (type == SOCK_STREAM)
|
- if (type == SOCK_STREAM)
|
||||||
- s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
|
- s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
|
||||||
@ -258,11 +258,16 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
+ e = getaddrinfo(NULL, port, &hints, &res);
|
+ e = getaddrinfo(NULL, port, &hints, &res);
|
||||||
+ if (e)
|
+ if (e)
|
||||||
+ {
|
+ {
|
||||||
|
+ if (hints.ai_family == AF_INET)
|
||||||
|
+ {
|
||||||
+ fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e));
|
+ fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e));
|
||||||
+ if (e == EAI_SYSTEM)
|
+ if (e == EAI_SYSTEM)
|
||||||
+ perror("getaddrinfo");
|
+ perror("getaddrinfo");
|
||||||
+ return (0);
|
+ return (0);
|
||||||
+ }
|
+ }
|
||||||
|
+ else
|
||||||
|
+ res = NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
- if (s == INVALID_SOCKET) goto err;
|
- if (s == INVALID_SOCKET) goto err;
|
||||||
+ res0 = res;
|
+ res0 = res;
|
||||||
@ -283,7 +288,7 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
#if defined SOL_SOCKET && defined SO_REUSEADDR
|
#if defined SOL_SOCKET && defined SO_REUSEADDR
|
||||||
{
|
{
|
||||||
int j = 1;
|
int j = 1;
|
||||||
@@ -356,35 +379,49 @@ static int init_server_long(int *sock, i
|
@@ -356,35 +384,49 @@ static int init_server_long(int *sock, i
|
||||||
(void *) &j, sizeof j);
|
(void *) &j, sizeof j);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -350,7 +355,7 @@ diff -up openssl-1.0.1-beta2/apps/s_socket.c.ipv6-apps openssl-1.0.1-beta2/apps/
|
|||||||
int len;
|
int len;
|
||||||
/* struct linger ling; */
|
/* struct linger ling; */
|
||||||
|
|
||||||
@@ -431,135 +468,58 @@ redoit:
|
@@ -431,135 +473,58 @@ redoit:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (host == NULL) goto end;
|
if (host == NULL) goto end;
|
Loading…
Reference in New Issue
Block a user