| 439 | |
| 440 | |
| 441 | void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check, |
| 442 | char is_replicated) |
| 443 | { |
| 444 | struct dlg_profile_table *profile; |
| 445 | struct dlg_profile_link *it; |
| 446 | str name, double_check_name; |
| 447 | char *end; |
| 448 | char *p,*s,*e; |
| 449 | char bk; |
| 450 | unsigned repl_type; |
| 451 | int_str val; |
| 452 | int type; |
| 453 | |
| 454 | end = b + l; |
| 455 | p = b; |
| 456 | |
| 457 | do { |
| 458 | /* read a new pair from input string */ |
| 459 | p = read_pair( p, end, &name, &val, &type); |
| 460 | if (p==NULL) break; |
| 461 | |
| 462 | if (type==DLG_VAL_TYPE_INT) { |
| 463 | LM_ERR("Bad type when reading profile\n"); |
| 464 | continue; |
| 465 | } |
| 466 | |
| 467 | LM_DBG("new profile found <%.*s>=<%.*s>\n",name.len,name.s,val.s.len,val.s.s); |
| 468 | |
| 469 | if (double_check) { |
| 470 | LM_DBG("Double checking profile - if it exists we'll skip it \n"); |
| 471 | repl_type = REPL_NONE; |
| 472 | |
| 473 | /* check if this is a shared profile, and remove /s for manual |
| 474 | * matching */ |
| 475 | double_check_name = name; |
| 476 | s = memchr(name.s, '/', name.len); |
| 477 | |
| 478 | if (s) { |
| 479 | e = double_check_name.s + double_check_name.len; |
| 480 | double_check_name.len = s - double_check_name.s; |
| 481 | trim_spaces_lr( double_check_name ); |
| 482 | /* skip spaces after p */ |
| 483 | for (++s; *s == ' ' && s < e; s++); |
| 484 | if ( s < e && *s == 's') |
| 485 | repl_type = REPL_CACHEDB; |
| 486 | else if (s < e && *s == 'b') |
| 487 | repl_type = REPL_PROTOBIN; |
| 488 | } |
| 489 | |
| 490 | if (dlg->locked_by != process_no) |
| 491 | dlg_lock_dlg(dlg); |
| 492 | |
| 493 | for (it=dlg->profile_links;it;it=it->next) { |
| 494 | if (it->profile->repl_type == repl_type && |
| 495 | it->profile->name.len == double_check_name.len && |
| 496 | memcmp(it->profile->name.s,double_check_name.s, |
| 497 | double_check_name.len) == 0) { |
| 498 | if (dlg->locked_by != process_no) |
no test coverage detected