| 199 | |
| 200 | |
| 201 | static int search_append_f(struct sip_msg* msg, regex_t* key, str* str2) |
| 202 | { |
| 203 | struct lump* l; |
| 204 | regmatch_t pmatch; |
| 205 | char* s; |
| 206 | char *begin; |
| 207 | int off; |
| 208 | |
| 209 | begin=get_header(msg); /* msg->orig/buf previously .. uri problems */ |
| 210 | off=begin-msg->buf; |
| 211 | |
| 212 | if (regexec(key, begin, 1, &pmatch, 0)!=0) return -1; |
| 213 | if (pmatch.rm_so!=-1){ |
| 214 | if ((l=anchor_lump(msg, off+pmatch.rm_eo, 0))==0) |
| 215 | return -1; |
| 216 | s=pkg_malloc(str2->len); |
| 217 | if (s==0){ |
| 218 | LM_ERR("memory allocation failure\n"); |
| 219 | return -1; |
| 220 | } |
| 221 | memcpy(s, str2->s, str2->len); |
| 222 | if (insert_new_lump_after(l, s, str2->len, 0)==0){ |
| 223 | LM_ERR("could not insert new lump\n"); |
| 224 | pkg_free(s); |
| 225 | return -1; |
| 226 | } |
| 227 | return 1; |
| 228 | } |
| 229 | return -1; |
| 230 | } |
| 231 | |
| 232 | static int search_append_body_f(struct sip_msg* msg, regex_t* key, str* str2) |
| 233 | { |
nothing calls this directly
no test coverage detected