abac0-leakabac0-mei
Last change
on this file since 84038c8 was
1afd681,
checked in by Mei <mei@…>, 11 years ago
|
1) ready the 1.5 release..
2) tested out the new attribute features (nicknames), multiple GENI
attribute formats
3) polish up testing' build dir alittle bit more..
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1afd681] | 1 | /** |
---|
| 2 | attr4.c |
---|
| 3 | |
---|
| 4 | testing mnemonic part of libabac in c |
---|
| 5 | |
---|
| 6 | call: ./attr4_r issuer.pem (issuer.pem is from attr4_setup.py) |
---|
| 7 | |
---|
| 8 | gcc -g -I/home/mei/Deter/abac0-master-new/libabac -c attr4.c -o attr4.o |
---|
| 9 | gcc -g -o attr4_r attr4.o -L/home/mei/Deter/abac0-master-new/libabac/.libs -labac -lm -lpthread -Wl,-rpath |
---|
| 10 | **/ |
---|
| 11 | |
---|
| 12 | #define _GNU_SOURCE |
---|
| 13 | #include <err.h> |
---|
| 14 | #include <stdio.h> |
---|
| 15 | #include <assert.h> |
---|
| 16 | |
---|
| 17 | #include <abac.h> |
---|
| 18 | |
---|
| 19 | extern char *abac_id_keyid(abac_id_t *id); |
---|
| 20 | |
---|
| 21 | int main(int argc, char **argv) { |
---|
| 22 | int i, success=0; |
---|
| 23 | abac_credential_t *cred=NULL; |
---|
| 24 | abac_credential_t **credentials=NULL; |
---|
| 25 | |
---|
| 26 | abac_context_t *ctx = abac_context_new(); |
---|
| 27 | int rc; |
---|
| 28 | |
---|
| 29 | rc=abac_context_load_id_file(ctx, argv[1]); |
---|
| 30 | if(rc!=0) { |
---|
| 31 | printf("can not open file %s\n", argv[1]); |
---|
| 32 | return 1; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /* build up structure */ |
---|
| 36 | abac_id_t *id =NULL; |
---|
| 37 | id = abac_id_from_file(argv[1]); |
---|
| 38 | abac_context_set_nickname(ctx, abac_id_keyid(id), "Ted"); |
---|
| 39 | |
---|
| 40 | abac_attribute_t *attr; |
---|
| 41 | rc=abac_attribute_create(&attr, id, "ABAC_Guy", 1800); |
---|
| 42 | abac_attribute_principal(attr, abac_id_keyid(id)); |
---|
| 43 | rc=abac_attribute_bake_context(attr,ctx); |
---|
| 44 | |
---|
| 45 | printf(" attribute being made : %s\n",abac_attribute_role_string(attr)); |
---|
| 46 | |
---|
| 47 | abac_attribute_write_file(attr,"ted_attr.xml"); |
---|
| 48 | |
---|
| 49 | abac_context_free(ctx); |
---|
| 50 | return 0; |
---|
| 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.