Bug#906233: kamailio-postgres-modules: Missing options for psql in pgsql_ro_query prevents usage of kamctl

Andreas Maus maus+debianbug at ypbind.de
Wed Aug 15 19:26:10 BST 2018


Package: kamailio-postgres-modules
Version: 4.4.4-2+deb9u2
Severity: important
Tags: patch

Hello everybody.

In the current version missing command line options for the
read-only psql call (in pgsql_ro_query) prevents usage of
kamctl for PostgreSQL backend, e.g. when adding a _new_ user:

root at debian9 ~ # kamctl add phone_u phone_p
database engine 'PGSQL' loaded
Control engine 'FIFO' loaded
is_user: user counter=1
INFO: user 'phone_u' already exists

This is because the psql query returns the correct result
(0 in this case) but the pgsql_ro_query function lacks the
psql options -A -q -t as defined.

As a result the query contains the result and the coloumn name and
footer,e.g. in this case:

root at debian9 ~ # /usr/bin/psql -h localhost -U kamailioro kamailio \
-c "select count(*) from subscriber where username='phone_u';"
 count
 -------
      0
      (1 row)

In this example the "kamctl add" command looks at the last line of the
output to check if the user is already defined and misinterprets the
result as it expectes "0" as the result.

This affect not only the "kamctl add" command but most calls that calls
$DBROCMD in kamctl.

The patch appended will fix this issue by adding the missing psql
parameters to pgsql_ro_query.

Sincerely yours,

Andreas Maus.

-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-6-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages kamailio-postgres-modules depends on:
ii  kamailio                                   4.4.4-2+deb9u2
ii  libc6                                      2.24-11+deb9u3
ii  libpq5                                     9.6.10-0+deb9u1
ii  postgresql-client                          9.6+181+deb9u2
ii  postgresql-client-9.6 [postgresql-client]  9.6.10-0+deb9u1

kamailio-postgres-modules recommends no packages.

kamailio-postgres-modules suggests no packages.

-- no debconf information

-- 
"Things that try to look like things often do
 look more like things than things. Well-known fact."
Granny Weatherwax - "Wyrd sisters"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgsql_ro_query_add_missing_options.patch
Type: text/x-diff
Size: 498 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-voip-maintainers/attachments/20180815/7aca27a3/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-voip-maintainers/attachments/20180815/7aca27a3/attachment.sig>


More information about the Pkg-voip-maintainers mailing list