| 407 | |
| 408 | |
| 409 | int ops_sql_avp_delete(struct sip_msg* msg, struct fis_param *sp, |
| 410 | struct db_param *dbp, struct db_url *url, int use_domain) |
| 411 | { |
| 412 | struct sip_uri uri; |
| 413 | int res; |
| 414 | str uuid; |
| 415 | pv_value_t xvalue; |
| 416 | str *s0, *s1, *s2; |
| 417 | |
| 418 | s0 = s1 = s2 = NULL; |
| 419 | if (!((sp->opd&SQLOPS_VAL_PVAR)||(sp->opd&SQLOPS_VAL_STR))) { |
| 420 | LM_CRIT("invalid flag combination (%d/%d)\n", sp->opd, sp->ops); |
| 421 | goto error; |
| 422 | } |
| 423 | |
| 424 | /* get uuid from avp */ |
| 425 | if (sp->opd&SQLOPS_VAL_PVAR) |
| 426 | { |
| 427 | if(pv_get_spec_value(msg, &(sp->u.sval), &xvalue)!=0) |
| 428 | { |
| 429 | LM_CRIT("failed to get PVAR value (%d/%d)\n", sp->opd, sp->ops); |
| 430 | goto error; |
| 431 | } |
| 432 | if(xvalue.flags&(PV_VAL_NULL|PV_VAL_EMPTY)) |
| 433 | { |
| 434 | LM_ERR("no value for first param\n"); |
| 435 | goto error; |
| 436 | } |
| 437 | uuid = xvalue.rs; |
| 438 | } else { |
| 439 | uuid.s = sp->u.s.s; |
| 440 | uuid.len = sp->u.s.len; |
| 441 | } |
| 442 | |
| 443 | if(sp->opd&SQLOPS_FLAG_UUID0) |
| 444 | { |
| 445 | s0 = &uuid; |
| 446 | } else { |
| 447 | /* parse uri */ |
| 448 | if (parse_uri(uuid.s, uuid.len, &uri)<0) |
| 449 | { |
| 450 | LM_ERR("failed to parse uri\n"); |
| 451 | goto error; |
| 452 | } |
| 453 | |
| 454 | if((sp->opd&SQLOPS_FLAG_URI0)||(sp->opd&SQLOPS_FLAG_USER0)) |
| 455 | { |
| 456 | /* check that uri contains user part */ |
| 457 | if(!uri.user.s|| !uri.user.len) |
| 458 | { |
| 459 | LM_ERR("incomplet uri <%.*s> missing user\n", uuid.len, uuid.s); |
| 460 | goto error; |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | s1 = &uri.user; |
| 465 | } |
| 466 | } |
no test coverage detected