[php-src] Issue #12296: odbc_connect does not pass authentication information to the driver under certain conditions

From: Date: Mon, 25 Sep 2023 15:14:57 +0000
Subject: [php-src] Issue #12296: odbc_connect does not pass authentication information to the driver under certain conditions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245430@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12296 Author: SakiTakamachi ### Description These are the problems that I found out while investigating various things because #12295, which is a fix PR for #12251, did not work properly. 1. If we pass an empty string for the password, the authentication information will not be passed in DSN when direct. ``` odbc_connect('Driver=FreeTDS;Server=mssql-server;Port=1433;Database=test', 'test_user2', ''); // my env ``` gdb ``` 2138 rc = SQLDriverConnect((*conn)->hdbc, NULL, (SQLCHAR *) ldb, strlen(ldb), dsnbuf, sizeof(dsnbuf) - 1, &dsnbuflen, SQL_DRIVER_NOPROMPT); (gdb) p ldb $1 = 0x7f45d265b240 "Driver=FreeTDS;Server=mssql-server;Port=1433;Database=test" ``` 2. If only one of uid or pwd is included in the dsn, the other will not be included in the built dsn. ``` odbc_connect('Driver=FreeTDS;Server=mssql-server;Port=1433;Database=test;uid=test_user', 'test_user', 'p@ssw0rd'); // my env ``` gdb ``` 2138 rc = SQLDriverConnect((*conn)->hdbc, NULL, (SQLCHAR *) ldb, strlen(ldb), dsnbuf, sizeof(dsnbuf) - 1, &dsnbuflen, SQL_DRIVER_NOPROMPT); (gdb) p ldb $1 = 0x7f089467f000 "Driver=FreeTDS;Server=mssql-server;Port=1433;Database=test;uid=test_user" ``` ### PHP Version PHP8.2+ ### Operating System Ubuntu22.04 (docker image)

« previous php.bugs (#245430) next »