abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since df3fe37 was
55c272b,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
remove libabac_init and libabac_deinit
|
-
Property mode set to
100755
|
File size:
920 bytes
|
Rev | Line | |
---|
[06e2fc5] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use ABAC; |
---|
[7af34ed] | 5 | use Getopt::Long; |
---|
[06e2fc5] | 6 | use Data::Dumper; |
---|
| 7 | $Data::Dumper::Indent = 1; |
---|
| 8 | |
---|
[7af34ed] | 9 | my ($keystore, $role, $principal); |
---|
| 10 | GetOptions( |
---|
| 11 | 'keystore=s' => \$keystore, |
---|
| 12 | 'role=s' => \$role, |
---|
| 13 | 'principal=s' => \$principal, |
---|
| 14 | ) || usage(); |
---|
[06e2fc5] | 15 | |
---|
[7af34ed] | 16 | usage() unless defined $keystore && defined $role && defined $principal; |
---|
| 17 | |
---|
| 18 | # code starts here |
---|
[06e2fc5] | 19 | |
---|
| 20 | my $ctx = ABAC::Context->new; |
---|
| 21 | $ctx->load_directory($keystore); |
---|
| 22 | |
---|
[7af34ed] | 23 | my ($success, $credentials) = $ctx->query($role, $principal); |
---|
[06e2fc5] | 24 | |
---|
| 25 | if ($success) { |
---|
| 26 | print "Success\n"; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | foreach my $credential (@$credentials) { |
---|
| 30 | printf "credential %s <- %s\n", |
---|
| 31 | $credential->head->string, |
---|
| 32 | $credential->tail->string; |
---|
| 33 | } |
---|
| 34 | |
---|
[7af34ed] | 35 | sub usage { |
---|
| 36 | print "Usage: $0 \\\n"; |
---|
| 37 | print " --keystore <keystore> \\\n"; |
---|
| 38 | print " --role <role> --principal <principal>\n"; |
---|
| 39 | print " loads the keystore and runs the query role <-?- principal\n"; |
---|
| 40 | exit 1; |
---|
| 41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.