source: libabac/abac.c @ d0efdec

mei_rt2
Last change on this file since d0efdec was 2e9455f, checked in by Mei <mei@…>, 11 years ago

1) added namespace
2) tweak ?This,
3) allowing linking role/oset as constraining conditions
4) adding access_tests regression testing that uses GENI's access policy
5) added couple multi contexts regression tests
6) add compression/uncompression calls to abac_encode_string/abac_decode_string
(libstrongwan only allows 512 char for attribute rule storage)
7) add attribute_now option to creddy that takes a whole char string for attribute
rule

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2** abac.c
3** original abac.c using prolog
4**/
5
6#include <assert.h>
7#include <err.h>
8#include <glob.h>
9
10#include <chunk.h>
11
12#include "abac_util.h"
13#include "abac_verifier.h"
14
15static int debug=0;
16
17/**************************************************************************/
18/**
19 * Init the library.
20 */
21void libabac_init(void) {
22
23    DEBUG_PRINTF("libabac_init, calling init\n");
24    void libabac_deinit(void);
25    static int has_been_init = 0;
26
27    // called every time a verifier session is created, so only do it once
28    if (!has_been_init) {
29        abac_verifier_init();
30        atexit(libabac_deinit);
31        has_been_init = 1;
32        } else {
33           DEBUG_PRINTF("libabac_init, can only be called once\n");
34    }
35}
36
37/**
38 * Deinit the library.
39 */
40void libabac_deinit(void) {
41    static int has_been_deinit = 0;
42    DEBUG_PRINTF("libabac_deinit, calling take down (%d)\n", has_been_deinit);
43    if(!has_been_deinit) {
44        abac_verifier_deinit();
45        has_been_deinit = 1;
46        } else {
47           DEBUG_PRINTF("libabac_deinit, can only be called once\n");
48    }
49}
50
Note: See TracBrowser for help on using the repository browser.