pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Nikhil Deshpande <ndeshpande@vmware.com>
To: pgsql-odbc@postgresql.org
Subject: [PATCH] Fix crash during connect using SSPI auth
Date: Mon, 23 Jun 2014 14:02:38 -0700
Message-ID: <53A895EE.9040902@vmware.com> (raw )
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
Hi,
I ran into a crash in psqlodbc driver on Windows while trying to connect
using SSPI authentication (both client and server are on same Windows
host, using a Windows local account instead of domain account, without
any Kerberos setup).
The crash is due to a NULL pointer dereference in function
extract_extra_attribute_setting(), ci->conn_settings.name was
NULL in caller MakePrincHint():
1741 char *extract_extra_attribute_setting(const pgNAME setting, ...
1742 {
1743 const char *str = GET_NAME(setting);
...
1750 for (cptr = str; *cptr; cptr++) <-- *cptr crashes
Please see attached stack trace for more details.
With attached patch, connection using SSPI authentication was
successful.
Thanks,
Nikhil
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Attachments:
stacktrace.txt (text/plain, 1.9K) download
00 psqlodbc35w!extract_extra_attribute_setting(struct pgNAME setting = struct pgNAME, char * attr = 0x00000001`80223bc0 "krbsrvname")+0x9b [e:\git\pg\winbuild\win64\pg\pgodbc\dlg_specific.c @ 1751]
01 psqlodbc35w!MakePrincHint(struct ConnInfo * ci = 0x00000000`01fa6160, int sspi = 0n1)+0x48 [e:\git\pg\winbuild\win64\pg\pgodbc\connection.c @ 1540]
02 psqlodbc35w!original_CC_connect(struct ConnectionClass_ * self = 0x00000000`01fa6080, char password_req = 0n0 '', char * salt_para = 0x00000000`0012ebe4 "")+0x1592 [e:\git\pg\winbuild\win64\pg\pgodbc\connection.c @ 2019]
03 psqlodbc35w!CC_connect(struct ConnectionClass_ * self = 0x00000000`01fa6080, char password_req = 0n0 '', char * salt_para = 0x00000000`0012ebe4 "")+0x17a [e:\git\pg\winbuild\win64\pg\pgodbc\connection.c @ 2165]
04 psqlodbc35w!PGAPI_DriverConnect(void * hdbc = 0x00000000`01fa6080, struct HWND__ * hwnd = 0x00000000`00010010, unsigned char * szConnStrIn = 0x00000000`01fa27d0 "DSN=sspi_dsn_test;", short cbConnStrIn = 0n22, unsigned char * szConnStrOut = 0x00000000`01fa70c0 "???", short cbConnStrOutMax = 0n2048, short * pcbConnStrOut = 0x00000000`0012ecc4, unsigned short fDriverCompletion = 0)+0x3b6 [e:\git\pg\winbuild\win64\pg\pgodbc\drvconn.c @ 229]
05 psqlodbc35w!SQLDriverConnectW(void * hdbc = 0x00000000`01fa6080, struct HWND__ * hwnd = 0x00000000`00010010, unsigned short * szConnStrIn = 0x00000000`003c4660, short cbConnStrIn = 0n-3, unsigned short * szConnStrOut = 0x00000000`0012f6c0, short cbConnStrOutMax = 0n2048, short * pcbConnStrOut = 0x00000000`0012fec0, unsigned short fDriverCompletion = 0)+0x1b6 [e:\git\pg\winbuild\win64\pg\pgodbc\odbcapiw.c @ 143]
06 ODBC32!SQLInternalDriverConnectW+0x53c
07 ODBC32!SQLDriverConnectW+0x1863
08 ODBCClientSample!getConnection(void)+0x17c [e:\git\pg\src\scripts\samples\odbcclientsample.c @ 163]
09 ODBCClientSample!main(int argc = 0n1, char ** argv = 0x00000000`00322d90)+0x12 [e:\git\pg\src\scripts\samples\odbcclientsample.c @ 219]
0001-Fix-crash-during-connect-using-SSPI-auth.patch (text/plain, 1011B) download
From 00882823d9e888701fb8d055f5cb8a3a84f36818 Mon Sep 17 00:00:00 2001
From: Nikhil R Deshpande <ndeshpande@vmware.com>
Date: Mon, 23 Jun 2014 13:33:47 -0700
Subject: [PATCH] Fix crash during connect using SSPI auth
This patch fixes a NULL pointer dereference occurring when connecting
using SSPI authentication (without kerberos, a local Windows user trying
to connect to postgres instance on same host).
---
dlg_specific.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlg_specific.c b/dlg_specific.c
index 8e051af..54525e3 100644
--- a/dlg_specific.c
+++ b/dlg_specific.c
@@ -1740,7 +1740,7 @@ char *extract_attribute_setting(const char *str, const char *attr, BOOL ref_comm
*/
char *extract_extra_attribute_setting(const pgNAME setting, const char *attr)
{
- const char *str = GET_NAME(setting);
+ const char *str = SAFE_NAME(setting);
const char *cptr, *sptr = NULL;
char *rptr;
BOOL allowed_cmd = FALSE, in_quote = FALSE, in_comment = FALSE;
--
1.8.5.2 (Apple Git-48)
view thread (2+ messages) latest in thread
Message-ID: <53A895EE.9040902@vmware.com>
Permalink: ../53A895EE.9040902@vmware.com/
Also on: postgresql.org/message-id/53A895EE.9040902@vmware.com
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: ndeshpande@vmware.com
Subject: Re: [PATCH] Fix crash during connect using SSPI auth
In-Reply-To: <53A895EE.9040902@vmware.com>
References: <53A895EE.9040902@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox