OpenSSL 1.1.1-pre2
This commit is contained in:
+23
-27
@@ -58,7 +58,11 @@ void BIO_CONNECT_free(BIO_CONNECT *a);
|
||||
static const BIO_METHOD methods_connectp = {
|
||||
BIO_TYPE_CONNECT,
|
||||
"socket connect",
|
||||
/* TODO: Convert to new style write function */
|
||||
bwrite_conv,
|
||||
conn_write,
|
||||
/* TODO: Convert to new style read function */
|
||||
bread_conv,
|
||||
conn_read,
|
||||
conn_puts,
|
||||
NULL, /* conn_gets, */
|
||||
@@ -212,7 +216,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
|
||||
if (cb != NULL)
|
||||
ret = cb((BIO *)b, c->state, ret);
|
||||
end:
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BIO_CONNECT *BIO_CONNECT_new(void)
|
||||
@@ -220,10 +224,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
|
||||
BIO_CONNECT *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
ret->state = BIO_CONN_S_BEFORE;
|
||||
ret->connect_family = BIO_FAMILY_IPANY;
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BIO_CONNECT_free(BIO_CONNECT *a)
|
||||
@@ -239,7 +243,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
|
||||
|
||||
const BIO_METHOD *BIO_s_connect(void)
|
||||
{
|
||||
return (&methods_connectp);
|
||||
return &methods_connectp;
|
||||
}
|
||||
|
||||
static int conn_new(BIO *bi)
|
||||
@@ -248,9 +252,9 @@ static int conn_new(BIO *bi)
|
||||
bi->num = (int)INVALID_SOCKET;
|
||||
bi->flags = 0;
|
||||
if ((bi->ptr = (char *)BIO_CONNECT_new()) == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
else
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void conn_close_socket(BIO *bio)
|
||||
@@ -272,7 +276,7 @@ static int conn_free(BIO *a)
|
||||
BIO_CONNECT *data;
|
||||
|
||||
if (a == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
data = (BIO_CONNECT *)a->ptr;
|
||||
|
||||
if (a->shutdown) {
|
||||
@@ -282,7 +286,7 @@ static int conn_free(BIO *a)
|
||||
a->flags = 0;
|
||||
a->init = 0;
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int conn_read(BIO *b, char *out, int outl)
|
||||
@@ -294,7 +298,7 @@ static int conn_read(BIO *b, char *out, int outl)
|
||||
if (data->state != BIO_CONN_S_OK) {
|
||||
ret = conn_state(b, data);
|
||||
if (ret <= 0)
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (out != NULL) {
|
||||
@@ -306,7 +310,7 @@ static int conn_read(BIO *b, char *out, int outl)
|
||||
BIO_set_retry_read(b);
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int conn_write(BIO *b, const char *in, int inl)
|
||||
@@ -318,7 +322,7 @@ static int conn_write(BIO *b, const char *in, int inl)
|
||||
if (data->state != BIO_CONN_S_OK) {
|
||||
ret = conn_state(b, data);
|
||||
if (ret <= 0)
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
clear_socket_error();
|
||||
@@ -328,7 +332,7 @@ static int conn_write(BIO *b, const char *in, int inl)
|
||||
if (BIO_sock_should_retry(ret))
|
||||
BIO_set_retry_write(b);
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
@@ -473,15 +477,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_SET_CALLBACK:
|
||||
{
|
||||
# if 0 /* FIXME: Should this be used? -- Richard
|
||||
* Levitte */
|
||||
BIOerr(BIO_F_CONN_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
ret = -1;
|
||||
# else
|
||||
ret = 0;
|
||||
# endif
|
||||
}
|
||||
ret = 0; /* use callback ctrl */
|
||||
break;
|
||||
case BIO_CTRL_GET_CALLBACK:
|
||||
{
|
||||
@@ -495,7 +491,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long conn_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
@@ -515,7 +511,7 @@ static long conn_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int conn_puts(BIO *bp, const char *str)
|
||||
@@ -524,7 +520,7 @@ static int conn_puts(BIO *bp, const char *str)
|
||||
|
||||
n = strlen(str);
|
||||
ret = conn_write(bp, str, n);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BIO *BIO_new_connect(const char *str)
|
||||
@@ -533,11 +529,11 @@ BIO *BIO_new_connect(const char *str)
|
||||
|
||||
ret = BIO_new(BIO_s_connect());
|
||||
if (ret == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
if (BIO_set_conn_hostname(ret, str))
|
||||
return (ret);
|
||||
return ret;
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user