3849a16
diff -up openssl-0.9.8g/apps/s_socket.c.ipv6-apps openssl-0.9.8g/apps/s_socket.c
3849a16
--- openssl-0.9.8g/apps/s_socket.c.ipv6-apps	2005-06-13 05:21:00.000000000 +0200
3849a16
+++ openssl-0.9.8g/apps/s_socket.c	2007-12-03 13:28:42.000000000 +0100
3849a16
@@ -96,9 +96,7 @@ static struct hostent *GetHostByName(cha
4d4d77e
 static void ssl_sock_cleanup(void);
4d4d77e
 #endif
4d4d77e
 static int ssl_sock_init(void);
4d4d77e
-static int init_client_ip(int *sock,unsigned char ip[4], int port, int type);
4d4d77e
-static int init_server(int *sock, int port, int type);
4d4d77e
-static int init_server_long(int *sock, int port,char *ip, int type);
4d4d77e
+static int init_server(int *sock, char *port, int type);
4d4d77e
 static int do_accept(int acc_sock, int *sock, char **host);
4d4d77e
 static int host_ip(char *str, unsigned char ip[4]);
4d4d77e
 
3849a16
@@ -228,60 +226,69 @@ static int ssl_sock_init(void)
4d4d77e
 	return(1);
4d4d77e
 	}
4d4d77e
 
4d4d77e
-int init_client(int *sock, char *host, int port, int type)
4d4d77e
+int init_client(int *sock, char *host, char *port, int type)
4d4d77e
 	{
4d4d77e
-	unsigned char ip[4];
4d4d77e
-	short p=0;
4d4d77e
-
4d4d77e
-	if (!host_ip(host,&(ip[0])))
4d4d77e
-		{
4d4d77e
-		return(0);
4d4d77e
-		}
4d4d77e
-	if (p != 0) port=p;
4d4d77e
-	return(init_client_ip(sock,ip,port,type));
4d4d77e
-	}
4d4d77e
-
4d4d77e
-static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
4d4d77e
-	{
4d4d77e
-	unsigned long addr;
4d4d77e
-	struct sockaddr_in them;
4d4d77e
-	int s,i;
4d4d77e
+	struct addrinfo *res, *res0, hints;
4d4d77e
+	char * failed_call = NULL;
4d4d77e
+	int s;
4d4d77e
+	int e;
4d4d77e
 
4d4d77e
 	if (!ssl_sock_init()) return(0);
4d4d77e
 
4d4d77e
-	memset((char *)&them,0,sizeof(them));
4d4d77e
-	them.sin_family=AF_INET;
4d4d77e
-	them.sin_port=htons((unsigned short)port);
4d4d77e
-	addr=(unsigned long)
4d4d77e
-		((unsigned long)ip[0]<<24L)|
4d4d77e
-		((unsigned long)ip[1]<<16L)|
4d4d77e
-		((unsigned long)ip[2]<< 8L)|
4d4d77e
-		((unsigned long)ip[3]);
4d4d77e
-	them.sin_addr.s_addr=htonl(addr);
4d4d77e
-
4d4d77e
-	if (type == SOCK_STREAM)
4d4d77e
-		s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
4d4d77e
-	else /* ( type == SOCK_DGRAM) */
4d4d77e
-		s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
4d4d77e
-			
4d4d77e
-	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
4d4d77e
+	memset(&hints, '\0', sizeof(hints));
4d4d77e
+	hints.ai_socktype = type;
4d4d77e
+	hints.ai_flags = AI_ADDRCONFIG;
4d4d77e
+
4d4d77e
+	e = getaddrinfo(host, port, &hints, &res;;
4d4d77e
+	if (e)
4d4d77e
+	{
4d4d77e
+		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e));
4d4d77e
+		if (e == EAI_SYSTEM)
4d4d77e
+			perror("getaddrinfo");
4d4d77e
+		return (0);
4d4d77e
+		}
4d4d77e
 
