Discussion:
[freetds] FreeTDS library 30 character password limitation
Vipul Sharma
2013-11-18 11:13:24 UTC
Permalink
Hi,



I tried connecting to sql server using a password whose length is more than
30 characters and it is failing. I am using the dbopen() API to connect.
After searching the freetds dblib code, found that
${top_dir}/include/tds.hhas this line in it which is causing the
problem:



*#define TDS_MAX_LOGIN_STR_SZ 30 *



The field length is somehow limited to 30 characters and making the value
to 128 apparently fixes the issue just for now.



Just wanted to know,

- If this 30 characters limitations is documented somewhere ?

- Is it safe to simply increase the value to 128 for now to work around the
limitation for now..



*Note *: I am interested to connect just using the TDS 7.1 version.



Any pointers around this would be really appreciated.



Thanks in advance ,
Sergio NNX
2013-11-18 13:00:56 UTC
Permalink
Ciao all.

I've just built FreeTDS 0.91.96 from source on Windows and now I'm running the unit tests. Some of them are failing and I need some advice about what the problem may be. Using MS SQL 2008.

Thanks in advance.

Sergio.

Tests output
----------------


====================
1 of 18 tests failed (tds/unittests) : FAIL: readconf.exe
====================

====================
All 29 tests failed (ctlib/unittests)
====================

====================
1 of 34 tests failed (dblib/unittests)
====================

DB-LIBRARY error (dberr 20050 (severity 4): "Attempt to convert data stopped by syntax error in source field"; oserr 0: "No error") error: no unanticipated errors allowed in unit tests
FAIL: t0016.exe


=====================
16 of 68 tests failed (odbc/unittests)
=====================


Wrong result
Got: 130000D8CDF730448203000000000000000000
Expected: 283208CFBB7DFCFF
FAIL: genparams.exe

data.c:54 rc=1 SQLFetch
SQL error 37000 -- [FreeTDS][SQL Server]Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')
FAIL: data.exe

CheckType 137
CheckType 139
Data expected. Inpute type 9 - SQL_DATE line 139
FAIL: typeinfo.exe

