add: case ASSIGN_T: case ADD_T: if (t->p1_type != AVP_ST) { LOG(L_CRIT, "BUG: fix_actions: Invalid left side of assignment\n"); return E_BUG; } if (t->p1.attr->type & AVP_CLASS_DOMAIN) { LOG(L_ERR, "ERROR: You cannot change domain attributes from the script, they are read-only\n"); return E_BUG; } else if (t->p1.attr->type & AVP_CLASS_GLOBAL) { LOG(L_ERR, "ERROR: You cannot change global attributes from the script, they are read-only\n"); return E_BUG; }  if (t->p2_type == ACTION_ST && t->p2.data) { if ((ret = fix_actions((struct action*)t->p2.data)) < 0) { return ret; } } else if (t->p2_type == EXPR_ST && t->p2.data) { if ((ret = fix_expr((struct expr*)t->p2.data)) < 0) { return ret; } } else if (t->p2_type == STRING_ST) { int len; len = strlen(t->p2.data); t->p2.str.s = t->p2.data; t->p2.str.len = len; } break;
context: static int fix_actions(struct action* a){	struct action *t;	struct proxy_l* p;	char *tmp;	int ret;	cmd_export_t* cmd;	struct sr_module* mod;	str s;	struct hostent* he;	struct ip_addr ip;	struct socket_info* si;		if (a==0){		LOG(L_CRIT,"BUG: fix_actions: null pointer\n");		return E_BUG;	}	for(t=a; t!=0; t=t->next){		switch(t->type){			case FORWARD_T:			case FORWARD_TLS_T:			case FORWARD_TCP_T:			case FORWARD_UDP_T:			case SEND_T:			case SEND_TCP_T:					switch(t->p1_type){						case IP_ST: 							tmp=strdup(ip_addr2a(										(struct ip_addr*)t->p1.data));							if (tmp==0){								LOG(L_CRIT, "ERROR: fix_actions:"										"memory allocation failure\n");								return E_OUT_OF_MEM;							}							t->p1_type=STRING_ST;							t->p1.string=tmp;							/* no break */						case STRING_ST:							s.s = t->p1.string;							s.len = strlen(s.s);							p=add_proxy(&s, t->p2.number, 0); /* FIXME proto*/							if (p==0) return E_BAD_ADDRESS;							t->p1.data=p;							t->p1_type=PROXY_ST;							break;						case URIHOST_ST:							break;						default:							LOG(L_CRIT, "BUG: fix_actions: invalid type"									"%d (should be string or number)\n",										t->type);							return E_BUG;					}					break;			case IF_T:				if (t->p1_type!=EXPR_ST){					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"								"%d for if (should be expr)\n",								t->p1_type);					return E_BUG;				}else if( (t->p2_type!=ACTIONS_ST)&&(t->p2_type!=NOSUBTYPE) ){					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"								"%d for if() {...} (should be action)\n",								t->p2_type);					return E_BUG;				}else if( (t->p3_type!=ACTIONS_ST)&&(t->p3_type!=NOSUBTYPE) ){					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"								"%d for if() {} else{...}(should be action)\n",								t->p3_type);					return E_BUG;				}				if (t->p1.data){					if ((ret=fix_expr((struct expr*)t->p1.data))<0)						return ret;				}				if ( (t->p2_type==ACTIONS_ST)&&(t->p2.data) ){					if ((ret=fix_actions((struct action*)t->p2.data))<0)						return ret;				}				if ( (t->p3_type==ACTIONS_ST)&&(t->p3.data) ){						if ((ret=fix_actions((struct action*)t->p3.data))<0)						return ret;				}				break;			case MODULE_T:				if ((mod=find_module(t->p1.data, &cmd))!=0){					DBG("fixing %s %s\n", mod->path, cmd->name);					if (cmd->fixup){						if (cmd->param_no>0){							ret=cmd->fixup(&t->p2.data, 1);							t->p2_type=MODFIXUP_ST;							if (ret<0) return ret;						}						if (cmd->param_no>1){							ret=cmd->fixup(&t->p3.data, 2);							t->p3_type=MODFIXUP_ST;							if (ret<0) return ret;						}					}				}				break;			case FORCE_SEND_SOCKET_T:				if (t->p1_type!=SOCKID_ST){					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"								"%d for force_send_socket\n",								t->p1_type);					return E_BUG;				}				he=resolvehost(((struct socket_id*)t->p1.data)->name);				if (he==0){					LOG(L_ERR, "ERROR: fix_actions: force_send_socket:"								" could not resolve %s\n",							((struct socket_id*)t->p1.data)->name);					return E_BAD_ADDRESS;				}				hostent2ip_addr(&ip, he, 0);				si=find_si(&ip, ((struct socket_id*)t->p1.data)->port,								((struct socket_id*)t->p1.data)->proto);				if (si==0){					LOG(L_ERR, "ERROR: fix_actions: bad force_send_socket"							" argument: %s:%d (ser doesn't listen on it)\n",							((struct socket_id*)t->p1.data)->name,							((struct socket_id*)t->p1.data)->port);					return E_BAD_ADDRESS;				}				t->p1.data=si;				t->p1_type=SOCKETINFO_ST;				break;		}	}	return 0;}