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