Npgsql Integrated Authentication Problem

From: 卢瑛 <ylu12345(at)qq(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Npgsql Integrated Authentication Problem
Date: 2013-03-20 10:09:21
Message-ID: tencent_479B4BFE751E423E4E17592F@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi;

I have set up a windows domain trying to run Postgres client using SSPI. I've reached a point that I can use psql to login from my client machine without specifying username and password. But everytime I ran my .NET client program on a domain computer other than the database server itself, I got following error messages. And the program works without error on the database server itself. Any help is much appreciated!

Ying

Message:FATAL: XX000: could not accept SSPI security context
BaseMessage:could not accept SSPI security context
Detail:The token supplied to the function is invalid
(80090308)
Source:Npgsql
TargetSite:Boolean MoveNext()

My code is very simple:

NpgsqlEventLog.Level = LogLevel.Debug;
NpgsqlEventLog.LogName = "NpgsqlEventLog.txt";
NpgsqlConnectionStringBuilder pgsqlCSB = new NpgsqlConnectionStringBuilder();
pgsqlCSB.Database = "test";
pgsqlCSB.IntegratedSecurity = true;
pgsqlCSB.Host = "VM-WIN2008";
pgsqlCSB.Port = 5432;
NpgsqlConnection pgsqlConn = new NpgsqlConnection(pgsqlCSB.ConnectionString);
pgsqlConn.Open();
DataTable dt = pgsqlConn.GetSchema();

More log message from NpgsqlEventLog.txt:

3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlClosedState.Open()
3/20/2013 10:31:38 AM 1316 Debug Attempt to connect to '192.168.73.141'.
3/20/2013 10:31:38 AM 1316 Normal Connected to: VM-WIN2008:5432.
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlStartupPacket.NpgsqlStartupPacket()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlStartupPacket.WriteToStream()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlStartupPacket.WriteToStream_Ver_3()
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: user.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: ylu.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: database.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: test.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: DateStyle.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteString()
3/20/2013 10:31:38 AM 1316 Debug String written: ISO.
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlState.ProcessBackendResponses()
3/20/2013 10:31:38 AM 1316 Debug AuthenticationRequest message received from server.
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlStartupState.Authenticate()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlPasswordPacket.NpgsqlPasswordPacket()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlPasswordPacket.WriteToStream()
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteBytes()
3/20/2013 10:31:38 AM 1316 Debug Unable to find resource string Log_BytesWritten for class PGUtil
3/20/2013 10:31:38 AM 1316 Debug AuthenticationRequest message received from server.
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlStartupState.Authenticate()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlPasswordPacket.NpgsqlPasswordPacket()
3/20/2013 10:31:38 AM 1316 Debug Entering NpgsqlPasswordPacket.WriteToStream()
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.WriteBytes()
3/20/2013 10:31:38 AM 1316 Debug Unable to find resource string Log_BytesWritten for class PGUtil
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: FATAL.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: XX000.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: could not accept SSPI security context.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: The token supplied to the function is invalid
(80090308).
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: src\backend\libpq\auth.c.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: 1220.
3/20/2013 10:31:38 AM 1316 Debug Entering PGUtil.ReadString()
3/20/2013 10:31:38 AM 1316 Debug Get NpgsqlEventLog.LogLevel
3/20/2013 10:31:38 AM 1316 Debug String read: pg_SSPI_error.
3/20/2013 10:31:38 AM 1316 Debug ErrorResponse message from Server: could not accept SSPI security context.
3/20/2013 10:31:38 AM 1316 Normal An NpgsqlException occured: FATAL: XX000: could not accept SSPI security context.

Browse pgsql-general by date

  From Date Subject
Next Message jg 2013-03-20 11:13:07 File Fragmentation
Previous Message Albe Laurenz 2013-03-20 09:35:04 Re: Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13