[freetds] Windows authentication on Windows

Mark Brand mabrand at mabrand.nl
Wed Jan 27 14:18:37 EST 2010

>> I committed an initial patch for SSPI support... quite limited:
>> - currently supported using MingW cross compiler
>> - use only NTLM, no SPNEGO or Kerberos
>> - does not take into account username/password (so using any
>> domain\user and a password will use your current account)
>> - have some possible leak (dll initilization is not thread safe)
>> Attached patch for review.
>> I uploaded a dll cross compiled at http://freetds.sf.net/odbc.zip. I
>> also applyed a fake ole registration extension to dll so you can
>> "register" odbc driver using regsvr32 executable. Just copy the dll
>> somewhere and execute
> Excellent!  Absolutely amazingly jaw-dropping awesome!  
> I modified Nmakefile to build tds.lib with sspi.c (and to generate 
> header files).  It works!  
> $ echo select @@version | src\apps\win32\debug\bsqldb.exe -S %S% -U "" -P ""
> -----------------------------------------------------------------------------------
> Microsoft SQL Server 2005 - 9.00.3282.00 (X64)
>         Aug  5 2008 00:48:00
>         Copyright (c) 1988-2005 Microsoft Corporation
>         Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)
> $ cl -? 2>&1 | grep Version
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
> Did I mention how excellent this is?  The FreeTDS community owes you a 
> big smooch.  
> Regards, 
> --jkl
> P.S.  One tiny question: you used function names like "AcquireCredentialsHandleA"; the canonical form is "AcquireCredentialsHandle". 
> Does mingw need the "A" form, or can we use normal one?  

This really is astounding great news. I almost can't believe it. Thanks
freddy77. JKL asked if I wanted to take a stab at this problem, but you
chopped off its head before I could even think about it.

I built freetds-0.83.dev.20100127 in mingw-cross-env with this

./configure \
        --prefix='$(PREFIX)/$(TARGET)' \
        --host='$(TARGET)' \
        --disable-rpath \
        --disable-dependency-tracking \
        --disable-shared \
        --enable-sspi \
        --enable-static \
        --enable-libiconv \
        --enable-msdblib \

Don't forget "--enable-sspi"!

First I tried jkl's test with bsqldb.exe. It works!

Then I rebuilt the Qt TDS driver plugin in mingw-cross-env and tried it
in an app in Win7. It works! No password!

Thanks. I'm going to go celebrate.


More information about the FreeTDS mailing list