diff options
| author | deraadt <> | 2014-04-13 23:31:37 +0000 |
|---|---|---|
| committer | deraadt <> | 2014-04-13 23:31:37 +0000 |
| commit | 8b4376c3ebaa81d1fc3bb4b652ee026559d79976 (patch) | |
| tree | 89065e5111041f7b870af1a24c15040904c5bf5f /src/lib/libcrypto/bio/bss_dgram.c | |
| parent | 2b180f82f3a7e494cb4e518ec1ea730a000b2dab (diff) | |
| download | openbsd-8b4376c3ebaa81d1fc3bb4b652ee026559d79976.tar.gz openbsd-8b4376c3ebaa81d1fc3bb4b652ee026559d79976.tar.bz2 openbsd-8b4376c3ebaa81d1fc3bb4b652ee026559d79976.zip | |
Remove various horrible socket syscall wrappers, especially SHUTDOWN*
which did shutdown + close, all nasty and surprising. Use the raw
syscalls that everyone knows the behaviour of.
ok beck matthew
Diffstat (limited to 'src/lib/libcrypto/bio/bss_dgram.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_dgram.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index f39f94f7fe..d09c0fc33e 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
| @@ -383,7 +383,7 @@ static int dgram_read(BIO *b, char *out, int outl) | |||
| 383 | 383 | ||
| 384 | if (out != NULL) | 384 | if (out != NULL) |
| 385 | { | 385 | { |
| 386 | clear_socket_error(); | 386 | errno = 0; |
| 387 | memset(&sa.peer, 0x00, sizeof(sa.peer)); | 387 | memset(&sa.peer, 0x00, sizeof(sa.peer)); |
| 388 | dgram_adjust_rcv_timeout(b); | 388 | dgram_adjust_rcv_timeout(b); |
| 389 | ret=recvfrom(b->num,out,outl,0,&sa.peer.sa,(void *)&sa.len); | 389 | ret=recvfrom(b->num,out,outl,0,&sa.peer.sa,(void *)&sa.len); |
| @@ -402,7 +402,7 @@ static int dgram_read(BIO *b, char *out, int outl) | |||
| 402 | if (BIO_dgram_should_retry(ret)) | 402 | if (BIO_dgram_should_retry(ret)) |
| 403 | { | 403 | { |
| 404 | BIO_set_retry_read(b); | 404 | BIO_set_retry_read(b); |
| 405 | data->_errno = get_last_socket_error(); | 405 | data->_errno = errno; |
| 406 | } | 406 | } |
| 407 | } | 407 | } |
| 408 | 408 | ||
| @@ -415,10 +415,10 @@ static int dgram_write(BIO *b, const char *in, int inl) | |||
| 415 | { | 415 | { |
| 416 | int ret; | 416 | int ret; |
| 417 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | 417 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; |
| 418 | clear_socket_error(); | 418 | errno = 0; |
| 419 | 419 | ||
| 420 | if ( data->connected ) | 420 | if ( data->connected ) |
| 421 | ret=writesocket(b->num,in,inl); | 421 | ret=write(b->num,in,inl); |
| 422 | else | 422 | else |
| 423 | { | 423 | { |
| 424 | int peerlen = sizeof(data->peer); | 424 | int peerlen = sizeof(data->peer); |
| @@ -442,7 +442,7 @@ static int dgram_write(BIO *b, const char *in, int inl) | |||
| 442 | if (BIO_dgram_should_retry(ret)) | 442 | if (BIO_dgram_should_retry(ret)) |
| 443 | { | 443 | { |
| 444 | BIO_set_retry_write(b); | 444 | BIO_set_retry_write(b); |
| 445 | data->_errno = get_last_socket_error(); | 445 | data->_errno = errno; |
| 446 | 446 | ||
| 447 | #if 0 /* higher layers are responsible for querying MTU, if necessary */ | 447 | #if 0 /* higher layers are responsible for querying MTU, if necessary */ |
| 448 | if ( data->_errno == EMSGSIZE) | 448 | if ( data->_errno == EMSGSIZE) |
| @@ -1018,7 +1018,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl) | |||
| 1018 | 1018 | ||
| 1019 | if (out != NULL) | 1019 | if (out != NULL) |
| 1020 | { | 1020 | { |
| 1021 | clear_socket_error(); | 1021 | errno = 0; |
| 1022 | 1022 | ||
| 1023 | do | 1023 | do |
| 1024 | { | 1024 | { |
| @@ -1180,7 +1180,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl) | |||
| 1180 | if (BIO_dgram_should_retry(ret)) | 1180 | if (BIO_dgram_should_retry(ret)) |
| 1181 | { | 1181 | { |
| 1182 | BIO_set_retry_read(b); | 1182 | BIO_set_retry_read(b); |
| 1183 | data->_errno = get_last_socket_error(); | 1183 | data->_errno = errno; |
| 1184 | } | 1184 | } |
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
| @@ -1238,7 +1238,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl) | |||
| 1238 | struct sctp_sndrcvinfo *sndrcvinfo; | 1238 | struct sctp_sndrcvinfo *sndrcvinfo; |
| 1239 | #endif | 1239 | #endif |
| 1240 | 1240 | ||
| 1241 | clear_socket_error(); | 1241 | errno = 0; |
| 1242 | 1242 | ||
| 1243 | /* If we're send anything else than application data, | 1243 | /* If we're send anything else than application data, |
| 1244 | * disable all user parameters and flags. | 1244 | * disable all user parameters and flags. |
| @@ -1321,7 +1321,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl) | |||
| 1321 | if (BIO_dgram_should_retry(ret)) | 1321 | if (BIO_dgram_should_retry(ret)) |
| 1322 | { | 1322 | { |
| 1323 | BIO_set_retry_write(b); | 1323 | BIO_set_retry_write(b); |
| 1324 | data->_errno = get_last_socket_error(); | 1324 | data->_errno = errno; |
| 1325 | } | 1325 | } |
| 1326 | } | 1326 | } |
| 1327 | return(ret); | 1327 | return(ret); |
| @@ -1596,7 +1596,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b) | |||
| 1596 | n = recvmsg(b->num, &msg, MSG_PEEK); | 1596 | n = recvmsg(b->num, &msg, MSG_PEEK); |
| 1597 | if (n <= 0) | 1597 | if (n <= 0) |
| 1598 | { | 1598 | { |
| 1599 | if ((n < 0) && (get_last_socket_error() != EAGAIN) && (get_last_socket_error() != EWOULDBLOCK)) | 1599 | if ((n < 0) && (errno != EAGAIN) && (errno != EWOULDBLOCK)) |
| 1600 | return -1; | 1600 | return -1; |
| 1601 | else | 1601 | else |
| 1602 | return 0; | 1602 | return 0; |
| @@ -1619,7 +1619,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b) | |||
| 1619 | n = recvmsg(b->num, &msg, 0); | 1619 | n = recvmsg(b->num, &msg, 0); |
| 1620 | if (n <= 0) | 1620 | if (n <= 0) |
| 1621 | { | 1621 | { |
| 1622 | if ((n < 0) && (get_last_socket_error() != EAGAIN) && (get_last_socket_error() != EWOULDBLOCK)) | 1622 | if ((n < 0) && (errno != EAGAIN) && (errno != EWOULDBLOCK)) |
| 1623 | return -1; | 1623 | return -1; |
| 1624 | else | 1624 | else |
| 1625 | return is_dry; | 1625 | return is_dry; |
| @@ -1686,7 +1686,7 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b) | |||
| 1686 | 1686 | ||
| 1687 | if (n <= 0) | 1687 | if (n <= 0) |
| 1688 | { | 1688 | { |
| 1689 | if ((n < 0) && (get_last_socket_error() != EAGAIN) && (get_last_socket_error() != EWOULDBLOCK)) | 1689 | if ((n < 0) && (errno != EAGAIN) && (errno != EWOULDBLOCK)) |
| 1690 | return -1; | 1690 | return -1; |
| 1691 | else | 1691 | else |
| 1692 | return is_dry; | 1692 | return is_dry; |
| @@ -1773,7 +1773,7 @@ static int BIO_dgram_should_retry(int i) | |||
| 1773 | 1773 | ||
| 1774 | if ((i == 0) || (i == -1)) | 1774 | if ((i == 0) || (i == -1)) |
| 1775 | { | 1775 | { |
| 1776 | err=get_last_socket_error(); | 1776 | err=errno; |
| 1777 | 1777 | ||
| 1778 | #if defined(OPENSSL_SYS_WINDOWS) | 1778 | #if defined(OPENSSL_SYS_WINDOWS) |
| 1779 | /* If the socket return value (i) is -1 | 1779 | /* If the socket return value (i) is -1 |
