Adjust to ObjFW changes
This commit is contained in:
parent
2b9e72b521
commit
794781e979
2 changed files with 16 additions and 21 deletions
|
@ -1,3 +1,3 @@
|
||||||
package_description 1
|
package_format 1
|
||||||
CPPFLAGS="$CPPFLAGS @OPENSSL_CPPFLAGS@"
|
CPPFLAGS="$CPPFLAGS @OPENSSL_CPPFLAGS@"
|
||||||
LIBS="-lobjopenssl @OPENSSL_LIBS@ $LIBS"
|
LIBS="-lobjopenssl @OPENSSL_LIBS@ $LIBS"
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#import "X509Certificate.h"
|
#import "X509Certificate.h"
|
||||||
|
|
||||||
#import <ObjFW/OFAutoreleasePool.h>
|
|
||||||
#import <ObjFW/OFArray.h>
|
#import <ObjFW/OFArray.h>
|
||||||
#import <ObjFW/OFData.h>
|
#import <ObjFW/OFData.h>
|
||||||
#import <ObjFW/OFDictionary.h>
|
#import <ObjFW/OFDictionary.h>
|
||||||
|
@ -71,7 +70,7 @@ OF_ASSUME_NONNULL_END
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
void *pool = objc_autoreleasePoolPush();
|
||||||
OFData *data = [OFData dataWithContentsOfFile: path];
|
OFData *data = [OFData dataWithContentsOfFile: path];
|
||||||
const unsigned char *dataItems = data.items;
|
const unsigned char *dataItems = data.items;
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ OF_ASSUME_NONNULL_END
|
||||||
@throw [OFInitializationFailedException
|
@throw [OFInitializationFailedException
|
||||||
exceptionWithClass: self.class];
|
exceptionWithClass: self.class];
|
||||||
|
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
[self release];
|
[self release];
|
||||||
@throw e;
|
@throw e;
|
||||||
|
@ -161,7 +160,6 @@ OF_ASSUME_NONNULL_END
|
||||||
|
|
||||||
- (OFDictionary *)subjectAlternativeName
|
- (OFDictionary *)subjectAlternativeName
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool;
|
|
||||||
OFMutableDictionary *ret;
|
OFMutableDictionary *ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -169,11 +167,11 @@ OF_ASSUME_NONNULL_END
|
||||||
return [[_subjectAlternativeName copy] autorelease];
|
return [[_subjectAlternativeName copy] autorelease];
|
||||||
|
|
||||||
ret = [OFMutableDictionary dictionary];
|
ret = [OFMutableDictionary dictionary];
|
||||||
pool = [[OFAutoreleasePool alloc] init];
|
|
||||||
|
|
||||||
i = -1;
|
i = -1;
|
||||||
while ((i = X509_get_ext_by_NID(_certificate,
|
while ((i = X509_get_ext_by_NID(_certificate,
|
||||||
NID_subject_alt_name, i)) != -1) {
|
NID_subject_alt_name, i)) != -1) {
|
||||||
|
void *pool = objc_autoreleasePoolPush();
|
||||||
X509_EXTENSION *extension;
|
X509_EXTENSION *extension;
|
||||||
STACK_OF(GENERAL_NAME) *values;
|
STACK_OF(GENERAL_NAME) *values;
|
||||||
int j, count;
|
int j, count;
|
||||||
|
@ -271,10 +269,9 @@ OF_ASSUME_NONNULL_END
|
||||||
}
|
}
|
||||||
|
|
||||||
i++; /* Next extension */
|
i++; /* Next extension */
|
||||||
[pool releaseObjects];
|
objc_autoreleasePoolPop(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
[ret makeImmutable];
|
[ret makeImmutable];
|
||||||
_subjectAlternativeName = [ret retain];
|
_subjectAlternativeName = [ret retain];
|
||||||
|
@ -284,34 +281,34 @@ OF_ASSUME_NONNULL_END
|
||||||
|
|
||||||
- (bool)hasCommonNameMatchingDomain: (OFString *)domain
|
- (bool)hasCommonNameMatchingDomain: (OFString *)domain
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
void *pool = objc_autoreleasePoolPush();
|
||||||
|
|
||||||
for (OFString *name in [[self subject] objectForKey: OID_commonName]) {
|
for (OFString *name in [[self subject] objectForKey: OID_commonName]) {
|
||||||
if ([self X509_isAssertedDomain: name
|
if ([self X509_isAssertedDomain: name
|
||||||
equalDomain: domain]) {
|
equalDomain: domain]) {
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)hasDNSNameMatchingDomain: (OFString *)domain
|
- (bool)hasDNSNameMatchingDomain: (OFString *)domain
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
void *pool = objc_autoreleasePoolPush();
|
||||||
|
|
||||||
for (OFString *name in
|
for (OFString *name in
|
||||||
[[self subjectAlternativeName] objectForKey: @"dNSName"]) {
|
[[self subjectAlternativeName] objectForKey: @"dNSName"]) {
|
||||||
if ([self X509_isAssertedDomain: name
|
if ([self X509_isAssertedDomain: name
|
||||||
equalDomain: domain]) {
|
equalDomain: domain]) {
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +316,7 @@ OF_ASSUME_NONNULL_END
|
||||||
service: (OFString *)service
|
service: (OFString *)service
|
||||||
{
|
{
|
||||||
size_t serviceLength;
|
size_t serviceLength;
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
void *pool = objc_autoreleasePoolPush();
|
||||||
OFDictionary *SANs = self.subjectAlternativeName;
|
OFDictionary *SANs = self.subjectAlternativeName;
|
||||||
OFList *assertedNames = [[SANs objectForKey: @"otherName"]
|
OFList *assertedNames = [[SANs objectForKey: @"otherName"]
|
||||||
objectForKey: OID_SRVName];
|
objectForKey: OID_SRVName];
|
||||||
|
@ -337,13 +334,13 @@ OF_ASSUME_NONNULL_END
|
||||||
serviceLength, name.length - serviceLength)];
|
serviceLength, name.length - serviceLength)];
|
||||||
if ([self X509_isAssertedDomain: asserted
|
if ([self X509_isAssertedDomain: asserted
|
||||||
equalDomain: domain]) {
|
equalDomain: domain]) {
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
objc_autoreleasePoolPop(pool);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,10 +381,10 @@ OF_ASSUME_NONNULL_END
|
||||||
- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name
|
- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name
|
||||||
{
|
{
|
||||||
OFMutableDictionary *dict = [OFMutableDictionary dictionary];
|
OFMutableDictionary *dict = [OFMutableDictionary dictionary];
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
|
||||||
int i, count = X509_NAME_entry_count(name);
|
int i, count = X509_NAME_entry_count(name);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
void *pool = objc_autoreleasePoolPush();
|
||||||
X509OID *key;
|
X509OID *key;
|
||||||
OFString *value;
|
OFString *value;
|
||||||
X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, i);
|
X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, i);
|
||||||
|
@ -402,11 +399,9 @@ OF_ASSUME_NONNULL_END
|
||||||
value = [self X509_stringFromASN1String: str];
|
value = [self X509_stringFromASN1String: str];
|
||||||
[[dict objectForKey: key] appendObject: value];
|
[[dict objectForKey: key] appendObject: value];
|
||||||
|
|
||||||
[pool releaseObjects];
|
objc_autoreleasePoolPop(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
[dict makeImmutable];
|
[dict makeImmutable];
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue