abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since 7af34ed was
7af34ed,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
give query options to example prover code
|
-
Property mode set to
100644
|
File size:
953 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 | libabac_init(); |
---|
16 | |
---|
17 | abac_context_t *ctx = abac_context_new(); |
---|
18 | abac_context_load_directory(ctx, opts.keystore); |
---|
19 | |
---|
20 | abac_credential_t **credentials = abac_context_query(ctx, |
---|
21 | opts.role, opts.principal, |
---|
22 | &success |
---|
23 | ); |
---|
24 | |
---|
25 | if (success) |
---|
26 | puts("success"); |
---|
27 | |
---|
28 | if (credentials != NULL) |
---|
29 | for (i = 0; credentials[i] != NULL; ++i) { |
---|
30 | cred = credentials[i]; |
---|
31 | printf("credential %s <- %s\n", |
---|
32 | abac_role_string(abac_credential_head(cred)), |
---|
33 | abac_role_string(abac_credential_tail(cred)) |
---|
34 | ); |
---|
35 | } |
---|
36 | |
---|
37 | abac_context_credentials_free(credentials); |
---|
38 | |
---|
39 | abac_context_free(ctx); |
---|
40 | |
---|
41 | libabac_deinit(); |
---|
42 | |
---|
43 | return 0; |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.