PR: 2512
authorDr. Stephen Henson <steve@openssl.org>
Wed, 25 May 2011 12:36:50 +0000 (12:36 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 25 May 2011 12:36:50 +0000 (12:36 +0000)
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de>
Reviewed by: steve

Fix BIO_accept so it can be bound to IPv4 or IPv6 sockets consistently.

crypto/bio/b_sock.c

index 54112e6ebe4eaca20b5e7438bc114e0ece684ab7..d47310d650c57ec71cb892eaab38216eea6ebbc2 100644 (file)
@@ -683,6 +683,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
         * note that commonly IPv6 wildchard socket can service
         * IPv4 connections just as well...  */
        memset(&hint,0,sizeof(hint));
+       hint.ai_flags = AI_PASSIVE;
        if (h)
                {
                if (strchr(h,':'))
@@ -695,7 +696,10 @@ int BIO_get_accept_socket(char *host, int bind_mode)
 #endif
                        }
                else if (h[0]=='*' && h[1]=='\0')
+                       {
+                       hint.ai_family = AF_INET;
                        h=NULL;
+                       }
                }
 
        if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;