blob: 9603189104a57fd51ad58cf05b1b723228763753 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include "krb5.h"
#include <stdio.h>
void
test_realm_iterator(int ctx)
{
krb5_error_code retval;
char *realm;
void *iter;
if ((retval = krb5_realm_iterator_create(ctx, &iter))) {
com_err("krb5_realm_iterator_create", retval, 0);
return;
}
while (iter) {
if ((retval = krb5_realm_iterator(ctx, &iter, &realm))) {
com_err("krb5_realm_iterator", retval, 0);
krb5_realm_iterator_free(ctx, &iter);
return;
}
if (realm) {
printf("Realm: '%s'\n", realm);
krb5_free_realm_string(ctx, realm);
}
}
}
int
main(int argc, char **argv)
{
krb5_context ctx;
krb5_error_code retval;
retval = krb5_init_context(&ctx);
if (retval) {
fprintf(stderr, "krb5_init_context returned error %ld\n",
retval);
exit(1);
}
test_realm_iterator(ctx);
krb5_free_context(ctx);
return 0;
}
|