source: creddy/roles.c

Last change on this file was bec30b5, checked in by Mei <mei@…>, 11 years ago

1) change abac_context_load_directory to check on every regular files

and try to extract id id/privkey and then attribute in turn.

2) move id_certs to be context based instead of shared globally

  • Property mode set to 100644
File size: 751 bytes
Line 
1
2/* roles.c */
3
4#include <err.h>
5
6#include "libabac_common.h"
7#include "creddy_common.h"
8
9void roles_main(options_t *opts) {
10    if (opts->cert == NULL)
11        usage(opts);
12
13    abac_list_t *attr_list = abac_attribute_certs_from_file(NULL,opts->cert);
14    if (abac_list_size(attr_list) == 0)
15        errx(1, "Couldn't get cert from %s", opts->cert);
16
17    abac_attribute_t *cert=NULL;
18    abac_list_foreach(attr_list, cert,
19            char *role_string=abac_attribute_role_string(cert);
20            if (role_string != NULL) {
21                puts(role_string);
22                free(role_string);
23            } else errx(1, "Couldn't get attributes from %s", opts->cert);
24            abac_attribute_free(cert);
25    );
26    abac_list_free(attr_list);
27}
Note: See TracBrowser for help on using the repository browser.