Fix BIO_set_nbio_accept()
authorRichard Levitte <levitte@openssl.org>
Thu, 28 Apr 2016 15:39:26 +0000 (17:39 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 28 Apr 2016 16:00:25 +0000 (18:00 +0200)
The code that implements this control would work when enabling nbio,
but the disabling code needed fixing.

Reviewed-by: Matt Caswell <matt@openssl.org>
crypto/bio/bss_acpt.c

index 8cd66fe1ee0757200e2fe29f60657e15e24397ab..70168ecd596a49c6de9aa5ad7f18151fd38bdc94 100644 (file)
@@ -474,16 +474,17 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
                 data->param_serv = BUF_strdup(ptr);
                 b->init = 1;
             } else if (num == 2) {
-                if (ptr != NULL)
-                    data->bind_mode |= BIO_SOCK_NONBLOCK;
-                else
-                    data->bind_mode &= ~BIO_SOCK_NONBLOCK;
+                data->bind_mode |= BIO_SOCK_NONBLOCK;
             } else if (num == 3) {
                 BIO_free(data->bio_chain);
                 data->bio_chain = (BIO *)ptr;
             } else if (num == 4) {
                 data->accept_family = *(int *)ptr;
             }
+        } else {
+            if (num == 2) {
+                data->bind_mode &= ~BIO_SOCK_NONBLOCK;
+            }
         }
         break;
     case BIO_C_SET_NBIO: