source: creddy/roles.c @ f89b991

mei_rt2
Last change on this file since f89b991 was dfe6b61, checked in by Mei <mei@…>, 12 years ago

1) added ID_chunk() and Attribute_chunk() to abac.hh

  • Property mode set to 100644
File size: 842 bytes
Line 
1/***
2   role.c
3***/
4
5#include "creddy_internal.h"
6
7extern certificate_t *abac_attribute_cert_from_file(char *filename);
8extern char* abac_decode_string(char *);
9
10static void _get_attributes(options_t *opts) {
11
12    certificate_t *cert = abac_attribute_cert_from_file(opts->cert);
13    if(cert == NULL)
14        errx(1, "Couldn't get attributes from cert");
15    ac_t *ac = (ac_t *)cert;
16    ietf_attributes_t *attr = ac->get_groups(ac);
17    if (attr == NULL)
18        errx(1, "Couldn't get attributes from cert");
19
20    puts(abac_decode_string(attr->get_string(attr)));
21
22    DESTROY_IF(attr);
23    DESTROY_IF(cert);
24}
25
26void roles_main(options_t *opts) {
27    if (opts->cert == NULL)
28        usage(opts);
29
30    _get_attributes(opts);
31}
32
33void osets_main(options_t *opts) {
34    if (opts->cert == NULL)
35        usage(opts);
36
37    _get_attributes(opts);
38}
39
Note: See TracBrowser for help on using the repository browser.