Lines Matching defs:ds

85     struct krb5int_dns_state *ds;
90 *dsp = ds = malloc(sizeof(*ds));
91 if (ds == NULL)
95 ds->nclass = nclass;
96 ds->ntype = ntype;
97 ds->ansp = NULL;
98 ds->anslen = 0;
99 ds->ansmax = 0;
104 ds->cur_ans = 0;
117 p = (ds->ansp == NULL)
118 ? malloc(nextincr) : realloc(ds->ansp, nextincr);
120 if (p == NULL && ds->ansp != NULL) {
124 ds->ansp = p;
125 ds->ansmax = nextincr;
128 len = res_nsearch(&statbuf, host, ds->nclass, ds->ntype,
129 ds->ansp, ds->ansmax);
131 len = res_search(host, ds->nclass, ds->ntype,
132 ds->ansp, ds->ansmax);
144 } while (len > ds->ansmax);
146 ds->anslen = len;
148 ret = ns_initparse(ds->ansp, ds->anslen, &ds->msg);
150 ret = initparse(ds);
162 if (ds->ansp != NULL) {
163 free(ds->ansp);
164 ds->ansp = NULL;
179 krb5int_dns_nextans(struct krb5int_dns_state *ds,
187 while (ds->cur_ans < ns_msg_count(ds->msg, ns_s_an)) {
188 len = ns_parserr(&ds->msg, ns_s_an, ds->cur_ans, &rr);
191 ds->cur_ans++;
192 if (ds->nclass == ns_rr_class(rr)
193 && ds->ntype == ns_rr_type(rr)) {
206 int krb5int_dns_expand(struct krb5int_dns_state *ds,
212 return ns_name_uncompress(ds->ansp,
213 (unsigned char *)ds->ansp + ds->anslen,
216 return dn_expand(ds->ansp,
217 (unsigned char *)ds->ansp + ds->anslen,
226 krb5int_dns_fini(struct krb5int_dns_state *ds)
228 if (ds == NULL)
230 if (ds->ansp != NULL)
231 free(ds->ansp);
232 free(ds);
248 initparse(struct krb5int_dns_state *ds)
258 if (ds->anslen < sizeof(HEADER))
261 hdr = (HEADER *)ds->ansp;
262 p = ds->ansp;
272 len = dn_skipname(p, (unsigned char *)ds->ansp + ds->anslen);
274 len = dn_expand(ds->ansp, (unsigned char *)ds->ansp + ds->anslen,
277 if (len < 0 || !INCR_OK(ds->ansp, ds->anslen, p, len + 4))
281 ds->ptr = p;
282 ds->nanswers = nanswers;
292 krb5int_dns_nextans(struct krb5int_dns_state *ds,
304 p = ds->ptr;
306 while (ds->nanswers--) {
308 len = dn_skipname(p, (unsigned char *)ds->ansp + ds->anslen);
310 len = dn_expand(ds->ansp, (unsigned char *)ds->ansp + ds->anslen,
313 if (len < 0 || !INCR_OK(ds->ansp, ds->anslen, p, len))
316 SAFE_GETUINT16(ds->ansp, ds->anslen, p, 2, ntype, out);
318 SAFE_GETUINT16(ds->ansp, ds->anslen, p, 6, nclass, out);
319 SAFE_GETUINT16(ds->ansp, ds->anslen, p, 2, rdlen, out);
321 if (!INCR_OK(ds->ansp, ds->anslen, p, rdlen))
328 if (nclass == ds->nclass && ntype == ds->ntype) {
331 ds->ptr = p + rdlen;