cursor1.c:69 rc=-1 SQLExecDirect
SQL error 37000 -- [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown.
FAIL: cursor1.exe
Frediano Ziglio
2013-11-18 18:22:30 UTC
Permalink
2013/11/18 Sergio NNX <sfhacker at hotmail.com>:
> Ciao all.
>
> I've just built FreeTDS 0.91.96 from source on Windows and now I'm running the unit tests. Some of them are failing and I need some advice about what the problem may be. Using MS SQL 2008.
>
> Thanks in advance.
>
> Sergio.
>
> Tests output
> ----------------
>
>
> ====================
> 1 of 18 tests failed (tds/unittests) : FAIL: readconf.exe
> ====================
>

Quite strange this fails!

> ====================
> All 29 tests failed (ctlib/unittests)
> ====================
>
> ====================
> 1 of 34 tests failed (dblib/unittests)
> ====================
>
> DB-LIBRARY error (dberr 20050 (severity 4): "Attempt to convert data stopped by syntax error in source field"; oserr 0: "No error") error: no unanticipated errors allowed in unit tests
> FAIL: t0016.exe
>

:( probably related to some characters conversion. utf-8 not working
?? Did you use iconv?

>
> =====================
> 16 of 68 tests failed (odbc/unittests)
> =====================
>

16 ?? Quite bad

>
> Wrong result
> Got: 130000D8CDF730448203000000000000000000
> Expected: 283208CFBB7DFCFF
> FAIL: genparams.exe
>

Mmm... this is using wrong protocol (expected bigint got numeric)

> data.c:54 rc=1 SQLFetch
> SQL error 37000 -- [FreeTDS][SQL Server]Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')
> FAIL: data.exe
>

Still conversions.

> CheckType 137
> CheckType 139
> Data expected. Inpute type 9 - SQL_DATE line 139
> FAIL: typeinfo.exe
>
> cursor1.c:69 rc=-1 SQLExecDirect
> SQL error 37000 -- [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown.
> FAIL: cursor1.exe
>

This is serious !!

Looking forward for dumps.

Frediano
Patrick McCoole
2013-11-18 18:31:04 UTC
Permalink
Stop


Patrick McCoole





> On Nov 18, 2013, at 12:22 PM, Frediano Ziglio <freddy77 at gmail.com> wrote:
>
> 2013/11/18 Sergio NNX <sfhacker at hotmail.com>:
>> Ciao all.
>>
>> I've just built FreeTDS 0.91.96 from source on Windows and now I'm running the unit tests. Some of them are failing and I need some advice about what the problem may be. Using MS SQL 2008.
>>
>> Thanks in advance.
>>
>> Sergio.
>>
>> Tests output
>> ----------------
>>
>>
>> ====================
>> 1 of 18 tests failed (tds/unittests) : FAIL: readconf.exe
>> ====================
>>
>
> Quite strange this fails!
>
>> ====================
>> All 29 tests failed (ctlib/unittests)
>> ====================
>>
>> ====================
>> 1 of 34 tests failed (dblib/unittests)
>> ====================
>>
>> DB-LIBRARY error (dberr 20050 (severity 4): "Attempt to convert data stopped by syntax error in source field"; oserr 0: "No error") error: no unanticipated errors allowed in unit tests
>> FAIL: t0016.exe
>>
>
> :( probably related to some characters conversion. utf-8 not working
> ?? Did you use iconv?
>
>>
>> =====================
>> 16 of 68 tests failed (odbc/unittests)
>> =====================
>>
>
> 16 ?? Quite bad
>
>>
>> Wrong result
>> Got: 130000D8CDF730448203000000000000000000
>> Expected: 283208CFBB7DFCFF
>> FAIL: genparams.exe
>>
>
> Mmm... this is using wrong protocol (expected bigint got numeric)
>
>> data.c:54 rc=1 SQLFetch
>> SQL error 37000 -- [FreeTDS][SQL Server]Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')
>> FAIL: data.exe
>>
>
> Still conversions.
>
>> CheckType 137
>> CheckType 139
>> Data expected. Inpute type 9 - SQL_DATE line 139
>> FAIL: typeinfo.exe
>>
>> cursor1.c:69 rc=-1 SQLExecDirect
>> SQL error 37000 -- [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown.
>> FAIL: cursor1.exe
>>
>
> This is serious !!
>
> Looking forward for dumps.
>
> Frediano
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
Sergio NNX
2013-11-19 02:48:25 UTC
Permalink
====================
1 of 18 tests failed (tds/unittests) : FAIL: readconf.exe
====================

> Quite strange this fails!

Someone forgot to check in a file (a.k.a readconf.in). No worries, you're not alone!

===================
All 29 tests passed (ctlib/unittests)
===================

====================
1 of 34 tests failed (dblib/unittests)
====================

> :( probably related to some characters conversion. utf-8 not working
> ?? Did you use iconv?

Yes, I did!


SQL text will be read from ./t0016.sql
About to logon
After logon
Creating table '#dblib0016'
1: create table #dblib0016 (f1 int not null, s1 int null, f2 numeric(10,2) null, f3 varchar(255) not null, f4 datetime null, [group] varchar(20))
bcp_init with in_file as './t0016.in'
return from bcp_init = 1
1: select * from #dblib0016 where 0=1
return from dbcmd = 1
return from dbsqlexec = 1
Number of columns = 6
return from bcp_columns = 1
DB-LIBRARY error (dberr 20050 (severity 4): "Attempt to convert data stopped by syntax error in source field"; oserr 0: "No error")
error: no unanticipated errors allowed in unit tests
FAIL: t0016.exe

t0016.in

1 2 123.45 This is a varchar 255 field 2001-09-11 09:13:13.663 group1
4 5 56789.12 This is another varchar 255 field 2000-02-29 13:01:01.000 group2



=====================
16 of 68 tests failed (odbc/unittests) (if TDSVER=7.0)
=====================

> 16 ?? Quite bad

So many version nos, you never know which one is right. Not even the unit tests know!

=====================
2 of 68 tests failed (odbc/unittests) (if TDSVER=8.0)
=====================

...
...
...

Using ODBC version 2
select cast(getdate() as date)
CheckType 137
CheckType 139
Data expected. Inpute type 9 - SQL_DATE line 139
FAIL: typeinfo.exe

...
...

Error finding last socket opened
FAIL: freeclose.exe

...
...

The 'freeclose' test seems quite 'odd'. There's a function there called: find_last_socket(void), which ..... Please, have a look at it!

Thanks in advance.

Sergio.
Sergio NNX
2013-11-20 14:30:08 UTC
Permalink
> Error finding last socket opened
> FAIL: freeclose.exe

> Using ODBC version 2
> select cast(getdate() as date)
> CheckType 137
> CheckType 139
> Data expected. Inpute type 9 - SQL_DATE line 139
> FAIL: typeinfo.exe

Ciao.

I'm trying to 'improve' the 'freeclose' test and I have some questions:

a) Does it support IPv6 addresses?
b) Is 'binded' a correct English word?

Can anyone help me out with test 'typeinfo'?

Thanks in advance.

Sergio.
Frediano Ziglio
2013-11-20 15:49:39 UTC
Permalink
2013/11/20 Sergio NNX <sfhacker at hotmail.com>:
>> Error finding last socket opened
>> FAIL: freeclose.exe
>
>> Using ODBC version 2
>> select cast(getdate() as date)
>> CheckType 137
>> CheckType 139
>> Data expected. Inpute type 9 - SQL_DATE line 139
>> FAIL: typeinfo.exe
>
> Ciao.
>
> I'm trying to 'improve' the 'freeclose' test and I have some questions:
>
> a) Does it support IPv6 addresses?

Should it?? It uses localhost but I don't think is a problem.

> b) Is 'binded' a correct English word?
>

Should be bound, probably mistake is mine.

> Can anyone help me out with test 'typeinfo'?
>
> Thanks in advance.
>
> Sergio.
>

Should not be a big issue. Some tests are very too strict and does not
pass with different version of MS drivers. This is one of them (well
this particular DATE piece).

Frediano
Sergio NNX
2013-11-20 18:58:52 UTC
Permalink
Thanks Frediano for your pronto answers.

I'm in the process of testing as much as I can now (as you can see!) and I have a few extra questions:

a) What's the purpose/use of 'tdssrv'? Is it supposed to be used in conjunction with 'freeclose' test or tdspool app?
b) tdspool app doesn't seem to work at all, I'm afraid. I get this error message:

