source:
libabac/prover_yap.c
@
53e540d
Last change on this file since 53e540d was e95d652, checked in by , 13 years ago | |
---|---|
|
|
File size: 954 bytes |
Line | |
---|---|
1 | |
2 | |
3 | #include <err.h> |
4 | #include <stdio.h> |
5 | |
6 | #include <abac_pl.h> |
7 | |
8 | #include "options.h" |
9 | |
10 | int main(int argc, char **argv) { |
11 | int i, success; |
12 | abac_credential_t *cred; |
13 | |
14 | options_t opts = { 0, }; |
15 | get_options(argc, argv, &opts); |
16 | abac_context_t *ctx = abac_context_new(); |
17 | abac_context_load_directory(ctx, opts.keystore); |
18 | abac_credential_t **credentials = abac_context_query(ctx, |
19 | opts.role, opts.principal, |
20 | &success |
21 | ); |
22 | if (success) |
23 | puts("prover success!!"); |
24 | |
25 | if (credentials != NULL) |
26 | puts("credentials needed :"); |
27 | for (i = 0; credentials[i] != NULL; ++i) { |
28 | cred = credentials[i]; |
29 | printf("(%d) %s <- %s\n", i, |
30 | abac_role_string(abac_credential_head(cred)), |
31 | abac_role_string(abac_credential_tail(cred)) |
32 | ); |
33 | } |
34 | abac_context_credentials_free(credentials); |
35 | |
36 | abac_context_free(ctx); |
37 | |
38 | return 0; |
39 | } |
Note: See TracBrowser
for help on using the repository browser.