meiyap1
Last change
on this file since 6e73091 was
53e540d,
checked in by Mei <mei@…>, 13 years ago
|
1) adding appendL to do the credential list appending
|
-
Property mode set to
100644
|
File size:
997 bytes
|
Line | |
---|
1 | #include <err.h> |
---|
2 | #include <stdio.h> |
---|
3 | |
---|
4 | #include <abac.h> |
---|
5 | |
---|
6 | #include "options.h" |
---|
7 | |
---|
8 | int main(int argc, char **argv) { |
---|
9 | int i, success; |
---|
10 | abac_credential_t *cred; |
---|
11 | |
---|
12 | options_t opts = { 0, }; |
---|
13 | get_options(argc, argv, &opts); |
---|
14 | |
---|
15 | abac_context_t *ctx = abac_context_new(); |
---|
16 | abac_context_load_directory(ctx, opts.keystore); |
---|
17 | |
---|
18 | printf("ASKING a question role(%s), principal(%s)\n\n", opts.role, opts.principal); |
---|
19 | abac_credential_t **credentials = abac_context_query(ctx, |
---|
20 | opts.role, opts.principal, |
---|
21 | &success |
---|
22 | ); |
---|
23 | |
---|
24 | if (success) |
---|
25 | puts("success"); |
---|
26 | |
---|
27 | if (credentials != NULL) |
---|
28 | for (i = 0; credentials[i] != NULL; ++i) { |
---|
29 | cred = credentials[i]; |
---|
30 | printf("credential %s <- %s\n", |
---|
31 | abac_role_string(abac_credential_head(cred)), |
---|
32 | abac_role_string(abac_credential_tail(cred)) |
---|
33 | ); |
---|
34 | } |
---|
35 | |
---|
36 | abac_context_credentials_free(credentials); |
---|
37 | |
---|
38 | abac_context_free(ctx); |
---|
39 | |
---|
40 | return 0; |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.