source:
libabac/prover_plus.cc
@
6e73091
Last change on this file since 6e73091 was 55c272b, checked in by , 14 years ago | |
---|---|
|
|
File size: 735 bytes |
Rev | Line | |
---|---|---|
[64fa9ba] | 1 | #include <err.h> |
2 | #include <stdio.h> | |
[9dffbd6] | 3 | #include <vector> |
[64fa9ba] | 4 | |
[6ede88c] | 5 | #include <abac.hh> |
[64fa9ba] | 6 | |
[7af34ed] | 7 | #include "options.h" |
8 | ||
[64fa9ba] | 9 | using namespace ABAC; |
[9dffbd6] | 10 | using std::vector; |
[64fa9ba] | 11 | |
12 | int main(int argc, char **argv) { | |
13 | int i; | |
14 | abac_credential_t *cred; | |
15 | ||
[7af34ed] | 16 | options_t opts = { 0, }; |
17 | get_options(argc, argv, &opts); | |
[64fa9ba] | 18 | |
19 | Context ctx; | |
[7af34ed] | 20 | ctx.load_directory(opts.keystore); |
[64fa9ba] | 21 | |
[4e426c9] | 22 | bool success; |
[9dffbd6] | 23 | vector<Credential> credentials = ctx.query( |
[7af34ed] | 24 | opts.role, opts.principal, |
[4e426c9] | 25 | success |
[64fa9ba] | 26 | ); |
27 | ||
[4e426c9] | 28 | if (success) |
29 | puts("success"); | |
[9dffbd6] | 30 | for (vector<Credential>::iterator i = credentials.begin(); i != credentials.end(); ++i) { |
[64fa9ba] | 31 | printf("credential %s <- %s\n", |
[2af3b82] | 32 | i->head().string(), |
33 | i->tail().string() | |
[64fa9ba] | 34 | ); |
35 | } | |
36 | ||
37 | return 0; | |
38 | } |
Note: See TracBrowser
for help on using the repository browser.