Adjust to ObjFW changes
This commit is contained in:
parent
bdd641b92d
commit
9e17e042cb
1 changed files with 27 additions and 1 deletions
|
@ -380,7 +380,9 @@ lockingCallback(int mode, int n, const char *file, int line)
|
||||||
[super asyncConnectToHost: host
|
[super asyncConnectToHost: host
|
||||||
port: port
|
port: port
|
||||||
runLoopMode: runLoopMode
|
runLoopMode: runLoopMode
|
||||||
block: ^ (SSLSocket *sock, id exception) {
|
block: ^ (OFTCPSocket *sock_, id exception) {
|
||||||
|
SSLSocket *sock = (SSLSocket *)sock_;
|
||||||
|
|
||||||
if (exception == nil) {
|
if (exception == nil) {
|
||||||
@try {
|
@try {
|
||||||
[sock SSL_startTLSWithExpectedHost: host
|
[sock SSL_startTLSWithExpectedHost: host
|
||||||
|
@ -448,6 +450,16 @@ lockingCallback(int mode, int n, const char *file, int line)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is no SSL session yet. However, it might be necessary to read
|
||||||
|
* from and write to the socket before negotiating an SSL session: For
|
||||||
|
* example, the socket might be connected to a SOCKS5 proxy and needs
|
||||||
|
* to establish a SOCKS5 connection before negotiating an SSL session.
|
||||||
|
*/
|
||||||
|
if (_SSL == NULL)
|
||||||
|
return [super lowlevelReadIntoBuffer: buffer
|
||||||
|
length: length];
|
||||||
|
|
||||||
if (length > INT_MAX)
|
if (length > INT_MAX)
|
||||||
@throw [OFOutOfRangeException exception];
|
@throw [OFOutOfRangeException exception];
|
||||||
|
|
||||||
|
@ -479,6 +491,20 @@ lockingCallback(int mode, int n, const char *file, int line)
|
||||||
{
|
{
|
||||||
int bytesWritten;
|
int bytesWritten;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is no SSL session yet. However, it might be necessary to read
|
||||||
|
* from and write to the socket before negotiating an SSL session: For
|
||||||
|
* example, the socket might be connected to a SOCKS5 proxy and needs
|
||||||
|
* to establish a SOCKS5 connection before negotiating an SSL session.
|
||||||
|
*
|
||||||
|
* TODO: Think of a way to make this safer, so that it's impossible to
|
||||||
|
* forget to establish an SSL session and then send unencrypted data by
|
||||||
|
* accident.
|
||||||
|
*/
|
||||||
|
if (_SSL == NULL)
|
||||||
|
return [super lowlevelWriteBuffer: buffer
|
||||||
|
length: length];
|
||||||
|
|
||||||
if (_socket == INVALID_SOCKET)
|
if (_socket == INVALID_SOCKET)
|
||||||
@throw [OFNotOpenException exceptionWithObject: self];
|
@throw [OFNotOpenException exceptionWithObject: self];
|
||||||
|
|
||||||
|
|
Reference in a new issue