make it more verbose and useful

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10072 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-06-17 12:22:59 +00:00
parent 2e11d16160
commit 7fd81134a3

View File

@@ -38,21 +38,27 @@ RCSID("$Id$");
int
main(int argc, char **argv)
{
int i;
int i, j;
krb5_context context;
krb5_init_context (&context);
int types[] = {KRB5_KRBHST_KDC, KRB5_KRBHST_ADMIN, KRB5_KRBHST_CHANGEPW,
KRB5_KRBHST_KRB524};
const char *type_str[] = {"kdc", "admin", "changepw", "krb524"};
krb5_init_context (&context);
for(i = 1; i < argc; i++) {
krb5_krbhst_handle handle;
char host[MAXHOSTNAMELEN];
krb5_krbhst_init(context, argv[i], KRB5_KRBHST_KDC, &handle);
while(krb5_krbhst_next_as_string(context, handle, host, sizeof(host)) == 0)
printf("%s\n", host);
krb5_krbhst_reset(context, handle);
printf("----\n");
while(krb5_krbhst_next_as_string(context, handle, host, sizeof(host)) == 0)
printf("%s\n", host);
krb5_krbhst_free(context, handle);
for (j = 0; j < sizeof(types)/sizeof(*types); ++j) {
printf ("%s for %s:\n", type_str[j], argv[i]);
krb5_krbhst_init(context, argv[i], types[j], &handle);
while(krb5_krbhst_next_as_string(context, handle,
host, sizeof(host)) == 0)
printf("%s\n", host);
krb5_krbhst_reset(context, handle);
printf ("\n");
}
}
return 0;
}