source: libabac/prover_plus.cc @ 342e28f

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

give query options to example prover code

  • Property mode set to 100644
File size: 779 bytes
RevLine 
[64fa9ba]1#include <err.h>
2#include <stdio.h>
[9dffbd6]3#include <vector>
[64fa9ba]4
[6ede88c]5#include <abac.hh>
[64fa9ba]6
[7af34ed]7#include "options.h"
8
[64fa9ba]9using namespace ABAC;
[9dffbd6]10using std::vector;
[64fa9ba]11
12int main(int argc, char **argv) {
13    int i;
14    abac_credential_t *cred;
15
[7af34ed]16    options_t opts = { 0, };
17    get_options(argc, argv, &opts);
[64fa9ba]18
19    libabac_init();
20
21    Context ctx;
[7af34ed]22    ctx.load_directory(opts.keystore);
[64fa9ba]23
[4e426c9]24    bool success;
[9dffbd6]25    vector<Credential> credentials = ctx.query(
[7af34ed]26        opts.role, opts.principal,
[4e426c9]27        success
[64fa9ba]28    );
29
[4e426c9]30    if (success)
31        puts("success");
[9dffbd6]32    for (vector<Credential>::iterator i = credentials.begin(); i != credentials.end(); ++i) {
[64fa9ba]33        printf("credential %s <- %s\n",
[2af3b82]34            i->head().string(),
35            i->tail().string()
[64fa9ba]36        );
37    }
38
39    libabac_deinit();
40
41    return 0;
42}
Note: See TracBrowser for help on using the repository browser.