mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
add gnustlsFileSystemRepresentation for mingw
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38965 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a79ff46c2d
commit
04c34a8c75
1 changed files with 35 additions and 6 deletions
|
@ -42,6 +42,35 @@
|
||||||
|
|
||||||
#import "GSPrivate.h"
|
#import "GSPrivate.h"
|
||||||
|
|
||||||
|
@interface NSString(gnutlsFileSystemRepresentation)
|
||||||
|
- (const char*) gnutlsFileSystemRepresentation;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSString(gnutlsFileSystemRepresentation)
|
||||||
|
- (const char*) gnutlsFileSystemRepresentation
|
||||||
|
{
|
||||||
|
#if defined(__MINGW__)
|
||||||
|
const unichar *buf = (const unichar*)[self fileSystemRepresentation];
|
||||||
|
int len = 0;
|
||||||
|
NSString *str;
|
||||||
|
const char *result;
|
||||||
|
|
||||||
|
while (buf[len] > 0)
|
||||||
|
{
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
str = [[NSString alloc] initWithBytes: buf
|
||||||
|
length: len * 2
|
||||||
|
encoding: NSUnicodeStringEncoding];
|
||||||
|
result = [str UTF8String];
|
||||||
|
RELEASE(str);
|
||||||
|
return result;
|
||||||
|
#else
|
||||||
|
return [self fileSystemRepresentation];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
/* Constants to control TLS/SSL (options).
|
/* Constants to control TLS/SSL (options).
|
||||||
*/
|
*/
|
||||||
NSString * const GSTLSCAFile = @"GSTLSCAFile";
|
NSString * const GSTLSCAFile = @"GSTLSCAFile";
|
||||||
|
@ -1045,7 +1074,7 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
const char *path;
|
const char *path;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
path = [dca fileSystemRepresentation];
|
path = [dca gnutlsFileSystemRepresentation];
|
||||||
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
|
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
|
||||||
path, GNUTLS_X509_FMT_PEM);
|
path, GNUTLS_X509_FMT_PEM);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -1074,7 +1103,7 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
const char *path;
|
const char *path;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
path = [dca fileSystemRepresentation];
|
path = [dca gnutlsFileSystemRepresentation];
|
||||||
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
|
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
|
||||||
path, GNUTLS_X509_FMT_PEM);
|
path, GNUTLS_X509_FMT_PEM);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -1106,7 +1135,7 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
const char *path;
|
const char *path;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
path = [drv fileSystemRepresentation];
|
path = [drv gnutlsFileSystemRepresentation];
|
||||||
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
|
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
|
||||||
path, GNUTLS_X509_FMT_PEM);
|
path, GNUTLS_X509_FMT_PEM);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -1130,7 +1159,7 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
const char *path;
|
const char *path;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
path = [rv fileSystemRepresentation];
|
path = [rv gnutlsFileSystemRepresentation];
|
||||||
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
|
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
|
||||||
path, GNUTLS_X509_FMT_PEM);
|
path, GNUTLS_X509_FMT_PEM);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -1468,8 +1497,6 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
}
|
}
|
||||||
else if ([pri isEqual: NSStreamSocketSecurityLevelSSLv3] == YES)
|
else if ([pri isEqual: NSStreamSocketSecurityLevelSSLv3] == YES)
|
||||||
{
|
{
|
||||||
GSOnceMLog(@"NSStreamSocketSecurityLevelSSLv3 is insecure ..."
|
|
||||||
@" please change your code to stop using it");
|
|
||||||
#if GNUTLS_VERSION_NUMBER < 0x020C00
|
#if GNUTLS_VERSION_NUMBER < 0x020C00
|
||||||
const int proto_prio[2] = {
|
const int proto_prio[2] = {
|
||||||
GNUTLS_SSL3,
|
GNUTLS_SSL3,
|
||||||
|
@ -1479,6 +1506,8 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
gnutls_priority_set_direct(session,
|
gnutls_priority_set_direct(session,
|
||||||
"NORMAL:-VERS-TLS-ALL:+VERS-SSL3.0", NULL);
|
"NORMAL:-VERS-TLS-ALL:+VERS-SSL3.0", NULL);
|
||||||
#endif
|
#endif
|
||||||
|
GSOnceMLog(@"NSStreamSocketSecurityLevelSSLv3 is insecure ..."
|
||||||
|
@" please change your code to stop using it");
|
||||||
}
|
}
|
||||||
else if ([pri isEqual: NSStreamSocketSecurityLevelTLSv1] == YES)
|
else if ([pri isEqual: NSStreamSocketSecurityLevelTLSv1] == YES)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue