Fix a missing copy.
This commit is contained in:
parent
38cd6bd401
commit
8ab05e111a
1 changed files with 12 additions and 8 deletions
|
@ -111,15 +111,17 @@ ssl_locking_callback(int mode, int n, const char *file, int line)
|
||||||
certificateFile: nil];
|
certificateFile: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithSocket: (OFTCPSocket*)socket
|
- initWithSocket: (OFTCPSocket*)socket
|
||||||
privateKeyFile: (OFString*)privateKeyFile_
|
privateKeyFile: (OFString*)privateKeyFile_
|
||||||
certificateFile: (OFString*)certificateFile_
|
certificateFile: (OFString*)certificateFile_
|
||||||
{
|
{
|
||||||
self = [self init];
|
self = [self init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
privateKeyFile = privateKeyFile_;
|
/* FIXME: Also allow with accepted sockets */
|
||||||
certificateFile = certificateFile_;
|
|
||||||
|
privateKeyFile = [privateKeyFile_ copy];
|
||||||
|
certificateFile = [certificateFile_ copy];
|
||||||
|
|
||||||
sock = dup(socket->sock);
|
sock = dup(socket->sock);
|
||||||
|
|
||||||
|
@ -366,18 +368,20 @@ ssl_locking_callback(int mode, int n, const char *file, int line)
|
||||||
- (X509Certificate*)peerCertificate
|
- (X509Certificate*)peerCertificate
|
||||||
{
|
{
|
||||||
X509 *certificate = SSL_get_peer_certificate(ssl);
|
X509 *certificate = SSL_get_peer_certificate(ssl);
|
||||||
|
|
||||||
if (!certificate)
|
if (!certificate)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [[[X509Certificate alloc]
|
return [[[X509Certificate alloc]
|
||||||
initWithX509Struct: certificate] autorelease];
|
initWithX509Struct: certificate] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)verifyPeerCertificate
|
- (void)verifyPeerCertificate
|
||||||
{
|
{
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
if ((SSL_get_peer_certificate(ssl) == NULL)
|
|
||||||
|| ((ret = SSL_get_verify_result(ssl)) != X509_V_OK)) {
|
if ((SSL_get_peer_certificate(ssl) == NULL) ||
|
||||||
|
((ret = SSL_get_verify_result(ssl)) != X509_V_OK)) {
|
||||||
const char *reason = X509_verify_cert_error_string(ret);
|
const char *reason = X509_verify_cert_error_string(ret);
|
||||||
@throw [SSLInvalidCertificateException
|
@throw [SSLInvalidCertificateException
|
||||||
exceptionWithClass: isa
|
exceptionWithClass: isa
|
||||||
|
|
Reference in a new issue