abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since e2a0f26 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:
779 bytes
|
Line | |
---|
1 | #include <err.h> |
---|
2 | #include <stdio.h> |
---|
3 | #include <vector> |
---|
4 | |
---|
5 | #include <abac.hh> |
---|
6 | |
---|
7 | #include "options.h" |
---|
8 | |
---|
9 | using namespace ABAC; |
---|
10 | using std::vector; |
---|
11 | |
---|
12 | int main(int argc, char **argv) { |
---|
13 | int i; |
---|
14 | abac_credential_t *cred; |
---|
15 | |
---|
16 | options_t opts = { 0, }; |
---|
17 | get_options(argc, argv, &opts); |
---|
18 | |
---|
19 | libabac_init(); |
---|
20 | |
---|
21 | Context ctx; |
---|
22 | ctx.load_directory(opts.keystore); |
---|
23 | |
---|
24 | bool success; |
---|
25 | vector<Credential> credentials = ctx.query( |
---|
26 | opts.role, opts.principal, |
---|
27 | success |
---|
28 | ); |
---|
29 | |
---|
30 | if (success) |
---|
31 | puts("success"); |
---|
32 | for (vector<Credential>::iterator i = credentials.begin(); i != credentials.end(); ++i) { |
---|
33 | printf("credential %s <- %s\n", |
---|
34 | i->head().string(), |
---|
35 | i->tail().string() |
---|
36 | ); |
---|
37 | } |
---|
38 | |
---|
39 | libabac_deinit(); |
---|
40 | |
---|
41 | return 0; |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.