[SR-Users] SOLVED (PATCH): Re: Kamailio accepts and stores XCAP XML document from jitsi but rejects it on retrieval

Alex Villací­s Lasso a_villacis at palosanto.com
Tue Jun 3 21:09:31 CEST 2014


El 02/06/14 12:31, Alex Villací­s Lasso escribió:
> El 31/05/14 01:30, Daniel-Constantin Mierla escribió:
>>
>> On 30/05/14 22:02, Alex Villací­s Lasso wrote:
>>> [...] The xml document retrieval is failing again. Now it is because retrieval is truncating the MEDIUMTEXT field at 1024 characters:
>> Adjust the value of parameter:
>>
>> http://kamailio.org/docs/modules/stable/modules/xcap_server.html#idm7128
>>
>> Cheers,
>> Daniel
>>
> Did not work. Same symptoms as before.
>
> I see that the file modules/db_unixodbc/connection.h defines a strn structure with a hardcoded limit of  STRN_LEN=1024 bytes per field.
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

I have solved this issue. In order to make it work with unixodbc, I need to apply the attached patch. This patch removes the hardcoded 1024-byte limit for field data that exists in current kamailio-4.1.3. What the patch does is replace the embedded array 
in the 'struct strn' with a pointer and a field for allocated size. The patch also introduces three functions for manipulation of the modified 'struct strn'. When  the SQLGetData function returns SQL_SUCCESS_WITH_INFO, the SQLSTATE is queried for the "data 
truncated" method. Then the rest of the data is fetched in a loop.

Please review this patch for inclusion. The actual detection of the truncation could need some work.

Also, the ODBC implementation could trip on true binary data (containing embedded binary zeroes) because it is not binary-safe. Are there scenarios in which the rest of Kamailio might need to retrieve or store data with a binary-safe implementation?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kamailio-4.1.3-dbunixodbc-remove-fieldlength-limit.patch
Type: text/x-patch
Size: 7548 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140603/313b6510/attachment.bin>


More information about the sr-users mailing list