Skip to Content.
Sympa Menu

freetds - [freetds] Kerberos and ODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Kyle Strickland <KyleStrickland AT aw-nc.com>
  • To: FreeTDS AT lists.ibiblio.org
  • Subject: [freetds] Kerberos and ODBC
  • Date: Mon, 21 Feb 2011 15:06:45 -0500

Hi folks,

A question and a possible answer here:

Question: What is the Right Way to get Kerberos login to work with FreeTDS
and unixODBC? (Note: I did not try setting up a freetds.conf file. I was
hoping to forego that and just use odbc.ini.)

Possible Answer: It's broken. I was unable to get it to work without
modifying src/odbc/connectparams.c. Looks like whatever you do with just
the odbc.ini file, only connection->server_name gets filled in, but
connection->server_host_name is left blank. (See
connectparams.c:odbc_get_dsn_info().) Later, in
src/tds/gssapi.c:tds_gss_get_auth(), connection->server_host_name is used to
create the SPN, but since that is blank, the SPN comes out as
"MSSQLSvc/:1433". From that point, it's clear that auth is going to fail.
So modifying odbc_get_dsn_info to drop the "Server" parameter into
connection->server_host_name instead of connection->server_name, seems to
fix that and everything works (for me anyway).

I am fairly new to using this library and unixODBC, so I'm wondering if I'm
missing something that should be obvious, or if this is a bug. And if it's
a bug, is this the right way to fix it, or is this going to break whatever
the normal usage pattern is supposed to be?

Diff attached.

Thanks!

--

Kyle Strickland

カイル ストリツケランド

Tel:+1.919.479.6560

Computer Programmer

IT Department

AW North Carolina
--- orig/freetds-0.82/src/odbc/connectparams.c	2007-07-01 06:10:52.000000000 -0400
+++ freetds-0.82/src/odbc/connectparams.c	2011-02-21 13:51:50.000000000 -0500
@@ -147,7 +147,7 @@
 
 		tmp[0] = '\0';
 		if (SQLGetPrivateProfileString(DSN, "Server", "", tmp, FILENAME_MAX, "odbc.ini") > 0) {
-			tds_dstr_copy(&connection->server_name, tmp);
+			tds_dstr_copy(&connection->server_host_name, tmp);
 			if (!address_specified) {
 				if (!parse_server(tmp, connection))
 					return 0;



Archive powered by MHonArc 2.6.24.

Top of Page