ObjXMPP  Check-in [e33c8d554c]

Overview
Comment:Adjust to recent ObjFW changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e33c8d554c408444deae69f3fcf49b1d5c9d8d4433dd9d9669c77953f0225b25
User & Date: js on 2012-12-19 21:36:14
Other Links: manifest | tags
Context
2012-12-22
13:55
Update documentation check-in: bbd249186e user: florob@babelmonkeys.de tags: trunk
2012-12-19
21:36
Adjust to recent ObjFW changes. check-in: e33c8d554c user: js tags: trunk
2012-12-13
22:29
Add -[asyncConnectAndHandle]. check-in: 2dcf26fbc9 user: js tags: trunk
Changes

Modified src/XMPPMulticastDelegate.m from [f042f4a75f] to [0af7f26680].

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
- (void)addDelegate: (id)delegate
{
	[delegates addItem: &delegate];
}

- (void)removeDelegate: (id)delegate
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];

	for (i = 0; i < count; i++) {
		if (cArray[i] == delegate) {
			[delegates removeItemAtIndex: i];
			return;
		}
	}
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, object);
	}

	return handled;
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object1
	       withObject: (id)object2
{
	id *cArray = [delegates cArray];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;








|













|




















|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
- (void)addDelegate: (id)delegate
{
	[delegates addItem: &delegate];
}

- (void)removeDelegate: (id)delegate
{
	id *cArray = [delegates items];
	size_t i, count = [delegates count];

	for (i = 0; i < count; i++) {
		if (cArray[i] == delegate) {
			[delegates removeItemAtIndex: i];
			return;
		}
	}
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object
{
	id *cArray = [delegates items];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

		BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id))
		    [cArray[i] methodForSelector: selector];

		handled |= imp(cArray[i], selector, object);
	}

	return handled;
}

- (BOOL)broadcastSelector: (SEL)selector
	       withObject: (id)object1
	       withObject: (id)object2
{
	id *cArray = [delegates items];
	size_t i, count = [delegates count];
	BOOL handled = NO;

	for (i = 0; i < count; i++) {
		if (![cArray[i] respondsToSelector: selector])
			continue;

Modified src/XMPPPLAINAuth.m from [375d451a91] to [ea90fec7bf].

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	if (authzid)
		[message addItem: authzid];

	/* separator */
	[message addItem: ""];

	/* authcid */
	[message addItemsFromCArray: [authcid UTF8String]
			      count: [authcid UTF8StringLength]];

	/* separator */
	[message addItem: ""];

	/* passwd */
	[message addItemsFromCArray: [password UTF8String]
			      count: [password UTF8StringLength]];

	return message;
}
@end







|
|





|
|




52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	if (authzid)
		[message addItem: authzid];

	/* separator */
	[message addItem: ""];

	/* authcid */
	[message addItems: [authcid UTF8String]
		    count: [authcid UTF8StringLength]];

	/* separator */
	[message addItem: ""];

	/* passwd */
	[message addItems: [password UTF8String]
		    count: [password UTF8StringLength]];

	return message;
}
@end

Modified src/XMPPSCRAMAuth.m from [47e72febdc] to [bc4fed3ba5].

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

	[clientFirstMessageBare release];
	clientFirstMessageBare = nil;
	clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@",
								   authcid,
								   cNonce];

	[ret addItemsFromCArray: [GS2Header UTF8String]
			  count: [GS2Header UTF8StringLength]];

	[ret addItemsFromCArray: [clientFirstMessageBare UTF8String]
			  count: [clientFirstMessageBare UTF8StringLength]];


	return ret;
}

- (OFDataArray*)continueWithData: (OFDataArray*)data
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];







|
|

|
|
<







168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184
185
186

	[clientFirstMessageBare release];
	clientFirstMessageBare = nil;
	clientFirstMessageBare = [[OFString alloc] initWithFormat: @"n=%@,r=%@",
								   authcid,
								   cNonce];

	[ret addItems: [GS2Header UTF8String]
		count: [GS2Header UTF8StringLength]];

	[ret addItems: [clientFirstMessageBare UTF8String]
		count: [clientFirstMessageBare UTF8StringLength]];


	return ret;
}

