Lines Matching +full:t +full:- +full:head

1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/os/dnssrv.c - Perform DNS SRV queries */
17 * the name of M.I.T. not be used in advertising or publicity pertaining
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
29 #include "k5-int.h"
30 #include "os-proto.h"
41 next = p->next; in krb5int_free_srv_dns_data()
42 free(p->host); in krb5int_free_srv_dns_data()
56 if (memchr(realm->data, 0, realm->length)) in make_lookup_name()
65 k5_buf_add_len(&buf, realm->data, realm->length); in make_lookup_name()
68 * Realm names don't (normally) end with ".", but if the query doesn't end in make_lookup_name()
69 * with "." and doesn't get an answer as is, the resolv code will try in make_lookup_name()
74 if (buf.len > 0 && ((char *)buf.data)[buf.len - 1] != '.') in make_lookup_name()
80 /* Insert new into the list *head, ordering by priority. Weight is not
83 place_srv_entry(struct srv_dns_entry **head, struct srv_dns_entry *new) in place_srv_entry() argument
87 if (*head == NULL || (*head)->priority > new->priority) { in place_srv_entry()
88 new->next = *head; in place_srv_entry()
89 *head = new; in place_srv_entry()
93 for (entry = *head; entry != NULL; entry = entry->next) { in place_srv_entry()
99 if (entry->next == NULL || entry->next->priority > new->priority) { in place_srv_entry()
100 new->next = entry->next; in place_srv_entry()
101 entry->next = new; in place_srv_entry()
131 struct srv_dns_entry *head = NULL, *srv = NULL; in krb5int_make_srv_query_realm() local
152 for (rr = records; rr != NULL; rr = rr->pNext) { in krb5int_make_srv_query_realm()
153 if (rr->wType != DNS_TYPE_SRV) in krb5int_make_srv_query_realm()
160 srv->priority = rr->Data.SRV.wPriority; in krb5int_make_srv_query_realm()
161 srv->weight = rr->Data.SRV.wWeight; in krb5int_make_srv_query_realm()
162 srv->port = rr->Data.SRV.wPort; in krb5int_make_srv_query_realm()
164 if (asprintf(&srv->host, "%s.", rr->Data.SRV.pNameTarget) < 0) { in krb5int_make_srv_query_realm()
169 TRACE_DNS_SRV_ANS(context, srv->host, srv->port, srv->priority, in krb5int_make_srv_query_realm()
170 srv->weight); in krb5int_make_srv_query_realm()
171 place_srv_entry(&head, srv); in krb5int_make_srv_query_realm()
178 *answers = head; in krb5int_make_srv_query_realm()
197 struct srv_dns_entry *head = NULL, *uri = NULL; in k5_make_uri_query() local
231 uri->priority = priority; in k5_make_uri_query()
232 uri->weight = weight; in k5_make_uri_query()
233 /* rdlen - 4 bytes remain after the priority and weight. */ in k5_make_uri_query()
234 uri->host = k5memdup0(p, rdlen - 4, &ret); in k5_make_uri_query()
235 if (uri->host == NULL) { in k5_make_uri_query()
240 TRACE_DNS_URI_ANS(context, uri->host, uri->priority, uri->weight); in k5_make_uri_query()
241 place_srv_entry(&head, uri); in k5_make_uri_query()
247 *answers = head; in k5_make_uri_query()
269 struct srv_dns_entry *head = NULL, *srv = NULL; in krb5int_make_srv_query_realm() local
319 * it's in the right order. Right now we don't do anything in krb5int_make_srv_query_realm()
327 srv->priority = priority; in krb5int_make_srv_query_realm()
328 srv->weight = weight; in krb5int_make_srv_query_realm()
329 srv->port = port; in krb5int_make_srv_query_realm()
330 /* The returned names are fully qualified. Don't let the in krb5int_make_srv_query_realm()
332 if (asprintf(&srv->host, "%s.", host) < 0) { in krb5int_make_srv_query_realm()
337 TRACE_DNS_SRV_ANS(context, srv->host, srv->port, srv->priority, in krb5int_make_srv_query_realm()
338 srv->weight); in krb5int_make_srv_query_realm()
339 place_srv_entry(&head, srv); in krb5int_make_srv_query_realm()
345 *answers = head; in krb5int_make_srv_query_realm()