diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2017-12-01 18:00:20 +0500 |
---|---|---|
committer | Vladislav Grishenko <themiron@mail.ru> | 2017-12-30 22:49:02 +0500 |
commit | ae45db860e6fe628c8e2fa107ee6b7dacd3aacbe (patch) | |
tree | ad9687697f2f28db1c2dab9aeea5bc4637e82476 /accel-pppd/ctrl | |
parent | 6eb32046351a0efd702db74c7e8521c4fcdb7bee (diff) | |
download | accel-ppp-ae45db860e6fe628c8e2fa107ee6b7dacd3aacbe.tar.gz accel-ppp-ae45db860e6fe628c8e2fa107ee6b7dacd3aacbe.zip |
sstp: fix eof result of ssl read/write ops although no harm was really happened
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/sstp/sstp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c index 9ecd1f6e..5953a1ca 100644 --- a/accel-pppd/ctrl/sstp/sstp.c +++ b/accel-pppd/ctrl/sstp/sstp.c @@ -406,20 +406,21 @@ static ssize_t ssl_stream_read(struct sstp_stream_t *stream, void *buf, size_t c ERR_clear_error(); ret = SSL_read(stream->ssl, buf, count); + if (ret > 0) + return ret; + err = SSL_get_error(stream->ssl, ret); switch (err) { - case SSL_ERROR_NONE: - case SSL_ERROR_ZERO_RETURN: - return ret; case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_READ: errno = EAGAIN; /* fall through */ + case SSL_ERROR_ZERO_RETURN: case SSL_ERROR_SYSCALL: - return -1; + return ret; default: errno = EIO; - return -1; + return ret; } } @@ -429,20 +430,21 @@ static ssize_t ssl_stream_write(struct sstp_stream_t *stream, const void *buf, s ERR_clear_error(); ret = SSL_write(stream->ssl, buf, count); + if (ret > 0) + return ret; + err = SSL_get_error(stream->ssl, ret); switch (err) { - case SSL_ERROR_NONE: - case SSL_ERROR_ZERO_RETURN: - return ret; case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_READ: errno = EAGAIN; /* fall through */ + case SSL_ERROR_ZERO_RETURN: case SSL_ERROR_SYSCALL: - return -1; + return ret; default: errno = EIO; - return -1; + return ret; } } |