- (OFDataArray*)continueWithData: (OFDataArray*)data
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
		GOT_ITERCOUNT = 0x04
	} got = 0;

	hash = [[[hashType alloc] init] autorelease];
	ret = [OFDataArray dataArray];
	authMessage = [OFDataArray dataArray];

	OFString *chal = [OFString stringWithUTF8String: [data cArray]
						 length: [data count] *
							 [data itemSize]];

	enumerator =
	    [[chal componentsSeparatedByString: @","] objectEnumerator];
	while ((comp = [enumerator nextObject]) != nil) {
		OFString *entry = [comp substringWithRange:







|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
		GOT_ITERCOUNT = 0x04
	} got = 0;

	hash = [[[hashType alloc] init] autorelease];
	ret = [OFDataArray dataArray];
	authMessage = [OFDataArray dataArray];

	OFString *chal = [OFString stringWithUTF8String: [data items]
						 length: [data count] *
							 [data itemSize]];

	enumerator =
	    [[chal componentsSeparatedByString: @","] objectEnumerator];
	while ((comp = [enumerator nextObject]) != nil) {
		OFString *entry = [comp substringWithRange:
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395

	if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
		@throw [OFInvalidServerReplyException
		    exceptionWithClass: [self class]];

	// Add c=<base64(GS2Header+channelBindingData)>
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: [GS2Header UTF8String]
			       count: [GS2Header UTF8StringLength]];
	if (plusAvailable && [connection encrypted]) {
		OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
		    channelBindingDataWithType: @"tls-unique"];
		[tmpArray addItemsFromCArray: [channelBinding cArray]
				       count: [channelBinding count]];
	}
	tmpString = [tmpArray stringByBase64Encoding];
	[ret addItemsFromCArray: "c="
			  count: 2];
	[ret addItemsFromCArray: [tmpString UTF8String]
			  count: [tmpString UTF8StringLength]];

	// Add r=<nonce>
	[ret addItem: ","];
	[ret addItemsFromCArray: "r="
			  count: 2];
	[ret addItemsFromCArray: [sNonce UTF8String]
			  count: [sNonce UTF8StringLength]];

	/*
	 * IETF RFC 5802:
	 * SaltedPassword := Hi(Normalize(password), salt, i)
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: [password UTF8String]
			       count: [password UTF8StringLength]];

	saltedPassword = [self XMPP_hiWithData: tmpArray
					  salt: salt
				iterationCount: iterCount];

	/*
	 * IETF RFC 5802:
	 * AuthMessage := client-first-message-bare + "," +
	 *		  server-first-message + "," +
	 *		  client-final-message-without-proof
	 */
	[authMessage addItemsFromCArray: [clientFirstMessageBare UTF8String]
				  count: [clientFirstMessageBare
					     UTF8StringLength]];
	[authMessage addItem: ","];
	[authMessage addItemsFromCArray: [data cArray]
				  count: [data count] * [data itemSize]];
	[authMessage addItem: ","];
	[authMessage addItemsFromCArray: [ret cArray]
				  count: [ret count]];

	/*
	 * IETF RFC 5802:
	 * ClientKey := HMAC(SaltedPassword, "Client Key")
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: "Client Key"
			       count: 10];
	clientKey = [self XMPP_HMACWithKey: saltedPassword
				      data: tmpArray];

	/*
	 * IETF RFC 5802:
	 * StoredKey := H(ClientKey)
	 */
	[hash updateWithBuffer: (void*) clientKey
			length: [hashType digestSize]];
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: [hash digest]
			       count: [hashType digestSize]];

	/*
	 * IETF RFC 5802:
	 * ClientSignature := HMAC(StoredKey, AuthMessage)
	 */
	clientSignature = [self XMPP_HMACWithKey: tmpArray
					    data: authMessage];

	/*
	 * IETF RFC 5802:
	 * ServerKey := HMAC(SaltedPassword, "Server Key")
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: "Server Key"
			       count: 10];
	serverKey = [self XMPP_HMACWithKey: saltedPassword
				      data: tmpArray];

	/*
	 * IETF RFC 5802:
	 * ServerSignature := HMAC(ServerKey, AuthMessage)
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItemsFromCArray: serverKey
			       count: [hashType digestSize]];
	serverSignature = [[OFDataArray alloc] init];
	[serverSignature addItemsFromCArray: [self
						 XMPP_HMACWithKey: tmpArray
							     data: authMessage]
				      count: [hashType digestSize]];

	/*
	 * IETF RFC 5802:
	 * ClientProof := ClientKey XOR ClientSignature
	 */
	tmpArray = [OFDataArray dataArray];
	for (i = 0; i < [hashType digestSize]; i++) {
		uint8_t c = clientKey[i] ^ clientSignature[i];
		[tmpArray addItem: &c];
	}

	// Add p=<base64(ClientProof)>
	[ret addItem: ","];
	[ret addItemsFromCArray: "p="
			  count: 2];
	tmpString = [tmpArray stringByBase64Encoding];
	[ret addItemsFromCArray: [tmpString UTF8String]
			  count: [tmpString UTF8StringLength]];

	return ret;
}

