Changeset 13b087a


Ignore:
Timestamp:
Jun 4, 2013 10:58:19 AM (6 years ago)
Author:
Mei <mei@…>
Branches:
abac0-leak, abac0-mei, master, mei-id, tvf-new-xml
Children:
e2e8440
Parents:
bec30b5
Message:

1) fix some compiling warnings

Location:
libabac
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libabac/abac.h

    rbec30b5 r13b087a  
    4242abac_credential_t **abac_context_credentials(abac_context_t *ctx);
    4343
     44/* get all the principals from the context, returns a NULL-terminated array of credentials */
     45abac_id_cert_t **abac_context_principals(abac_context_t *ctx);
     46
    4447/* use this to free the results of either of the previous two functions */
    4548void abac_context_credentials_free(abac_credential_t **credentials);
     
    5558abac_credential_t *abac_credential_dup(abac_credential_t *cred);
    5659void abac_credential_free(abac_credential_t *cred);
     60char *abac_id_cert_keyid(abac_id_cert_t *);
    5761
    5862/*
  • libabac/abac_attribute.c

    rbec30b5 r13b087a  
    3838
    3939char *abac_attribute_role_string(abac_attribute_t *attr);
    40 extern abac_id_t *abac_verifier_lookup_id(abac_id_cert_t *, char *keyid);
     40extern abac_id_t *abac_verifier_lookup_id(abac_list_t*, char *keyid);
    4141static char *_validate_principal(char *keyid);
    4242
  • libabac/abac_verifier.c

    rbec30b5 r13b087a  
    22/* abac_verifier.c */
    33#include <assert.h>
     4#include <string.h>
    45
    56#include "libabac_common.h"
  • libabac/prover.c

    r4721618 r13b087a  
    55#include "abac_list.h"
    66#include "options.h"
     7
     8static void _dump_context(FILE *fp, abac_context_t *ctx)
     9{
     10    int i;
     11    abac_credential_t **credentials = abac_context_credentials(ctx);
     12    abac_credential_t *cred;
     13    if (credentials != NULL)
     14        for (i = 0; credentials[i] != NULL; ++i) {
     15            cred = credentials[i];
     16            fprintf(fp,"%s <- %s\n",
     17                abac_role_string(abac_credential_head(cred)),
     18                abac_role_string(abac_credential_tail(cred)));
     19        }
     20    abac_context_credentials_free(credentials);
     21
     22    abac_id_cert_t **ilist=abac_context_principals(ctx);
     23    abac_id_cert_t *cert;
     24    if (ilist != NULL)
     25        for (i = 0; ilist[i] != NULL; ++i) {
     26               cert = ilist[i];
     27               printf("id[%d] %s\n",i, abac_id_cert_keyid(cert));
     28        }
     29    abac_context_id_credentials_free(ilist);
     30}
    731
    832int main(int argc, char **argv) {
     
    1943        FILE *fp=fopen(opts.rulefile,"w+");
    2044        if(fp) {
    21             abac_credential_t **credentials = abac_context_credentials(ctx);
    22             if (credentials != NULL)
    23                 for (i = 0; credentials[i] != NULL; ++i) {
    24                     cred = credentials[i];
    25                     fprintf(fp,"%s <- %s\n",
    26                             abac_role_string(abac_credential_head(cred)),
    27                             abac_role_string(abac_credential_tail(cred))
    28                           );
    29                 }
    30             abac_context_credentials_free(credentials);
     45            _dump_context(fp,ctx);       
    3146            fclose(fp);
    3247        }
Note: See TracChangeset for help on using the changeset viewer.