/[pdpsoft]/trunk/grid-mw-security/ees/src/eval_man/pdl.c
ViewVC logotype

Diff of /trunk/grid-mw-security/ees/src/eval_man/pdl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 526 by aramv, Wed Jul 15 09:15:06 2009 UTC revision 566 by aramv, Mon Jul 20 09:41:59 2009 UTC
# Line 14  NG_RC pdl_init(const char* name){ Line 14  NG_RC pdl_init(const char* name){
14  }  }
15    
16  record_t* concat_strings(record_t* r1, record_t* r2){  record_t* concat_strings(record_t* r1, record_t* r2){
17    /*record_t* new_record;*/    record_t* new_record;
18    /*new_record = malloc(sizeof(record_t));*/    if((new_record = malloc(sizeof(record_t)))){
19    /*new_record->string = malloc(sizeof(char)*(strlen(r1->string) + strlen(r2->string)));*/      if((new_record->string =
20    /*strcat(new_record->string, r2->string);*/          calloc(1, sizeof(char)*(strlen(r1->string) + strlen(r2->string)+1)))){
21    /*return new_record;*/        strcat(new_record->string, r1->string);
22    /*free(r1->string);*/        strcat(new_record->string, r2->string);
23    free(r1);        free(r1->string);
24    /*free(r2->string);*/        free(r1);
25    free(r2);        free(r2->string);
26          free(r2);
27          return new_record;
28        }
29      }
30      return NULL;
31    }
32    
33    record_t* concat_strings_with_space(record_t *r1, record_t* r2){
34      ng_log(LOG_NOTICE, "Concating: %s with %s", r1->string, r2->string);
35      record_t *r;
36      if((r = malloc(sizeof(record_t)))){
37        if((r1->string[strlen(r1->string)-1]=='"') &&
38           (r2->string[strlen(r2->string)-1]=='"')){
39          r = concat_strings(r1, r2);
40        } else {
41          r->string = calloc(1,(sizeof(char)*(strlen(r1->string)+strlen(r2->string)+2)));
42          strcat(r->string, r1->string);
43          strcat(r->string, " ");
44          strcat(r->string, r2->string);
45        }
46        free(r1->string);
47        free(r1);
48        free(r2->string);
49        free(r2);
50        return r;
51      }
52    return NULL;    return NULL;
53  }  }
54    
# Line 31  int yyerror(const char* string){ Line 57  int yyerror(const char* string){
57  }  }
58    
59  void set_path(record_t* path){  void set_path(record_t* path){
60    /*ng_log(LOG_ERR, "Found a new path: %s\n", path->string);*/    ng_log(LOG_ERR, "Found a new path: %s\n", path->string);
61    /*free(path);*/    free(path->string);
62      free(path);
63  }  }
64    
65  void add_policy(record_t* policy, rule_t* rule){  void add_policy(record_t* policy, rule_t* rule){
# Line 40  void add_policy(record_t* policy, rule_t Line 67  void add_policy(record_t* policy, rule_t
67    /*ng_log(LOG_ERR, "Found a new rule: %s\n", rule->string);*/    /*ng_log(LOG_ERR, "Found a new rule: %s\n", rule->string);*/
68    free(policy->string);    free(policy->string);
69    free(policy);    free(policy);
70    
71    /*free(rule->true_branch);*/    /*free(rule->true_branch);*/
72    /*free(rule->false_branch);*/    /*free(rule->false_branch);*/
73    /*free(rule);*/    /*free(rule);*/
# Line 50  const char* pdl_path(){ Line 78  const char* pdl_path(){
78  }  }
79    
80  rule_t* add_rule(record_t* state, record_t* true_branch, record_t* false_branch){  rule_t* add_rule(record_t* state, record_t* true_branch, record_t* false_branch){
81    ng_log(LOG_ERR, "Added a new rule: %s\n", state->string);    rule_t* new_rule = malloc(sizeof(rule_t));
82    ng_log(LOG_ERR, "True branch: %s\n", true_branch->string);    if(state != NULL){
83    /*ng_log(LOG_ERR, "False branch: %s\n", false_branch->string);*/      ng_log(LOG_ERR, "Added a new rule: %s\n", state->string);
84    free(state->string);    }
85      if(true_branch != NULL){
86        ng_log(LOG_ERR, "True branch: %s\n", true_branch->string);
87      }
88      if(false_branch != NULL){
89        ng_log(LOG_ERR, "False branch: %s\n", false_branch->string);
90      }
91      if(state != NULL){
92        free(state->string);
93      }
94    free(state);    free(state);
95    free(true_branch->string);    if(true_branch != NULL){
96        free(true_branch->string);
97      }
98    free(true_branch);    free(true_branch);
99    /*free(false_branch->string);*/    if(false_branch != NULL){
100        free(false_branch->string);
101      }
102    free(false_branch);    free(false_branch);
103      free(new_rule);
104      return new_rule;
105  }  }
106    
107  void remove_policy(record_t* policy){  void remove_policy(record_t* policy){
# Line 69  void remove_policy(record_t* policy){ Line 112  void remove_policy(record_t* policy){
112    
113  void add_variable(record_t* name, record_t* value){  void add_variable(record_t* name, record_t* value){
114    ng_log(LOG_ERR, "Added variable name: %s\n", name->string);    ng_log(LOG_ERR, "Added variable name: %s\n", name->string);
115    /*ng_log(LOG_ERR, "Added variable value: %s\n", value->string);*/    ng_log(LOG_ERR, "Added variable value: %s\n", value->string);
116    free(name->string);    free(name->string);
117    free(name);    free(name);
118    /*free(value->string);*/    free(value->string);
119    free(value);    free(value);
120  }  }
121    
# Line 86  NG_RC pdl_term(){ Line 129  NG_RC pdl_term(){
129  }  }
130    
131  NG_RC allow_rules(int val){  NG_RC allow_rules(int val){
132        return NG_SUCCESS;
133  }  }
134    
135  NG_RC allowed_policy_rule(const char* label){  NG_RC allowed_policy_rule(const char* label){
136        return NG_SUCCESS;  
137  }  }

Legend:
Removed from v.526  
changed lines
  Added in v.566

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28