- (OFDataArray*)XMPP_parseServerFinalMessage: (OFDataArray*)data
{
	OFString *mess, *value;

	/*
	 * server-final-message already received,
	 * we were just waiting for the last word from the server
	 */
	if (authenticated)
		return nil;

	mess = [OFString stringWithUTF8String: [data cArray]
				       length: [data count] *
					       [data itemSize]];
	value = [mess substringWithRange: of_range(2, [mess length] - 2)];

	if ([mess hasPrefix: @"v="]) {
		if (![value isEqual: [serverSignature stringByBase64Encoding]])
			@throw [XMPPAuthFailedException







|
|



|
|


|
|
|
|



|
|
|
|






|
|











|
|
<

|
|

|
|






|
|










|
|













|
|








|
|

|
<
|
|













|
|

|
|















|







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392

	if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
		@throw [OFInvalidServerReplyException
		    exceptionWithClass: [self class]];

	// Add c=<base64(GS2Header+channelBindingData)>
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: [GS2Header UTF8String]
		     count: [GS2Header UTF8StringLength]];
	if (plusAvailable && [connection encrypted]) {
		OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
		    channelBindingDataWithType: @"tls-unique"];
		[tmpArray addItems: [channelBinding items]
			     count: [channelBinding count]];
	}
	tmpString = [tmpArray stringByBase64Encoding];
	[ret addItems: "c="
		count: 2];
	[ret addItems: [tmpString UTF8String]
		count: [tmpString UTF8StringLength]];

	// Add r=<nonce>
	[ret addItem: ","];
	[ret addItems: "r="
		count: 2];
	[ret addItems: [sNonce UTF8String]
		count: [sNonce UTF8StringLength]];

	/*
	 * IETF RFC 5802:
	 * SaltedPassword := Hi(Normalize(password), salt, i)
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: [password UTF8String]
		     count: [password UTF8StringLength]];

	saltedPassword = [self XMPP_hiWithData: tmpArray
					  salt: salt
				iterationCount: iterCount];

	/*
	 * IETF RFC 5802:
	 * AuthMessage := client-first-message-bare + "," +
	 *		  server-first-message + "," +
	 *		  client-final-message-without-proof
	 */
	[authMessage addItems: [clientFirstMessageBare UTF8String]
			count: [clientFirstMessageBare UTF8StringLength]];

	[authMessage addItem: ","];
	[authMessage addItems: [data items]
			count: [data count] * [data itemSize]];
	[authMessage addItem: ","];
	[authMessage addItems: [ret items]
			count: [ret count]];

	/*
	 * IETF RFC 5802:
	 * ClientKey := HMAC(SaltedPassword, "Client Key")
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: "Client Key"
		     count: 10];
	clientKey = [self XMPP_HMACWithKey: saltedPassword
				      data: tmpArray];

	/*
	 * IETF RFC 5802:
	 * StoredKey := H(ClientKey)
	 */
	[hash updateWithBuffer: (void*) clientKey
			length: [hashType digestSize]];
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: [hash digest]
		     count: [hashType digestSize]];

	/*
	 * IETF RFC 5802:
	 * ClientSignature := HMAC(StoredKey, AuthMessage)
	 */
	clientSignature = [self XMPP_HMACWithKey: tmpArray
					    data: authMessage];

	/*
	 * IETF RFC 5802:
	 * ServerKey := HMAC(SaltedPassword, "Server Key")
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: "Server Key"
		     count: 10];
	serverKey = [self XMPP_HMACWithKey: saltedPassword
				      data: tmpArray];

	/*
	 * IETF RFC 5802:
	 * ServerSignature := HMAC(ServerKey, AuthMessage)
	 */
	tmpArray = [OFDataArray dataArray];
	[tmpArray addItems: serverKey
		     count: [hashType digestSize]];
	serverSignature = [[OFDataArray alloc] init];
	[serverSignature addItems: [self XMPP_HMACWithKey: tmpArray

						     data: authMessage]
			    count: [hashType digestSize]];

	/*
	 * IETF RFC 5802:
	 * ClientProof := ClientKey XOR ClientSignature
	 */
	tmpArray = [OFDataArray dataArray];
	for (i = 0; i < [hashType digestSize]; i++) {
		uint8_t c = clientKey[i] ^ clientSignature[i];
		[tmpArray addItem: &c];
	}

	// Add p=<base64(ClientProof)>
	[ret addItem: ","];
	[ret addItems: "p="
		count: 2];
	tmpString = [tmpArray stringByBase64Encoding];
	[ret addItems: [tmpString UTF8String]
		count: [tmpString UTF8StringLength]];

	return ret;
}

