source: libabac/prover.c @ 53e540d

mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2 yap_rt0
Last change on this file since 53e540d was 53e540d, checked in by Mei <mei@…>, 13 years ago

1) adding appendL to do the credential list appending

  • Property mode set to 100644
File size: 997 bytes
Line 
1#include <err.h>
2#include <stdio.h>
3
4#include <abac.h>
5
6#include "options.h"
7
8int main(int argc, char **argv) {
9    int i, success;
10    abac_credential_t *cred;
11
12    options_t opts = { 0, };
13    get_options(argc, argv, &opts);
14
15    abac_context_t *ctx = abac_context_new();
16    abac_context_load_directory(ctx, opts.keystore);
17
18    printf("ASKING a question role(%s), principal(%s)\n\n", opts.role, opts.principal);
19    abac_credential_t **credentials = abac_context_query(ctx,
20        opts.role, opts.principal,
21        &success
22    );
23
24    if (success)
25        puts("success");
26
27    if (credentials != NULL)
28        for (i = 0; credentials[i] != NULL; ++i) {
29            cred = credentials[i];
30            printf("credential %s <- %s\n",
31                    abac_role_string(abac_credential_head(cred)),
32                    abac_role_string(abac_credential_tail(cred))
33                  );
34        }
35
36    abac_context_credentials_free(credentials);
37
38    abac_context_free(ctx);
39
40    return 0;
41}
Note: See TracBrowser for help on using the repository browser.