Skip to content

Error connecting with "Other Params" set #2032

@48clyde

Description

@48clyde

Bug description
In the database connection dialog, if a space is NOT put after the "Other Params", the "Test" connection fails with failed: fe_sendauth: no password supplied

How to reproduce
See screen shot below. If "Other Params" is set, then it needs a trailing space for a successful connection.

Expected behavior
The "Test" connection successfully connects to the database server regardless of the "Other Params" value having a trailing space or not.

Screenshots
Image
Connection dialog with "Other params" set to "application_name=OMS.bluegum ". Note the trailing space.

Info about your desktop

  • OS: Ubuntu
  • Version: 24.04.3 LTS
  • Window manager: Wayland
  • pgModeler version: 1.2.2
  • Qt version: 6.4.2

Stacktrace / Debug info

[0] src/settings/connectionsconfigwidget.cpp (471)
  void ConnectionsConfigWidget::testConnection()
    [ConnectionNotStablished] Could not connect to the database.
Message returned: 'connection to server at "db0.local" (192.168.100.243), port 5432 failed: fe_sendauth: no password supplied
'

[1] src/connection.cpp (265)
  void Connection::connect()
    [ConnectionNotStablished] Could not connect to the database.
Message returned: 'connection to server at "db0.local" (192.168.100.243), port 5432 failed: fe_sendauth: no password supplied
'

Additional info
I believe the problem is in libs/libconnector/src/connection.cpp, line 158. When building up the connection string of key value pairs, a space is added after the value using the param_str formatter defined on line 134. "Other Params" are appended directly to the connection string in line 158 without appending a space after.

This results in an invalid connection string which looks like to the server that a password was not supplied. Adding a trailing space to "Other Params" works round this issue.

Replacing lines 157 & 158 with:

        else {
                connection_str += value;
                connection_str += " ";
        }

fixed the problem for me

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions