[openssl-commits] [openssl] master update

Kurt Roeckx kurt at openssl.org
Thu Feb 4 15:06:24 UTC 2016


The branch master has been updated
       via  c86d1f19fc69adacdd8d5955193330e18a0c7ebb (commit)
      from  df057ea6c8a20e4babc047689507dfafde59ffd6 (commit)


- Log -----------------------------------------------------------------
commit c86d1f19fc69adacdd8d5955193330e18a0c7ebb
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Thu Feb 4 15:20:26 2016 +0100

    Use WSAGetLastError() on windows
    
    Windows doesn't have h_error or hstrerror()
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    
    MR: #1848

-----------------------------------------------------------------------

Summary of changes:
 crypto/bio/b_addr.c   | 8 ++++++++
 crypto/err/err.c      | 1 +
 include/openssl/err.h | 1 +
 3 files changed, 10 insertions(+)

diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 8f94fe8..61714e5 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -715,8 +715,12 @@ int BIO_lookup(const char *host, const char *service,
             he = gethostbyname(host);
 
             if (he == NULL) {
+#ifndef OPENSSL_SYS_WINDOWS
                 BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
                 ERR_add_error_data(1, hstrerror(h_errno));
+#else
+                SYSerr(SYS_F_GETHOSTBYNAME, WSAGetLastError());
+#endif
                 ret = 0;
                 goto err;
             }
@@ -747,8 +751,12 @@ int BIO_lookup(const char *host, const char *service,
                 se = getservbyname(service, proto);
 
                 if (se == NULL) {
+#ifndef OPENSSL_SYS_WINDOWS
                     BIOerr(BIO_F_BIO_LOOKUP, ERR_R_SYS_LIB);
                     ERR_add_error_data(1, hstrerror(h_errno));
+#else
+                    SYSerr(SYS_F_GETSERVBYNAME, WSAGetLastError());
+#endif
                     goto err;
                 }
             } else {
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 6cb582d..64f8adc 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -178,6 +178,7 @@ static ERR_STRING_DATA ERR_str_functs[] = {
     {ERR_PACK(0, SYS_F_SETSOCKOPT, 0), "setsockopt"},
     {ERR_PACK(0, SYS_F_GETSOCKOPT, 0), "getsockopt"},
     {ERR_PACK(0, SYS_F_GETSOCKNAME, 0), "getsockname"},
+    {ERR_PACK(0, SYS_F_GETHOSTBYNAME, 0), "gethostbyname"},
     {0, NULL},
 };
 
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 370763c..8baf6b7 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -262,6 +262,7 @@ typedef struct err_state_st {
 # define SYS_F_SETSOCKOPT        14
 # define SYS_F_GETSOCKOPT        15
 # define SYS_F_GETSOCKNAME       16
+# define SYS_F_GETHOSTBYNAME     17
 
 /* reasons */
 # define ERR_R_SYS_LIB   ERR_LIB_SYS/* 2 */


More information about the openssl-commits mailing list