source: libabac/prover.c @ 605ee1d

abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0tvf-new-xml
Last change on this file since 605ee1d was 605ee1d, checked in by Mike Ryan <mikeryan@…>, 12 years ago

be clear when a proof has failed

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