source: libabac/prover.c @ 15200be

abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change on this file since 15200be was 15200be, checked in by Mike Ryan <mikeryan@…>, 14 years ago

move libabac into its own directory

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[7f25a67f]1#include <err.h>
2#include <stdio.h>
3
[7dd5f2e]4#include "abac.h"
[3c251d0]5#include "abac_util.h"
[7f25a67f]6
7int main(int argc, char **argv) {
[4e426c9]8    int i, success;
[401a054]9    abac_credential_t *cred;
[dc62c68]10
[7f25a67f]11    if (argc < 2)
[5450aeb]12        errx(1, "Usage: %s <keystore>", argv[0]);
[7f25a67f]13
[7dd5f2e]14    libabac_init();
[7f25a67f]15
[390f749]16    abac_context_t *ctx = abac_context_new();
17    abac_context_load_directory(ctx, argv[1]);
[186cb75]18
[dbbf777]19    debug_printf("querying\n");
[97a5e13]20
[401a054]21    abac_credential_t **credentials = abac_context_query(ctx,
[dc62c68]22        "3f1aca4c5911b345d81c5f1a77675dce13249d0c.fed_create",
[4e426c9]23        "5839d714b16bbe108642c5eb586c2173420bed19",
24        &success
[dc62c68]25    );
26
[4e426c9]27    if (success)
28        puts("success");
29
30    if (credentials != NULL)
31        for (i = 0; credentials[i] != NULL; ++i) {
32            cred = credentials[i];
33            printf("credential %s <- %s\n",
34                    abac_role_string(abac_credential_head(cred)),
35                    abac_role_string(abac_credential_tail(cred))
36                  );
37        }
38
[401a054]39    abac_context_query_free(credentials);
[902d079]40
[390f749]41    abac_context_free(ctx);
[ea401bc]42
[7dd5f2e]43    libabac_deinit();
[186cb75]44
[7f25a67f]45    return 0;
46}
Note: See TracBrowser for help on using the repository browser.