4d4d77e
+	res0 = res;
4d4d77e
+	while (res)
4d4d77e
+		{
4d4d77e
+		s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
4d4d77e
+		if (s == INVALID_SOCKET)
4d4d77e
+			{
4d4d77e
+			failed_call = "socket";
4d4d77e
+			goto nextres;
4d4d77e
+			}
4d4d77e
 #ifndef OPENSSL_SYS_MPE
4d4d77e
 	if (type == SOCK_STREAM)
4d4d77e
 		{
4d4d77e
-		i=0;
4d4d77e
-		i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
4d4d77e
-		if (i < 0) { perror("keepalive"); return(0); }
4d4d77e
+			int i=0;
4d4d77e
+			i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,
4d4d77e
+				(char *)&i,sizeof(i));
4d4d77e
+			if (i < 0) {
4d4d77e
+				failed_call = "keepalive";
4d4d77e
+				goto nextres;
4d4d77e
+				}
4d4d77e
 		}
4d4d77e
 #endif
4d4d77e
-
4d4d77e
-	if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
4d4d77e
-		{ close(s); perror("connect"); return(0); }
4d4d77e
+		if (connect(s,(struct sockaddr *)res->ai_addr,
4d4d77e
+			res->ai_addrlen) == 0)
4d4d77e
+			{
4d4d77e
+			freeaddrinfo(res0);
4d4d77e
 	*sock=s;
4d4d77e
 	return(1);
4d4d77e
 	}
4d4d77e
+		failed_call = "socket";
4d4d77e
+nextres:
4d4d77e
+		if (s != INVALID_SOCKET)
4d4d77e
+			close(s);
4d4d77e
+		res = res->ai_next;
4d4d77e
+		}
4d4d77e
+	freeaddrinfo(res0);
3849a16
 
3849a16
-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
4d4d77e
+	perror(failed_call);
4d4d77e
+	return(0);
4d4d77e
+	}
3849a16
+
4d4d77e
+int do_server(char *port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context)
4d4d77e
 	{
4d4d77e
 	int sock;
4d4d77e
 	char *name = NULL;
3849a16
@@ -319,33 +326,38 @@ int do_server(int port, int type, int *r
4d4d77e
 		}
4d4d77e
 	}
4d4d77e
 
4d4d77e
-static int init_server_long(int *sock, int port, char *ip, int type)
4d4d77e
+static int init_server(int *sock, char *port, int type)
4d4d77e
 	{
4d4d77e
-	int ret=0;
4d4d77e
-	struct sockaddr_in server;
4d4d77e
-	int s= -1,i;
4d4d77e
+	struct addrinfo *res, *res0, hints;
4d4d77e
+	char * failed_call = NULL;
4d4d77e
+	char port_name[8];
4d4d77e
+	int s;
4d4d77e
+	int e;
4d4d77e
 
4d4d77e
 	if (!ssl_sock_init()) return(0);
4d4d77e
 
4d4d77e
-	memset((char *)&server,0,sizeof(server));
4d4d77e
-	server.sin_family=AF_INET;
4d4d77e
-	server.sin_port=htons((unsigned short)port);
4d4d77e
-	if (ip == NULL)
4d4d77e
-		server.sin_addr.s_addr=INADDR_ANY;
4d4d77e
-	else
4d4d77e
-/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
4d4d77e
-#ifndef BIT_FIELD_LIMITS
4d4d77e
-		memcpy(&server.sin_addr.s_addr,ip,4);
4d4d77e
-#else
4d4d77e
-		memcpy(&server.sin_addr,ip,4);
4d4d77e
-#endif
3849a16
+	memset(&hints, '\0', sizeof(hints));
3849a16
+	hints.ai_socktype = type;
3849a16
+	hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
3849a16
 	
4d4d77e
-		if (type == SOCK_STREAM)
4d4d77e
-			s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
4d4d77e
-		else /* type == SOCK_DGRAM */
4d4d77e
-			s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
4d4d77e
+	e = getaddrinfo(NULL, port, &hints, &res;;
4d4d77e
+	if (e)
4d4d77e
+		{
4d4d77e
+		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e));
4d4d77e
+		if (e == EAI_SYSTEM)
4d4d77e
+			perror("getaddrinfo");
4d4d77e
+		return (0);
4d4d77e
+		}
4d4d77e
 
4d4d77e
-	if (s == INVALID_SOCKET) goto err;
4d4d77e
+	res0 = res;
4d4d77e
+	while (res)
4d4d77e
+		{
4d4d77e
+		s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
4d4d77e
+		if (s == INVALID_SOCKET)
4d4d77e
+			{
4d4d77e
+			failed_call = "socket";
4d4d77e
+			goto nextres;
4d4d77e
+			}
4d4d77e
 #if defined SOL_SOCKET && defined SO_REUSEADDR
4d4d77e
 		{
4d4d77e
 		int j = 1;
3849a16
@@ -353,36 +365,39 @@ static int init_server_long(int *sock, i
4d4d77e
 			   (void *) &j, sizeof j);
4d4d77e
 		}
4d4d77e
 #endif
4d4d77e
-	if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
4d4d77e
+
4d4d77e
+		if (bind(s,(struct sockaddr *)res->ai_addr, res->ai_addrlen) == -1)
4d4d77e
 		{
4d4d77e
-#ifndef OPENSSL_SYS_WINDOWS
4d4d77e
-		perror("bind");
4d4d77e
-#endif
4d4d77e
-		goto err;
4d4d77e
+			failed_call = "bind";
4d4d77e
+			goto nextres;
4d4d77e
 		}
4d4d77e
-	/* Make it 128 for linux */
4d4d77e
-	if (type==SOCK_STREAM && listen(s,128) == -1) goto err;
4d4d77e
-	i=0;
4d4d77e
-	*sock=s;
4d4d77e
-	ret=1;
4d4d77e
-err:
4d4d77e
-	if ((ret == 0) && (s != -1))
4d4d77e
+		if (type==SOCK_STREAM && listen(s,128) == -1)
4d4d77e
 		{
4d4d77e
-		SHUTDOWN(s);
4d4d77e
+			failed_call = "listen";
4d4d77e
+			goto nextres;
4d4d77e
 		}
4d4d77e
-	return(ret);
4d4d77e
+
4d4d77e
+		*sock=s;
4d4d77e
+		return(1);
4d4d77e
+
4d4d77e
+nextres:
4d4d77e
+		if (s != INVALID_SOCKET)
4d4d77e
+			close(s);
4d4d77e
+		res = res->ai_next;
4d4d77e
 	}
4d4d77e
+	freeaddrinfo(res0);
4d4d77e
 
4d4d77e
-static int init_server(int *sock, int port, int type)
4d4d77e
-	{
4d4d77e
-	return(init_server_long(sock, port, NULL, type));
4d4d77e
+	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
4d4d77e
+
4d4d77e
+	perror(failed_call);
4d4d77e
+	return(0);
4d4d77e
 	}
4d4d77e
 
4d4d77e
 static int do_accept(int acc_sock, int *sock, char **host)
