Lines Matching +full:5 +full:kd
171 krbhst_empty(const struct krb5_krbhst_data *kd) in krbhst_empty() argument
173 return kd->index == &kd->hosts; in krbhst_empty()
177 * Return the default protocol for the `kd' (either TCP or UDP)
181 krbhst_get_default_proto(struct krb5_krbhst_data *kd) in krbhst_get_default_proto() argument
183 if (kd->flags & KD_LARGE_MSG) in krbhst_get_default_proto()
204 parse_hostspec(krb5_context context, struct krb5_krbhst_data *kd, in parse_hostspec() argument
214 hi->proto = krbhst_get_default_proto(kd); in parse_hostspec()
219 } else if(strncmp(p, "http/", 5) == 0) { in parse_hostspec()
221 p += 5; in parse_hostspec()
296 append_host_hostinfo(struct krb5_krbhst_data *kd, struct krb5_krbhst_info *host) in append_host_hostinfo() argument
300 for(h = kd->hosts; h; h = h->next) in append_host_hostinfo()
307 *kd->end = host; in append_host_hostinfo()
308 kd->end = &host->next; in append_host_hostinfo()
312 append_host_string(krb5_context context, struct krb5_krbhst_data *kd, in append_host_string() argument
317 hi = parse_hostspec(context, kd, host, def_port, port); in append_host_string()
321 append_host_hostinfo(kd, hi); in append_host_string()
428 get_next(struct krb5_krbhst_data *kd, krb5_krbhst_info **host) in get_next() argument
430 struct krb5_krbhst_info *hi = *kd->index; in get_next()
433 kd->index = &(*kd->index)->next; in get_next()
440 srv_get_hosts(krb5_context context, struct krb5_krbhst_data *kd, in srv_get_hosts() argument
447 ret = srv_find_realm(context, &res, &count, kd->realm, "SRV", proto, service, in srv_get_hosts()
448 kd->port); in srv_get_hosts()
450 kd->realm, proto, service, ret); in srv_get_hosts()
454 append_host_hostinfo(kd, res[i]); in srv_get_hosts()
459 * read the configuration for `conf_string', defaulting to kd->def_port and
460 * forcing it to `kd->port' if kd->port != 0
464 config_get_hosts(krb5_context context, struct krb5_krbhst_data *kd, in config_get_hosts() argument
470 "realms", kd->realm, conf_string, NULL); in config_get_hosts()
473 kd->realm, hostlist ? "" : " not"); in config_get_hosts()
477 kd->flags |= KD_CONFIG_EXISTS; in config_get_hosts()
479 append_host_string(context, kd, hostlist[i], kd->def_port, kd->port); in config_get_hosts()
485 * as a fallback, look for `serv_string.kd->realm' (typically
492 fallback_get_hosts(krb5_context context, struct krb5_krbhst_data *kd, in fallback_get_hosts() argument
502 kd->fallback_count, kd->realm, serv_string); in fallback_get_hosts()
508 if(kd->fallback_count >= 5) { in fallback_get_hosts()
509 kd->flags |= KD_FALLBACK; in fallback_get_hosts()
513 if(kd->fallback_count == 0) in fallback_get_hosts()
514 ret = asprintf(&host, "%s.%s.", serv_string, kd->realm); in fallback_get_hosts()
517 serv_string, kd->fallback_count, kd->realm); in fallback_get_hosts()
528 kd->flags |= KD_FALLBACK; in fallback_get_hosts()
545 append_host_hostinfo(kd, hi); in fallback_get_hosts()
546 kd->fallback_count++; in fallback_get_hosts()
559 struct krb5_krbhst_data *kd = ctx; in add_locate() local
573 make_hints(&hints, krbhst_get_default_proto(kd)); in add_locate()
584 hi->proto = krbhst_get_default_proto(kd); in add_locate()
589 append_host_hostinfo(kd, hi); in add_locate()
596 struct krb5_krbhst_data *kd, in plugin_get_hosts() argument
616 ret = (*service->lookup)(ctx, type, kd->realm, 0, 0, add_locate, kd); in plugin_get_hosts()
621 kd->realm, ret); in plugin_get_hosts()
624 _krb5_debug(context, 2, "plugin found result for realm %s", kd->realm); in plugin_get_hosts()
625 kd->flags |= KD_CONFIG_EXISTS; in plugin_get_hosts()
638 struct krb5_krbhst_data *kd, in kdc_get_next() argument
643 if ((kd->flags & KD_PLUGIN) == 0) { in kdc_get_next()
644 plugin_get_hosts(context, kd, locate_service_kdc); in kdc_get_next()
645 kd->flags |= KD_PLUGIN; in kdc_get_next()
646 if(get_next(kd, host)) in kdc_get_next()
650 if((kd->flags & KD_CONFIG) == 0) { in kdc_get_next()
651 config_get_hosts(context, kd, "kdc"); in kdc_get_next()
652 kd->flags |= KD_CONFIG; in kdc_get_next()
653 if(get_next(kd, host)) in kdc_get_next()
657 if (kd->flags & KD_CONFIG_EXISTS) { in kdc_get_next()
660 kd->realm); in kdc_get_next()
665 if((kd->flags & KD_SRV_UDP) == 0 && (kd->flags & KD_LARGE_MSG) == 0) { in kdc_get_next()
666 srv_get_hosts(context, kd, "udp", "kerberos"); in kdc_get_next()
667 kd->flags |= KD_SRV_UDP; in kdc_get_next()
668 if(get_next(kd, host)) in kdc_get_next()
672 if((kd->flags & KD_SRV_TCP) == 0) { in kdc_get_next()
673 srv_get_hosts(context, kd, "tcp", "kerberos"); in kdc_get_next()
674 kd->flags |= KD_SRV_TCP; in kdc_get_next()
675 if(get_next(kd, host)) in kdc_get_next()
678 if((kd->flags & KD_SRV_HTTP) == 0) { in kdc_get_next()
679 srv_get_hosts(context, kd, "http", "kerberos"); in kdc_get_next()
680 kd->flags |= KD_SRV_HTTP; in kdc_get_next()
681 if(get_next(kd, host)) in kdc_get_next()
686 while((kd->flags & KD_FALLBACK) == 0) { in kdc_get_next()
687 ret = fallback_get_hosts(context, kd, "kerberos", in kdc_get_next()
688 kd->def_port, in kdc_get_next()
689 krbhst_get_default_proto(kd)); in kdc_get_next()
692 if(get_next(kd, host)) in kdc_get_next()
696 _krb5_debug(context, 0, "No KDC entries found for %s", kd->realm); in kdc_get_next()
703 struct krb5_krbhst_data *kd, in admin_get_next() argument
708 if ((kd->flags & KD_PLUGIN) == 0) { in admin_get_next()
709 plugin_get_hosts(context, kd, locate_service_kadmin); in admin_get_next()
710 kd->flags |= KD_PLUGIN; in admin_get_next()
711 if(get_next(kd, host)) in admin_get_next()
715 if((kd->flags & KD_CONFIG) == 0) { in admin_get_next()
716 config_get_hosts(context, kd, "admin_server"); in admin_get_next()
717 kd->flags |= KD_CONFIG; in admin_get_next()
718 if(get_next(kd, host)) in admin_get_next()
722 if (kd->flags & KD_CONFIG_EXISTS) { in admin_get_next()
725 kd->realm); in admin_get_next()
730 if((kd->flags & KD_SRV_TCP) == 0) { in admin_get_next()
731 srv_get_hosts(context, kd, "tcp", "kerberos-adm"); in admin_get_next()
732 kd->flags |= KD_SRV_TCP; in admin_get_next()
733 if(get_next(kd, host)) in admin_get_next()
738 if (krbhst_empty(kd) in admin_get_next()
739 && (kd->flags & KD_FALLBACK) == 0) { in admin_get_next()
740 ret = fallback_get_hosts(context, kd, "kerberos", in admin_get_next()
741 kd->def_port, in admin_get_next()
742 krbhst_get_default_proto(kd)); in admin_get_next()
745 kd->flags |= KD_FALLBACK; in admin_get_next()
746 if(get_next(kd, host)) in admin_get_next()
750 _krb5_debug(context, 0, "No admin entries found for realm %s", kd->realm); in admin_get_next()
757 struct krb5_krbhst_data *kd, in kpasswd_get_next() argument
762 if ((kd->flags & KD_PLUGIN) == 0) { in kpasswd_get_next()
763 plugin_get_hosts(context, kd, locate_service_kpasswd); in kpasswd_get_next()
764 kd->flags |= KD_PLUGIN; in kpasswd_get_next()
765 if(get_next(kd, host)) in kpasswd_get_next()
769 if((kd->flags & KD_CONFIG) == 0) { in kpasswd_get_next()
770 config_get_hosts(context, kd, "kpasswd_server"); in kpasswd_get_next()
771 kd->flags |= KD_CONFIG; in kpasswd_get_next()
772 if(get_next(kd, host)) in kpasswd_get_next()
776 if (kd->flags & KD_CONFIG_EXISTS) { in kpasswd_get_next()
779 kd->realm); in kpasswd_get_next()
784 if((kd->flags & KD_SRV_UDP) == 0) { in kpasswd_get_next()
785 srv_get_hosts(context, kd, "udp", "kpasswd"); in kpasswd_get_next()
786 kd->flags |= KD_SRV_UDP; in kpasswd_get_next()
787 if(get_next(kd, host)) in kpasswd_get_next()
790 if((kd->flags & KD_SRV_TCP) == 0) { in kpasswd_get_next()
791 srv_get_hosts(context, kd, "tcp", "kpasswd"); in kpasswd_get_next()
792 kd->flags |= KD_SRV_TCP; in kpasswd_get_next()
793 if(get_next(kd, host)) in kpasswd_get_next()
800 if (krbhst_empty(kd)) { in kpasswd_get_next()
801 kd->flags = 0; in kpasswd_get_next()
802 kd->port = kd->def_port; in kpasswd_get_next()
803 kd->get_next = admin_get_next; in kpasswd_get_next()
804 ret = (*kd->get_next)(context, kd, host); in kpasswd_get_next()
806 (*host)->proto = krbhst_get_default_proto(kd); in kpasswd_get_next()
810 _krb5_debug(context, 0, "No kpasswd entries found for realm %s", kd->realm); in kpasswd_get_next()
817 struct krb5_krbhst_data *kd, in krb524_get_next() argument
820 if ((kd->flags & KD_PLUGIN) == 0) { in krb524_get_next()
821 plugin_get_hosts(context, kd, locate_service_krb524); in krb524_get_next()
822 kd->flags |= KD_PLUGIN; in krb524_get_next()
823 if(get_next(kd, host)) in krb524_get_next()
827 if((kd->flags & KD_CONFIG) == 0) { in krb524_get_next()
828 config_get_hosts(context, kd, "krb524_server"); in krb524_get_next()
829 if(get_next(kd, host)) in krb524_get_next()
831 kd->flags |= KD_CONFIG; in krb524_get_next()
834 if (kd->flags & KD_CONFIG_EXISTS) { in krb524_get_next()
837 kd->realm); in krb524_get_next()
842 if((kd->flags & KD_SRV_UDP) == 0) { in krb524_get_next()
843 srv_get_hosts(context, kd, "udp", "krb524"); in krb524_get_next()
844 kd->flags |= KD_SRV_UDP; in krb524_get_next()
845 if(get_next(kd, host)) in krb524_get_next()
849 if((kd->flags & KD_SRV_TCP) == 0) { in krb524_get_next()
850 srv_get_hosts(context, kd, "tcp", "krb524"); in krb524_get_next()
851 kd->flags |= KD_SRV_TCP; in krb524_get_next()
852 if(get_next(kd, host)) in krb524_get_next()
859 if (krbhst_empty(kd)) { in krb524_get_next()
860 kd->flags = 0; in krb524_get_next()
861 kd->port = kd->def_port; in krb524_get_next()
862 kd->get_next = kdc_get_next; in krb524_get_next()
863 return (*kd->get_next)(context, kd, host); in krb524_get_next()
866 _krb5_debug(context, 0, "No kpasswd entries found for realm %s", kd->realm); in krb524_get_next()
877 struct krb5_krbhst_data *kd; in common_init() local
879 if((kd = calloc(1, sizeof(*kd))) == NULL) in common_init()
882 if((kd->realm = strdup(realm)) == NULL) { in common_init()
883 free(kd); in common_init()
892 kd->flags |= KD_CONFIG_EXISTS; in common_init()
895 kd->flags |= KD_LARGE_MSG; in common_init()
896 kd->end = kd->index = &kd->hosts; in common_init()
897 return kd; in common_init()
920 struct krb5_krbhst_data *kd; in krb5_krbhst_init_flags() local
954 if((kd = common_init(context, service, realm, flags)) == NULL) in krb5_krbhst_init_flags()
956 kd->get_next = next; in krb5_krbhst_init_flags()
957 kd->def_port = def_port; in krb5_krbhst_init_flags()
958 *handle = kd; in krb5_krbhst_init_flags()