From 1cf4c817ed2582d126ba4c01520d6f9c647a2cc698c244b6e13131a607f41392 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 24 Oct 2018 14:43:50 +0000 Subject: [PATCH] - Update to 2.3.7: * Fix for pkg-config file update on no linux platforms * Add W entry for GUI work * Various fixes for SQLBrowseConnect/W, SQLGetConnectAttr/W,and SQLSetConnectAttr/W * Fix buffer overflows in SQLConnect/W and refine behaviour of SQLGet/WritePrivateProfileString * SQLBrowseConnect/W allow disconnecting a started browse session after error * Add --with-stats-ftok-name configure option to allow the selection of a file name used to generate the IPC id when collecting stats. Default is the system odbc.ini file * Improve diag record handling with the behavior of Windows DM and export SQLCancelHandle * bug fix when SQLGetPrivateProfileString() is called to get a list of sections or a list of keys * Connection pooling: Fix liveness check for Unicode drivers - Add unixODBC-2.3.7-warning-cleanup.patch: 2.3.7 a 64bit protability error See https://github.com/lurcher/unixODBC/issues/18 OBS-URL: https://build.opensuse.org/package/show/server:database/unixODBC?expand=0&rev=54 --- unixODBC-2.3.1-libodbcinst-exports.patch | 11 +- unixODBC-2.3.6.tar.gz | 3 - unixODBC-2.3.7-warning-cleanup.patch | 784 +++++++++++++++++++++++ unixODBC-2.3.7.tar.gz | 3 + unixODBC.changes | 17 + unixODBC.spec | 9 +- 6 files changed, 815 insertions(+), 12 deletions(-) delete mode 100644 unixODBC-2.3.6.tar.gz create mode 100644 unixODBC-2.3.7-warning-cleanup.patch create mode 100644 unixODBC-2.3.7.tar.gz diff --git a/unixODBC-2.3.1-libodbcinst-exports.patch b/unixODBC-2.3.1-libodbcinst-exports.patch index 47a9bfb..1052564 100644 --- a/unixODBC-2.3.1-libodbcinst-exports.patch +++ b/unixODBC-2.3.1-libodbcinst-exports.patch @@ -1,10 +1,9 @@ -Index: odbcinst/odbcinst.exp -=================================================================== ---- odbcinst/odbcinst.exp.orig -+++ odbcinst/odbcinst.exp -@@ -64,3 +64,50 @@ _odbcinst_UserINI - _odbcinst_FileINI +diff -urEbwB unixODBC-2.3.7/odbcinst/odbcinst.exp unixODBC-2.3.7.new/odbcinst/odbcinst.exp +--- unixODBC-2.3.7/odbcinst/odbcinst.exp 2018-04-03 12:36:21.000000000 +0200 ++++ unixODBC-2.3.7.new/odbcinst/odbcinst.exp 2018-08-13 12:31:10.660686094 +0200 +@@ -65,3 +65,50 @@ _SQLDriverConnectPrompt + _SQLDriverConnectPromptW inst_logPushMsg +iniAllTrim +iniAppend diff --git a/unixODBC-2.3.6.tar.gz b/unixODBC-2.3.6.tar.gz deleted file mode 100644 index 909cfa5..0000000 --- a/unixODBC-2.3.6.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:88b637f647c052ecc3861a3baa275c3b503b193b6a49ff8c28b2568656d14d69 -size 1661914 diff --git a/unixODBC-2.3.7-warning-cleanup.patch b/unixODBC-2.3.7-warning-cleanup.patch new file mode 100644 index 0000000..21f0749 --- /dev/null +++ b/unixODBC-2.3.7-warning-cleanup.patch @@ -0,0 +1,784 @@ +https://github.com/lurcher/unixODBC/issues/18 + +From ca226e2e94f68ef7eee5ed9b6368f6550e3ecd56 Mon Sep 17 00:00:00 2001 +From: lurcher +Date: Wed, 24 Oct 2018 14:55:36 +0100 +Subject: [PATCH] Tidy up warnings + +--- + DriverManager/SQLBrowseConnect.c | 4 ++-- + DriverManager/SQLBrowseConnectW.c | 13 +++++++++-- + DriverManager/SQLConnect.c | 33 +++++++++++----------------- + DriverManager/SQLConnectW.c | 4 +--- + DriverManager/SQLDriverConnect.c | 6 ++--- + DriverManager/SQLDriverConnectW.c | 6 ++--- + DriverManager/SQLError.c | 4 ++-- + DriverManager/SQLErrorW.c | 4 ++-- + DriverManager/SQLExecDirect.c | 6 ++--- + DriverManager/SQLExecDirectW.c | 6 ++--- + DriverManager/SQLFetchScroll.c | 4 ++-- + DriverManager/SQLGetConnectAttr.c | 18 +++++++-------- + DriverManager/SQLGetConnectAttrW.c | 14 ++++++------ + DriverManager/SQLGetData.c | 4 ++-- + DriverManager/SQLGetDiagField.c | 4 ++-- + DriverManager/SQLGetDiagFieldW.c | 4 ++-- + DriverManager/SQLGetFunctions.c | 8 +++---- + DriverManager/SQLGetStmtAttr.c | 4 ++-- + DriverManager/SQLGetStmtAttrW.c | 4 ++-- + DriverManager/SQLGetStmtOption.c | 6 ++--- + DriverManager/SQLSetConnectAttr.c | 2 +- + DriverManager/SQLSetConnectAttrW.c | 2 +- + DriverManager/SQLSetConnectOption.c | 2 +- + DriverManager/SQLSetConnectOptionW.c | 2 +- + DriverManager/SQLSetScrollOptions.c | 4 ++-- + DriverManager/SQLSpecialColumns.c | 4 ++-- + DriverManager/SQLSpecialColumnsW.c | 4 ++-- + DriverManager/__info.c | 4 ++++ + DriverManager/drivermanager.h | 29 +++++++++++++++++++++++- + exe/iusql.c | 5 ----- + exe/slencheck.c | 6 ++--- + 31 files changed, 121 insertions(+), 99 deletions(-) + +diff --git a/DriverManager/SQLBrowseConnect.c b/DriverManager/SQLBrowseConnect.c +index dc7cfcf..56b3306 100644 +--- a/DriverManager/SQLBrowseConnect.c ++++ b/DriverManager/SQLBrowseConnect.c +@@ -425,7 +425,7 @@ SQLRETURN SQLBrowseConnect( + } + else + { +- in_str = conn_str_in; ++ in_str = (char*)conn_str_in; + in_str_len = len_conn_str_in == SQL_NTS ? strlen(in_str) : len_conn_str_in; + } + +@@ -462,7 +462,7 @@ SQLRETURN SQLBrowseConnect( + { + unicode_to_ansi_copy((char*) conn_str_out, conn_str_out_max, uc_out_str, SQL_NTS, connection, NULL ); + if (*ptr_conn_str_out < conn_str_out_max) +- *ptr_conn_str_out = strlen(conn_str_out); ++ *ptr_conn_str_out = strlen((char*)conn_str_out); + free(uc_out_str); + } + +diff --git a/DriverManager/SQLBrowseConnectW.c b/DriverManager/SQLBrowseConnectW.c +index 4a4e750..21451a1 100644 +--- a/DriverManager/SQLBrowseConnectW.c ++++ b/DriverManager/SQLBrowseConnectW.c +@@ -406,7 +406,7 @@ SQLRETURN SQLBrowseConnectW( + } + else if (CHECK_SQLBROWSECONNECT( connection )) + { +- SQLCHAR *an_in_str = unicode_to_ansi_alloc( in_str, SQL_NTS, connection, 0 ); ++ SQLCHAR *an_in_str = (SQLCHAR*) unicode_to_ansi_alloc( in_str, SQL_NTS, connection, 0 ); + SQLCHAR *ob = conn_str_out ? malloc( (conn_str_out_max + 1) * sizeof(SQLWCHAR) ) : 0; + SQLINTEGER len; + +@@ -421,7 +421,16 @@ SQLRETURN SQLBrowseConnectW( + *ptr_conn_str_out = len; + if(ob) + { +- ansi_to_unicode_copy(conn_str_out, ob, conn_str_out_max, connection, ptr_conn_str_out ); ++ if ( ptr_conn_str_out ) { ++ int wptr; ++ ++ ansi_to_unicode_copy(conn_str_out, (char*)ob, conn_str_out_max, connection, &wptr ); ++ ++ *ptr_conn_str_out = (SQLSMALLINT) wptr; ++ } ++ else { ++ ansi_to_unicode_copy(conn_str_out, (char*)ob, conn_str_out_max, connection, NULL ); ++ } + free(ob); + } + free(an_in_str); +diff --git a/DriverManager/SQLConnect.c b/DriverManager/SQLConnect.c +index 9ff1867..1a1e63a 100644 +--- a/DriverManager/SQLConnect.c ++++ b/DriverManager/SQLConnect.c +@@ -1844,7 +1844,7 @@ int __connect_part_one( DMHDBC connection, char *driver_lib, char *driver_name, + SQLSETCONNECTATTR(connection, + connection -> driver_dbc, + sa -> attr_type, +- sa -> int_attr, ++ sa -> intptr_attr, + sa -> str_len ); + } + else if (CHECK_SQLSETCONNECTOPTION(connection)) +@@ -1852,7 +1852,7 @@ int __connect_part_one( DMHDBC connection, char *driver_lib, char *driver_name, + SQLSETCONNECTOPTION(connection, + connection -> driver_dbc, + sa -> attr_type, +- sa -> int_attr ); ++ sa -> intptr_attr ); + } + } + +@@ -2978,20 +2978,15 @@ static void close_pooled_connection( CPOOL *ptr ) + + void __strip_from_pool( DMHENV env ) + { +- time_t current_time; +- SQLINTEGER dead; +- CPOOL *ptr, *prev; +- int has_checked = 0; ++ CPOOL *ptr; + + mutex_pool_entry(); + +- current_time = time( NULL ); +- + /* + * look in the list of connections for one that matches + */ + +- for( ptr = pool_head, prev = NULL; ptr; prev = ptr, ptr = ptr -> next ) ++ for( ptr = pool_head; ptr; ptr = ptr -> next ) + { + if ( ptr -> connection.environment == env ) { + +@@ -3146,30 +3141,30 @@ restart:; + * ok so far, is it still alive ? + */ + +- if ( CHECK_SQLGETCONNECTATTR(( &ptr -> connection )) && ++ if ((CHECK_SQLGETCONNECTATTR(( &ptr -> connection )) && + SQL_SUCCEEDED( ret = SQLGETCONNECTATTR(( &ptr -> connection ), + ptr -> connection.driver_dbc, + SQL_ATTR_CONNECTION_DEAD, + &dead, + 0, +- 0 ) ) || +- CHECK_SQLGETCONNECTATTRW(( &ptr -> connection )) && ++ 0 ))) || ++ (CHECK_SQLGETCONNECTATTRW(( &ptr -> connection )) && + SQL_SUCCEEDED( ret = SQLGETCONNECTATTRW(( &ptr -> connection ), + ptr -> connection.driver_dbc, + SQL_ATTR_CONNECTION_DEAD, + &dead, + 0, +- 0 ) ) || +- CHECK_SQLGETCONNECTOPTION(( &ptr -> connection )) && ++ 0 ))) || ++ (CHECK_SQLGETCONNECTOPTION(( &ptr -> connection )) && + SQL_SUCCEEDED( ret = SQLGETCONNECTOPTION(( &ptr->connection ), + ptr -> connection.driver_dbc, + SQL_ATTR_CONNECTION_DEAD, +- &dead ) ) || +- CHECK_SQLGETCONNECTOPTIONW(( &ptr -> connection )) && ++ &dead ))) || ++ (CHECK_SQLGETCONNECTOPTIONW(( &ptr -> connection )) && + SQL_SUCCEEDED( ret = SQLGETCONNECTOPTIONW(( &ptr->connection ), + ptr -> connection.driver_dbc, + SQL_ATTR_CONNECTION_DEAD, +- &dead ) ) ++ &dead ))) + ) + { + /* +@@ -4110,9 +4105,7 @@ SQLRETURN SQLConnect( SQLHDBC connection_handle, + + if ( CHECK_SQLSETCONNECTATTR( connection )) + { +- int lret; +- +- lret = SQLSETCONNECTATTR( connection, ++ SQLSETCONNECTATTR( connection, + connection -> driver_dbc, + SQL_ATTR_ANSI_APP, + SQL_AA_FALSE, +diff --git a/DriverManager/SQLConnectW.c b/DriverManager/SQLConnectW.c +index 372547a..104eddb 100644 +--- a/DriverManager/SQLConnectW.c ++++ b/DriverManager/SQLConnectW.c +@@ -380,9 +380,7 @@ SQLRETURN SQLConnectW( SQLHDBC connection_handle, + { + if ( CHECK_SQLSETCONNECTATTR( connection )) + { +- int lret; +- +- lret = SQLSETCONNECTATTR( connection, ++ SQLSETCONNECTATTR( connection, + connection -> driver_dbc, + SQL_ATTR_ANSI_APP, + SQL_AA_FALSE, +diff --git a/DriverManager/SQLDriverConnect.c b/DriverManager/SQLDriverConnect.c +index 9d861b7..8272cab 100644 +--- a/DriverManager/SQLDriverConnect.c ++++ b/DriverManager/SQLDriverConnect.c +@@ -334,7 +334,7 @@ char *tmp; + while( cp ) + { + size_t attrlen = strlen( cp -> attribute ); +- int use_esc = isspace( *(cp -> attribute ) ) || attrlen && isspace( cp->attribute[attrlen - 1] ); ++ int use_esc = isspace( *(cp -> attribute ) ) || ( attrlen && isspace( cp->attribute[attrlen - 1] )); + for ( tmp = cp -> attribute; *tmp; tmp++ ) + { + use_esc |= (*tmp == '{') || (*tmp == '}'); +@@ -1500,9 +1500,7 @@ SQLRETURN SQLDriverConnect( + + if ( CHECK_SQLSETCONNECTATTR( connection )) + { +- int lret; +- +- lret = SQLSETCONNECTATTR( connection, ++ SQLSETCONNECTATTR( connection, + connection -> driver_dbc, + SQL_ATTR_ANSI_APP, + SQL_AA_FALSE, +diff --git a/DriverManager/SQLDriverConnectW.c b/DriverManager/SQLDriverConnectW.c +index c65027c..828ab02 100644 +--- a/DriverManager/SQLDriverConnectW.c ++++ b/DriverManager/SQLDriverConnectW.c +@@ -423,7 +423,7 @@ SQLRETURN SQLDriverConnectW( + } + else + { +- unicode_to_ansi_copy( returned_dsn, sizeof( returned_dsn ), returned_wdsn, SQL_NTS, connection, NULL ); ++ unicode_to_ansi_copy((char*) returned_dsn, sizeof( returned_dsn ), returned_wdsn, SQL_NTS, connection, NULL ); + prefix = returned_dsn; + target = (SQLCHAR*)strchr( (char*)returned_dsn, '=' ); + if ( target ) +@@ -596,9 +596,7 @@ SQLRETURN SQLDriverConnectW( + { + if ( CHECK_SQLSETCONNECTATTR( connection )) + { +- int lret; +- +- lret = SQLSETCONNECTATTR( connection, ++ SQLSETCONNECTATTR( connection, + connection -> driver_dbc, + SQL_ATTR_ANSI_APP, + SQL_AA_FALSE, +diff --git a/DriverManager/SQLError.c b/DriverManager/SQLError.c +index d4a2a0a..8714037 100644 +--- a/DriverManager/SQLError.c ++++ b/DriverManager/SQLError.c +@@ -184,7 +184,7 @@ + + static char const rcsid[]= "$RCSfile: SQLError.c,v $ $Revision: 1.11 $"; + +-static SQLRETURN extract_sql_error( EHEAD *head, ++static SQLRETURN local_extract_sql_error( EHEAD *head, + SQLCHAR *sqlstate, + SQLINTEGER *native_error, + SQLCHAR *message_text, +@@ -440,7 +440,7 @@ SQLRETURN SQLError( SQLHENV environment_handle, + herror->ret_code_deferred = 0; + } + +- ret = extract_sql_error( herror, ++ ret = local_extract_sql_error( herror, + sqlstate, + native_error, + message_text, +diff --git a/DriverManager/SQLErrorW.c b/DriverManager/SQLErrorW.c +index 16df262..d108756 100644 +--- a/DriverManager/SQLErrorW.c ++++ b/DriverManager/SQLErrorW.c +@@ -173,7 +173,7 @@ SQLRETURN extract_parent_handle_err( int handle_type, + * unicode mapping function + */ + +-static SQLRETURN extract_sql_error_w( EHEAD *head, ++static SQLRETURN local_extract_sql_error_w( EHEAD *head, + SQLWCHAR *sqlstate, + SQLINTEGER *native_error, + SQLWCHAR *message_text, +@@ -391,7 +391,7 @@ SQLRETURN SQLErrorW( SQLHENV environment_handle, + herror->ret_code_deferred = 0; + } + +- ret = extract_sql_error_w( herror, ++ ret = local_extract_sql_error_w( herror, + sqlstate, + native_error, + message_text, +diff --git a/DriverManager/SQLExecDirect.c b/DriverManager/SQLExecDirect.c +index 1f19a81..24622b8 100644 +--- a/DriverManager/SQLExecDirect.c ++++ b/DriverManager/SQLExecDirect.c +@@ -500,9 +500,9 @@ SQLRETURN SQLExecDirect( SQLHSTMT statement_handle, + + statement -> prepared = 0; + } +- else if ( statement -> state >= STATE_S2 && statement -> state <= STATE_S4 || +- statement -> state >= STATE_S11 && statement -> state <= STATE_S12 && +- statement -> interupted_state >= STATE_S2 && statement -> interupted_state <= STATE_S4) ++ else if (( statement -> state >= STATE_S2 && statement -> state <= STATE_S4 ) || ++ ( statement -> state >= STATE_S11 && statement -> state <= STATE_S12 && ++ statement -> interupted_state >= STATE_S2 && statement -> interupted_state <= STATE_S4 )) + { + statement -> state = STATE_S1; + } +diff --git a/DriverManager/SQLExecDirectW.c b/DriverManager/SQLExecDirectW.c +index 6c040f3..b4cbe61 100644 +--- a/DriverManager/SQLExecDirectW.c ++++ b/DriverManager/SQLExecDirectW.c +@@ -435,9 +435,9 @@ SQLRETURN SQLExecDirectW( SQLHSTMT statement_handle, + + statement -> prepared = 0; + } +- else if ( statement -> state >= STATE_S2 && statement -> state <= STATE_S4 || +- statement -> state >= STATE_S11 && statement -> state <= STATE_S12 && +- statement -> interupted_state >= STATE_S2 && statement -> interupted_state <= STATE_S4) ++ else if (( statement -> state >= STATE_S2 && statement -> state <= STATE_S4 ) || ++ ( statement -> state >= STATE_S11 && statement -> state <= STATE_S12 && ++ statement -> interupted_state >= STATE_S2 && statement -> interupted_state <= STATE_S4 )) + { + statement -> state = STATE_S1; + } +diff --git a/DriverManager/SQLFetchScroll.c b/DriverManager/SQLFetchScroll.c +index c08f8ca..bd3fc39 100644 +--- a/DriverManager/SQLFetchScroll.c ++++ b/DriverManager/SQLFetchScroll.c +@@ -164,13 +164,13 @@ SQLRETURN SQLFetchScroll( SQLHSTMT statement_handle, + + thread_protect( SQL_HANDLE_STMT, statement ); + +- if ( fetch_orientation != SQL_FETCH_NEXT && ++ if (( fetch_orientation != SQL_FETCH_NEXT && + fetch_orientation != SQL_FETCH_PRIOR && + fetch_orientation != SQL_FETCH_FIRST && + fetch_orientation != SQL_FETCH_LAST && + fetch_orientation != SQL_FETCH_ABSOLUTE && + fetch_orientation != SQL_FETCH_RELATIVE && +- fetch_orientation != SQL_FETCH_BOOKMARK || ++ fetch_orientation != SQL_FETCH_BOOKMARK ) || + (fetch_orientation == SQL_FETCH_BOOKMARK + && statement -> bookmarks_on == SQL_UB_OFF) ) + { +diff --git a/DriverManager/SQLGetConnectAttr.c b/DriverManager/SQLGetConnectAttr.c +index 9dc3182..92eef95 100644 +--- a/DriverManager/SQLGetConnectAttr.c ++++ b/DriverManager/SQLGetConnectAttr.c +@@ -360,12 +360,12 @@ SQLRETURN SQLGetConnectAttr( SQLHDBC connection_handle, + rc = SQL_SUCCESS_WITH_INFO; + } + } +- else if(buffer_length >= sizeof(SQLLEN)) ++ else if(buffer_length >= sizeof(intptr_t)) + { +- *(SQLLEN*)value = sa -> int_attr; ++ *(intptr_t*)value = sa -> intptr_attr; + if(string_length) + { +- *string_length = sizeof(SQLLEN); ++ *string_length = sizeof(intptr_t); + } + } + else if(sa -> str_len >= SQL_IS_SMALLINT && sa -> str_len <= SQL_IS_POINTER) +@@ -374,23 +374,23 @@ SQLRETURN SQLGetConnectAttr( SQLHDBC connection_handle, + switch (sa -> str_len) + { + case SQL_IS_SMALLINT: +- *(SQLSMALLINT*)value = sa->int_attr; ++ *(SQLSMALLINT*)value = sa->intptr_attr; + length = sizeof(SQLSMALLINT); + break; + case SQL_IS_USMALLINT: +- *(SQLUSMALLINT*)value = sa->int_attr; ++ *(SQLUSMALLINT*)value = sa->intptr_attr; + length = sizeof(SQLUSMALLINT); + break; + case SQL_IS_INTEGER: +- *(SQLINTEGER*)value = sa->int_attr; ++ *(SQLINTEGER*)value = sa->intptr_attr; + length = sizeof(SQLINTEGER); + break; + case SQL_IS_UINTEGER: +- *(SQLUINTEGER*)value = sa->int_attr; ++ *(SQLUINTEGER*)value = sa->intptr_attr; + length = sizeof(SQLUINTEGER); + break; + case SQL_IS_POINTER: +- *(SQLPOINTER**)value = sa->int_attr; ++ *(SQLPOINTER**)value = (SQLPOINTER*) sa->intptr_attr; + length = sizeof(SQLPOINTER); + break; + } +@@ -401,7 +401,7 @@ SQLRETURN SQLGetConnectAttr( SQLHDBC connection_handle, + } + else + { +- memcpy(value, &sa->int_attr, buffer_length); ++ memcpy(value, &sa->intptr_attr, buffer_length); + } + return function_return_nodrv( SQL_HANDLE_DBC, connection, rc ); + } +diff --git a/DriverManager/SQLGetConnectAttrW.c b/DriverManager/SQLGetConnectAttrW.c +index 1838c15..99d8e75 100644 +--- a/DriverManager/SQLGetConnectAttrW.c ++++ b/DriverManager/SQLGetConnectAttrW.c +@@ -306,7 +306,7 @@ SQLRETURN SQLGetConnectAttrW( SQLHDBC connection_handle, + } + else if(buffer_length >= sizeof(SQLLEN)) + { +- *(SQLLEN*)value = sa -> int_attr; ++ *(SQLLEN*)value = sa -> intptr_attr; + if(string_length) + { + *string_length = sizeof(SQLLEN); +@@ -318,23 +318,23 @@ SQLRETURN SQLGetConnectAttrW( SQLHDBC connection_handle, + switch (sa -> str_len) + { + case SQL_IS_SMALLINT: +- *(SQLSMALLINT*)value = sa->int_attr; ++ *(SQLSMALLINT*)value = sa->intptr_attr; + length = sizeof(SQLSMALLINT); + break; + case SQL_IS_USMALLINT: +- *(SQLUSMALLINT*)value = sa->int_attr; ++ *(SQLUSMALLINT*)value = sa->intptr_attr; + length = sizeof(SQLUSMALLINT); + break; + case SQL_IS_INTEGER: +- *(SQLINTEGER*)value = sa->int_attr; ++ *(SQLINTEGER*)value = sa->intptr_attr; + length = sizeof(SQLINTEGER); + break; + case SQL_IS_UINTEGER: +- *(SQLUINTEGER*)value = sa->int_attr; ++ *(SQLUINTEGER*)value = sa->intptr_attr; + length = sizeof(SQLUINTEGER); + break; + case SQL_IS_POINTER: +- *(SQLPOINTER**)value = sa->int_attr; ++ *(SQLPOINTER**)value = (SQLPOINTER) sa->intptr_attr; + length = sizeof(SQLPOINTER); + break; + } +@@ -345,7 +345,7 @@ SQLRETURN SQLGetConnectAttrW( SQLHDBC connection_handle, + } + else + { +- memcpy(value, &sa->int_attr, buffer_length); ++ memcpy(value, &sa->intptr_attr, buffer_length); + } + return function_return_nodrv( SQL_HANDLE_DBC, connection, rc ); + } +diff --git a/DriverManager/SQLGetData.c b/DriverManager/SQLGetData.c +index 497c525..deac047 100644 +--- a/DriverManager/SQLGetData.c ++++ b/DriverManager/SQLGetData.c +@@ -300,8 +300,8 @@ SQLRETURN SQLGetData( SQLHSTMT statement_handle, + } + else if ( statement -> state == STATE_S4 || + statement -> state == STATE_S5 || +- ( statement -> state == STATE_S6 || statement -> state == STATE_S7 ) +- && statement -> eod ) ++ (( statement -> state == STATE_S6 || statement -> state == STATE_S7 ) ++ && statement -> eod )) + { + dm_log_write( __FILE__, + __LINE__, +diff --git a/DriverManager/SQLGetDiagField.c b/DriverManager/SQLGetDiagField.c +index 26d72c7..58a253c 100644 +--- a/DriverManager/SQLGetDiagField.c ++++ b/DriverManager/SQLGetDiagField.c +@@ -512,8 +512,8 @@ static SQLRETURN extract_sql_error_field( EHEAD *head, + */ + + if ( rec_number < 1 || +- ( diag_identifier == SQL_DIAG_COLUMN_NUMBER || +- diag_identifier == SQL_DIAG_ROW_NUMBER ) && head -> handle_type != SQL_HANDLE_STMT ) ++ (( diag_identifier == SQL_DIAG_COLUMN_NUMBER || ++ diag_identifier == SQL_DIAG_ROW_NUMBER ) && head -> handle_type != SQL_HANDLE_STMT )) + { + return SQL_ERROR; + } +diff --git a/DriverManager/SQLGetDiagFieldW.c b/DriverManager/SQLGetDiagFieldW.c +index c3245f6..42175d3 100644 +--- a/DriverManager/SQLGetDiagFieldW.c ++++ b/DriverManager/SQLGetDiagFieldW.c +@@ -489,8 +489,8 @@ static SQLRETURN extract_sql_error_field_w( EHEAD *head, + */ + + if ( rec_number < 1 || +- ( diag_identifier == SQL_DIAG_COLUMN_NUMBER || +- diag_identifier == SQL_DIAG_ROW_NUMBER ) && head -> handle_type != SQL_HANDLE_STMT ) ++ (( diag_identifier == SQL_DIAG_COLUMN_NUMBER || ++ diag_identifier == SQL_DIAG_ROW_NUMBER ) && head -> handle_type != SQL_HANDLE_STMT )) + { + return SQL_ERROR; + } +diff --git a/DriverManager/SQLGetFunctions.c b/DriverManager/SQLGetFunctions.c +index bc8698e..997f6a4 100644 +--- a/DriverManager/SQLGetFunctions.c ++++ b/DriverManager/SQLGetFunctions.c +@@ -182,10 +182,10 @@ SQLRETURN SQLGetFunctions( SQLHDBC connection_handle, + return function_return_nodrv( SQL_HANDLE_DBC, connection, SQL_ERROR ); + } + +- if ( function_id > SQL_API_SQLBULKOPERATIONS && function_id < SQL_API_SQLCOLUMNS || +- function_id > SQL_API_SQLALLOCHANDLESTD && function_id < SQL_API_LOADBYORDINAL || +- function_id > SQL_API_LOADBYORDINAL && function_id < SQL_API_ODBC3_ALL_FUNCTIONS || +- function_id > SQL_API_ODBC3_ALL_FUNCTIONS && function_id < SQL_API_SQLALLOCHANDLE || ++ if (( function_id > SQL_API_SQLBULKOPERATIONS && function_id < SQL_API_SQLCOLUMNS ) || ++ ( function_id > SQL_API_SQLALLOCHANDLESTD && function_id < SQL_API_LOADBYORDINAL ) || ++ ( function_id > SQL_API_LOADBYORDINAL && function_id < SQL_API_ODBC3_ALL_FUNCTIONS ) || ++ ( function_id > SQL_API_ODBC3_ALL_FUNCTIONS && function_id < SQL_API_SQLALLOCHANDLE ) || + function_id > SQL_API_SQLFETCHSCROLL ) + { + __post_internal_error( &connection -> error, +diff --git a/DriverManager/SQLGetStmtAttr.c b/DriverManager/SQLGetStmtAttr.c +index 23082ca..0aa02dd 100644 +--- a/DriverManager/SQLGetStmtAttr.c ++++ b/DriverManager/SQLGetStmtAttr.c +@@ -239,8 +239,8 @@ SQLRETURN SQLGetStmtAttr( SQLHSTMT statement_handle, + statement -> state == STATE_S3 || + statement -> state == STATE_S4 || + statement -> state == STATE_S5 || +- ( statement -> state == STATE_S6 || +- statement -> state == STATE_S7 ) && statement -> eod ) ++ (( statement -> state == STATE_S6 || ++ statement -> state == STATE_S7 ) && statement -> eod )) + { + dm_log_write( __FILE__, + __LINE__, +diff --git a/DriverManager/SQLGetStmtAttrW.c b/DriverManager/SQLGetStmtAttrW.c +index b486101..a191dd0 100644 +--- a/DriverManager/SQLGetStmtAttrW.c ++++ b/DriverManager/SQLGetStmtAttrW.c +@@ -169,8 +169,8 @@ SQLRETURN SQLGetStmtAttrW( SQLHSTMT statement_handle, + statement -> state == STATE_S3 || + statement -> state == STATE_S4 || + statement -> state == STATE_S5 || +- ( statement -> state == STATE_S6 || +- statement -> state == STATE_S7 ) && statement -> eod ) ++ (( statement -> state == STATE_S6 || ++ statement -> state == STATE_S7 ) && statement -> eod )) + { + dm_log_write( __FILE__, + __LINE__, +diff --git a/DriverManager/SQLGetStmtOption.c b/DriverManager/SQLGetStmtOption.c +index 7f8d912..04fcdc8 100644 +--- a/DriverManager/SQLGetStmtOption.c ++++ b/DriverManager/SQLGetStmtOption.c +@@ -170,9 +170,9 @@ SQLRETURN SQLGetStmtOption( SQLHSTMT statement_handle, + + if ( option == SQL_ROW_NUMBER || option == SQL_GET_BOOKMARK ) + { +- if ( statement -> state >= STATE_S1 && statement -> state <= STATE_S5 || +- ( statement -> state == STATE_S6 || +- statement -> state == STATE_S7 ) && statement -> eod ) ++ if (( statement -> state >= STATE_S1 && statement -> state <= STATE_S5 ) || ++ (( statement -> state == STATE_S6 || ++ statement -> state == STATE_S7 ) && statement -> eod )) + { + dm_log_write( __FILE__, + __LINE__, +diff --git a/DriverManager/SQLSetConnectAttr.c b/DriverManager/SQLSetConnectAttr.c +index 1a4a89f..272eea9 100644 +--- a/DriverManager/SQLSetConnectAttr.c ++++ b/DriverManager/SQLSetConnectAttr.c +@@ -676,7 +676,7 @@ SQLRETURN SQLSetConnectAttr( SQLHDBC connection_handle, + } + else + { +- sa -> int_attr = ( SQLLEN ) value; ++ sa -> intptr_attr = (intptr_t) value; + sa -> str_len = string_length; + } + sa -> next = connection -> save_attr; +diff --git a/DriverManager/SQLSetConnectAttrW.c b/DriverManager/SQLSetConnectAttrW.c +index 0dc18e0..105dab8 100644 +--- a/DriverManager/SQLSetConnectAttrW.c ++++ b/DriverManager/SQLSetConnectAttrW.c +@@ -612,7 +612,7 @@ SQLRETURN SQLSetConnectAttrW( SQLHDBC connection_handle, + } + else + { +- sa -> int_attr = ( SQLLEN ) value; ++ sa -> intptr_attr = (intptr_t) value; + sa -> str_len = string_length; + } + sa -> next = connection -> save_attr; +diff --git a/DriverManager/SQLSetConnectOption.c b/DriverManager/SQLSetConnectOption.c +index 83ca85c..61daf46 100644 +--- a/DriverManager/SQLSetConnectOption.c ++++ b/DriverManager/SQLSetConnectOption.c +@@ -512,7 +512,7 @@ SQLRETURN SQLSetConnectOption( SQLHDBC connection_handle, + struct save_attr *sa = calloc( 1, sizeof( struct save_attr )); + + sa -> attr_type = option; +- sa -> int_attr = ( SQLINTEGER ) value; ++ sa -> intptr_attr = value; + sa -> next = connection -> save_attr; + connection -> save_attr = sa; + } +diff --git a/DriverManager/SQLSetConnectOptionW.c b/DriverManager/SQLSetConnectOptionW.c +index 028f3b2..ba0ea15 100644 +--- a/DriverManager/SQLSetConnectOptionW.c ++++ b/DriverManager/SQLSetConnectOptionW.c +@@ -431,7 +431,7 @@ SQLRETURN SQLSetConnectOptionW( SQLHDBC connection_handle, + struct save_attr *sa = calloc( 1, sizeof( struct save_attr )); + + sa -> attr_type = option; +- sa -> int_attr = ( SQLINTEGER ) value; ++ sa -> intptr_attr = value; + sa -> next = connection -> save_attr; + connection -> save_attr = sa; + } +diff --git a/DriverManager/SQLSetScrollOptions.c b/DriverManager/SQLSetScrollOptions.c +index b24e8ae..82916ac 100644 +--- a/DriverManager/SQLSetScrollOptions.c ++++ b/DriverManager/SQLSetScrollOptions.c +@@ -208,10 +208,10 @@ SQLRETURN SQLSetScrollOptions( + return function_return_nodrv( SQL_HANDLE_STMT, statement, SQL_ERROR ); + } + +- if ( crow_keyset != SQL_SCROLL_FORWARD_ONLY && ++ if (( crow_keyset != SQL_SCROLL_FORWARD_ONLY && + crow_keyset != SQL_SCROLL_STATIC && + crow_keyset != SQL_SCROLL_KEYSET_DRIVEN && +- crow_keyset != SQL_SCROLL_DYNAMIC || ++ crow_keyset != SQL_SCROLL_DYNAMIC ) || + !crow_rowset) + { + dm_log_write( __FILE__, +diff --git a/DriverManager/SQLSpecialColumns.c b/DriverManager/SQLSpecialColumns.c +index 507727a..ea5863b 100644 +--- a/DriverManager/SQLSpecialColumns.c ++++ b/DriverManager/SQLSpecialColumns.c +@@ -231,8 +231,8 @@ SQLRETURN SQLSpecialColumns( SQLHSTMT statement_handle, + return function_return_nodrv( SQL_HANDLE_STMT, statement, SQL_ERROR ); + } + +- if ( name_length1 < 0 && name_length1 != SQL_NTS || +- name_length2 < 0 && name_length2 != SQL_NTS ) ++ if (( name_length1 < 0 && name_length1 != SQL_NTS ) || ++ ( name_length2 < 0 && name_length2 != SQL_NTS )) + { + __post_internal_error( &statement -> error, + ERROR_HY090, NULL, +diff --git a/DriverManager/SQLSpecialColumnsW.c b/DriverManager/SQLSpecialColumnsW.c +index 637e4c4..01937cd 100644 +--- a/DriverManager/SQLSpecialColumnsW.c ++++ b/DriverManager/SQLSpecialColumnsW.c +@@ -198,8 +198,8 @@ SQLRETURN SQLSpecialColumnsW( SQLHSTMT statement_handle, + return function_return_nodrv( SQL_HANDLE_STMT, statement, SQL_ERROR ); + } + +- if ( name_length1 < 0 && name_length1 != SQL_NTS || +- name_length2 < 0 && name_length2 != SQL_NTS ) ++ if (( name_length1 < 0 && name_length1 != SQL_NTS ) || ++ ( name_length2 < 0 && name_length2 != SQL_NTS )) + { + __post_internal_error( &statement -> error, + ERROR_HY090, NULL, +diff --git a/DriverManager/__info.c b/DriverManager/__info.c +index cfb87ad..974aec4 100644 +--- a/DriverManager/__info.c ++++ b/DriverManager/__info.c +@@ -4600,7 +4600,9 @@ void extract_diag_error_w( int htype, + if ( SQL_SUCCEEDED( ret )) + { + ERROR *e = malloc( sizeof( ERROR )); ++#ifndef STRICT_ODBC_ERROR + SQLWCHAR *tmp; ++#endif + + /* + * make sure we are truncated in the right place +@@ -4836,7 +4838,9 @@ void extract_sql_error_w( DRV_SQLHANDLE henv, + + if ( SQL_SUCCEEDED( ret )) + { ++#ifndef STRICT_ODBC_ERROR + SQLWCHAR *tmp; ++#endif + + /* + * add to the lists, SQLError list first +diff --git a/DriverManager/drivermanager.h b/DriverManager/drivermanager.h +index e6a00c7..29c176a 100644 +--- a/DriverManager/drivermanager.h ++++ b/DriverManager/drivermanager.h +@@ -235,7 +235,7 @@ struct save_attr + int attr_type; + char *str_attr; + int str_len; +- SQLLEN int_attr; ++ intptr_t intptr_attr; + struct save_attr *next; + }; + +@@ -845,6 +845,33 @@ int __append_pair( struct con_struct *con_str, char *kword, char *value ); + void __handle_attr_extensions_cs( DMHDBC connection, struct con_struct *con_str ); + void __strip_from_pool( DMHENV env ); + ++void extract_diag_error_w( int htype, ++ DRV_SQLHANDLE handle, ++ DMHDBC connection, ++ EHEAD *head, ++ int return_code, ++ int save_to_diag ); ++ ++void extract_diag_error( int htype, ++ DRV_SQLHANDLE handle, ++ DMHDBC connection, ++ EHEAD *head, ++ int return_code, ++ int save_to_diag ); ++ ++void extract_sql_error_w( DRV_SQLHANDLE henv, ++ DRV_SQLHANDLE hdbc, ++ DRV_SQLHANDLE hstmt, ++ DMHDBC connection, ++ EHEAD *head, ++ int return_code ); ++ ++void extract_sql_error( DRV_SQLHANDLE henv, ++ DRV_SQLHANDLE hdbc, ++ DRV_SQLHANDLE hstmt, ++ DMHDBC connection, ++ EHEAD *head, ++ int return_code ); + /* + * the following two are part of a effort to get a particular unicode driver working + */ +diff --git a/exe/iusql.c b/exe/iusql.c +index ce3d39a..d413bb7 100644 +--- a/exe/iusql.c ++++ b/exe/iusql.c +@@ -35,18 +35,13 @@ static int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNa + static int ExecuteHelp( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int bHTMLTable ); + + static void WriteHeaderHTMLTable( SQLHSTMT hStmt ); +-static void WriteHeaderNormal( SQLHSTMT hStmt, SQLCHAR *szSepLine ); + static void WriteHeaderDelimited( SQLHSTMT hStmt, char cDelimiter ); + static void WriteBodyHTMLTable( SQLHSTMT hStmt ); + static SQLLEN WriteBodyNormal( SQLHSTMT hStmt ); + static void WriteBodyDelimited( SQLHSTMT hStmt, char cDelimiter ); + static void WriteFooterHTMLTable( SQLHSTMT hStmt ); +-static void WriteFooterNormal( SQLHSTMT hStmt, SQLCHAR *szSepLine, SQLLEN nRows ); + + static int DumpODBCLog( SQLHENV hEnv, SQLHDBC hDbc, SQLHSTMT hStmt ); +-static int get_args(char *string, char **args, int maxarg); +-static void free_args(char **args, int maxarg); +-static void output_help(void); + + + int bVerbose = 0; +diff --git a/exe/slencheck.c b/exe/slencheck.c +index 8df7c11..330299b 100644 +--- a/exe/slencheck.c ++++ b/exe/slencheck.c +@@ -69,13 +69,13 @@ int main( int argc, char **argv ) + } + + if ( argc == 2 ) { +- ret = SQLConnect( hdbc, argv[ 1 ], SQL_NTS, NULL, 0, NULL, 0 ); ++ ret = SQLConnect( hdbc, (SQLCHAR*) argv[ 1 ], SQL_NTS, NULL, 0, NULL, 0 ); + } + else if ( argc == 3 ) { +- ret = SQLConnect( hdbc, argv[ 1 ], SQL_NTS, argv[ 2 ], SQL_NTS, NULL, 0 ); ++ ret = SQLConnect( hdbc, (SQLCHAR*) argv[ 1 ], SQL_NTS, (SQLCHAR*) argv[ 2 ], SQL_NTS, NULL, 0 ); + } + else { +- ret = SQLConnect( hdbc, argv[ 1 ], SQL_NTS, argv[ 2 ], SQL_NTS, argv[ 3 ], SQL_NTS ); ++ ret = SQLConnect( hdbc, (SQLCHAR*) argv[ 1 ], SQL_NTS, (SQLCHAR*) argv[ 2 ], SQL_NTS, (SQLCHAR*) argv[ 3 ], SQL_NTS ); + } + + if ( !SQL_SUCCEEDED( ret )) { diff --git a/unixODBC-2.3.7.tar.gz b/unixODBC-2.3.7.tar.gz new file mode 100644 index 0000000..188db54 --- /dev/null +++ b/unixODBC-2.3.7.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45f169ba1f454a72b8fcbb82abd832630a3bf93baa84731cf2949f449e1e3e77 +size 1669501 diff --git a/unixODBC.changes b/unixODBC.changes index 3897294..6c83cf3 100644 --- a/unixODBC.changes +++ b/unixODBC.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Wed Oct 24 14:37:58 UTC 2018 - mvetter@suse.com + +- Update to 2.3.7: + * Fix for pkg-config file update on no linux platforms + * Add W entry for GUI work + * Various fixes for SQLBrowseConnect/W, SQLGetConnectAttr/W,and SQLSetConnectAttr/W + * Fix buffer overflows in SQLConnect/W and refine behaviour of SQLGet/WritePrivateProfileString + * SQLBrowseConnect/W allow disconnecting a started browse session after error + * Add --with-stats-ftok-name configure option to allow the selection of a file name + used to generate the IPC id when collecting stats. Default is the system odbc.ini file + * Improve diag record handling with the behavior of Windows DM and export SQLCancelHandle + * bug fix when SQLGetPrivateProfileString() is called to get a list of sections or a list of keys + * Connection pooling: Fix liveness check for Unicode drivers +- Add unixODBC-2.3.7-warning-cleanup.patch: 2.3.7 a 64bit protability error + See https://github.com/lurcher/unixODBC/issues/18 + ------------------------------------------------------------------- Thu Mar 22 14:09:43 UTC 2018 - mvetter@suse.com diff --git a/unixODBC.spec b/unixODBC.spec index 8cd271f..b2f98ab 100644 --- a/unixODBC.spec +++ b/unixODBC.spec @@ -17,7 +17,7 @@ Name: unixODBC -Version: 2.3.6 +Version: 2.3.7 Release: 0 Summary: ODBC driver manager with some drivers included License: GPL-2.0-or-later AND LGPL-2.1-or-later @@ -30,7 +30,9 @@ Patch1: unixODBC-paths.patch Patch2: unixODBC-gccwarnings.patch # https://github.com/lurcher/unixODBC/issues/8 Patch3: unixODBC-2.3.1-libodbcinst-exports.patch -Patch4: unixODBC-2.3.6-declarations.patch +Patch4: unixODBC-2.3.6-declarations.patch +# https://github.com/lurcher/unixODBC/issues/18 +Patch5: unixODBC-2.3.7-warning-cleanup.patch BuildRequires: automake BuildRequires: bison BuildRequires: gcc-c++ @@ -58,8 +60,9 @@ Includes for ODBC development (based on unixODBC). %setup -q %patch1 %patch2 -%patch3 +%patch3 -p1 %patch4 -p1 +%patch5 -p1 %build perl -i -pe 's{^ACLOCAL_AMFLAGS.*}{}' Makefile.am