[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Richard Levitte levitte at openssl.org
Sat Dec 19 21:09:27 UTC 2015


The branch OpenSSL_1_0_2-stable has been updated
       via  17592f323ac7dad381cc3b512573c291b1a820c0 (commit)
       via  6d97060ee00518efc99c5d89a78529dc111780fb (commit)
       via  7eb51251252ea0b269227d267512b98495f51bc4 (commit)
       via  2a60fccdd9b696e01fddaa268e92ea210beb0e8f (commit)
      from  f6cadeeeede13239127a2b58970124f4c1f3c217 (commit)


- Log -----------------------------------------------------------------
commit 17592f323ac7dad381cc3b512573c291b1a820c0
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Nov 2 16:43:28 2015 +0100

    BIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it does
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 6d97060ee00518efc99c5d89a78529dc111780fb
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Nov 1 15:56:21 2015 +0100

    Correct or add comments indicating what controls belong to what
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 7eb51251252ea0b269227d267512b98495f51bc4
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Nov 1 15:45:49 2015 +0100

    Document how BIO_get_conn_ip and BIO_get_conn_int_port actually work
    
    No dummy arguments.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 2a60fccdd9b696e01fddaa268e92ea210beb0e8f
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Nov 1 15:42:04 2015 +0100

    Have BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrl
    
    BIO_int_ctrl isn't made for the purpose BIO_get_conn_int_port used it
    for.
    
    This also changes BIO_C_GET_CONNECT to actually return the port
    instead of assigning it to a pointer that was never returned back to
    the caller.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

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

Summary of changes:
 crypto/bio/bio.h             |  8 ++++++--
 crypto/bio/bss_conn.c        | 31 ++++++++++++++++++++-----------
 crypto/bio/bss_dgram.c       |  2 --
 doc/crypto/BIO_s_connect.pod |  4 ++--
 4 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h
index f78796b..6e2293b 100644
--- a/crypto/bio/bio.h
+++ b/crypto/bio/bio.h
@@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo {
 # define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
 # define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
 # define BIO_get_conn_ip(b)               BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
-# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)
+# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,0,NULL)
 
 # define BIO_set_nbio(b,n)       BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
 
-/* BIO_s_accept_socket() */
+/* BIO_s_accept() */
 # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
 # define BIO_get_accept_port(b)  BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
 /* #define BIO_set_nbio(b,n)    BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
@@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo {
 # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
 # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
 
+/* BIO_s_accept() and BIO_s_connect() */
 # define BIO_do_connect(b)       BIO_do_handshake(b)
 # define BIO_do_accept(b)        BIO_do_handshake(b)
 # define BIO_do_handshake(b)     BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
@@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo {
 # define BIO_get_url(b,url)      BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
 # define BIO_get_no_connect_return(b)    BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
 
+/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */
 # define BIO_set_fd(b,fd,c)      BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
 # define BIO_get_fd(b,c)         BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
 
+/* BIO_s_file() */
 # define BIO_set_fp(b,fp,c)      BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
 # define BIO_get_fp(b,fpp)       BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
 
+/* BIO_s_fd() and BIO_s_file() */
 # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
 # define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
 
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index 42d0aff..7d15ad2 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -419,7 +419,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
 {
     BIO *dbio;
     int *ip;
-    const char **pptr;
+    const char **pptr = NULL;
     long ret = 1;
     BIO_CONNECT *data;
 
@@ -442,19 +442,28 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
     case BIO_C_GET_CONNECT:
         if (ptr != NULL) {
             pptr = (const char **)ptr;
-            if (num == 0) {
-                *pptr = data->param_hostname;
+        }
 
-            } else if (num == 1) {
-                *pptr = data->param_port;
-            } else if (num == 2) {
-                *pptr = (char *)&(data->ip[0]);
-            } else if (num == 3) {
-                *((int *)ptr) = data->port;
+        if (b->init) {
+            if (pptr != NULL) {
+                ret = 1;
+                if (num == 0) {
+                    *pptr = data->param_hostname;
+                } else if (num == 1) {
+                    *pptr = data->param_port;
+                } else if (num == 2) {
+                    *pptr = (char *)&(data->ip[0]);
+                } else {
+                    ret = 0;
+                }
+            }
+            if (num == 3) {
+                ret = data->port;
             }
-            if ((!b->init) || (ptr == NULL))
+        } else {
+            if (pptr != NULL)
                 *pptr = "not initialized";
-            ret = 1;
+            ret = 0;
         }
         break;
     case BIO_C_SET_CONNECT:
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 7fcd831..bdd7bf8 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -519,10 +519,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
     switch (cmd) {
     case BIO_CTRL_RESET:
         num = 0;
-    case BIO_C_FILE_SEEK:
         ret = 0;
         break;
-    case BIO_C_FILE_TELL:
     case BIO_CTRL_INFO:
         ret = 0;
         break;
diff --git a/doc/crypto/BIO_s_connect.pod b/doc/crypto/BIO_s_connect.pod
index 18ece4c..345a468 100644
--- a/doc/crypto/BIO_s_connect.pod
+++ b/doc/crypto/BIO_s_connect.pod
@@ -21,8 +21,8 @@ BIO_set_nbio, BIO_do_connect - connect BIO
  long BIO_set_conn_int_port(BIO *b, char *port);
  char *BIO_get_conn_hostname(BIO *b);
  char *BIO_get_conn_port(BIO *b);
- char *BIO_get_conn_ip(BIO *b, dummy);
- long BIO_get_conn_int_port(BIO *b, int port);
+ char *BIO_get_conn_ip(BIO *b);
+ long BIO_get_conn_int_port(BIO *b);
 
  long BIO_set_nbio(BIO *b, long n);
 


More information about the openssl-commits mailing list