Author: rfm
Date: Wed Sep 2 19:23:07 2015
New Revision: 38965
URL: http://svn.gna.org/viewcvs/gnustep?rev=38965&view=rev
Log:
add gnustlsFileSystemRepresentation for mingw
Modified:
libs/base/trunk/Source/GSTLS.m
Modified: libs/base/trunk/Source/GSTLS.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSTLS.m?rev=38965&r1=38964&r2=38965&view=diff
==============================================================================
--- libs/base/trunk/Source/GSTLS.m (original)
+++ libs/base/trunk/Source/GSTLS.m Wed Sep 2 19:23:07 2015
@@ -41,6 +41,35 @@
#import "GSTLS.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).
*/
@@ -1045,7 +1074,7 @@
const char *path;
int ret;
- path = [dca fileSystemRepresentation];
+ path = [dca gnutlsFileSystemRepresentation];
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
path, GNUTLS_X509_FMT_PEM);
if (ret < 0)
@@ -1074,7 +1103,7 @@
const char *path;
int ret;
- path = [dca fileSystemRepresentation];
+ path = [dca gnutlsFileSystemRepresentation];
ret = gnutls_certificate_set_x509_trust_file(c->certcred,
path, GNUTLS_X509_FMT_PEM);
if (ret < 0)
@@ -1106,7 +1135,7 @@
const char *path;
int ret;
- path = [drv fileSystemRepresentation];
+ path = [drv gnutlsFileSystemRepresentation];
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
path, GNUTLS_X509_FMT_PEM);
if (ret < 0)
@@ -1130,7 +1159,7 @@
const char *path;
int ret;
- path = [rv fileSystemRepresentation];
+ path = [rv gnutlsFileSystemRepresentation];
ret = gnutls_certificate_set_x509_crl_file(c->certcred,
path, GNUTLS_X509_FMT_PEM);
if (ret < 0)
@@ -1468,8 +1497,6 @@
}
else if ([pri isEqual: NSStreamSocketSecurityLevelSSLv3] == YES)
{
- GSOnceMLog(@"NSStreamSocketSecurityLevelSSLv3 is insecure ..."
- @" please change your code to stop using it");
#if GNUTLS_VERSION_NUMBER < 0x020C00
const int proto_prio[2] = {
GNUTLS_SSL3,
@@ -1479,6 +1506,8 @@
gnutls_priority_set_direct(session,
"NORMAL:-VERS-TLS-ALL:+VERS-SSL3.0", NULL);
#endif
+ GSOnceMLog(@"NSStreamSocketSecurityLevelSSLv3 is insecure ..."
+ @" please change your code to stop using it");
}
else if ([pri isEqual: NSStreamSocketSecurityLevelTLSv1] == YES)
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs