diff options
author | Richard Levitte <levitte@openssl.org> | 2016-02-03 00:27:44 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-02-03 19:40:32 +0100 |
commit | d858c87653257185ead1c5baf3d84cd7276dd912 (patch) | |
tree | 88c6ea3d7634e2cd36e4d4910d5d7f81a32562fc /apps/s_server.c | |
parent | 75d5bd4e7d61ba3ed845f9e8170eac6a48a26407 (diff) | |
download | openssl-d858c87653257185ead1c5baf3d84cd7276dd912.zip openssl-d858c87653257185ead1c5baf3d84cd7276dd912.tar.gz openssl-d858c87653257185ead1c5baf3d84cd7276dd912.tar.bz2 |
Refactoring BIO: Adapt BIO_s_datagram and all that depends on it
The control commands that previously took a struct sockaddr * have
been changed to take a BIO_ADDR * instead.
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'apps/s_server.c')
-rw-r--r-- | apps/s_server.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index 6467060..848ba1f 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2432,12 +2432,15 @@ static int init_ssl_connection(SSL *con) unsigned next_proto_neg_len; #endif unsigned char *exportedkeymat; -#ifndef OPENSSL_NO_DTLS - struct sockaddr_storage client; -#endif #ifndef OPENSSL_NO_DTLS if(dtlslisten) { + BIO_ADDR *client = NULL; + + if ((client = BIO_ADDR_new()) == NULL) { + BIO_printf(bio_err, "ERROR - memory\n"); + return 0; + } i = DTLSv1_listen(con, &client); if (i > 0) { BIO *wbio; @@ -2448,11 +2451,12 @@ static int init_ssl_connection(SSL *con) BIO_get_fd(wbio, &fd); } - if(!wbio || connect(fd, (struct sockaddr *)&client, - sizeof(struct sockaddr_storage))) { + if(!wbio || BIO_connect(fd, client, 0) == 0) { BIO_printf(bio_err, "ERROR - unable to connect\n"); + BIO_ADDR_free(client); return 0; } + BIO_ADDR_free(client); dtlslisten = 0; i = SSL_accept(con); } |