http://bugs.winehq.org/show_bug.cgi?id=59799 Bug ID: 59799 Summary: odbc32: SQLSetConnectAttr returns SQL_ERROR for unknown driver-specific connection attributes instead of forwarding to the driver Product: Wine Version: unspecified Hardware: x86-64 OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: odbc Assignee: wine-bugs@list.winehq.org Reporter: arthur.talpaert_winehq@m4x.org Description Per the ODBC specification, the driver manager's SQLSetConnectAttr must forward attributes outside the standard range (≥ SQL_CONNECT_OPT_DRVR_START = 1000) to the underlying driver's SQLSetConnectAttr without validation. Wine's odbc32 implementation has a hardcoded switch over known attribute IDs and returns SQL_ERROR for anything else, logging fixme:odbc:SQLSetConnectAttr unhandled attribute <N>. This breaks every modern SQL Server client built on Microsoft ODBC Driver 17/18, which routinely sets vendor-specific attributes: 1219 — SQL_COPT_SS_ENCRYPT 1224 — SQL_COPT_SS_TRUST_SERVER_CERTIFICATE 1226 — SQL_COPT_SS_APPLICATION_INTENT 1227 — SQL_COPT_SS_MULTI_SUBNET_FAILOVER Steps to reproduce Install Microsoft ODBC Driver 17 for SQL Server (msodbcsql.msi) into a Wine prefix. Run any application that calls SQLSetConnectAttr with SQL_COPT_SS_TRUST_SERVER_CERTIFICATE (1224) on the connection handle before SQLConnect. Concrete reproducer: GMC PaDok 5.0.5.0 client installer (setup_gmcpadok_5050.exe) pointed at any SQL Server with a default self-signed TLS cert. Expected SQLSetConnectAttr forwards the call to the driver's SQLSetConnectAttr, which honors it (the MS driver does). SQLConnect then proceeds with the trust-cert flag set. Actual SQLSetConnectAttr returns SQL_ERROR (-1). SQLGetDiagRec returns SQL_NO_DATA (Wine populated no diagnostic record). The application gives up before any TCP connection to SQL Server is attempted. Trace excerpt (with WINEDEBUG=-fixme,+odbc) 0214:trace:odbc:SQLSetConnectAttr (ConnectionHandle …, Attribute 103, Value 0000000F, …) Returning 0 0214:trace:odbc:SQLSetConnectAttr (ConnectionHandle …, Attribute 113, Value 0000001E, …) Returning 0 0214:trace:odbc:SQLSetConnectAttr (ConnectionHandle …, Attribute 1224, Value 00000001, …) 0214:fixme:odbc:SQLSetConnectAttr unhandled attribute 1224 0214:trace:odbc:SQLSetConnectAttr Returning -1 0214:trace:odbc:SQLGetDiagRec (…) Returning 100 0214:trace:odbc:SQLFreeHandle (HandleType 2, …) Proposed fix Wine's odbc32 should forward SQLSetConnectAttr calls for attributes ≥ 1000 (SQL_CONNECT_OPT_DRVR_START) directly to the underlying driver via the proxy table, without validation. Attributes < 1000 that are not in the manager's known set may still be rejected with SQL_ERROR, but with a populated diagnostic record per spec. Workarounds None known. WINEDLLOVERRIDES can replace odbc32 itself, but Microsoft ODBC Driver 17 doesn't ship its own driver manager. Installing native macOS unixODBC + Microsoft's native msodbcsql17 and putting Wine into Unix-proxy mode (libodbc.dylib) is untested and would also still hit downstream FILESTREAM-IOCTL issues unrelated to this bug. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.