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 int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i; int i, j;
krb5_context context; 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++) { for(i = 1; i < argc; i++) {
krb5_krbhst_handle handle; krb5_krbhst_handle handle;
char host[MAXHOSTNAMELEN]; 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) for (j = 0; j < sizeof(types)/sizeof(*types); ++j) {
printf("%s\n", host); printf ("%s for %s:\n", type_str[j], argv[i]);
krb5_krbhst_reset(context, handle);
printf("----\n"); krb5_krbhst_init(context, argv[i], types[j], &handle);
while(krb5_krbhst_next_as_string(context, handle, host, sizeof(host)) == 0) while(krb5_krbhst_next_as_string(context, handle,
printf("%s\n", host); host, sizeof(host)) == 0)
krb5_krbhst_free(context, handle); printf("%s\n", host);
krb5_krbhst_reset(context, handle);
printf ("\n");
}
} }
return 0; return 0;
} }