krb5_error_code krb5_sendto_kdc(krb5_context, const krb5_data *,
const krb5_data *, krb5_data *, int *, int);
-krb5_error_code krb5_get_krbhst(krb5_context, const krb5_data *, char *** );
-krb5_error_code krb5_free_krbhst(krb5_context, char * const * );
krb5_error_code krb5_create_secure_file(krb5_context, const char * pathname);
krb5_error_code krb5_sync_disk_file(krb5_context, FILE *fp);
krb5_free_keyblock
krb5_free_keyblock_contents
krb5_free_keytab_entry_contents
-krb5_free_krbhst
krb5_free_last_req
krb5_free_octet_data
krb5_free_pa_data
krb5_get_init_creds_opt_set_salt
krb5_get_init_creds_opt_set_tkt_life
krb5_get_init_creds_password
-krb5_get_krbhst
krb5_get_notification_message
krb5_get_permitted_enctypes
krb5_get_profile
dnsglue.o \
dnssrv.o \
expand_path.o \
- free_krbhs.o \
full_ipadr.o \
- get_krbhst.o \
gen_port.o \
genaddrs.o \
gen_rname.o \
$(OUTPRE)dnsglue.$(OBJEXT) \
$(OUTPRE)dnssrv.$(OBJEXT) \
$(OUTPRE)expand_path.$(OBJEXT) \
- $(OUTPRE)free_krbhs.$(OBJEXT) \
$(OUTPRE)full_ipadr.$(OBJEXT) \
- $(OUTPRE)get_krbhst.$(OBJEXT) \
$(OUTPRE)gen_port.$(OBJEXT) \
$(OUTPRE)genaddrs.$(OBJEXT) \
$(OUTPRE)gen_rname.$(OBJEXT) \
$(srcdir)/dnsglue.c \
$(srcdir)/dnssrv.c \
$(srcdir)/expand_path.c \
- $(srcdir)/free_krbhs.c \
$(srcdir)/full_ipadr.c \
- $(srcdir)/get_krbhst.c \
$(srcdir)/gen_port.c \
$(srcdir)/genaddrs.c \
$(srcdir)/gen_rname.c \
check-unix-stdconf:: t_std_conf
KRB5_CONFIG=$(srcdir)/td_krb5.conf ; export KRB5_CONFIG ;\
$(KRB5_RUN_ENV) $(VALGRIND) ./t_std_conf -d -s NEW.DEFAULT.REALM -d \
- -k IGGY.ORG -k DEFAULT_REALM.TST \
-D DEFAULT_REALM.TST -r bad.idea -r itar.bad.idea \
-r really.BAD.IDEA. -r clipper.bad.idea -r KeYEsCrOW.BaD.IDea \
-r pgp.good.idea -r no_domain > test.out
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/* lib/krb5/os/free_krbhs.c */
-/*
- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
- * All Rights Reserved.
- *
- * Export of this software from the United States of America may
- * require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Furthermore if you modify this software you must label
- * your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#include "k5-int.h"
-
-/* Free the storage taken by a host list returned by krb5_get_krbhst. */
-krb5_error_code
-krb5_free_krbhst(krb5_context context, char *const *hostlist)
-{
- register char * const *cp;
-
- if (hostlist == NULL)
- return 0;
- for (cp = hostlist; *cp; cp++)
- free(*cp);
- free((char *)hostlist);
- return 0;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/* lib/krb5/os/get_krbhst.c */
-/*
- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
- * All Rights Reserved.
- *
- * Export of this software from the United States of America may
- * require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Furthermore if you modify this software you must label
- * your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#include "k5-int.h"
-#include <stdio.h>
-#include <ctype.h>
-
-/*
- Figures out the Kerberos server names for the given realm, filling in a
- pointer to an argv[] style list of names, terminated with a null pointer.
-
- If the realm is unknown, the filled-in pointer is set to NULL.
-
- The pointer array and strings pointed to are all in allocated storage,
- and should be freed by the caller when finished.
-
- returns system errors
-*/
-
-/*
- * Implementation: the server names for given realms are stored in a
- * configuration file,
- * named by krb5_config_file; the first token (on the first line) in
- * this file is taken as the default local realm name.
- *
- * Each succeeding line has a realm name as the first token, and a server name
- * as a second token. Additional tokens may be present on the line, but
- * are ignored by this function.
- *
- * All lines which begin with the desired realm name will have the
- * hostname added to the list returned.
- */
-
-krb5_error_code
-krb5_get_krbhst(krb5_context context, const krb5_data *realm, char ***hostlist)
-{
- char **values, **cpp, *cp;
- const char *realm_kdc_names[4];
- krb5_error_code retval;
- int i, count;
- char **rethosts;
-
- rethosts = 0;
-
- realm_kdc_names[0] = KRB5_CONF_REALMS;
- realm_kdc_names[1] = realm->data;
- realm_kdc_names[2] = KRB5_CONF_KDC;
- realm_kdc_names[3] = 0;
-
- if (context->profile == 0)
- return KRB5_CONFIG_CANTOPEN;
-
- retval = profile_get_values(context->profile, realm_kdc_names, &values);
- if (retval == PROF_NO_SECTION)
- return KRB5_REALM_UNKNOWN;
- if (retval == PROF_NO_RELATION)
- return KRB5_CONFIG_BADFORMAT;
- if (retval)
- return retval;
-
- /*
- * Do cleanup over the list. We allow for some extra field to be
- * added to the kdc line later (maybe the port number)
- */
- for (cpp = values; *cpp; cpp++) {
- cp = strchr(*cpp, ' ');
- if (cp)
- *cp = 0;
- cp = strchr(*cpp, '\t');
- if (cp)
- *cp = 0;
- cp = strchr(*cpp, ':');
- if (cp)
- *cp = 0;
- }
- count = cpp - values;
- rethosts = malloc(sizeof(char *) * (count + 1));
- if (!rethosts) {
- retval = ENOMEM;
- goto cleanup;
- }
- for (i = 0; i < count; i++) {
- rethosts[i] = k5memdup0(values[i], strlen(values[i]), &retval);
- if (rethosts[i] == NULL)
- goto cleanup;
- }
- rethosts[count] = 0;
-cleanup:
- if (retval && rethosts) {
- for (cpp = rethosts; *cpp; cpp++)
- free(*cpp);
- free(rethosts);
- rethosts = 0;
- }
- profile_free_list(values);
- *hostlist = rethosts;
- return retval;
-}
krb5_error_code KRB5_CALLCONV
krb5_free_host_realm(krb5_context context, char *const *realmlist)
{
- /* same format, so why duplicate code? */
- return krb5_free_krbhst(context, realmlist);
+ char *const *cp;
+
+ if (realmlist == NULL)
+ return 0;
+ for (cp = realmlist; *cp; cp++)
+ free(*cp);
+ free((char *)realmlist);
+ return 0;
}
krb5_get_default_realm() returned 'DEFAULT.REALM.TST'
krb5_set_default_realm(NEW.DEFAULT.REALM)
krb5_get_default_realm() returned 'NEW.DEFAULT.REALM'
-krb_get_krbhst(IGGY.ORG) returned: 'KERBEROS.IGGY.ORG' 'KERBEROS-B.IGGY.ORG'
-krb_get_krbhst(DEFAULT_REALM.TST) returned: 'FIRST.KDC.HOST' 'SECOND.KDC.HOST'
krb5_get_realm_domain(DEFAULT_REALM.TST) returned 'MIT.EDU'
krb_get_host_realm(bad.idea) returned: 'US.GOV'
krb_get_host_realm(itar.bad.idea) returned: 'NSA.GOV'
printf("krb5_set_default_ccname(%s)\n", ccname);
}
-static void
-test_get_krbhst(krb5_context ctx, char *realm)
-{
- char **hostlist, **cpp;
- krb5_data rlm;
- krb5_error_code retval;
-
- rlm.data = realm;
- rlm.length = strlen(realm);
- retval = krb5_get_krbhst(ctx, &rlm, &hostlist);
- if (retval) {
- com_err("krb5_get_krbhst", retval, 0);
- return;
- }
- printf("krb_get_krbhst(%s) returned:", realm);
- if (hostlist == 0) {
- printf(" (null)\n");
- return;
- }
- if (hostlist[0] == 0) {
- printf(" (none)\n");
- krb5_free_krbhst(ctx, hostlist);
- return;
- }
- for (cpp = hostlist; *cpp; cpp++) {
- printf(" '%s'", *cpp);
- }
- krb5_free_krbhst(ctx, hostlist);
- printf("\n");
-}
-
static void
test_locate_kdc(krb5_context ctx, char *realm)
{
exit(1);
}
- while ((c = getopt(argc, argv, "cdk:r:C:D:l:s:")) != -1) {
+ while ((c = getopt(argc, argv, "cdr:C:D:l:s:")) != -1) {
switch (c) {
case 'c': /* Get default ccname */
test_get_default_ccname(ctx);
case 'd': /* Get default realm */
test_get_default_realm(ctx);
break;
- case 'k': /* Get list of KDC's */
- test_get_krbhst(ctx, optarg);
- break;
case 'l':
test_locate_kdc(ctx, optarg);
break;