ObjXMPP  Diff

Differences From Artifact [6251193e54]:

To Artifact [5c2bd5b040]:


22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48







+











-
+







 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <inttypes.h>
#include <stdlib.h>

#include <assert.h>

#include <arpa/inet.h>
#include <netdb.h>
#include <sys/types.h>
#include <openssl/rand.h>

#import "XMPPSRVLookup.h"

#import <ObjFW/OFSystemInfo.h>
#import <ObjFW/OFLocalization.h>

@implementation XMPPSRVEntry
@synthesize priority = _priority, weight = _weight;
@synthesize accumulatedWeight = _accumulatedWeight, port = _port;
@synthesize target = _target;

+ (instancetype)entryWithPriority: (uint16_t)priority
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126







-
+







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

		_target = [[OFString alloc]
		    initWithCString: buffer
			   encoding: [OFSystemInfo native8BitEncoding]];
			   encoding: [OFLocalization encoding]];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
188
189
190
191
192
193
194
195

196
197
198
199
200
201
202
189
190
191
192
193
194
195

196
197
198
199
200
201
202
203







-
+








		if (res_ninit(&_resState))
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: _domain];

		answer = [self allocMemoryWithSize: pageSize];
		answerLen = res_nsearch(&_resState, [request
		    cStringWithEncoding: [OFSystemInfo native8BitEncoding]],
		    cStringWithEncoding: [OFLocalization encoding]],
		    ns_c_in, ns_t_srv, answer, (int)pageSize);

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

		if (answerLen < 1 || answerLen > pageSize)