- (OFDataArray*)XMPP_parseServerFinalMessage: (OFDataArray*)data
{
	OFString *mess, *value;

	/*
	 * server-final-message already received,
	 * we were just waiting for the last word from the server
	 */
	if (authenticated)
		return nil;

	mess = [OFString stringWithUTF8String: [data items]
				       length: [data count] *
					       [data itemSize]];
	value = [mess substringWithRange: of_range(2, [mess length] - 2)];

	if ([mess hasPrefix: @"v="]) {
		if (![value isEqual: [serverSignature stringByBase64Encoding]])
			@throw [XMPPAuthFailedException
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
	OFDataArray *k = [OFDataArray dataArray];
	size_t i, kSize, blockSize = [hashType blockSize];
	uint8_t *kI = NULL, *kO = NULL;
	OFHash *hashI, *hashO;

	if ([key itemSize] * [key count] > blockSize) {
		hashI = [[[hashType alloc] init] autorelease];
		[hashI updateWithBuffer: [key cArray]
				length: [key itemSize] * [key count]];
		[k addItemsFromCArray: [hashI digest]
				count: [hashType digestSize]];
	} else
		[k addItemsFromCArray: [key cArray]
				count: [key itemSize] * [key count]];

	@try {
		kI = [self allocMemoryWithSize: blockSize];
		kO = [self allocMemoryWithSize: blockSize];

		kSize = [k count];
		memcpy(kI, [k cArray], kSize);
		memset(kI + kSize, 0, blockSize - kSize);
		memcpy(kO, kI, blockSize);

		for (i = 0; i < blockSize; i++) {
			kI[i] ^= HMAC_IPAD;
			kO[i] ^= HMAC_OPAD;
		}

		hashI = [[[hashType alloc] init] autorelease];
		[hashI updateWithBuffer: (char*)kI
				 length: blockSize];
		[hashI updateWithBuffer: [data cArray]
				 length: [data itemSize] * [data count]];

		hashO = [[[hashType alloc] init] autorelease];
		[hashO updateWithBuffer: (char*)kO
				 length: blockSize];
		[hashO updateWithBuffer: (char*)[hashI digest]
				 length: [hashType digestSize]];







|

|
|

|
|






|











|







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
	OFDataArray *k = [OFDataArray dataArray];
	size_t i, kSize, blockSize = [hashType blockSize];
	uint8_t *kI = NULL, *kO = NULL;
	OFHash *hashI, *hashO;

	if ([key itemSize] * [key count] > blockSize) {
		hashI = [[[hashType alloc] init] autorelease];
		[hashI updateWithBuffer: [key items]
				length: [key itemSize] * [key count]];
		[k addItems: [hashI digest]
		      count: [hashType digestSize]];
	} else
		[k addItems: [key items]
		      count: [key itemSize] * [key count]];

	@try {
		kI = [self allocMemoryWithSize: blockSize];
		kO = [self allocMemoryWithSize: blockSize];

		kSize = [k count];
		memcpy(kI, [k items], kSize);
		memset(kI + kSize, 0, blockSize - kSize);
		memcpy(kO, kI, blockSize);

		for (i = 0; i < blockSize; i++) {
			kI[i] ^= HMAC_IPAD;
			kO[i] ^= HMAC_OPAD;
		}

		hashI = [[[hashType alloc] init] autorelease];
		[hashI updateWithBuffer: (char*)kI
				 length: blockSize];
		[hashI updateWithBuffer: [data items]
				 length: [data itemSize] * [data count]];

		hashO = [[[hashType alloc] init] autorelease];
		[hashO updateWithBuffer: (char*)kO
				 length: blockSize];
		[hashO updateWithBuffer: (char*)[hashI digest]
				 length: [hashType digestSize]];
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538

	result = [self allocMemoryWithSize: digestSize];

	@try {
		memset(result, 0, digestSize);

		salty = [[salt_ copy] autorelease];
		[salty addItemsFromCArray: "\0\0\0\1"
				    count: 4];

		uOld = [self XMPP_HMACWithKey: str
					 data: salty];

		for (j = 0; j < digestSize; j++)
			result[j] ^= uOld[j];

		for (j = 0; j < i - 1; j++) {
			tmp = [OFDataArray dataArray];
			[tmp addItemsFromCArray: uOld
					  count: digestSize];

			u = [self XMPP_HMACWithKey: str
					      data: tmp];

			for (k = 0; k < digestSize; k++)
				result[k] ^= u[k];

			uOld = u;

			[pool releaseObjects];
		}

		ret = [OFDataArray dataArray];
		[ret addItemsFromCArray: result
				  count: digestSize];
	} @finally {
		[self freeMemory: result];
	}

	[ret retain];
	[pool release];

	return [ret autorelease];
}
@end







|
|









|
|













|
|










491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535

	result = [self allocMemoryWithSize: digestSize];

	@try {
		memset(result, 0, digestSize);

		salty = [[salt_ copy] autorelease];
		[salty addItems: "\0\0\0\1"
			  count: 4];

		uOld = [self XMPP_HMACWithKey: str
					 data: salty];

		for (j = 0; j < digestSize; j++)
			result[j] ^= uOld[j];

		for (j = 0; j < i - 1; j++) {
			tmp = [OFDataArray dataArray];
			[tmp addItems: uOld
				count: digestSize];

			u = [self XMPP_HMACWithKey: str
					      data: tmp];

			for (k = 0; k < digestSize; k++)
				result[k] ^= u[k];

			uOld = u;

			[pool releaseObjects];
		}

		ret = [OFDataArray dataArray];
		[ret addItems: result
			count: digestSize];
	} @finally {
		[self freeMemory: result];
	}

	[ret retain];
	[pool release];

	return [ret autorelease];
}
@end

Modified src/XMPPSRVLookup.m from [4cdbc19657] to [17ba4973e1].

208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
		if (res_ninit(&resState))
			@throw [OFAddressTranslationFailedException
			    exceptionWithClass: [self class]
					socket: nil
					  host: domain];

		answer = [self allocMemoryWithSize: of_pagesize];
		answerLen = res_nsearch(&resState, [request cStringWithEncoding:
		    OF_STRING_ENCODING_NATIVE], ns_c_in, ns_t_srv, answer,
		    (int)of_pagesize);

		if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
		    (h_errno == NO_DATA)))
			return;

		if (answerLen < 1 || answerLen > of_pagesize) {
			@throw [OFAddressTranslationFailedException







|
|
|







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
		if (res_ninit(&resState))
			@throw [OFAddressTranslationFailedException
			    exceptionWithClass: [self class]
					socket: nil
					  host: domain];

		answer = [self allocMemoryWithSize: of_pagesize];
		answerLen = res_nsearch(&resState,
		    [request cStringUsingEncoding: OF_STRING_ENCODING_NATIVE],
		    ns_c_in, ns_t_srv, answer, (int)of_pagesize);

		if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
		    (h_errno == NO_DATA)))
			return;

		if (answerLen < 1 || answerLen > of_pagesize) {
			@throw [OFAddressTranslationFailedException