source: creddy/roles.c @ 461541a

abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change on this file since 461541a 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: 802 bytes
Line 
1
2/* roles.c */
3
4#include <err.h>
5
6#include "abac.h"
7#include <creddy_common.h>
8
9extern char *abac_attribute_role_string(abac_attribute_t *attr);
10
11void roles_main(options_t *opts) {
12    if (opts->cert == NULL)
13        usage(opts);
14
15    abac_list_t *attr_list = abac_attribute_certs_from_file(opts->cert);
16    if (abac_list_size(attr_list) == 0)
17        errx(1, "Couldn't get cert from %s", opts->cert);
18
19    abac_attribute_t *cert=NULL;
20    abac_list_foreach(attr_list, cert,
21            char *role_string=abac_attribute_role_string(cert);
22            if (role_string != NULL) {
23                puts(role_string);
24                free(role_string);
25            } else errx(1, "Couldn't get attributes from %s", opts->cert);
26            abac_attribute_free(cert);
27    );
28    abac_list_free(attr_list);
29}
Note: See TracBrowser for help on using the repository browser.