Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHTjA-0001Rm-5E for pgsql-odbc@arkaria.postgresql.org; Tue, 21 Jul 2015 09:20:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHTj9-00077z-Gj for pgsql-odbc@arkaria.postgresql.org; Tue, 21 Jul 2015 09:20:43 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZHTim-0006iP-9l for pgsql-odbc@postgresql.org; Tue, 21 Jul 2015 09:20:20 +0000 Received: from mail.verishare.co.za ([217.29.208.2]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZHTii-0003YG-SH for pgsql-odbc@postgresql.org; Tue, 21 Jul 2015 09:20:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.verishare.co.za (Postfix) with ESMTP id 0CE2A422365 for ; Tue, 21 Jul 2015 11:20:11 +0200 (SAST) Received: from mail.verishare.co.za ([127.0.0.1]) by localhost (mail.verishare.co.za [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Ak0D4vjMoUNh; Tue, 21 Jul 2015 11:20:10 +0200 (SAST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.verishare.co.za (Postfix) with ESMTP id 02023422374; Tue, 21 Jul 2015 11:20:10 +0200 (SAST) X-Virus-Scanned: amavisd-new at verishare.co.za Received: from mail.verishare.co.za ([127.0.0.1]) by localhost (mail.verishare.co.za [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CGwAbOhUmBmE; Tue, 21 Jul 2015 11:20:09 +0200 (SAST) Received: from STEFANPC (unknown [172.16.1.76]) by mail.verishare.co.za (Postfix) with ESMTPSA id DF9D6422365 for ; Tue, 21 Jul 2015 11:20:09 +0200 (SAST) From: "Stefan Viljoen" To: References: <000b01d0c066$c58f3b80$50adb280$@verishare.co.za> <55A8BF02.4090001@lurcher.org> <002701d0c07f$bd09f3b0$371ddb10$@verishare.co.za> <55A8E0B8.3070107@lurcher.org> <002e01d0c088$c6b57390$54205ab0$@verishare.co.za> <55A8F948.9040407@lurcher.org> <002f01d0c090$da03cc50$8e0b64f0$@verishare.co.za> <55A905FA.2080701@aklaver.com> <003001d0c099$e21a7b60$a64f7220$@verishare.co.za> <55A90E6A.4030802@lurcher.org>, <003201d0c09f$b1ece5d0$15c6b170$@verishare.co.za> <55BAADA01D8C504993894EAEA7517CF8124630@003FCH1MPN2-002.003f.mgd2.msft.net> <000d01d0c2b8$a8f146e0$fad3d4a0$@verishare.co.za>, <004501d0c2d8$5a4cc710$0ee65530$@verishare.co.za> <55BAADA01D8C504993894EAEA7517CF81246C6@003FCH1MPN2-002.003f.mgd2.msft.net>, <004601d0c2db$2d38ade0$87aa09a0$@verishare.co.za> <55BAADA01D8C504993894EAEA7517CF81246DB@003FCH1MPN2-002.003f.mgd2.msft.net> <004a01d0c2e4$ad416320$07c42960$@verishare.co.za> <55ACE4C5.2030704@lurcher.org> <005101d0c2eb$ae674150$0b35c3f0$@verishare.co.za> <55ACF2B9.2020805@lurc her.org> ,<0 00b01d0c38e$be80f880$3b82e980$@verishare.co.za> <55BAADA01D8C504993894EAEA7517CF8124792@003FCH1MPN2-002.003f.mgd2.msft.net> In-Reply-To: <55BAADA01D8C504993894EAEA7517CF8124792@003FCH1MPN2-002.003f.mgd2.msft.net> Subject: Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client Date: Tue, 21 Jul 2015 11:23:21 +0200 Message-ID: <001301d0c396$e361c2d0$aa254870$@verishare.co.za> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIlJsTM6eABCGiGgETx/eeRTV0aKQD+sBlEAd+uLVACvS0eZwIDK6DSAbi5yQACNRVlIgKyOovEAwQzP6cC5YclzgJpmRobAc/BjzoBf0NcHwGnPLYpAkwTS5MBk03d/wG9jGHvAr6SG74B/EZIOQDrtGsTASYFzUkBluYSjgHYgwHAm+HTv9A= Content-Language: en-za X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Hi Jeremy > You probably want to set ServerName back to localhost in your odbc.ini file, I had you change it to /tmp when I thought psql was using a unix domain socket. Ok, I set it back to localhost, and tried again, same result - IPV6 is used, and the database name is randomly corrupted in the raw packet data if one tries to connect via isql. > It is strange that tcpdump is picking up this connection, if the postgres driver is using the ServerName parameter then there should NOT have been a TCP connection. Hmm - ok my tcpdump command was literally just to dump anything sent to / from the 5432 postgres port on 127.0.0.1 / localhost - and for each failed isql connection attempt over IPV6 exactly 13 packets are collected, and the database name is always corrupt (if I'm reading it right!) >Have you tried doing the tcpdump on a psql connection attempt for comparison? Yes, psql emits more packets (28 for a login and logout), runs on IPV4, works correctly, and the database name is always correctly specified and not corrupted. Postgress accepts the connection. I find it interesting that the isql connection attempt fails with almost half the number of packets as the psql connection attempt (depending on ODBC protocol overhead?) indicating that isql fails about 1/2 way through the required amount of packets to send to establish a Postgres connection? I've got a feeling if I can somehow force isql to use IPV4 to postgress that will already be a big step in the right direction... but how does one do that? Thanks Regards Stefan -----Original Message----- From: Faith, Jeremy [mailto:jfaith@tycoint.com] Sent: Tuesday,July 21, 2015 11:08 AM To: Stefan Viljoen; pgsql-odbc@postgresql.org Subject: RE: [ODBC] Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client Hi Stefan, You probably want to set ServerName back to localhost in your odbc.ini file, I had you change it to /tmp when I thought psql was using a unix domain socket. It is strange that tcpdump is picking up this connection, if the postgres driver is using the ServerName parameter then there should NOT have been a TCP connection. Have you tried doing the tcpdump on a psql connection attempt for comparison? Regards, Jeremy Faith ________________________________________ From: pgsql-odbc-owner@postgresql.org [pgsql-odbc-owner@postgresql.org] on behalf of Stefan Viljoen [viljoens@verishare.co.za] Sent: 21 July 2015 09:25 To: pgsql-odbc@postgresql.org Subject: Re: [ODBC] Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client Hi List The plot thickens - I have now resorted to doing a tcpdump of the postgres port and then trying to connect via isql. The tcpdump command used was --- tcpdump -vvvvv -x -X -s 65535 -i lo 'port 5432' -w post.pcap --- This has revealed that in the post.pcap file (even just viewing the raw packet data with vi in the terminal) that the REASON postgress keeps rejecting isql login attempts is that isql apparently passes the database name only partially, or corrupts it randomly... E. g. I tried this five or six times and each time, the packets sent from unixODBC / isql binary, specifies the string asteriskcdrdb which denotes the database name to postgress (and therefore is critical to control login) as &%%@%!db *&#!@#drdb !@&&%$idb etc. and sometimes mixed / along with some other ASCII crud I cannot duplicate here. SSL is most definitely off so this cannot be encryption? The STRANGE thing is I can spot the username (asteriskcdruser) in the packet data and that is ALWAYS correct and uncorrupted, and is always passed as "asteriskcdruser". But the database name is -always- corrupted that is sent to port 5432 from isql to login to postgress. So if I do with isql --- isql -v pgdb-cdr asteriskcdruser pword --- In effect I try to login to postgress with *&#!@#drdb (as indicated by the packet data) which is of course a database that does not exist, nor is there a role that matches "asteriskcdruser" for such a database.