qdnslookup_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/kernel/qdnslookup_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19typedef int (*dn_expand_proto)(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);-
20static dn_expand_proto local_dn_expand = 0;-
21typedef void (*res_nclose_proto)(res_state);-
22static res_nclose_proto local_res_nclose = 0;-
23typedef int (*res_ninit_proto)(res_state);-
24static res_ninit_proto local_res_ninit = 0;-
25typedef int (*res_nquery_proto)(res_state, const char *, int, int, unsigned char *, int);-
26static res_nquery_proto local_res_nquery = 0;-
27-
28-
29-
30struct QDnsLookupStateDeleter-
31{-
32 static inline void cleanup(struct __res_state *pointer)-
33 {-
34 local_res_nclose(pointer);-
35 }
executed 84 times by 2 tests: end of block
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
84
36};-
37-
38static bool resolveLibraryInternal()-
39{-
40 QLibrary lib;-
41-
42 lib.setFileName(([]() -> QString { enum { Size = sizeof(u"" "libresolv.so.2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "libresolv.so.2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 2 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
qstring_literal_temp;
executed 2 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
}()));
2
43 if (!lib.load()
!lib.load()Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
44-
45 {-
46 lib.setFileName(QLatin1String("resolv"));-
47 if (!lib.load()
!lib.load()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
48 return
never executed: return false;
false;
never executed: return false;
0
49 }
never executed: end of block
0
50-
51 local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));-
52 if (!local_dn_expand
!local_dn_expandDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
53 local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));
never executed: local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));
0
54-
55 local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));-
56 if (!local_res_nclose
!local_res_ncloseDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
57 local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
never executed: local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
0
58 if (!local_res_nclose
!local_res_ncloseDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
59 local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
never executed: local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
0
60-
61 local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));-
62 if (!local_res_ninit
!local_res_ninitDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
63 local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
never executed: local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
0
64 if (!local_res_ninit
!local_res_ninitDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
65 local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
never executed: local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
0
66-
67 local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery"));-
68 if (!local_res_nquery
!local_res_nqueryDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
69 local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
never executed: local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
0
70 if (!local_res_nquery
!local_res_nqueryDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
)
0-2
71 local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
never executed: local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
0
72-
73 return
executed 2 times by 2 tests: return true;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
true;
executed 2 times by 2 tests: return true;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
2
74}-
75namespace { namespace Q_QGS_resolveLibrary { typedef bool Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 2 times by 2 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (resolveLibraryInternal()))) : value (resolveLibraryInternal()) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 84 times by 2 tests: return &holder.value;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
&holder.value;
executed 84 times by 2 tests: return &holder.value;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
} } } static QGlobalStatic<bool, Q_QGS_resolveLibrary::innerFunction, Q_QGS_resolveLibrary::guard> resolveLibrary;
0-84
76-
77void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestName, const QHostAddress &nameserver, QDnsLookupReply *reply)-
78{-
79-
80 resolveLibrary();-
81-
82-
83 if (!local_dn_expand
!local_dn_expandDescription
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
|| !local_res_nclose
!local_res_ncloseDescription
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
|| !local_res_ninit
!local_res_ninitDescription
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
|| !local_res_nquery
!local_res_nqueryDescription
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-84
84 reply->error = QDnsLookup::ResolverError;-
85 reply->errorString = tr("Resolver functions not found");-
86 return;
never executed: return;
0
87 }-
88-
89-
90 struct __res_state state;-
91 memset(&state, 0, sizeof(state));-
92 if (local_res_ninit(&state) < 0
local_res_ninit(&state) < 0Description
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-84
93 reply->error = QDnsLookup::ResolverError;-
94 reply->errorString = tr("Resolver initialization failed");-
95 return;
never executed: return;
0
96 }-
97-
98-
99 if (!nameserver.isNull()
!nameserver.isNull()Description
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-84
100 if (nameserver.protocol() == QAbstractSocket::IPv4Protocol
nameserver.pro...::IPv4ProtocolDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 state.nsaddr_list[0].sin_addr.s_addr = htonl(nameserver.toIPv4Address());-
102 state.nscount = 1;-
103 }
never executed: end of block
else if (nameserver.protocol() == QAbstractSocket::IPv6Protocol
nameserver.pro...::IPv6ProtocolDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
104-
105 struct sockaddr_in6 *ns;-
106 ns = state._u._ext.nsaddrs[0];-
107-
108 if (!ns
!nsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
109-
110-
111 ns = (struct sockaddr_in6*) calloc(1, sizeof(struct sockaddr_in6));-
112 do {if(!(ns)
!(ns)Description
TRUEnever evaluated
FALSEnever evaluated
)qt_check_pointer(__FILE__,159);
never executed: qt_check_pointer(__FILE__,159);
} while (0);
0
113 state._u._ext.nsaddrs[0] = ns;-
114 }
never executed: end of block
0
115-
116-
117-
118 state._u._ext.nsmap[0] = 3 + 1;-
119-
120 state._u._ext.nscount6 = 1;-
121 ns->sin6_family = 10;-
122 ns->sin6_port = htons(53);-
123 SetSALen::set(ns, sizeof(*ns));-
124-
125 Q_IPV6ADDR ipv6Address = nameserver.toIPv6Address();-
126 for (int i=0; i<16
i<16Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
127 ns->sin6_addr.__in6_u.__u6_addr8[i] = ipv6Address[i];-
128 }
never executed: end of block
0
129-
130-
131-
132-
133-
134-
135 }
never executed: end of block
0
136 }
never executed: end of block
0
137-
138-
139-
140 QScopedPointer<struct __res_state, QDnsLookupStateDeleter> state_ptr(&state);-
141-
142-
143 unsigned char response[512];-
144 memset(response, 0, sizeof(response));-
145 const int responseLength = local_res_nquery(&state, requestName, ns_c_in, requestType, response, sizeof(response));-
146-
147-
148 HEADER *header = (HEADER*)response;-
149 const int answerCount = ntohs(header->ancount);-
150 switch (header->rcode) {-
151 case
executed 58 times by 2 tests: case ns_r_noerror:
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
ns_r_noerror:
executed 58 times by 2 tests: case ns_r_noerror:
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
58
152 break;
executed 58 times by 2 tests: break;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
58
153 case
never executed: case ns_r_formerr:
ns_r_formerr:
never executed: case ns_r_formerr:
0
154 reply->error = QDnsLookup::InvalidRequestError;-
155 reply->errorString = tr("Server could not process query");-
156 return;
never executed: return;
0
157 case
never executed: case ns_r_servfail:
ns_r_servfail:
never executed: case ns_r_servfail:
0
158 reply->error = QDnsLookup::ServerFailureError;-
159 reply->errorString = tr("Server failure");-
160 return;
never executed: return;
0
161 case
executed 26 times by 2 tests: case ns_r_nxdomain:
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
ns_r_nxdomain:
executed 26 times by 2 tests: case ns_r_nxdomain:
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
26
162 reply->error = QDnsLookup::NotFoundError;-
163 reply->errorString = tr("Non existent domain");-
164 return;
executed 26 times by 2 tests: return;
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
26
165 case
never executed: case ns_r_refused:
ns_r_refused:
never executed: case ns_r_refused:
0
166 reply->error = QDnsLookup::ServerRefusedError;-
167 reply->errorString = tr("Server refused to answer");-
168 return;
never executed: return;
0
169 default
never executed: default:
:
never executed: default:
0
170 reply->error = QDnsLookup::InvalidReplyError;-
171 reply->errorString = tr("Invalid reply received");-
172 return;
never executed: return;
0
173 }-
174-
175-
176 if (responseLength < int(sizeof(HEADER))
responseLength...izeof(HEADER))Description
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-58
177 reply->error = QDnsLookup::InvalidReplyError;-
178 reply->errorString = tr("Invalid reply received");-
179 return;
never executed: return;
0
180 }-
181-
182-
183 char host[512], answer[512];-
184 unsigned char *p = response + sizeof(HEADER);-
185 int status = local_dn_expand(response, response + responseLength, p, host, sizeof(host));-
186 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-58
187 reply->error = QDnsLookup::InvalidReplyError;-
188 reply->errorString = tr("Could not expand domain name");-
189 return;
never executed: return;
0
190 }-
191 p += status + 4;-
192-
193-
194 int answerIndex = 0;-
195 while ((
(p < response ...esponseLength)Description
TRUEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEevaluated 52 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
p < response + responseLength)
(p < response ...esponseLength)Description
TRUEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEevaluated 52 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
&& (
(answerIndex < answerCount)Description
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
answerIndex < answerCount)
(answerIndex < answerCount)Description
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
6-100
196 status = local_dn_expand(response, response + responseLength, p, host, sizeof(host));-
197 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEevaluated 94 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-94
198 reply->error = QDnsLookup::InvalidReplyError;-
199 reply->errorString = tr("Could not expand domain name");-
200 return;
never executed: return;
0
201 }-
202 const QString name = QUrl::fromAce(host);-
203-
204 p += status;-
205 const quint16 type = (p[0] << 8) | p[1];-
206 p += 2;-
207 p += 2;-
208 const quint32 ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];-
209 p += 4;-
210 const quint16 size = (p[0] << 8) | p[1];-
211 p += 2;-
212-
213 if (type == QDnsLookup::A
type == QDnsLookup::ADescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
32-62
214 if (size != 4
size != 4Description
TRUEnever evaluated
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
) {
0-32
215 reply->error = QDnsLookup::InvalidReplyError;-
216 reply->errorString = tr("Invalid IPv4 address record");-
217 return;
never executed: return;
0
218 }-
219 const quint32 addr = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];-
220 QDnsHostAddressRecord record;-
221 record.d->name = name;-
222 record.d->timeToLive = ttl;-
223 record.d->value = QHostAddress(addr);-
224 reply->hostAddressRecords.append(record);-
225 }
executed 32 times by 2 tests: end of block
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
else if (type == QDnsLookup::AAAA
type == QDnsLookup::AAAADescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
18-44
226 if (size != 16
size != 16Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-18
227 reply->error = QDnsLookup::InvalidReplyError;-
228 reply->errorString = tr("Invalid IPv6 address record");-
229 return;
never executed: return;
0
230 }-
231 QDnsHostAddressRecord record;-
232 record.d->name = name;-
233 record.d->timeToLive = ttl;-
234 record.d->value = QHostAddress(p);-
235 reply->hostAddressRecords.append(record);-
236 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
else if (type == QDnsLookup::CNAME
type == QDnsLookup::CNAMEDescription
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-44
237 status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));-
238 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
239 reply->error = QDnsLookup::InvalidReplyError;-
240 reply->errorString = tr("Invalid canonical name record");-
241 return;
never executed: return;
0
242 }-
243 QDnsDomainNameRecord record;-
244 record.d->name = name;-
245 record.d->timeToLive = ttl;-
246 record.d->value = QUrl::fromAce(answer);-
247 reply->canonicalNameRecords.append(record);-
248 }
never executed: end of block
else if (type == QDnsLookup::NS
type == QDnsLookup::NSDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-38
249 status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));-
250 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-6
251 reply->error = QDnsLookup::InvalidReplyError;-
252 reply->errorString = tr("Invalid name server record");-
253 return;
never executed: return;
0
254 }-
255 QDnsDomainNameRecord record;-
256 record.d->name = name;-
257 record.d->timeToLive = ttl;-
258 record.d->value = QUrl::fromAce(answer);-
259 reply->nameServerRecords.append(record);-
260 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
else if (type == QDnsLookup::PTR
type == QDnsLookup::PTRDescription
TRUEnever evaluated
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-38
261 status = local_dn_expand(response, response + responseLength, p, answer, sizeof(answer));-
262 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
263 reply->error = QDnsLookup::InvalidReplyError;-
264 reply->errorString = tr("Invalid pointer record");-
265 return;
never executed: return;
0
266 }-
267 QDnsDomainNameRecord record;-
268 record.d->name = name;-
269 record.d->timeToLive = ttl;-
270 record.d->value = QUrl::fromAce(answer);-
271 reply->pointerRecords.append(record);-
272 }
never executed: end of block
else if (type == QDnsLookup::MX
type == QDnsLookup::MXDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-26
273 const quint16 preference = (p[0] << 8) | p[1];-
274 status = local_dn_expand(response, response + responseLength, p + 2, answer, sizeof(answer));-
275 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-12
276 reply->error = QDnsLookup::InvalidReplyError;-
277 reply->errorString = tr("Invalid mail exchange record");-
278 return;
never executed: return;
0
279 }-
280 QDnsMailExchangeRecord record;-
281 record.d->exchange = QUrl::fromAce(answer);-
282 record.d->name = name;-
283 record.d->preference = preference;-
284 record.d->timeToLive = ttl;-
285 reply->mailExchangeRecords.append(record);-
286 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
else if (type == QDnsLookup::SRV
type == QDnsLookup::SRVDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
8-18
287 const quint16 priority = (p[0] << 8) | p[1];-
288 const quint16 weight = (p[2] << 8) | p[3];-
289 const quint16 port = (p[4] << 8) | p[5];-
290 status = local_dn_expand(response, response + responseLength, p + 6, answer, sizeof(answer));-
291 if (status < 0
status < 0Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-18
292 reply->error = QDnsLookup::InvalidReplyError;-
293 reply->errorString = tr("Invalid service record");-
294 return;
never executed: return;
0
295 }-
296 QDnsServiceRecord record;-
297 record.d->name = name;-
298 record.d->target = QUrl::fromAce(answer);-
299 record.d->port = port;-
300 record.d->priority = priority;-
301 record.d->timeToLive = ttl;-
302 record.d->weight = weight;-
303 reply->serviceRecords.append(record);-
304 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
else if (type == QDnsLookup::TXT
type == QDnsLookup::TXTDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEnever evaluated
) {
0-18
305 unsigned char *txt = p;-
306 QDnsTextRecord record;-
307 record.d->name = name;-
308 record.d->timeToLive = ttl;-
309 while (txt < p + size
txt < p + sizeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
8-10
310 const unsigned char length = *txt;-
311 txt++;-
312 if (txt + length > p + size
txt + length > p + sizeDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qdnslookup - unknown status
) {
0-10
313 reply->error = QDnsLookup::InvalidReplyError;-
314 reply->errorString = tr("Invalid text record");-
315 return;
never executed: return;
0
316 }-
317 record.d->values << QByteArray((char*)txt, length);-
318 txt += length;-
319 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
10
320 reply->textRecords.append(record);-
321 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qdnslookup - unknown status
8
322 p += size;-
323 answerIndex++;-
324 }
executed 94 times by 2 tests: end of block
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
94
325}
executed 58 times by 2 tests: end of block
Executed by:
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
58
326-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9