ObjXMPP  Check-in [fb7805c61b]

Overview
Comment:Update to recent ObjFW changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fb7805c61b2eb6486fa376e96c4c2d71826c1c3dbb5ad744caf56963da24e150
User & Date: js on 2011-09-12 20:08:45
Other Links: manifest | tags
Context
2011-09-14
20:09
Make it possible to require TLS. check-in: 44237d2647 user: js tags: trunk
2011-09-12
20:08
Update to recent ObjFW changes. check-in: fb7805c61b user: js tags: trunk
2011-09-10
18:24
Remove obsolete comment check-in: 92e951e73f user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPConnection.m from [09cb9f4b6c] to [6deb2fd84f].

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

- (void)setUsername: (OFString*)username_
{
	OFString *old = username;
	char *node;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([username_ cString], &node,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"SASLprep"
							    string: username_];

	@try {
		username = [[OFString alloc] initWithCString: node];
	} @finally {
		free(node);
	}

	[old release];
}

- (OFString*)username
{
	return [[username copy] autorelease];
}

- (void)setResource: (OFString*)resource_
{
	OFString *old = resource;
	char *res;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([resource_ cString], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    newWithClass: isa
		      connection: self
			 profile: @"Resourceprep"
			  string: resource_];

	@try {
		resource = [[OFString alloc] initWithCString: res];
	} @finally {
		free(res);
	}

	[old release];
}

- (OFString*)resource
{
	return [[resource copy] autorelease];
}

- (void)setServer: (OFString*)server_
{
	OFString *old = server;
	char *srv;
	Idna_rc rc;

	if ((rc = idna_to_ascii_8z([server_ cString],
	    &srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
		@throw [XMPPIDNATranslationFailedException
		    newWithClass: isa
		      connection: self
		       operation: @"ToASCII"
			  string: server_];

	@try {
		server = [[OFString alloc] initWithCString: srv];
	} @finally {
		free(srv);
	}

	[old release];
}

- (OFString*)server
{
	return [[server copy] autorelease];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ cString], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"Nameprep"
							    string: domain_];

	@try {
		domain = [[OFString alloc] initWithCString: srv];
	} @finally {
		free(srv);
	}

	[old release];
}

- (OFString*)domain
{
	return [[domain copy] autorelease];
}

- (void)setPassword: (OFString*)password_
{
	OFString *old = password;
	char *pass;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([password_ cString], &pass,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"SASLprep"
							    string: password_];

	@try {
		password = [[OFString alloc] initWithCString: pass];
	} @finally {
		free(pass);
	}

	[old release];
}








|







|


















|








|


















|








|


















|







|


















|







|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

- (void)setUsername: (OFString*)username_
{
	OFString *old = username;
	char *node;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([username_ UTF8String], &node,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"SASLprep"
							    string: username_];

	@try {
		username = [[OFString alloc] initWithUTF8String: node];
	} @finally {
		free(node);
	}

	[old release];
}

- (OFString*)username
{
	return [[username copy] autorelease];
}

- (void)setResource: (OFString*)resource_
{
	OFString *old = resource;
	char *res;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([resource_ UTF8String], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    newWithClass: isa
		      connection: self
			 profile: @"Resourceprep"
			  string: resource_];

	@try {
		resource = [[OFString alloc] initWithUTF8String: res];
	} @finally {
		free(res);
	}

	[old release];
}

- (OFString*)resource
{
	return [[resource copy] autorelease];
}

- (void)setServer: (OFString*)server_
{
	OFString *old = server;
	char *srv;
	Idna_rc rc;

	if ((rc = idna_to_ascii_8z([server_ UTF8String],
	    &srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
		@throw [XMPPIDNATranslationFailedException
		    newWithClass: isa
		      connection: self
		       operation: @"ToASCII"
			  string: server_];

	@try {
		server = [[OFString alloc] initWithUTF8String: srv];
	} @finally {
		free(srv);
	}

	[old release];
}

- (OFString*)server
{
	return [[server copy] autorelease];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ UTF8String], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"Nameprep"
							    string: domain_];

	@try {
		domain = [[OFString alloc] initWithUTF8String: srv];
	} @finally {
		free(srv);
	}

	[old release];
}

- (OFString*)domain
{
	return [[domain copy] autorelease];
}

- (void)setPassword: (OFString*)password_
{
	OFString *old = password;
	char *pass;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([password_ UTF8String], &pass,
	    "SASLprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: self
							   profile: @"SASLprep"
							    string: password_];

	@try {
		password = [[OFString alloc] initWithUTF8String: pass];
	} @finally {
		free(pass);
	}

	[old release];
}

237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
	char *cDomainToASCII;
	Idna_rc rc;

	if (server)
		[sock connectToHost: server
			       port: port];
	else {
		if ((rc = idna_to_ascii_8z([domain cString], &cDomainToASCII,
		    IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
			@throw [XMPPIDNATranslationFailedException
				newWithClass: isa
				  connection: self
				   operation: @"ToASCII"
				      string: domain];

		@try {
			domainToASCII = [OFString
			    stringWithCString: cDomainToASCII];
		} @finally {
			free(cDomainToASCII);
		}

		@try {
			SRVLookup = [XMPPSRVLookup
			    lookupWithDomain: domainToASCII];







|









|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
	char *cDomainToASCII;
	Idna_rc rc;

	if (server)
		[sock connectToHost: server
			       port: port];
	else {
		if ((rc = idna_to_ascii_8z([domain UTF8String], &cDomainToASCII,
		    IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
			@throw [XMPPIDNATranslationFailedException
				newWithClass: isa
				  connection: self
				   operation: @"ToASCII"
				      string: domain];

		@try {
			domainToASCII = [OFString
			    stringWithUTF8String: cDomainToASCII];
		} @finally {
			free(cDomainToASCII);
		}

		@try {
			SRVLookup = [XMPPSRVLookup
			    lookupWithDomain: domainToASCII];

Modified src/XMPPJID.m from [a2663297e0] to [29e551d558].

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

	if (node_ == nil) {
		[old release];
		node = nil;
		return;
	}

	if ((rc = stringprep_profile([node_ cString], &nodepart,
	    "Nodeprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nodeprep"
							    string: node_];

	@try {
		node = [[OFString alloc] initWithCString: nodepart];
	} @finally {
		free(nodepart);
	}

	[old release];
}

- (OFString*)node
{
	return [[node copy] autorelease];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ cString], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nameprep"
							    string: domain_];

	@try {
		domain = [[OFString alloc] initWithCString: srv];
	} @finally {
		free(srv);
	}

	[old release];
}








|







|


















|







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

	if (node_ == nil) {
		[old release];
		node = nil;
		return;
	}

	if ((rc = stringprep_profile([node_ UTF8String], &nodepart,
	    "Nodeprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nodeprep"
							    string: node_];

	@try {
		node = [[OFString alloc] initWithUTF8String: nodepart];
	} @finally {
		free(nodepart);
	}

	[old release];
}

- (OFString*)node
{
	return [[node copy] autorelease];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ UTF8String], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nameprep"
							    string: domain_];

	@try {
		domain = [[OFString alloc] initWithUTF8String: srv];
	} @finally {
		free(srv);
	}

	[old release];
}

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

	if (resource_ == nil) {
		[old release];
		resource = nil;
		return;
	}

	if ((rc = stringprep_profile([resource_ cString], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    newWithClass: isa
		      connection: nil
			 profile: @"Resourceprep"
			  string: resource_];

	@try {
		resource = [[OFString alloc] initWithCString: res];
	} @finally {
		free(res);
	}

	[old release];
}








|








|







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

	if (resource_ == nil) {
		[old release];
		resource = nil;
		return;
	}

	if ((rc = stringprep_profile([resource_ UTF8String], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    newWithClass: isa
		      connection: nil
			 profile: @"Resourceprep"
			  string: resource_];

	@try {
		resource = [[OFString alloc] initWithUTF8String: res];
	} @finally {
		free(res);
	}

	[old release];
}

Modified src/XMPPPLAINAuth.m from [ee98e083fb] to [0f39082dfe].

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

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

	/* authcid */
	[message addNItems: [authcid cStringLength]
		fromCArray: [authcid cString]];

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

	/* passwd */
	[message addNItems: [password cStringLength]
		fromCArray: [password cString]];

	return message;
}

- (OFDataArray*)calculateResponseWithChallenge: (OFDataArray*)challenge
{
	@throw [XMPPAuthFailedException newWithClass: isa







|
|





|
|







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

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

	/* authcid */
	[message addNItems: [authcid UTF8StringLength]
		fromCArray: [authcid UTF8String]];

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

	/* passwd */
	[message addNItems: [password UTF8StringLength]
		fromCArray: [password UTF8String]];

	return message;
}

- (OFDataArray*)calculateResponseWithChallenge: (OFDataArray*)challenge
{
	@throw [XMPPAuthFailedException newWithClass: isa

Modified src/XMPPSCRAMAuth.m from [b88bfe5c49] to [e3e56c14fb].

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

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

	[ret addNItems: [GS2Header cStringLength]
	    fromCArray: [GS2Header cString]];

	[ret addNItems: [clientFirstMessageBare cStringLength]
	    fromCArray: [clientFirstMessageBare cString]];

	return ret;
}

- (OFDataArray*)calculateResponseWithChallenge: (OFDataArray*)challenge
{
	size_t i;







|
|

|
|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

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

	[ret addNItems: [GS2Header UTF8StringLength]
	    fromCArray: [GS2Header UTF8String]];

	[ret addNItems: [clientFirstMessageBare UTF8StringLength]
	    fromCArray: [clientFirstMessageBare UTF8String]];

	return ret;
}

- (OFDataArray*)calculateResponseWithChallenge: (OFDataArray*)challenge
{
	size_t i;
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
		GOT_ITERCOUNT = 0x04
	} got = 0;

	hash = [[[hashType alloc] init] autorelease];
	ret = [OFDataArray dataArrayWithItemSize: 1];
	authMessage = [OFDataArray dataArrayWithItemSize: 1];

	OFString *chal = [OFString stringWithCString: [challenge cArray]
					      length: [challenge count] *
						      [challenge itemSize]];

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








|
|
|







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
		GOT_ITERCOUNT = 0x04
	} got = 0;

	hash = [[[hashType alloc] init] autorelease];
	ret = [OFDataArray dataArrayWithItemSize: 1];
	authMessage = [OFDataArray dataArrayWithItemSize: 1];

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

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

228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
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
	}

	if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
		@throw [OFInvalidServerReplyException newWithClass: isa];

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

	// Add r=<nonce>
	[ret addItem: ","];
	[ret addNItems: 2
	    fromCArray: "r="];
	[ret addNItems: [sNonce cStringLength]
	    fromCArray: [sNonce cString]];

	tmpArray = [OFDataArray dataArrayWithItemSize: 1];
	[tmpArray addNItems: [password cStringLength]
		 fromCArray: [password cString]];

	/*
	 * IETF RFC 5802:
	 * SaltedPassword := Hi(Normalize(password), salt, i)
	 */
	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 addNItems: [clientFirstMessageBare cStringLength]
		    fromCArray: [clientFirstMessageBare cString]];
	[authMessage addItem: ","];
	[authMessage addNItems: [challenge count] * [challenge itemSize]
		    fromCArray: [challenge cArray]];
	[authMessage addItem: ","];
	[authMessage addNItems: [ret count]
		    fromCArray: [ret cArray]];








|
|









|
|





|
|


|
|















|
|







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
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
	}

	if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
		@throw [OFInvalidServerReplyException newWithClass: isa];

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

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

	tmpArray = [OFDataArray dataArrayWithItemSize: 1];
	[tmpArray addNItems: [password UTF8StringLength]
		 fromCArray: [password UTF8String]];

	/*
	 * IETF RFC 5802:
	 * SaltedPassword := Hi(Normalize(password), salt, i)
	 */
	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 addNItems: [clientFirstMessageBare UTF8StringLength]
		    fromCArray: [clientFirstMessageBare UTF8String]];
	[authMessage addItem: ","];
	[authMessage addNItems: [challenge count] * [challenge itemSize]
		    fromCArray: [challenge cArray]];
	[authMessage addItem: ","];
	[authMessage addNItems: [ret count]
		    fromCArray: [ret cArray]];

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
	}

	// Add p=<base64(ClientProof)>
	[ret addItem: ","];
	[ret addNItems: 2
	    fromCArray: "p="];
	tmpString = [tmpArray stringByBase64Encoding];
	[ret addNItems: [tmpString cStringLength]
	    fromCArray: [tmpString cString]];

	[ret retain];
	[pool release];

	return [ret autorelease];
}

- (void)parseServerFinalMessage: (OFDataArray*)message
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *mess = [OFString stringWithCString: [message cArray]
					      length: [message count] *
						      [message itemSize]];
	OFString *value = [mess substringWithRange:
	    of_range(2, [mess length] - 2)];

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







|
|










|
|
|







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
	}

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

	[ret retain];
	[pool release];

	return [ret autorelease];
}

- (void)parseServerFinalMessage: (OFDataArray*)message
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *mess = [OFString stringWithUTF8String: [message cArray]
						 length: [message count] *
							 [message itemSize]];
	OFString *value = [mess substringWithRange:
	    of_range(2, [mess length] - 2)];

	if ([mess hasPrefix: @"v="]) {
		if (![value isEqual: [serverSignature stringByBase64Encoding]])
			@throw [XMPPAuthFailedException
			    newWithClass: isa
389
390
391
392
393
394
395

396
397
398
399
400
401
402
		while (tmp == ',')
			tmp = ((buf[i] >> 1) % ('~' - '!')) + '!';

		buf[i] = tmp;
	}

	return [OFString stringWithCString: (char*)buf

				    length: 64];
}

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







>







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
		while (tmp == ',')
			tmp = ((buf[i] >> 1) % ('~' - '!')) + '!';

		buf[i] = tmp;
	}

	return [OFString stringWithCString: (char*)buf
				  encoding: OF_STRING_ENCODING_ASCII
				    length: 64];
}

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

Modified src/XMPPSRVLookup.m from [4fcb2e211c] to [50f66c7748].

98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
		port = ntohs(rdata[2]);

		if (dn_expand(ns_msg_base(handle), ns_msg_end(handle),
		    (uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1)
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		target = [[OFString alloc] initWithCString: buffer];


	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







|
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
		port = ntohs(rdata[2]);

		if (dn_expand(ns_msg_base(handle), ns_msg_end(handle),
		    (uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1)
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		target = [[OFString alloc]
		    initWithCString: buffer
			   encoding: OF_STRING_ENCODING_NATIVE];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
209
210
211
212
213
214
215
216

217
218
219
220
221
222
223
224
		if (res_ninit(&resState))
			@throw [OFAddressTranslationFailedException
			    newWithClass: isa
				  socket: nil
				    host: domain];

		answer = [self allocMemoryWithSize: of_pagesize];
		answerLen = res_nsearch(&resState, [request cString], 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







|
>
|







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
		if (res_ninit(&resState))
			@throw [OFAddressTranslationFailedException
			    newWithClass: isa
				  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