Adjust to recent ObjFW changes.
This commit is contained in:
parent
4978c42916
commit
20e111024e
4 changed files with 64 additions and 67 deletions
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
- (void)removeDelegate: (id)delegate
|
- (void)removeDelegate: (id)delegate
|
||||||
{
|
{
|
||||||
id *cArray = [delegates cArray];
|
id *cArray = [delegates items];
|
||||||
size_t i, count = [delegates count];
|
size_t i, count = [delegates count];
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
- (BOOL)broadcastSelector: (SEL)selector
|
- (BOOL)broadcastSelector: (SEL)selector
|
||||||
withObject: (id)object
|
withObject: (id)object
|
||||||
{
|
{
|
||||||
id *cArray = [delegates cArray];
|
id *cArray = [delegates items];
|
||||||
size_t i, count = [delegates count];
|
size_t i, count = [delegates count];
|
||||||
BOOL handled = NO;
|
BOOL handled = NO;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
withObject: (id)object1
|
withObject: (id)object1
|
||||||
withObject: (id)object2
|
withObject: (id)object2
|
||||||
{
|
{
|
||||||
id *cArray = [delegates cArray];
|
id *cArray = [delegates items];
|
||||||
size_t i, count = [delegates count];
|
size_t i, count = [delegates count];
|
||||||
BOOL handled = NO;
|
BOOL handled = NO;
|
||||||
|
|
||||||
|
|
|
@ -56,15 +56,15 @@
|
||||||
[message addItem: ""];
|
[message addItem: ""];
|
||||||
|
|
||||||
/* authcid */
|
/* authcid */
|
||||||
[message addItemsFromCArray: [authcid UTF8String]
|
[message addItems: [authcid UTF8String]
|
||||||
count: [authcid UTF8StringLength]];
|
count: [authcid UTF8StringLength]];
|
||||||
|
|
||||||
/* separator */
|
/* separator */
|
||||||
[message addItem: ""];
|
[message addItem: ""];
|
||||||
|
|
||||||
/* passwd */
|
/* passwd */
|
||||||
[message addItemsFromCArray: [password UTF8String]
|
[message addItems: [password UTF8String]
|
||||||
count: [password UTF8StringLength]];
|
count: [password UTF8StringLength]];
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,11 @@
|
||||||
authcid,
|
authcid,
|
||||||
cNonce];
|
cNonce];
|
||||||
|
|
||||||
[ret addItemsFromCArray: [GS2Header UTF8String]
|
[ret addItems: [GS2Header UTF8String]
|
||||||
count: [GS2Header UTF8StringLength]];
|
count: [GS2Header UTF8StringLength]];
|
||||||
|
|
||||||
[ret addItemsFromCArray: [clientFirstMessageBare UTF8String]
|
|
||||||
count: [clientFirstMessageBare UTF8StringLength]];
|
|
||||||
|
|
||||||
|
[ret addItems: [clientFirstMessageBare UTF8String]
|
||||||
|
count: [clientFirstMessageBare UTF8StringLength]];
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +217,7 @@
|
||||||
ret = [OFDataArray dataArray];
|
ret = [OFDataArray dataArray];
|
||||||
authMessage = [OFDataArray dataArray];
|
authMessage = [OFDataArray dataArray];
|
||||||
|
|
||||||
OFString *chal = [OFString stringWithUTF8String: [data cArray]
|
OFString *chal = [OFString stringWithUTF8String: [data items]
|
||||||
length: [data count] *
|
length: [data count] *
|
||||||
[data itemSize]];
|
[data itemSize]];
|
||||||
|
|
||||||
|
@ -254,34 +253,34 @@
|
||||||
|
|
||||||
// Add c=<base64(GS2Header+channelBindingData)>
|
// Add c=<base64(GS2Header+channelBindingData)>
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: [GS2Header UTF8String]
|
[tmpArray addItems: [GS2Header UTF8String]
|
||||||
count: [GS2Header UTF8StringLength]];
|
count: [GS2Header UTF8StringLength]];
|
||||||
if (plusAvailable && [connection encrypted]) {
|
if (plusAvailable && [connection encrypted]) {
|
||||||
OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
|
OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
|
||||||
channelBindingDataWithType: @"tls-unique"];
|
channelBindingDataWithType: @"tls-unique"];
|
||||||
[tmpArray addItemsFromCArray: [channelBinding cArray]
|
[tmpArray addItems: [channelBinding items]
|
||||||
count: [channelBinding count]];
|
count: [channelBinding count]];
|
||||||
}
|
}
|
||||||
tmpString = [tmpArray stringByBase64Encoding];
|
tmpString = [tmpArray stringByBase64Encoding];
|
||||||
[ret addItemsFromCArray: "c="
|
[ret addItems: "c="
|
||||||
count: 2];
|
count: 2];
|
||||||
[ret addItemsFromCArray: [tmpString UTF8String]
|
[ret addItems: [tmpString UTF8String]
|
||||||
count: [tmpString UTF8StringLength]];
|
count: [tmpString UTF8StringLength]];
|
||||||
|
|
||||||
// Add r=<nonce>
|
// Add r=<nonce>
|
||||||
[ret addItem: ","];
|
[ret addItem: ","];
|
||||||
[ret addItemsFromCArray: "r="
|
[ret addItems: "r="
|
||||||
count: 2];
|
count: 2];
|
||||||
[ret addItemsFromCArray: [sNonce UTF8String]
|
[ret addItems: [sNonce UTF8String]
|
||||||
count: [sNonce UTF8StringLength]];
|
count: [sNonce UTF8StringLength]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IETF RFC 5802:
|
* IETF RFC 5802:
|
||||||
* SaltedPassword := Hi(Normalize(password), salt, i)
|
* SaltedPassword := Hi(Normalize(password), salt, i)
|
||||||
*/
|
*/
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: [password UTF8String]
|
[tmpArray addItems: [password UTF8String]
|
||||||
count: [password UTF8StringLength]];
|
count: [password UTF8StringLength]];
|
||||||
|
|
||||||
saltedPassword = [self XMPP_hiWithData: tmpArray
|
saltedPassword = [self XMPP_hiWithData: tmpArray
|
||||||
salt: salt
|
salt: salt
|
||||||
|
@ -293,23 +292,22 @@
|
||||||
* server-first-message + "," +
|
* server-first-message + "," +
|
||||||
* client-final-message-without-proof
|
* client-final-message-without-proof
|
||||||
*/
|
*/
|
||||||
[authMessage addItemsFromCArray: [clientFirstMessageBare UTF8String]
|
[authMessage addItems: [clientFirstMessageBare UTF8String]
|
||||||
count: [clientFirstMessageBare
|
count: [clientFirstMessageBare UTF8StringLength]];
|
||||||
UTF8StringLength]];
|
|
||||||
[authMessage addItem: ","];
|
[authMessage addItem: ","];
|
||||||
[authMessage addItemsFromCArray: [data cArray]
|
[authMessage addItems: [data items]
|
||||||
count: [data count] * [data itemSize]];
|
count: [data count] * [data itemSize]];
|
||||||
[authMessage addItem: ","];
|
[authMessage addItem: ","];
|
||||||
[authMessage addItemsFromCArray: [ret cArray]
|
[authMessage addItems: [ret items]
|
||||||
count: [ret count]];
|
count: [ret count]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IETF RFC 5802:
|
* IETF RFC 5802:
|
||||||
* ClientKey := HMAC(SaltedPassword, "Client Key")
|
* ClientKey := HMAC(SaltedPassword, "Client Key")
|
||||||
*/
|
*/
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: "Client Key"
|
[tmpArray addItems: "Client Key"
|
||||||
count: 10];
|
count: 10];
|
||||||
clientKey = [self XMPP_HMACWithKey: saltedPassword
|
clientKey = [self XMPP_HMACWithKey: saltedPassword
|
||||||
data: tmpArray];
|
data: tmpArray];
|
||||||
|
|
||||||
|
@ -320,8 +318,8 @@
|
||||||
[hash updateWithBuffer: (void*) clientKey
|
[hash updateWithBuffer: (void*) clientKey
|
||||||
length: [hashType digestSize]];
|
length: [hashType digestSize]];
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: [hash digest]
|
[tmpArray addItems: [hash digest]
|
||||||
count: [hashType digestSize]];
|
count: [hashType digestSize]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IETF RFC 5802:
|
* IETF RFC 5802:
|
||||||
|
@ -335,8 +333,8 @@
|
||||||
* ServerKey := HMAC(SaltedPassword, "Server Key")
|
* ServerKey := HMAC(SaltedPassword, "Server Key")
|
||||||
*/
|
*/
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: "Server Key"
|
[tmpArray addItems: "Server Key"
|
||||||
count: 10];
|
count: 10];
|
||||||
serverKey = [self XMPP_HMACWithKey: saltedPassword
|
serverKey = [self XMPP_HMACWithKey: saltedPassword
|
||||||
data: tmpArray];
|
data: tmpArray];
|
||||||
|
|
||||||
|
@ -345,13 +343,12 @@
|
||||||
* ServerSignature := HMAC(ServerKey, AuthMessage)
|
* ServerSignature := HMAC(ServerKey, AuthMessage)
|
||||||
*/
|
*/
|
||||||
tmpArray = [OFDataArray dataArray];
|
tmpArray = [OFDataArray dataArray];
|
||||||
[tmpArray addItemsFromCArray: serverKey
|
[tmpArray addItems: serverKey
|
||||||
count: [hashType digestSize]];
|
count: [hashType digestSize]];
|
||||||
serverSignature = [[OFDataArray alloc] init];
|
serverSignature = [[OFDataArray alloc] init];
|
||||||
[serverSignature addItemsFromCArray: [self
|
[serverSignature addItems: [self XMPP_HMACWithKey: tmpArray
|
||||||
XMPP_HMACWithKey: tmpArray
|
data: authMessage]
|
||||||
data: authMessage]
|
count: [hashType digestSize]];
|
||||||
count: [hashType digestSize]];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IETF RFC 5802:
|
* IETF RFC 5802:
|
||||||
|
@ -365,11 +362,11 @@
|
||||||
|
|
||||||
// Add p=<base64(ClientProof)>
|
// Add p=<base64(ClientProof)>
|
||||||
[ret addItem: ","];
|
[ret addItem: ","];
|
||||||
[ret addItemsFromCArray: "p="
|
[ret addItems: "p="
|
||||||
count: 2];
|
count: 2];
|
||||||
tmpString = [tmpArray stringByBase64Encoding];
|
tmpString = [tmpArray stringByBase64Encoding];
|
||||||
[ret addItemsFromCArray: [tmpString UTF8String]
|
[ret addItems: [tmpString UTF8String]
|
||||||
count: [tmpString UTF8StringLength]];
|
count: [tmpString UTF8StringLength]];
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +382,7 @@
|
||||||
if (authenticated)
|
if (authenticated)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
mess = [OFString stringWithUTF8String: [data cArray]
|
mess = [OFString stringWithUTF8String: [data items]
|
||||||
length: [data count] *
|
length: [data count] *
|
||||||
[data itemSize]];
|
[data itemSize]];
|
||||||
value = [mess substringWithRange: of_range(2, [mess length] - 2)];
|
value = [mess substringWithRange: of_range(2, [mess length] - 2)];
|
||||||
|
@ -438,20 +435,20 @@
|
||||||
|
|
||||||
if ([key itemSize] * [key count] > blockSize) {
|
if ([key itemSize] * [key count] > blockSize) {
|
||||||
hashI = [[[hashType alloc] init] autorelease];
|
hashI = [[[hashType alloc] init] autorelease];
|
||||||
[hashI updateWithBuffer: [key cArray]
|
[hashI updateWithBuffer: [key items]
|
||||||
length: [key itemSize] * [key count]];
|
length: [key itemSize] * [key count]];
|
||||||
[k addItemsFromCArray: [hashI digest]
|
[k addItems: [hashI digest]
|
||||||
count: [hashType digestSize]];
|
count: [hashType digestSize]];
|
||||||
} else
|
} else
|
||||||
[k addItemsFromCArray: [key cArray]
|
[k addItems: [key items]
|
||||||
count: [key itemSize] * [key count]];
|
count: [key itemSize] * [key count]];
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
kI = [self allocMemoryWithSize: blockSize];
|
kI = [self allocMemoryWithSize: blockSize];
|
||||||
kO = [self allocMemoryWithSize: blockSize];
|
kO = [self allocMemoryWithSize: blockSize];
|
||||||
|
|
||||||
kSize = [k count];
|
kSize = [k count];
|
||||||
memcpy(kI, [k cArray], kSize);
|
memcpy(kI, [k items], kSize);
|
||||||
memset(kI + kSize, 0, blockSize - kSize);
|
memset(kI + kSize, 0, blockSize - kSize);
|
||||||
memcpy(kO, kI, blockSize);
|
memcpy(kO, kI, blockSize);
|
||||||
|
|
||||||
|
@ -463,7 +460,7 @@
|
||||||
hashI = [[[hashType alloc] init] autorelease];
|
hashI = [[[hashType alloc] init] autorelease];
|
||||||
[hashI updateWithBuffer: (char*)kI
|
[hashI updateWithBuffer: (char*)kI
|
||||||
length: blockSize];
|
length: blockSize];
|
||||||
[hashI updateWithBuffer: [data cArray]
|
[hashI updateWithBuffer: [data items]
|
||||||
length: [data itemSize] * [data count]];
|
length: [data itemSize] * [data count]];
|
||||||
|
|
||||||
hashO = [[[hashType alloc] init] autorelease];
|
hashO = [[[hashType alloc] init] autorelease];
|
||||||
|
@ -498,8 +495,8 @@
|
||||||
memset(result, 0, digestSize);
|
memset(result, 0, digestSize);
|
||||||
|
|
||||||
salty = [[salt_ copy] autorelease];
|
salty = [[salt_ copy] autorelease];
|
||||||
[salty addItemsFromCArray: "\0\0\0\1"
|
[salty addItems: "\0\0\0\1"
|
||||||
count: 4];
|
count: 4];
|
||||||
|
|
||||||
uOld = [self XMPP_HMACWithKey: str
|
uOld = [self XMPP_HMACWithKey: str
|
||||||
data: salty];
|
data: salty];
|
||||||
|
@ -509,8 +506,8 @@
|
||||||
|
|
||||||
for (j = 0; j < i - 1; j++) {
|
for (j = 0; j < i - 1; j++) {
|
||||||
tmp = [OFDataArray dataArray];
|
tmp = [OFDataArray dataArray];
|
||||||
[tmp addItemsFromCArray: uOld
|
[tmp addItems: uOld
|
||||||
count: digestSize];
|
count: digestSize];
|
||||||
|
|
||||||
u = [self XMPP_HMACWithKey: str
|
u = [self XMPP_HMACWithKey: str
|
||||||
data: tmp];
|
data: tmp];
|
||||||
|
@ -524,8 +521,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = [OFDataArray dataArray];
|
ret = [OFDataArray dataArray];
|
||||||
[ret addItemsFromCArray: result
|
[ret addItems: result
|
||||||
count: digestSize];
|
count: digestSize];
|
||||||
} @finally {
|
} @finally {
|
||||||
[self freeMemory: result];
|
[self freeMemory: result];
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,9 +212,9 @@
|
||||||
host: domain];
|
host: domain];
|
||||||
|
|
||||||
answer = [self allocMemoryWithSize: of_pagesize];
|
answer = [self allocMemoryWithSize: of_pagesize];
|
||||||
answerLen = res_nsearch(&resState, [request cStringWithEncoding:
|
answerLen = res_nsearch(&resState,
|
||||||
OF_STRING_ENCODING_NATIVE], ns_c_in, ns_t_srv, answer,
|
[request cStringUsingEncoding: OF_STRING_ENCODING_NATIVE],
|
||||||
(int)of_pagesize);
|
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