4d4d77e
 	{
4d4d77e
-	int ret,i;
4d4d77e
-	struct hostent *h1,*h2;
4d4d77e
-	static struct sockaddr_in from;
4d4d77e
+	static struct sockaddr_storage from;
4d4d77e
+	char buffer[NI_MAXHOST];
4d4d77e
+	int ret;
4d4d77e
 	int len;
4d4d77e
 /*	struct linger ling; */
4d4d77e
 
3849a16
@@ -427,137 +442,62 @@ redoit:
4d4d77e
 	if (i < 0) { perror("keepalive"); return(0); }
4d4d77e
 */
4d4d77e
 
4d4d77e
-	if (host == NULL) goto end;
4d4d77e
-#ifndef BIT_FIELD_LIMITS
4d4d77e
-	/* I should use WSAAsyncGetHostByName() under windows */
4d4d77e
-	h1=gethostbyaddr((char *)&from.sin_addr.s_addr,
4d4d77e
-		sizeof(from.sin_addr.s_addr),AF_INET);
4d4d77e
-#else
4d4d77e
-	h1=gethostbyaddr((char *)&from.sin_addr,
4d4d77e
-		sizeof(struct in_addr),AF_INET);
4d4d77e
-#endif
4d4d77e
-	if (h1 == NULL)
3849a16
-		{
4d4d77e
-		BIO_printf(bio_err,"bad gethostbyaddr\n");
4d4d77e
-		*host=NULL;
4d4d77e
-		/* return(0); */
4d4d77e
-		}
4d4d77e
-	else
3849a16
+	if (host == NULL)
3849a16
 		{
4d4d77e
-		if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
4d4d77e
-			{
4d4d77e
-			perror("OPENSSL_malloc");
4d4d77e
+		*sock=ret;
4d4d77e
 			return(0);
4d4d77e
 			}
4d4d77e
-		BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
4d4d77e
 
4d4d77e
-		h2=GetHostByName(*host);
4d4d77e
-		if (h2 == NULL)
4d4d77e
+	if (getnameinfo((struct sockaddr *)&from, sizeof(from),
4d4d77e
+		buffer, sizeof(buffer),
4d4d77e
+		NULL, 0, 0))
4d4d77e
 			{
4d4d77e
-			BIO_printf(bio_err,"gethostbyname failure\n");
4d4d77e
+		BIO_printf(bio_err,"getnameinfo failed\n");
4d4d77e
+		*host=NULL;
4d4d77e
 			return(0);
4d4d77e
 			}
4d4d77e
-		i=0;
4d4d77e
-		if (h2->h_addrtype != AF_INET)
4d4d77e
+	else
4d4d77e
 			{
4d4d77e
-			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
4d4d77e
+		if ((*host=(char *)OPENSSL_malloc(strlen(buffer)+1)) == NULL)
4d4d77e
+			{
4d4d77e
+			perror("OPENSSL_malloc");
4d4d77e
 			return(0);
4d4d77e
 			}
4d4d77e
-		}
4d4d77e
-end:
4d4d77e
+		strcpy(*host, buffer);
4d4d77e
 	*sock=ret;
4d4d77e
 	return(1);
4d4d77e
 	}
4d4d77e
+	}
4d4d77e
 
4d4d77e
-int extract_host_port(char *str, char **host_ptr, unsigned char *ip,
4d4d77e
-	     short *port_ptr)
4d4d77e
+int extract_host_port(char *str, char **host_ptr, 
4d4d77e
+	     char **port_ptr)
4d4d77e
 	{
4d4d77e
-	char *h,*p;
4d4d77e
+	char *h,*p,*x;
4d4d77e
 
4d4d77e
-	h=str;
4d4d77e
-	p=strchr(str,':');
4d4d77e
+	x=h=str;
4d4d77e
+	if (*h == '[')
4d4d77e
+		{
4d4d77e
+		h++;
4d4d77e
+		p=strchr(h,']');
4d4d77e
 	if (p == NULL)
4d4d77e
 		{
4d4d77e
-		BIO_printf(bio_err,"no port defined\n");
4d4d77e
+			BIO_printf(bio_err,"no ending bracket for IPv6 address\n");
4d4d77e
 		return(0);
4d4d77e
 		}
4d4d77e
 	*(p++)='\0';
4d4d77e
-
4d4d77e
-	if ((ip != NULL) && !host_ip(str,ip))
4d4d77e
-		goto err;
4d4d77e
-	if (host_ptr != NULL) *host_ptr=h;
4d4d77e
-
4d4d77e
-	if (!extract_port(p,port_ptr))
4d4d77e
-		goto err;
4d4d77e
-	return(1);
4d4d77e
-err:
4d4d77e
-	return(0);
4d4d77e
+		x = p;
4d4d77e
 	}
4d4d77e
-
4d4d77e
-static int host_ip(char *str, unsigned char ip[4])
4d4d77e
-	{
4d4d77e
-	unsigned int in[4]; 
4d4d77e
-	int i;
4d4d77e
-
4d4d77e
-	if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4)
4d4d77e
-		{
4d4d77e
-		for (i=0; i<4; i++)
4d4d77e
-			if (in[i] > 255)
4d4d77e
-				{
4d4d77e
-				BIO_printf(bio_err,"invalid IP address\n");
4d4d77e
-				goto err;
4d4d77e
-				}
4d4d77e
-		ip[0]=in[0];
4d4d77e
-		ip[1]=in[1];
4d4d77e
-		ip[2]=in[2];
4d4d77e
-		ip[3]=in[3];
4d4d77e
-		}
4d4d77e
-	else
4d4d77e
-		{ /* do a gethostbyname */
4d4d77e
-		struct hostent *he;
4d4d77e
-
4d4d77e
-		if (!ssl_sock_init()) return(0);
4d4d77e
-
4d4d77e
-		he=GetHostByName(str);
4d4d77e
-		if (he == NULL)
4d4d77e
-			{
4d4d77e
-			BIO_printf(bio_err,"gethostbyname failure\n");
4d4d77e
-			goto err;
4d4d77e
-			}
4d4d77e
-		/* cast to short because of win16 winsock definition */
4d4d77e
-		if ((short)he->h_addrtype != AF_INET)
4d4d77e
+	p=strchr(x,':');
4d4d77e
+	if (p == NULL)
4d4d77e
 			{
4d4d77e
-			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
4d4d77e
-			return(0);
4d4d77e
-			}
4d4d77e
-		ip[0]=he->h_addr_list[0][0];
4d4d77e
-		ip[1]=he->h_addr_list[0][1];
4d4d77e
-		ip[2]=he->h_addr_list[0][2];
4d4d77e
-		ip[3]=he->h_addr_list[0][3];
4d4d77e
-		}
4d4d77e
-	return(1);
4d4d77e
-err:
4d4d77e
+		BIO_printf(bio_err,"no port defined\n");
4d4d77e
 	return(0);
4d4d77e
 	}
4d4d77e
+	*(p++)='\0';
4d4d77e
 
4d4d77e
-int extract_port(char *str, short *port_ptr)
4d4d77e
-	{
4d4d77e
-	int i;
4d4d77e
-	struct servent *s;
4d4d77e
+	if (host_ptr != NULL) *host_ptr=h;
4d4d77e
+	if (port_ptr != NULL) *port_ptr=p;
4d4d77e
 
4d4d77e
-	i=atoi(str);
4d4d77e
-	if (i != 0)
4d4d77e
-		*port_ptr=(unsigned short)i;
4d4d77e
-	else
4d4d77e
-		{
4d4d77e
-		s=getservbyname(str,"tcp");
4d4d77e
-		if (s == NULL)
4d4d77e
-			{
4d4d77e
-			BIO_printf(bio_err,"getservbyname failure for %s\n",str);
4d4d77e
-			return(0);
4d4d77e
-			}
4d4d77e
-		*port_ptr=ntohs((unsigned short)s->s_port);
4d4d77e
-		}
4d4d77e
 	return(1);
4d4d77e
 	}
4d4d77e
 
3849a16
diff -up openssl-0.9.8g/apps/s_server.c.ipv6-apps openssl-0.9.8g/apps/s_server.c
3849a16
--- openssl-0.9.8g/apps/s_server.c.ipv6-apps	2007-08-23 14:16:02.000000000 +0200
3849a16
+++ openssl-0.9.8g/apps/s_server.c	2007-12-03 13:31:14.000000000 +0100
3849a16
@@ -592,7 +592,7 @@ int MAIN(int argc, char *argv[])
3849a16
 	{
3849a16
 	X509_STORE *store = NULL;
3849a16
 	int vflags = 0;
3849a16
-	short port=PORT;
3849a16
+	char *port_str = PORT_STR;
3849a16
 	char *CApath=NULL,*CAfile=NULL;
3849a16
 	unsigned char *context = NULL;
3849a16
 	char *dhfile = NULL;
3849a16
@@ -662,8 +662,7 @@ int MAIN(int argc, char *argv[])
3849a16
 			 (strcmp(*argv,"-accept") == 0))
3849a16
 			{
3849a16
 			if (--argc < 1) goto bad;
3849a16
-			if (!extract_port(*(++argv),&port))
3849a16
-				goto bad;
3849a16
+			port_str= *(++argv);
3849a16
 			}
3849a16
 		else if	(strcmp(*argv,"-verify") == 0)
3849a16
 			{
3849a16
@@ -1332,9 +1331,9 @@ bad:
3849a16
 		}
3849a16
 	BIO_printf(bio_s_out,"ACCEPT\n");
3849a16
 	if (www)
3849a16
-		do_server(port,socket_type,&accept_socket,www_body, context);
3849a16
+		do_server(port_str,socket_type,&accept_socket,www_body, context);
3849a16
 	else
3849a16
-		do_server(port,socket_type,&accept_socket,sv_body, context);
3849a16
+		do_server(port_str,socket_type,&accept_socket,sv_body, context);
3849a16
 	print_stats(bio_s_out,ctx);
3849a16
 	ret=0;
3849a16
 end:
3849a16
diff -up openssl-0.9.8g/apps/s_client.c.ipv6-apps openssl-0.9.8g/apps/s_client.c
3849a16
--- openssl-0.9.8g/apps/s_client.c.ipv6-apps	2007-08-23 14:20:56.000000000 +0200
3849a16
+++ openssl-0.9.8g/apps/s_client.c	2007-12-03 13:28:42.000000000 +0100
3849a16
@@ -285,7 +285,7 @@ int MAIN(int argc, char **argv)
3849a16
 	int cbuf_len,cbuf_off;
3849a16
 	int sbuf_len,sbuf_off;
3849a16
 	fd_set readfds,writefds;
3849a16
-	short port=PORT;
3849a16
+	char *port_str = PORT_STR;
3849a16
 	int full_log=1;
3849a16
 	char *host=SSL_HOST_NAME;
3849a16
 	char *cert_file=NULL,*key_file=NULL;
3849a16
@@ -377,13 +377,12 @@ int MAIN(int argc, char **argv)
3849a16
 		else if	(strcmp(*argv,"-port") == 0)
3849a16
 			{
3849a16
 			if (--argc < 1) goto bad;
3849a16
-			port=atoi(*(++argv));
3849a16
-			if (port == 0) goto bad;
3849a16
+			port_str= *(++argv);
3849a16
 			}
3849a16
 		else if (strcmp(*argv,"-connect") == 0)
3849a16
 			{
3849a16
 			if (--argc < 1) goto bad;
3849a16
-			if (!extract_host_port(*(++argv),&host,NULL,&port))
3849a16
+			if (!extract_host_port(*(++argv),&host,&port_str))
3849a16
 				goto bad;
3849a16
 			}
3849a16
 		else if	(strcmp(*argv,"-verify") == 0)
3849a16
@@ -739,7 +738,7 @@ bad:
3849a16
 
3849a16
 re_start:
3849a16
 
3849a16
-	if (init_client(&s,host,port,sock_type) == 0)
3849a16
+	if (init_client(&s,host,port_str,sock_type) == 0)
3849a16
 		{
3849a16
 		BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
3849a16
 		SHUTDOWN(s);
3849a16
diff -up openssl-0.9.8g/apps/s_apps.h.ipv6-apps openssl-0.9.8g/apps/s_apps.h
3849a16
--- openssl-0.9.8g/apps/s_apps.h.ipv6-apps	2007-12-03 13:28:42.000000000 +0100
3849a16
+++ openssl-0.9.8g/apps/s_apps.h	2007-12-03 13:28:42.000000000 +0100
3849a16
@@ -148,7 +148,7 @@ typedef fd_mask fd_set;
3849a16
 #define PORT_STR        "4433"
3849a16
 #define PROTOCOL        "tcp"
3849a16
 
3849a16
-int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
3849a16
+int do_server(char *port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context);
3849a16
 #ifdef HEADER_X509_H
3849a16
 int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
3849a16
 #endif
3849a16
@@ -156,10 +156,9 @@ int MS_CALLBACK verify_callback(int ok, 
3849a16
 int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
3849a16
 int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key);
3849a16
 #endif
3849a16
-int init_client(int *sock, char *server, int port, int type);
3849a16
+int init_client(int *sock, char *server, char *port, int type);
3849a16
 int should_retry(int i);
3849a16
-int extract_port(char *str, short *port_ptr);
3849a16
-int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
3849a16
+int extract_host_port(char *str,char **host_ptr,char **port_ptr);
3849a16
 
3849a16
 long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
3849a16
 	int argi, long argl, long ret);