mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change
on this file since 59ea648 was
c586a3c,
checked in by Mei <mei@…>, 13 years ago
|
1) add support for float static range constraint
2) add a testcase for testing float static range constraint
3) add runall-fast (skipping the creddy part)
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[e95d652] | 1 | |
---|
| 2 | #include <err.h> |
---|
| 3 | #include <stdio.h> |
---|
[da5afdf] | 4 | #include <assert.h> |
---|
[e95d652] | 5 | |
---|
[202a7f9] | 6 | |
---|
[e95d652] | 7 | #include <abac_pl.h> |
---|
| 8 | |
---|
| 9 | #include "options.h" |
---|
| 10 | |
---|
[da5afdf] | 11 | extern void abac_print_cred_info(abac_credential_t*, FILE*); |
---|
[202a7f9] | 12 | |
---|
[e95d652] | 13 | int main(int argc, char **argv) { |
---|
[da5afdf] | 14 | int i, success=0; |
---|
| 15 | abac_credential_t *cred=NULL; |
---|
| 16 | abac_credential_t **credentials=NULL; |
---|
[e95d652] | 17 | |
---|
| 18 | options_t opts = { 0, }; |
---|
| 19 | get_options(argc, argv, &opts); |
---|
| 20 | abac_context_t *ctx = abac_context_new(); |
---|
| 21 | abac_context_load_directory(ctx, opts.keystore); |
---|
[da5afdf] | 22 | |
---|
| 23 | if(opts.filename) { |
---|
| 24 | credentials = abac_context_credentials(ctx); |
---|
| 25 | FILE *fp=fopen(opts.filename,"w+"); |
---|
| 26 | |
---|
| 27 | if (credentials != NULL) { |
---|
| 28 | for (i = 0; credentials[i] != NULL; ++i) { |
---|
| 29 | cred = credentials[i]; |
---|
| 30 | abac_print_cred_info(cred,fp); |
---|
| 31 | } |
---|
| 32 | abac_context_credentials_free(credentials); |
---|
| 33 | } |
---|
| 34 | fclose(fp); |
---|
| 35 | return 0; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | char *query=NULL; |
---|
| 39 | char *with=NULL; |
---|
| 40 | if(opts.role && opts.principal) { |
---|
| 41 | query=opts.role; |
---|
| 42 | with=opts.principal; |
---|
| 43 | } else { |
---|
| 44 | if(opts.oset) { |
---|
| 45 | query=opts.oset; |
---|
[c586a3c] | 46 | } |
---|
| 47 | if(opts.principal) { |
---|
[da5afdf] | 48 | with=opts.principal; |
---|
| 49 | } else if(opts.object) { |
---|
| 50 | with=opts.object; |
---|
[c586a3c] | 51 | } |
---|
| 52 | if(with==NULL || query==NULL) { |
---|
[0d0c3a9] | 53 | puts("prover eeekkk \n"); |
---|
[da5afdf] | 54 | assert(0); |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | credentials = abac_context_query(ctx, |
---|
| 58 | query, with, |
---|
| 59 | &success); |
---|
[e95d652] | 60 | if (success) |
---|
| 61 | puts("prover success!!"); |
---|
[da5afdf] | 62 | else puts("prover failed!!"); |
---|
[e95d652] | 63 | |
---|
[da5afdf] | 64 | if (credentials != NULL && success) { |
---|
[e95d652] | 65 | puts("credentials needed :"); |
---|
| 66 | for (i = 0; credentials[i] != NULL; ++i) { |
---|
[da5afdf] | 67 | cred = credentials[i]; |
---|
| 68 | abac_print_cred_info(cred,NULL); |
---|
[e95d652] | 69 | } |
---|
[da5afdf] | 70 | } |
---|
| 71 | if(credentials) |
---|
| 72 | abac_context_credentials_free(credentials); |
---|
[e95d652] | 73 | abac_context_free(ctx); |
---|
[da5afdf] | 74 | |
---|
[e95d652] | 75 | return 0; |
---|
| 76 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.