'Could not open initial connection 0'

plus a lovely runtime exception! Grrr!

Program received signal SIGSEGV, Segmentation fault.
0x774e1711 in ntdll!RtlLeaveCriticalSection ()
from C:\Windows\system32\ntdll.dll
(gdb) bt
#0 0x774e1711 in ntdll!RtlLeaveCriticalSection ()
from C:\Windows\system32\ntdll.dll
#1 0x765d5d03 in SHStartNetConnectionDialogW ()
from C:\Windows\syswow64\shell32.dll
#2 0x774b32f2 in ntdll!LdrLoadAlternateResourceModuleEx ()
from C:\Windows\system32\ntdll.dll
#3 0x02bf08e0 in ?? ()
#4 0x77550c96 in ntdll!RtlValidateHeap () from C:\Windows\system32\ntdll.dll
#5 0x00bf0000 in ?? ()
#6 0x7750a967 in ntdll!AlpcMaxAllowedMessageLength ()
from C:\Windows\system32\ntdll.dll
#7 0x00bf0000 in ?? ()
#8 0x774b32f2 in ntdll!LdrLoadAlternateResourceModuleEx ()
from C:\Windows\system32\ntdll.dll
#9 0x02bf09b0 in ?? ()
#10 0x750598cd in msvcrt!free () from C:\Windows\syswow64\msvcrt.dll
#11 0x00bf0000 in ?? ()
#12 0x004643b7 in CRYPTO_free ()
#13 0x0043d0e1 in SSL_CTX_free ()
#14 0x00541354 in tds_tls_deinit ()
#15 0x0053a5c2 in __do_global_dtors ()
at ../mingwrt-4.0.0-1-mingw32-src/src/libcrt/crt/gccmain.c:50
#16 0x7505c3e9 in msvcrt!isspace () from C:\Windows\syswow64\msvcrt.dll
#17 0x750636bb in msvcrt!exit () from C:\Windows\syswow64\msvcrt.dll
#18 0x00402278 in pool_mbr_init ()
#19 0x005412c2 in main ()

By looking at some source code inside src/pool folder, I can see an issue in member.c, where it reads:

...
#if HAVE_GETHOSTNAME
...
...
#endif

However, winsockets were/are never initialised. (Note: this doesn't fix the runtime exception)

I need some help with the runtime exception. My C language knowledge is less than basic!

Thanks again.

Sergio.
Frediano Ziglio
2013-11-18 17:59:22 UTC
Permalink
2013/11/18 Vipul Sharma <vipsharma.sharma at gmail.com>:
> Hi,
>
>
>
> I tried connecting to sql server using a password whose length is more than
> 30 characters and it is failing. I am using the dbopen() API to connect.
> After searching the freetds dblib code, found that
> ${top_dir}/include/tds.hhas this line in it which is causing the
> problem:
>
>
>
> *#define TDS_MAX_LOGIN_STR_SZ 30 *
>
>
>
> The field length is somehow limited to 30 characters and making the value
> to 128 apparently fixes the issue just for now.
>
>
>
> Just wanted to know,
>
> - If this 30 characters limitations is documented somewhere ?
>
> - Is it safe to simply increase the value to 128 for now to work around the
> limitation for now..
>
>
>
> *Note *: I am interested to connect just using the TDS 7.1 version.
>
>
>
> Any pointers around this would be really appreciated.
>
>
>
> Thanks in advance ,


As a workaround works if you use a protocol > 5.0. However this
constant is used also to build login packet for former versions. The
safest thing is to change the use in src/dblib/dblib.c

Frediano
Frediano Ziglio
2013-11-18 18:37:03 UTC
Permalink
2013/11/18 Vipul Sharma <vipsharma.sharma at gmail.com>:
> Hi,
>
>
>
> I tried connecting to sql server using a password whose length is more than
> 30 characters and it is failing. I am using the dbopen() API to connect.
> After searching the freetds dblib code, found that
> ${top_dir}/include/tds.hhas this line in it which is causing the
> problem:
>
>
>
> *#define TDS_MAX_LOGIN_STR_SZ 30 *
>
>
>
> The field length is somehow limited to 30 characters and making the value
> to 128 apparently fixes the issue just for now.
>
>
>
> Just wanted to know,
>
> - If this 30 characters limitations is documented somewhere ?
>
> - Is it safe to simply increase the value to 128 for now to work around the
> limitation for now..
>
>
>
> *Note *: I am interested to connect just using the TDS 7.1 version.
>
>
>
> Any pointers around this would be really appreciated.
>
>
>
> Thanks in advance ,

Just committed patch for both 0.91 and master

Frediano
Patrick McCoole
2013-11-18 20:06:34 UTC
Permalink
Stop


Patrick McCoole





> On Nov 18, 2013, at 12:37 PM, Frediano Ziglio <freddy77 at gmail.com> wrote:
>
> 2013/11/18 Vipul Sharma <vipsharma.sharma at gmail.com>:
>> Hi,
>>
>>
>>
>> I tried connecting to sql server using a password whose length is more than
>> 30 characters and it is failing. I am using the dbopen() API to connect.
>> After searching the freetds dblib code, found that
>> ${top_dir}/include/tds.hhas this line in it which is causing the
>> problem:
>>
>>
>>
>> *#define TDS_MAX_LOGIN_STR_SZ 30 *
>>
>>
>>
>> The field length is somehow limited to 30 characters and making the value
>> to 128 apparently fixes the issue just for now.
>>
>>
>>
>> Just wanted to know,
>>
>> - If this 30 characters limitations is documented somewhere ?
>>
>> - Is it safe to simply increase the value to 128 for now to work around the
>> limitation for now..
>>
>>
>>
>> *Note *: I am interested to connect just using the TDS 7.1 version.
>>
>>
>>
>> Any pointers around this would be really appreciated.
>>
>>
>>
>> Thanks in advance ,
>
> Just committed patch for both 0.91 and master
>
> Frediano
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
Loading...