Changeset 5d06689 for libabac/abac_verifier.c
- Timestamp:
- 05/24/12 16:23:21 (12 months ago)
- Branches:
- mei_rt2, mei_rt2_fix_1
- Children:
- 7211a95
- Parents:
- 6e8997e
- git-author:
- Mei <mei@…> (05/24/12 16:23:21)
- git-committer:
- Mei <mei@…> (05/24/12 16:23:21)
- File:
-
- 1 edited
-
libabac/abac_verifier.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libabac/abac_verifier.c
r5110d42 r5d06689 27 27 28 28 static int debug=0; 29 30 /* from abac_attribute.c */ 31 extern char *get_cred_encoding(abac_attribute_t *ptr); 29 32 30 33 extern abac_aspect_t *abac_yy_get_rule_head_aspect(); … … 34 37 extern void abac_yy_free_rule_clauses(); 35 38 extern char *generate_pl_type_clause(char *, int); 39 extern abac_list_t *generate_pl_clauses(abac_aspect_t *, abac_aspect_t *); 36 40 37 41 extern void abac_print_aspect_string_with_condition(abac_aspect_t *role, FILE*); … … 665 669 /****************************************************************************/ 666 670 667 static int _verify_valid_credential (certificate_t *cert,671 static int _verify_valid_credential_string(certificate_t *cert, 668 672 abac_credential_t **cred_ret, char *encoded_attr_string) 669 673 { … … 738 742 * Returns true only if the certificate is valid and is issued by the proper 739 743 * authority. 744 * attribute string is parsed via yyparse call 740 745 */ 741 746 static int _load_attribute_cert(certificate_t *cert, abac_credential_t **cred_ret) { … … 771 776 } 772 777 773 ret=_verify_valid_credential (cert,cred_ret,encoded_attr_string);778 ret=_verify_valid_credential_string(cert,cred_ret,encoded_attr_string); 774 779 775 780 if(ret != ABAC_CERT_SUCCESS) { … … 790 795 /** 791 796 * Load an attribute cert from a abac_attribute_t. 792 */ 793 int abac_verifier_load_attribute_cert_attribute(abac_attribute_t *attr, abac_credential_t **cred) { 794 // load the cert 795 certificate_t *cert = abac_attribute_cert(attr); 796 if (cert == NULL) 797 return ABAC_CERT_INVALID; 798 799 // XXX need to skip the parsing part 800 return _load_attribute_cert(cert, cred); 797 * attr should be all checked out before arriving here 798 */ 799 int abac_verifier_load_attribute_cert_attribute(abac_attribute_t *ptr, abac_credential_t **cred_ret) { 800 // get the attr 801 abac_aspect_t *head=abac_attribute_head(ptr); 802 abac_aspect_t *tail=abac_attribute_tail(ptr); 803 804 // preprocess for constraint part 805 preprocess_pl_head(head); 806 preprocess_pl_tail(tail); 807 808 /* XXX collect up type clauses, constraint clauses and 809 generate rule clauses */ 810 abac_list_t *clauses=generate_pl_clauses(head,tail); 811 char *encoded_attr_string=get_cred_encoding(ptr); 812 813 abac_credential_t *cred = abac_xmalloc(sizeof(abac_credential_t)); 814 cred->hashkeyid=abac_xstrdup(encoded_attr_string); 815 cred->attr=abac_attribute_dup(ptr); 816 cred->pl_clauses = clauses; 817 *cred_ret = cred; 818 819 // success, add the key to the map of certificates 820 HASH_ADD_KEYPTR(hh, attr_creds, cred->hashkeyid, strlen(cred->hashkeyid), cred); 821 822 assert(attr_hashkeyid_list); 823 abac_list_add(attr_hashkeyid_list, abac_xstrdup(cred->hashkeyid)); 824 return ABAC_CERT_SUCCESS; 801 825 } 802 826
Note: See TracChangeset
for help on using the changeset viewer.
