abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since e96c107 was
e96c107,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
match example keystore
|
-
Property mode set to
100644
|
File size:
1008 bytes
|
Rev | Line | |
---|
[7f25a67f] | 1 | #include <err.h> |
---|
| 2 | #include <stdio.h> |
---|
| 3 | |
---|
[6ede88c] | 4 | #include <abac.h> |
---|
[7f25a67f] | 5 | |
---|
| 6 | int main(int argc, char **argv) { |
---|
[4e426c9] | 7 | int i, success; |
---|
[401a054] | 8 | abac_credential_t *cred; |
---|
[dc62c68] | 9 | |
---|
[7f25a67f] | 10 | if (argc < 2) |
---|
[5450aeb] | 11 | errx(1, "Usage: %s <keystore>", argv[0]); |
---|
[7f25a67f] | 12 | |
---|
[7dd5f2e] | 13 | libabac_init(); |
---|
[7f25a67f] | 14 | |
---|
[390f749] | 15 | abac_context_t *ctx = abac_context_new(); |
---|
| 16 | abac_context_load_directory(ctx, argv[1]); |
---|
[186cb75] | 17 | |
---|
[401a054] | 18 | abac_credential_t **credentials = abac_context_query(ctx, |
---|
[e96c107] | 19 | "06df985dc065fc69b508f6afa8dd127cd29ccc62.fed_create", |
---|
| 20 | "ef3584d91703acc4d9cb0f1f0950a31fc89e0b4c", |
---|
[4e426c9] | 21 | &success |
---|
[dc62c68] | 22 | ); |
---|
| 23 | |
---|
[4e426c9] | 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 | |
---|
[3c4fd68] | 36 | abac_context_credentials_free(credentials); |
---|
[902d079] | 37 | |
---|
[390f749] | 38 | abac_context_free(ctx); |
---|
[ea401bc] | 39 | |
---|
[7dd5f2e] | 40 | libabac_deinit(); |
---|
[186cb75] | 41 | |
---|
[7f25a67f] | 42 | return 0; |
---|
| 43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.