! \brief Adds the proxies in the proxy list & resolves the hostnames * \return 0 if ok, <0 on error */
| 1304 | /*! \brief Adds the proxies in the proxy list & resolves the hostnames |
| 1305 | * \return 0 if ok, <0 on error */ |
| 1306 | static int fix_actions(struct action* a) |
| 1307 | { |
| 1308 | struct action *t; |
| 1309 | int ret; |
| 1310 | const cmd_export_t* cmd; |
| 1311 | const acmd_export_t* acmd; |
| 1312 | str s; |
| 1313 | pv_elem_t *model=NULL; |
| 1314 | xl_level_p xlp; |
| 1315 | struct script_route_ref *rt_ref; |
| 1316 | |
| 1317 | if (a==0){ |
| 1318 | LM_CRIT("null pointer\n"); |
| 1319 | return E_BUG; |
| 1320 | } |
| 1321 | for(t=a; t!=0; t=t->next){ |
| 1322 | switch(t->type){ |
| 1323 | case ROUTE_T: |
| 1324 | ret = 0; |
| 1325 | switch (t->elem[0].type) { |
| 1326 | case SCRIPTVAR_ST: |
| 1327 | case SCRIPTVAR_ELEM_ST: |
| 1328 | break; |
| 1329 | case NUMBER_ST: |
| 1330 | if ((t->elem[0].u.number>RT_NO)||(t->elem[0].u.number<0)){ |
| 1331 | LM_ALERT("invalid routing table number in" |
| 1332 | "route(%lu)\n", t->elem[0].u.number); |
| 1333 | ret = -1; |
| 1334 | } |
| 1335 | if (sroutes->request[t->elem[0].u.number].a==NULL) { |
| 1336 | LM_ERR("called route [%s] (id=%d) is not defined\n", |
| 1337 | sroutes->request[t->elem[0].u.number].name, |
| 1338 | (int)t->elem[0].u.number); |
| 1339 | ret = -1; |
| 1340 | } |
| 1341 | break; |
| 1342 | default: |
| 1343 | ret = -1; |
| 1344 | break; |
| 1345 | } |
| 1346 | if (ret == -1) { |
| 1347 | LM_ERR("failed to validate a route() statement (type %d)\n", |
| 1348 | t->elem[0].type); |
| 1349 | ret = E_CFG; |
| 1350 | goto error; |
| 1351 | } |
| 1352 | if (t->elem[1].type != 0) { |
| 1353 | if (t->elem[1].type != NUMBER_ST || |
| 1354 | t->elem[2].type != SCRIPTVAR_ST) { |
| 1355 | LM_ALERT("BUG in route() type %d/%d\n", |
| 1356 | t->elem[1].type, t->elem[2].type); |
| 1357 | ret=E_BUG; |
| 1358 | goto error; |
| 1359 | } |
| 1360 | if (t->elem[1].u.number >= MAX_ACTION_ELEMS || |
| 1361 | t->elem[1].u.number <= 0) { |
| 1362 | LM_ALERT("BUG in number of route parameters %d\n", |
| 1363 | (int)t->elem[1].u.number); |
no test coverage detected