{
int ret;
+ i_assert(type != OPENSSL_IOSTREAM_SYNC_TYPE_NONE);
+
ret = openssl_iostream_bio_output(ssl_io);
if (ret >= 0 && openssl_iostream_bio_input(ssl_io, type) > 0)
ret = 1;
err = SSL_get_error(ssl_io->ssl, ret);
switch (err) {
case SSL_ERROR_WANT_WRITE:
- if (openssl_iostream_bio_sync(ssl_io, type) == 0) {
+ if (type != OPENSSL_IOSTREAM_SYNC_TYPE_NONE &&
+ openssl_iostream_bio_sync(ssl_io, type) == 0) {
if (type != OPENSSL_IOSTREAM_SYNC_TYPE_WRITE)
i_panic("SSL ostream buffer size not unlimited");
return 0;
openssl_iostream_closed(ssl_io);
return -1;
}
+ if (type == OPENSSL_IOSTREAM_SYNC_TYPE_NONE)
+ return 0;
return 1;
case SSL_ERROR_WANT_READ:
ssl_io->want_read = TRUE;
- (void)openssl_iostream_bio_sync(ssl_io, type);
+ if (type != OPENSSL_IOSTREAM_SYNC_TYPE_NONE)
+ (void)openssl_iostream_bio_sync(ssl_io, type);
if (ssl_io->closed) {
openssl_iostream_closed(ssl_io);
return -1;
}
+ if (type == OPENSSL_IOSTREAM_SYNC_TYPE_NONE)
+ return 0;
return ssl_io->want_read ? 0 : 1;
case SSL_ERROR_SYSCALL:
/* eat up the error queue */
# define ASN1_STRING_get0_data(str) ASN1_STRING_data(str)
#endif
enum openssl_iostream_sync_type {
+ OPENSSL_IOSTREAM_SYNC_TYPE_NONE,
OPENSSL_IOSTREAM_SYNC_TYPE_FIRST_READ,
OPENSSL_IOSTREAM_SYNC_TYPE_CONTINUE_READ,
OPENSSL_IOSTREAM_SYNC_TYPE_WRITE,