Package: gda2-freetds
Version: 1.2.3-2
Severity: normal
Tags: patch

The presence of a DATABASE field in the DNS of a FreeTDS-Provider
causes an segmentation fault at time of connection.

Cause:
        - gda_client_open_connection() wants to switch to the
          given <DATABASE>
        - gda_freetds_execute_cmd() will be called with an argument
          of "USE <DATABASE>"
        - tds_process_result_tokens() sets tds_cnc->tds->res_info
          to NULL
        - tds_cnc->tds->res_info->rows_exist refers to a NULL pointer

Solution:
        - Test for tds_cnc->tds->res_info != NULL before access of
          rows_exist

Two additional fixes showed necessary:
        - tds_process_result_tokens() takes 3 instead of 2 arguments
        - tds_free_connection() was misspelt as tds_free_connect()

Example configuration:
<libgda-config>
        <section path="/apps/libgda/Datasources/EXAMPLE">
        <entry name="Provider" type="string" value="FreeTDS"/>
        <entry name="Description" type="string" value="Test"/>
        <entry name="DSN" type="string" value="HOST=localhost;DATABASE=testdb"/>
        </section>
</libgda-config>

Patch:
diff -ru libgda-1.2.3/providers/freetds/gda-freetds-provider.c 
libgda-1.2.3.mod/providers/freetds/gda-freetds-provider.c
--- libgda-1.2.3/providers/freetds/gda-freetds-provider.c       2004-12-28 
14:26:11.000000000 +0100
+++ libgda-1.2.3.mod/providers/freetds/gda-freetds-provider.c   2006-08-09 
13:39:56.000000000 +0200
@@ -358,7 +358,7 @@
        }
        if (tds_cnc->config) {
 #ifdef HAVE_FREETDS_VER0_6X
-               tds_free_connect (tds_cnc->config);
+               tds_free_connection (tds_cnc->config);
 #else
                tds_free_config(tds_cnc->config);
 #endif
@@ -803,12 +803,12 @@
 
        /* there should not be any result tokens */
 #ifdef HAVE_FREETDS_VER0_6X
-       while ((tds_cnc->rc = tds_process_result_tokens (tds_cnc->tds, 
&tds_cnc->result_type))
+       while ((tds_cnc->rc = tds_process_result_tokens (tds_cnc->tds, 
&tds_cnc->result_type, NULL))
 #else
        while ((tds_cnc->rc = tds_process_result_tokens (tds_cnc->tds)) 
 #endif
               == TDS_SUCCEED) {
-               if (tds_cnc->tds->res_info->rows_exist) {
+               if (tds_cnc->tds->res_info && 
tds_cnc->tds->res_info->rows_exist) {
                        gda_log_error (_("Unexpected result tokens in 
execute_cmd()."));
                        error = gda_freetds_make_error (tds_cnc->tds,
                                                        _("Unexpected result 
tokens in execute_cmd()."));
diff -ru libgda-1.2.3/providers/freetds/gda-freetds-recordset.c 
libgda-1.2.3.mod/providers/freetds/gda-freetds-recordset.c
--- libgda-1.2.3/providers/freetds/gda-freetds-recordset.c      2004-12-28 
14:26:11.000000000 +0100
+++ libgda-1.2.3.mod/providers/freetds/gda-freetds-recordset.c  2006-08-09 
13:27:48.000000000 +0200
@@ -341,7 +341,7 @@
 
 #ifdef HAVE_FREETDS_VER0_6X
        while ((tds_cnc->rc = tds_process_result_tokens (tds_cnc->tds,
-                                                        &tds_cnc->result_type))
+                                                        &tds_cnc->result_type, 
NULL))
               == TDS_SUCCEED) {
                if (tds_cnc->result_type == TDS_ROW_RESULT) {
                        gint row_type, compute_id;


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (90, 'unstable'), (80, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-686
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages gda2-freetds depends on:
ii  libc6                      2.3.6-15      GNU C Library: Shared libraries
ii  libct3                     0.63-3        libraries for connecting to MS SQL
ii  libgda2-3                  1.2.3-2       GNOME Data Access library for GNOM
ii  libglib2.0-0               2.10.3-3      The GLib library of C routines
ii  libxml2                    2.6.26.dfsg-3 GNOME XML library
ii  libxslt1.1                 1.1.17-2      XSLT processing library - runtime 
ii  zlib1g                     1:1.2.3-13    compression library - runtime

gda2-freetds recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to