Update to recent ObjFW changes.
This commit is contained in:
parent
7b07a24ec4
commit
7c35be965c
5 changed files with 51 additions and 47 deletions
|
@ -96,7 +96,7 @@
|
||||||
char *node;
|
char *node;
|
||||||
Stringprep_rc rc;
|
Stringprep_rc rc;
|
||||||
|
|
||||||
if ((rc = stringprep_profile([username_ cString], &node,
|
if ((rc = stringprep_profile([username_ UTF8String], &node,
|
||||||
"SASLprep", 0)) != STRINGPREP_OK)
|
"SASLprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException newWithClass: isa
|
@throw [XMPPStringPrepFailedException newWithClass: isa
|
||||||
connection: self
|
connection: self
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
string: username_];
|
string: username_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
username = [[OFString alloc] initWithCString: node];
|
username = [[OFString alloc] initWithUTF8String: node];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
char *res;
|
char *res;
|
||||||
Stringprep_rc rc;
|
Stringprep_rc rc;
|
||||||
|
|
||||||
if ((rc = stringprep_profile([resource_ cString], &res,
|
if ((rc = stringprep_profile([resource_ UTF8String], &res,
|
||||||
"Resourceprep", 0)) != STRINGPREP_OK)
|
"Resourceprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException
|
@throw [XMPPStringPrepFailedException
|
||||||
newWithClass: isa
|
newWithClass: isa
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
string: resource_];
|
string: resource_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
resource = [[OFString alloc] initWithCString: res];
|
resource = [[OFString alloc] initWithUTF8String: res];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(res);
|
free(res);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
char *srv;
|
char *srv;
|
||||||
Idna_rc rc;
|
Idna_rc rc;
|
||||||
|
|
||||||
if ((rc = idna_to_ascii_8z([server_ cString],
|
if ((rc = idna_to_ascii_8z([server_ UTF8String],
|
||||||
&srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
|
&srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
|
||||||
@throw [XMPPIDNATranslationFailedException
|
@throw [XMPPIDNATranslationFailedException
|
||||||
newWithClass: isa
|
newWithClass: isa
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
string: server_];
|
string: server_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
server = [[OFString alloc] initWithCString: srv];
|
server = [[OFString alloc] initWithUTF8String: srv];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(srv);
|
free(srv);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
char *srv;
|
char *srv;
|
||||||
Stringprep_rc rc;
|
Stringprep_rc rc;
|
||||||
|
|
||||||
if ((rc = stringprep_profile([domain_ cString], &srv,
|
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
|
||||||
"Nameprep", 0)) != STRINGPREP_OK)
|
"Nameprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException newWithClass: isa
|
@throw [XMPPStringPrepFailedException newWithClass: isa
|
||||||
connection: self
|
connection: self
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
string: domain_];
|
string: domain_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
domain = [[OFString alloc] initWithCString: srv];
|
domain = [[OFString alloc] initWithUTF8String: srv];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(srv);
|
free(srv);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
char *pass;
|
char *pass;
|
||||||
Stringprep_rc rc;
|
Stringprep_rc rc;
|
||||||
|
|
||||||
if ((rc = stringprep_profile([password_ cString], &pass,
|
if ((rc = stringprep_profile([password_ UTF8String], &pass,
|
||||||
"SASLprep", 0)) != STRINGPREP_OK)
|
"SASLprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException newWithClass: isa
|
@throw [XMPPStringPrepFailedException newWithClass: isa
|
||||||
connection: self
|
connection: self
|
||||||
|
@ -214,7 +214,7 @@
|
||||||
string: password_];
|
string: password_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
password = [[OFString alloc] initWithCString: pass];
|
password = [[OFString alloc] initWithUTF8String: pass];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(pass);
|
free(pass);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
[sock connectToHost: server
|
[sock connectToHost: server
|
||||||
port: port];
|
port: port];
|
||||||
else {
|
else {
|
||||||
if ((rc = idna_to_ascii_8z([domain cString], &cDomainToASCII,
|
if ((rc = idna_to_ascii_8z([domain UTF8String], &cDomainToASCII,
|
||||||
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
|
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
|
||||||
@throw [XMPPIDNATranslationFailedException
|
@throw [XMPPIDNATranslationFailedException
|
||||||
newWithClass: isa
|
newWithClass: isa
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
domainToASCII = [OFString
|
domainToASCII = [OFString
|
||||||
stringWithCString: cDomainToASCII];
|
stringWithUTF8String: cDomainToASCII];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(cDomainToASCII);
|
free(cDomainToASCII);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = stringprep_profile([node_ cString], &nodepart,
|
if ((rc = stringprep_profile([node_ UTF8String], &nodepart,
|
||||||
"Nodeprep", 0)) != STRINGPREP_OK)
|
"Nodeprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException newWithClass: isa
|
@throw [XMPPStringPrepFailedException newWithClass: isa
|
||||||
connection: nil
|
connection: nil
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
string: node_];
|
string: node_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
node = [[OFString alloc] initWithCString: nodepart];
|
node = [[OFString alloc] initWithUTF8String: nodepart];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(nodepart);
|
free(nodepart);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
char *srv;
|
char *srv;
|
||||||
Stringprep_rc rc;
|
Stringprep_rc rc;
|
||||||
|
|
||||||
if ((rc = stringprep_profile([domain_ cString], &srv,
|
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
|
||||||
"Nameprep", 0)) != STRINGPREP_OK)
|
"Nameprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException newWithClass: isa
|
@throw [XMPPStringPrepFailedException newWithClass: isa
|
||||||
connection: nil
|
connection: nil
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
string: domain_];
|
string: domain_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
domain = [[OFString alloc] initWithCString: srv];
|
domain = [[OFString alloc] initWithUTF8String: srv];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(srv);
|
free(srv);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = stringprep_profile([resource_ cString], &res,
|
if ((rc = stringprep_profile([resource_ UTF8String], &res,
|
||||||
"Resourceprep", 0)) != STRINGPREP_OK)
|
"Resourceprep", 0)) != STRINGPREP_OK)
|
||||||
@throw [XMPPStringPrepFailedException
|
@throw [XMPPStringPrepFailedException
|
||||||
newWithClass: isa
|
newWithClass: isa
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
string: resource_];
|
string: resource_];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
resource = [[OFString alloc] initWithCString: res];
|
resource = [[OFString alloc] initWithUTF8String: res];
|
||||||
} @finally {
|
} @finally {
|
||||||
free(res);
|
free(res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,15 @@
|
||||||
[message addItem: ""];
|
[message addItem: ""];
|
||||||
|
|
||||||
/* authcid */
|
/* authcid */
|
||||||
[message addNItems: [authcid cStringLength]
|
[message addNItems: [authcid UTF8StringLength]
|
||||||
fromCArray: [authcid cString]];
|
fromCArray: [authcid UTF8String]];
|
||||||
|
|
||||||
/* separator */
|
/* separator */
|
||||||
[message addItem: ""];
|
[message addItem: ""];
|
||||||
|
|
||||||
/* passwd */
|
/* passwd */
|
||||||
[message addNItems: [password cStringLength]
|
[message addNItems: [password UTF8StringLength]
|
||||||
fromCArray: [password cString]];
|
fromCArray: [password UTF8String]];
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,11 +168,11 @@
|
||||||
authcid,
|
authcid,
|
||||||
cNonce];
|
cNonce];
|
||||||
|
|
||||||
[ret addNItems: [GS2Header cStringLength]
|
[ret addNItems: [GS2Header UTF8StringLength]
|
||||||
fromCArray: [GS2Header cString]];
|
fromCArray: [GS2Header UTF8String]];
|
||||||
|
|
||||||
[ret addNItems: [clientFirstMessageBare cStringLength]
|
[ret addNItems: [clientFirstMessageBare UTF8StringLength]
|
||||||
fromCArray: [clientFirstMessageBare cString]];
|
fromCArray: [clientFirstMessageBare UTF8String]];
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
ret = [OFDataArray dataArrayWithItemSize: 1];
|
ret = [OFDataArray dataArrayWithItemSize: 1];
|
||||||
authMessage = [OFDataArray dataArrayWithItemSize: 1];
|
authMessage = [OFDataArray dataArrayWithItemSize: 1];
|
||||||
|
|
||||||
OFString *chal = [OFString stringWithCString: [challenge cArray]
|
OFString *chal = [OFString stringWithUTF8String: [challenge cArray]
|
||||||
length: [challenge count] *
|
length: [challenge count] *
|
||||||
[challenge itemSize]];
|
[challenge itemSize]];
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@
|
||||||
|
|
||||||
// Add c=<base64(GS2Header+channelBindingData)>
|
// Add c=<base64(GS2Header+channelBindingData)>
|
||||||
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
|
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
|
||||||
[tmpArray addNItems: [GS2Header cStringLength]
|
[tmpArray addNItems: [GS2Header UTF8StringLength]
|
||||||
fromCArray: [GS2Header cString]];
|
fromCArray: [GS2Header UTF8String]];
|
||||||
if (plusAvailable && [connection encrypted]) {
|
if (plusAvailable && [connection encrypted]) {
|
||||||
OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
|
OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
|
||||||
channelBindingDataWithType: @"tls-unique"];
|
channelBindingDataWithType: @"tls-unique"];
|
||||||
|
@ -243,19 +243,19 @@
|
||||||
tmpString = [tmpArray stringByBase64Encoding];
|
tmpString = [tmpArray stringByBase64Encoding];
|
||||||
[ret addNItems: 2
|
[ret addNItems: 2
|
||||||
fromCArray: "c="];
|
fromCArray: "c="];
|
||||||
[ret addNItems: [tmpString cStringLength]
|
[ret addNItems: [tmpString UTF8StringLength]
|
||||||
fromCArray: [tmpString cString]];
|
fromCArray: [tmpString UTF8String]];
|
||||||
|
|
||||||
// Add r=<nonce>
|
// Add r=<nonce>
|
||||||
[ret addItem: ","];
|
[ret addItem: ","];
|
||||||
[ret addNItems: 2
|
[ret addNItems: 2
|
||||||
fromCArray: "r="];
|
fromCArray: "r="];
|
||||||
[ret addNItems: [sNonce cStringLength]
|
[ret addNItems: [sNonce UTF8StringLength]
|
||||||
fromCArray: [sNonce cString]];
|
fromCArray: [sNonce UTF8String]];
|
||||||
|
|
||||||
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
|
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
|
||||||
[tmpArray addNItems: [password cStringLength]
|
[tmpArray addNItems: [password UTF8StringLength]
|
||||||
fromCArray: [password cString]];
|
fromCArray: [password UTF8String]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IETF RFC 5802:
|
* IETF RFC 5802:
|
||||||
|
@ -271,8 +271,8 @@
|
||||||
* server-first-message + "," +
|
* server-first-message + "," +
|
||||||
* client-final-message-without-proof
|
* client-final-message-without-proof
|
||||||
*/
|
*/
|
||||||
[authMessage addNItems: [clientFirstMessageBare cStringLength]
|
[authMessage addNItems: [clientFirstMessageBare UTF8StringLength]
|
||||||
fromCArray: [clientFirstMessageBare cString]];
|
fromCArray: [clientFirstMessageBare UTF8String]];
|
||||||
[authMessage addItem: ","];
|
[authMessage addItem: ","];
|
||||||
[authMessage addNItems: [challenge count] * [challenge itemSize]
|
[authMessage addNItems: [challenge count] * [challenge itemSize]
|
||||||
fromCArray: [challenge cArray]];
|
fromCArray: [challenge cArray]];
|
||||||
|
@ -344,8 +344,8 @@
|
||||||
[ret addNItems: 2
|
[ret addNItems: 2
|
||||||
fromCArray: "p="];
|
fromCArray: "p="];
|
||||||
tmpString = [tmpArray stringByBase64Encoding];
|
tmpString = [tmpArray stringByBase64Encoding];
|
||||||
[ret addNItems: [tmpString cStringLength]
|
[ret addNItems: [tmpString UTF8StringLength]
|
||||||
fromCArray: [tmpString cString]];
|
fromCArray: [tmpString UTF8String]];
|
||||||
|
|
||||||
[ret retain];
|
[ret retain];
|
||||||
[pool release];
|
[pool release];
|
||||||
|
@ -356,7 +356,7 @@
|
||||||
- (void)parseServerFinalMessage: (OFDataArray*)message
|
- (void)parseServerFinalMessage: (OFDataArray*)message
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||||
OFString *mess = [OFString stringWithCString: [message cArray]
|
OFString *mess = [OFString stringWithUTF8String: [message cArray]
|
||||||
length: [message count] *
|
length: [message count] *
|
||||||
[message itemSize]];
|
[message itemSize]];
|
||||||
OFString *value = [mess substringWithRange:
|
OFString *value = [mess substringWithRange:
|
||||||
|
@ -393,6 +393,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return [OFString stringWithCString: (char*)buf
|
return [OFString stringWithCString: (char*)buf
|
||||||
|
encoding: OF_STRING_ENCODING_ASCII
|
||||||
length: 64];
|
length: 64];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,9 @@
|
||||||
@throw [OFInitializationFailedException
|
@throw [OFInitializationFailedException
|
||||||
newWithClass: isa];
|
newWithClass: isa];
|
||||||
|
|
||||||
target = [[OFString alloc] initWithCString: buffer];
|
target = [[OFString alloc]
|
||||||
|
initWithCString: buffer
|
||||||
|
encoding: OF_STRING_ENCODING_NATIVE];
|
||||||
} @catch (id e) {
|
} @catch (id e) {
|
||||||
[self release];
|
[self release];
|
||||||
@throw e;
|
@throw e;
|
||||||
|
@ -213,8 +215,9 @@
|
||||||
host: domain];
|
host: domain];
|
||||||
|
|
||||||
answer = [self allocMemoryWithSize: of_pagesize];
|
answer = [self allocMemoryWithSize: of_pagesize];
|
||||||
answerLen = res_nsearch(&resState, [request cString], ns_c_in,
|
answerLen = res_nsearch(&resState, [request cStringWithEncoding:
|
||||||
ns_t_srv, answer, (int)of_pagesize);
|
OF_STRING_ENCODING_NATIVE], ns_c_in, ns_t_srv, answer,
|
||||||
|
(int)of_pagesize);
|
||||||
|
|
||||||
if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
|
if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
|
||||||
(h_errno == NO_DATA)))
|
(h_errno == NO_DATA)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue