abac0-leak
Last change
on this file since f2622ee was
461541a,
checked in by Mei <mei@…>, 11 years ago
|
1) updated original rt0 to remove libstrongswan dependency
a) identity credential being made/accessed with openssl api calls
(X509/EVP_PKEY pem)
b) attribute credential being made/access via xmlsec1 (custom XML
structure)
2) refactored libcreddy into libabac and now one ABAC namespace for
libabac
3) added attribute_rule suboption to creddy's attribute as another way
to insert access rule
4) added some regression tests into example directory
5) updated some docs.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[461541a] | 1 | |
---|
| 2 | /* options.c */ |
---|
| 3 | |
---|
| 4 | #include <stdio.h> |
---|
[06d7b3a] | 5 | #include <getopt.h> |
---|
| 6 | #include <stdlib.h> |
---|
| 7 | #include <string.h> |
---|
| 8 | |
---|
| 9 | #include "options.h" |
---|
| 10 | |
---|
| 11 | static void _usage(char *name) { |
---|
| 12 | printf( |
---|
| 13 | "Usage: %s \\\n" |
---|
| 14 | " --keystore <keystore> \\\n" |
---|
| 15 | " --role <keyid.role> --principal <keyid>\n" |
---|
[461541a] | 16 | " --dump <file>\n" |
---|
[06d7b3a] | 17 | " loads the keystore and runs the query role <-?- principal\n", |
---|
| 18 | name |
---|
| 19 | ); |
---|
| 20 | exit(1); |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | void get_options(int argc, char **argv, options_t *opts) { |
---|
| 24 | #define OPT_KEYSTORE 1 |
---|
| 25 | #define OPT_ROLE 2 |
---|
| 26 | #define OPT_PRINCIPAL 3 |
---|
[461541a] | 27 | #define OPT_DUMP 4 |
---|
[06d7b3a] | 28 | struct option options[] = { |
---|
| 29 | { "keystore", 1, 0, OPT_KEYSTORE }, |
---|
| 30 | { "role", 1, 0, OPT_ROLE }, |
---|
| 31 | { "principal", 1, 0, OPT_PRINCIPAL }, |
---|
[461541a] | 32 | { "dump", 1, 0, OPT_DUMP }, |
---|
[06d7b3a] | 33 | { 0 }, |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | for ( ; ; ) { |
---|
| 37 | int c = getopt_long(argc, argv, "", options, NULL); |
---|
| 38 | if (c < 0) |
---|
| 39 | break; |
---|
| 40 | |
---|
| 41 | switch (c) { |
---|
| 42 | case OPT_KEYSTORE: |
---|
| 43 | opts->keystore = strdup(optarg); |
---|
| 44 | break; |
---|
| 45 | case OPT_ROLE: |
---|
| 46 | opts->role = strdup(optarg); |
---|
| 47 | break; |
---|
| 48 | case OPT_PRINCIPAL: |
---|
| 49 | opts->principal = strdup(optarg); |
---|
| 50 | break; |
---|
[461541a] | 51 | case OPT_DUMP: |
---|
| 52 | opts->rulefile = strdup(optarg); |
---|
| 53 | break; |
---|
| 54 | |
---|
[06d7b3a] | 55 | |
---|
| 56 | default: |
---|
| 57 | _usage(argv[0]); |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | |
---|
[461541a] | 61 | if (!(opts->keystore && opts->role && opts->principal) && !(opts->rulefile) ) |
---|
[06d7b3a] | 62 | _usage(argv[0]); |
---|
| 63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.