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