[sr-dev] [kamailio/kamailio] lost: do not parse locationURI with indention spaces (#2569)

sergey-safarov notifications at github.com
Mon Nov 30 16:23:59 CET 2020


### Description

Examples of [RFC7840](https://tools.ietf.org/html/rfc7840#section-7) contains this response:
```xml
   <locationResponse xmlns="urn:ietf:params:xml:ns:geopriv:held">
     <locationUriSet expires="2006-01-01T13:00:00.0Z">
       <locationURI>
                   https://ls.example.com:9768/357yc6s64ceyoiuy5ax3o
           </locationURI>
       <locationURI>
                   sip:9769+357yc6s64ceyoiuy5ax3o at ls.example.com
       </locationURI>
     </locationUriSet>

     <routingInformation
         xmlns="urn:ietf:params:xml:ns:geopriv:held:ri">
       <service serviceUri="urn:service:sos">
         <dest>sip:112 at example.com</dest>
         <dest>sips:112 at example.com</dest>
         <dest>xmpp:112 at example.com</dest>
       </service>
     </routingInformation>

   </locationResponse>
```

When the `lost` module receives such a response, then generate this message
```
http_client [functions.c:299]: curL_query_url(): Malformed URL used in http client (url: 
                                                                                         https://ls.example.com:9768/357yc6s64ceyoiuy5ax3o
                                                                                      )
lost [functions.c:325]: lost_held_function(): dereferencing location failed: 3
```

This error is fixed when if I strip spaces in a string of `locationURI` element.

### Troubleshooting

#### Reproduction

Send xml eample from RFC as responce for `lost_held_query` function call.

### Possible Solutions

Strip leading and trailing spaces of `locationURI` element.
Maybe the required changes here
https://github.com/kamailio/kamailio/blob/master/src/modules/lost/functions.c#L295-L301

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
[root at ip-100-86-47-115 ~]# kamailio -v
version: kamailio 5.5.0-dev3 (x86_64/linux) 0f572c
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 0f572c 
compiled on 04:01:25 Nov 29 2020 with gcc 8.3.1
```

* **Operating System**:


```
[root at ip-100-86-47-115 ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2569
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20201130/5d7aad5d/attachment-0001.htm>


More information about the sr-dev mailing list