sed-perl style re: s/regular expression/replacement/flags, like * subst but works on the user part of the uri */
| 550 | /* sed-perl style re: s/regular expression/replacement/flags, like |
| 551 | * subst but works on the user part of the uri */ |
| 552 | static int subst_user_f(struct sip_msg* msg, struct subst_expr *se) |
| 553 | { |
| 554 | str* result; |
| 555 | str user; |
| 556 | char c; |
| 557 | int nmatches; |
| 558 | |
| 559 | c=0; |
| 560 | if (parse_sip_msg_uri(msg)<0){ |
| 561 | return -1; /* error, bad uri */ |
| 562 | } |
| 563 | if (msg->parsed_uri.user.s==0){ |
| 564 | /* no user in uri */ |
| 565 | user.s=""; |
| 566 | user.len=0; |
| 567 | }else{ |
| 568 | user=msg->parsed_uri.user; |
| 569 | c=user.s[user.len]; |
| 570 | user.s[user.len]=0; |
| 571 | } |
| 572 | result=subst_str(user.s, msg, se, &nmatches);/* pkg malloc'ed result */ |
| 573 | if (c) user.s[user.len]=c; |
| 574 | if (result == NULL) { |
| 575 | if (nmatches<0) |
| 576 | LM_ERR("subst_user(): subst_str() failed\n"); |
| 577 | return -1; |
| 578 | } |
| 579 | /* result->s[result->len] = '\0'; --subst_str returns 0-term strings */ |
| 580 | if (rewrite_ruri(msg, result, 0, RW_RURI_USER) < 0) { |
| 581 | LM_ERR("Failed to set R-URI user\n"); |
| 582 | return -1; |
| 583 | } |
| 584 | pkg_free(result->s); |
| 585 | pkg_free(result); |
| 586 | return 1; |
| 587 | } |
| 588 | |
| 589 | |
| 590 | /* sed-perl style re: s/regular expression/replacement/flags */ |
nothing calls this directly
no test coverage detected