[PATCH] Replace / with : in ConnectionString

Florian Manschwetus manschwetus at cs-software-gmbh.de
Thu Mar 31 13:05:31 CDT 2022


From: manschwetusCS <30724946+manschwetusCS at users.noreply.github.com>

In Windows ODBC it seems to be legal to use "host/port", which is not legal with Linux ODBC.
This patch aims to find and replace such in the ConnectionString

Signed-off-by: Florian Manschwetus <manschwetus at cs-software-gmbh.de>
---
 dlls/odbc32/proxyodbc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index c1cb44c29fc..3c78d94b69a 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -1779,10 +1779,21 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR *Connectio
                                   SQLCHAR *conn_str_out, SQLSMALLINT conn_str_out_max,
                                   SQLSMALLINT *ptr_conn_str_out, SQLUSMALLINT driver_completion)
 {
+    static const char *serverStr="SERVER=";
     struct SQLDriverConnect_params params = { hdbc, hwnd, ConnectionString, Length, conn_str_out,
                                               conn_str_out_max, ptr_conn_str_out, driver_completion };
     SQLRETURN ret;

+    SQLCHAR *serverPos;
+    for (serverPos = strstr(ConnectionString,serverStr);(*serverPos != ';') && (*serverPos != '\0'); ++serverPos)
+    {
+        if (*serverPos == '/')
+        {
+           *serverPos = ':';
+           break;
+        }
+    }
+
     TRACE("(hdbc %p, hwnd %p, ConnectionString %s, Length %d, conn_str_out %p, conn_str_out_max %d,"
           " ptr_conn_str_out %p, driver_completion %d)\n", hdbc, hwnd,
           debugstr_an((const char *)ConnectionString, Length), Length, conn_str_out, conn_str_out_max,
--
2.33.0.windows.2

If you received this email in error, please advise the sender (by return email or otherwise) immediately.



More information about the wine-devel mailing list