pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unix domain socket
12+ messages / 4 participants
[nested] [flat]

* Unix domain socket
@ 2005-02-07 14:26 Ramon Danieli <ramond@post.tau.ac.il>
  0 siblings, 0 replies; 12+ messages in thread

From: Ramon Danieli @ 2005-02-07 14:26 UTC (permalink / raw)
  To: pgsql-odbc

Hi,
I hope I'm posting to the right place...
I have successfully connected PostGre server using unixODBC and libodbcpsql.so
driver (the one that comes with unixODBC) through PostGre's unix domain socket
stream. Trying the same with psqlodbc.so fails. From a brief look in the
sources, it seems that psqlodbc.so does NOT support unix domain sockets at
all.
Is that true?
Environment details: OS - RedHat Linux AS 3.90 (Nahant) beta; PostGre - 7.3.6
(not RPM); Driver - postgresql-odbc-7.3-8.i386.rpm; unixODBC -
postgresql-odbc-7.3-8.i386.rpm.
Thanks,
Ramon

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
@ 2005-02-09 07:10 Dave Page <dpage@vale-housing.co.uk>
  2005-02-17 15:06 ` Re: Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
  2005-02-23 09:09 ` Re: Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
  0 siblings, 2 replies; 12+ messages in thread

From: Dave Page @ 2005-02-09 07:10 UTC (permalink / raw)
  To: Ramon Danieli <ramond@post.tau.ac.il>; pgsql-odbc




-----Original Message-----
From: pgsql-odbc-owner@postgresql.org on behalf of Ramon Danieli
Sent: Mon 2/7/2005 2:26 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] Unix domain socket
 
> it seems that psqlodbc.so does NOT support unix domain sockets at all.
> Is that true?

Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had the itch to add uds support.

Regards, Dave



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-09 07:10 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
@ 2005-02-17 15:06 ` Ramon Danieli <ramond@post.tau.ac.il>
  1 sibling, 0 replies; 12+ messages in thread

From: Ramon Danieli @ 2005-02-17 15:06 UTC (permalink / raw)
  To: pgsql-odbc

Quoting Dave Page <dpage@vale-housing.co.uk>:

>  
> > it seems that psqlodbc.so does NOT support unix domain sockets at all.
> > Is that true?
> 
> Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had the
> itch to add uds support.
> 
> Regards, Dave
> 

Right...
If we would offer a patch (based on code in the unixODBC PG driver), would you
consider to include it sometimes in the (near) future?
Thanks, Ramon

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-09 07:10 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
@ 2005-02-23 09:09 ` Ramon Danieli <ramond@post.tau.ac.il>
  1 sibling, 0 replies; 12+ messages in thread

From: Ramon Danieli @ 2005-02-23 09:09 UTC (permalink / raw)
  To: pgsql-odbc

I'm reposting this one as I've got the feeling that my previous posting got
lost...
Anyways, if we would offer a patch (based on code in the unixODBC PG driver) to
provide UDS capability, would you consider to include it sometimes in the
(near) future?
Thanks, Ramon

Quoting Dave Page <dpage@vale-housing.co.uk>:
> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org on behalf of Ramon Danieli
> Sent: Mon 2/7/2005 2:26 PM
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix domain socket
>  
> > it seems that psqlodbc.so does NOT support unix domain sockets at all.
> > Is that true?
> 
> Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had the
> itch to add uds support.
> 
> Regards, Dave
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
@ 2005-02-23 09:01 Dave Page <dpage@vale-housing.co.uk>
  2005-02-23 22:14 ` Re: Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
  0 siblings, 1 reply; 12+ messages in thread

From: Dave Page @ 2005-02-23 09:01 UTC (permalink / raw)
  To: Ramon Danieli <ramond@post.tau.ac.il>; pgsql-odbc

 

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org 
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Ramon Danieli
> Sent: 17 February 2005 15:06
> To: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix domain socket
> 
> Quoting Dave Page <dpage@vale-housing.co.uk>:
> 
> >  
> > > it seems that psqlodbc.so does NOT support unix domain 
> sockets at all.
> > > Is that true?
> > 
> > Yes. psqlODBC was written on Windows and ported to Unix. 
> No-one ever had the
> > itch to add uds support.
> > 
> > Regards, Dave
> > 
> 
> Right...
> If we would offer a patch (based on code in the unixODBC PG 
> driver), would you
> consider to include it sometimes in the (near) future?
> Thanks, Ramon
>

Sure, it'll be reviewed and applied if suitable.

Regards, Dave



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-23 09:01 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
@ 2005-02-23 22:14 ` Ramon Danieli <ramond@post.tau.ac.il>
  0 siblings, 0 replies; 12+ messages in thread

From: Ramon Danieli @ 2005-02-23 22:14 UTC (permalink / raw)
  To: pgsql-odbc

While having another look in the sources (08.00.0004) I have found some code
that seems to provide Unix domain sockets connection in socket.c.
This code depends on "HAVE_UNIX_SOCKETS" macro and seems to allow a single hard
coded path (/tmp/...) while providing an empty "ServerName" property in the
connection string.
Can you please explain the nature of this code (it was not available in the
07.03.0200 version)?
What is required (configure, compilation flags, etc`) in order to have this
macro valid (I think that normally this code is not included)?
Why does it have a single hard coded path?
Thanks
Ramon

> > > > it seems that psqlodbc.so does NOT support unix domain 
> > sockets at all.
> > > > Is that true?
> > > 
> > > Yes. psqlODBC was written on Windows and ported to Unix. 
> > No-one ever had the
> > > itch to add uds support.
> > > 
> > > Regards, Dave
> > > 
> > 
> > Right...
> > If we would offer a patch (based on code in the unixODBC PG 
> > driver), would you
> > consider to include it sometimes in the (near) future?
> > Thanks, Ramon
> >
> 
> Sure, it'll be reviewed and applied if suitable.
> 
> Regards, Dave


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
@ 2005-02-24 08:13 Dave Page <dpage@vale-housing.co.uk>
  2005-02-24 20:16 ` Re: Unix domain socket Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 12+ messages in thread

From: Dave Page @ 2005-02-24 08:13 UTC (permalink / raw)
  To: Ramon Danieli <ramond@post.tau.ac.il>; pgsql-odbc

 

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org 
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Ramon Danieli
> Sent: 23 February 2005 22:15
> To: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix domain socket
> 
> While having another look in the sources (08.00.0004) I have 
> found some code
> that seems to provide Unix domain sockets connection in socket.c.
> This code depends on "HAVE_UNIX_SOCKETS" macro and seems to 
> allow a single hard
> coded path (/tmp/...) while providing an empty "ServerName" 
> property in the
> connection string.
> Can you please explain the nature of this code (it was not 
> available in the
> 07.03.0200 version)?
> What is required (configure, compilation flags, etc`) in 
> order to have this
> macro valid (I think that normally this code is not included)?
> Why does it have a single hard coded path?

Hmm, did even realise it had crept in there. Well to enable it you will
need to define the HAVE_UNIX_SOCKETS macro when you compile. Does it
then work? As for why it's done the way it is, I have no idea - it was
committed by Hiroshi Inoue, so he'd need to answer that - unfortunately
though, he no longer works on psqlODBC.

Regards, Dave.



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-24 08:13 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
@ 2005-02-24 20:16 ` Peter Eisentraut <peter_e@gmx.net>
  2005-03-01 09:00   ` Re: Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
  0 siblings, 1 reply; 12+ messages in thread

From: Peter Eisentraut @ 2005-02-24 20:16 UTC (permalink / raw)
  To: Dave Page <dpage@vale-housing.co.uk>; +Cc: Ramon Danieli <ramond@post.tau.ac.il>; pgsql-odbc

Dave Page wrote:
> Hmm, did even realise it had crept in there. Well to enable it you
> will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> Does it then work? As for why it's done the way it is, I have no idea
> - it was committed by Hiroshi Inoue, so he'd need to answer that -
> unfortunately though, he no longer works on psqlODBC.

HAVE_UNIX_SOCKETS is defined in the server source tree, so I guess this 
could be a leftover from those days.  Turn on the macro and see if you 
get it working.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-24 08:13 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
  2005-02-24 20:16 ` Re: Unix domain socket Peter Eisentraut <peter_e@gmx.net>
@ 2005-03-01 09:00   ` Ramon Danieli <ramond@post.tau.ac.il>
  2005-03-02 15:31     ` Re: Unix domain socket Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 12+ messages in thread

From: Ramon Danieli @ 2005-03-01 09:00 UTC (permalink / raw)
  To: pgsql-odbc; +Cc: Dave Page <dpage@vale-housing.co.uk>; Peter Eisentraut <peter_e@gmx.net>

Quoting Peter Eisentraut <peter_e@gmx.net>:

> Dave Page wrote:
> > Hmm, did even realise it had crept in there. Well to enable it you
> > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > Does it then work? As for why it's done the way it is, I have no idea
> > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > unfortunately though, he no longer works on psqlODBC.
> 
> HAVE_UNIX_SOCKETS is defined in the server source tree, so I guess this 
> could be a leftover from those days.  Turn on the macro and see if you 
> get it working.
> 
> -- 

The macro is turned on automatically (RHL 4.0AS, gcc version 3.4.2 20041017 (Red
Hat 3.4.2-6.fc3)) and it works.

The following patch allow users to configure the Unix domain socket path,
using the "Uds" property.
I took some code from the unixODBC PG driver and performed the necessary
adjustments.
Please note that unlike unixODBC, I have followed the current convention, which
means that:
1) "Uds" is considered only if "Servername" is empty.
2) Default path is "/tmp".
3) The provided path should point the folder that comtains the UDS node.

Please let me know if you find anything wrong in this patch and whether it will
be included sometimes in the near future.

Thanks,
Ramon


diff -Naur psqlodbc-08.00.0004/connection.c
psqlodbc-08.00.0004.patch/connection.c
inline patch 1: psqlodbc-08.00.0004.patch/connection.c (+0/-1 lines) download inline-1.patch--- psqlodbc-08.00.0004/connection.c 2005-01-28 23:36:14.000000000 +0200 +++ psqlodbc-08.00.0004.patch/connection.c 2005-02-27 14:40:34.430232000 +0200 @@ -725,7 +725,16 @@ return 0; } - mylog("CC_connect(): DSN = '%s', server = '%s', port = '%s', database = '%s',
username = '%s', password='%s'\n", ci->dsn, ci->server, ci->port, ci->database, ci->username, ci->password ? "xxxxx" : ""); + mylog("CC_connect(): DSN = '%s', server = '%s', port = '%s'," +#ifdef HAVE_UNIX_SOCKETS + " uds = '%s'," +#endif + " database = '%s', username = '%s'," + " password='%s'\n", ci->dsn, ci->server, ci->port, +#ifdef HAVE_UNIX_SOCKETS + ci->uds, +#endif + ci->database, ci->username, ci->password ? "xxxxx" : ""); another_version_retry: @@ -747,7 +756,11 @@ mylog("connecting to the server socket...\n"); - SOCK_connect_to(sock, (short) atoi(ci->port), ci->server); + SOCK_connect_to(sock, (short) atoi(ci->port), ci->server +#ifdef HAVE_UNIX_SOCKETS + , ci->uds +#endif + ); if (SOCK_get_errcode(sock) != 0) { mylog("connection to the server socket failed.\n"); diff -Naur psqlodbc-08.00.0004/connection.h psqlodbc-08.00.0004.patch/connection.h
inline patch 2: psqlodbc-08.00.0004.patch/connection.h (+7/-0 lines) download inline-2.patch--- psqlodbc-08.00.0004/connection.h 2005-01-28 23:36:14.000000000 +0200 +++ psqlodbc-08.00.0004.patch/connection.h 2005-02-27 16:04:37.469858000 +0200 @@ -19,6 +19,10 @@ #include <pthread.h> #endif +#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS +#define HAVE_UNIX_SOCKETS +#endif + typedef enum { CONN_NOT_CONNECTED, /* Connection has not been established */ @@ -239,6 +243,9 @@ char conn_settings[LARGE_REGISTRY_LEN]; char protocol[SMALL_REGISTRY_LEN]; char port[SMALL_REGISTRY_LEN]; +#ifdef HAVE_UNIX_SOCKETS + char uds[LARGE_REGISTRY_LEN]; +#endif char onlyread[SMALL_REGISTRY_LEN]; char fake_oid_index[SMALL_REGISTRY_LEN]; char show_oid_column[SMALL_REGISTRY_LEN]; diff -Naur psqlodbc-08.00.0004/dlg_specific.c
psqlodbc-08.00.0004.patch/dlg_specific.c --- psqlodbc-08.00.0004/dlg_specific.c 2005-01-28 23:36:15.000000000 +0200 +++ psqlodbc-08.00.0004.patch/dlg_specific.c 2005-02-27 16:03:10.559495000 +0200 @@ -286,6 +286,11 @@ else if (stricmp(attribute, INI_PORT) == 0) strcpy(ci->port, value); +#ifdef HAVE_UNIX_SOCKETS + else if (stricmp(attribute, INI_UDS) == 0) + strcpy(ci->uds, value); +#endif + else if (stricmp(attribute, INI_READONLY) == 0 || stricmp(attribute, "A0") == 0) strcpy(ci->onlyread, value); @@ -492,6 +497,11 @@ if (ci->port[0] == '\0' || overwrite) SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI); +#ifdef HAVE_UNIX_SOCKETS + if (ci->uds[0] == '\0' || overwrite) + SQLGetPrivateProfileString(DSN, INI_UDS, "", ci->uds, sizeof(ci->uds), ODBC_INI); +#endif + if (ci->onlyread[0] == '\0' || overwrite) SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread, sizeof(ci->onlyread), ODBC_INI); @@ -725,6 +735,13 @@ ci->port, ODBC_INI); +#ifdef HAVE_UNIX_SOCKETS + SQLWritePrivateProfileString(DSN, + INI_UDS, + ci->uds, + ODBC_INI); +#endif + SQLWritePrivateProfileString(DSN, INI_USER, ci->username, diff -Naur psqlodbc-08.00.0004/dlg_specific.h psqlodbc-08.00.0004.patch/dlg_specific.h --- psqlodbc-08.00.0004/dlg_specific.h 2005-01-28 23:36:15.000000000 +0200 +++ psqlodbc-08.00.0004.patch/dlg_specific.h 2005-02-27 14:10:03.393190000 +0200 @@ -38,6 +38,14 @@ #define INI_KDESC "Description" /* Data source description */ #define INI_SERVER "Servername" /* Name of Server running PostgreSQL */ #define INI_PORT "Port" /* Port on which the Postmaster is listening */ + +#if !defined WIN32 && defined HAVE_SYS_UN_H +#ifndef HAVE_UNIX_SOCKETS +#define HAVE_UNIX_SOCKETS +#endif +#define INI_UDS "Uds" /* Unix domain socket path*/ +#endif + #define INI_DATABASE "Database" /* Database Name */ #define INI_USER "Username" /* Default User Name */ #define INI_PASSWORD "Password" /* Default Password */
inline patch 3: psqlodbc-08.00.0004.patch/socket.c, psqlodbc-08.00.0004.patch/socket.h (+14/-5 lines) download inline-3.patchdiff -Naur psqlodbc-08.00.0004/socket.c psqlodbc-08.00.0004.patch/socket.c --- psqlodbc-08.00.0004/socket.c 2005-01-28 23:36:20.000000000 +0200 +++ psqlodbc-08.00.0004.patch/socket.c 2005-02-27 16:20:34.993553000 +0200 @@ -109,7 +109,11 @@ char -SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname) +SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname +#ifdef HAVE_UNIX_SOCKETS + , char *uds /* unix domain socket path */ +#endif + ) { #if defined (POSIX_MULTITHREAD_SUPPORT) const int bufsz = 8192; @@ -140,7 +144,7 @@ /* - * If it is a valid IP address, use it. Otherwise use hostname lookup. + * If it is a valid IP address, use it. Otherwise use AF_UNIX socket. */ if (hostname && hostname[0]) { @@ -196,7 +200,7 @@ } un->sun_family = family = AF_UNIX; /* passing NULL means that this only suports the pg default "/tmp" */ - UNIXSOCK_PATH(un, port, ((char *) NULL)); + UNIXSOCK_PATH(un, port, uds); sLen = UNIXSOCK_LEN(un); self->sadr = (struct sockaddr *) un; } diff -Naur psqlodbc-08.00.0004/socket.h psqlodbc-08.00.0004.patch/socket.h --- psqlodbc-08.00.0004/socket.h 2005-01-28 23:36:20.000000000 +0200 +++ psqlodbc-08.00.0004.patch/socket.h 2005-02-27 16:18:22.733047000 +0200 @@ -34,7 +34,7 @@ #define SOCK_ERRNO errno #define SOCK_ERRNO_SET(e) (errno = e) -#ifdef HAVE_SYS_UN_H +#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS #define HAVE_UNIX_SOCKETS #endif /* HAVE_SYS_UN_H */ #else @@ -121,7 +121,12 @@ /* Socket prototypes */ SocketClass *SOCK_Constructor(const ConnectionClass *conn); void SOCK_Destructor(SocketClass *self); -char SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname); +char SOCK_connect_to(SocketClass *self, unsigned short port, + char *hostname +#ifdef HAVE_UNIX_SOCKETS + , char *uds +#endif + ); void SOCK_get_n_char(SocketClass *self, char *buffer, int len); void SOCK_put_n_char(SocketClass *self, char *buffer, int len); BOOL SOCK_get_string(SocketClass *self, char *buffer, int bufsize);
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. Patches: download all (3 files, .tar.gz) ^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Unix domain socket
  2005-02-24 08:13 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
  2005-02-24 20:16 ` Re: Unix domain socket Peter Eisentraut <peter_e@gmx.net>
  2005-03-01 09:00   ` Re: Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
@ 2005-03-02 15:31     ` Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 12+ messages in thread

From: Peter Eisentraut @ 2005-03-02 15:31 UTC (permalink / raw)
  To: Ramon Danieli <ramond@post.tau.ac.il>; +Cc: pgsql-odbc@postgresql.org, Dave Page <dpage@vale-housing.co.uk>

Am Dienstag, 1. März 2005 10:00 schrieb Ramon Danieli:
> The following patch allow users to configure the Unix domain socket path,
> using the "Uds" property.

For consistency with libpq, the Unix domain socket path should probably 
configured through the hostname.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
@ 2005-03-02 15:11 Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 12+ messages in thread

From: Dave Page @ 2005-03-02 15:11 UTC (permalink / raw)
  To: Ramon Danieli <ramond@post.tau.ac.il>; pgsql-odbc; +Cc: Peter Eisentraut <peter_e@gmx.net>

Thanks Ramon, patch applied.

Regards, Dave. 

> -----Original Message-----
> From: Ramon Danieli [mailto:ramond@post.tau.ac.il] 
> Sent: 01 March 2005 09:01
> To: pgsql-odbc@postgresql.org
> Cc: Dave Page; Peter Eisentraut
> Subject: Re: [ODBC] Unix domain socket
> 
> Quoting Peter Eisentraut <peter_e@gmx.net>:
> 
> > Dave Page wrote:
> > > Hmm, did even realise it had crept in there. Well to enable it you
> > > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > > Does it then work? As for why it's done the way it is, I 
> have no idea
> > > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > > unfortunately though, he no longer works on psqlODBC.
> > 
> > HAVE_UNIX_SOCKETS is defined in the server source tree, so 
> I guess this 
> > could be a leftover from those days.  Turn on the macro and 
> see if you 
> > get it working.
> > 
> > -- 
> 
> The macro is turned on automatically (RHL 4.0AS, gcc version 
> 3.4.2 20041017 (Red
> Hat 3.4.2-6.fc3)) and it works.
> 
> The following patch allow users to configure the Unix domain 
> socket path,
> using the "Uds" property.
> I took some code from the unixODBC PG driver and performed 
> the necessary
> adjustments.
> Please note that unlike unixODBC, I have followed the current 
> convention, which
> means that:
> 1) "Uds" is considered only if "Servername" is empty.
> 2) Default path is "/tmp".
> 3) The provided path should point the folder that comtains 
> the UDS node.
> 
> Please let me know if you find anything wrong in this patch 
> and whether it will
> be included sometimes in the near future.
> 
> Thanks,
> Ramon
> 
> 
> diff -Naur psqlodbc-08.00.0004/connection.c
> psqlodbc-08.00.0004.patch/connection.c
> --- psqlodbc-08.00.0004/connection.c	2005-01-28 
> 23:36:14.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/connection.c	2005-02-27 
> 14:40:34.430232000 +0200
> @@ -725,7 +725,16 @@
>  			return 0;
>  		}
>  
> -		mylog("CC_connect(): DSN = '%s', server = '%s', 
> port = '%s', database = '%s',
> username = '%s', password='%s'\n", ci->dsn, ci->server, 
> ci->port, ci->database,
> ci->username, ci->password ? "xxxxx" : "");
> +		mylog("CC_connect(): DSN = '%s', server = '%s', 
> port = '%s',"
> +#ifdef HAVE_UNIX_SOCKETS
> +		      " uds = '%s',"
> +#endif
> +		      " database = '%s', username = '%s',"
> +		      " password='%s'\n", ci->dsn, ci->server, ci->port,
> +#ifdef HAVE_UNIX_SOCKETS
> +		      ci->uds,
> +#endif
> +		      ci->database, ci->username, ci->password 
> ? "xxxxx" : "");
>  
>  another_version_retry:
>  
> @@ -747,7 +756,11 @@
>  
>  		mylog("connecting to the server socket...\n");
>  
> -		SOCK_connect_to(sock, (short) atoi(ci->port), 
> ci->server);
> +		SOCK_connect_to(sock, (short) atoi(ci->port), ci->server
> +#ifdef HAVE_UNIX_SOCKETS
> +				, ci->uds
> +#endif
> +				);
>  		if (SOCK_get_errcode(sock) != 0)
>  		{
>  			mylog("connection to the server socket 
> failed.\n");
> diff -Naur psqlodbc-08.00.0004/connection.h
> psqlodbc-08.00.0004.patch/connection.h
> --- psqlodbc-08.00.0004/connection.h	2005-01-28 
> 23:36:14.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/connection.h	2005-02-27 
> 16:04:37.469858000 +0200
> @@ -19,6 +19,10 @@
>  #include <pthread.h>
>  #endif
>  
> +#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined 
> HAVE_UNIX_SOCKETS
> +#define HAVE_UNIX_SOCKETS
> +#endif
> +
>  typedef enum
>  {
>  	CONN_NOT_CONNECTED,			/* Connection 
> has not been established */
> @@ -239,6 +243,9 @@
>  	char		conn_settings[LARGE_REGISTRY_LEN];
>  	char		protocol[SMALL_REGISTRY_LEN];
>  	char		port[SMALL_REGISTRY_LEN];
> +#ifdef HAVE_UNIX_SOCKETS
> +	char		uds[LARGE_REGISTRY_LEN];
> +#endif
>  	char		onlyread[SMALL_REGISTRY_LEN];
>  	char		fake_oid_index[SMALL_REGISTRY_LEN];
>  	char		show_oid_column[SMALL_REGISTRY_LEN];
> diff -Naur psqlodbc-08.00.0004/dlg_specific.c
> psqlodbc-08.00.0004.patch/dlg_specific.c
> --- psqlodbc-08.00.0004/dlg_specific.c	2005-01-28 
> 23:36:15.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/dlg_specific.c	2005-02-27 
> 16:03:10.559495000
> +0200
> @@ -286,6 +286,11 @@
>  	else if (stricmp(attribute, INI_PORT) == 0)
>  		strcpy(ci->port, value);
>  
> +#ifdef HAVE_UNIX_SOCKETS
> +	else if (stricmp(attribute, INI_UDS) == 0)
> +		strcpy(ci->uds, value);
> +#endif
> +
>  	else if (stricmp(attribute, INI_READONLY) == 0 || 
> stricmp(attribute, "A0") ==
> 0)
>  		strcpy(ci->onlyread, value);
>  
> @@ -492,6 +497,11 @@
>  	if (ci->port[0] == '\0' || overwrite)
>  		SQLGetPrivateProfileString(DSN, INI_PORT, "", 
> ci->port, sizeof(ci->port),
> ODBC_INI);
>  
> +#ifdef HAVE_UNIX_SOCKETS
> +	if (ci->uds[0] == '\0' || overwrite)
> +		SQLGetPrivateProfileString(DSN, INI_UDS, "", 
> ci->uds, sizeof(ci->uds),
> ODBC_INI);
> +#endif
> +
>  	if (ci->onlyread[0] == '\0' || overwrite)
>  		SQLGetPrivateProfileString(DSN, INI_READONLY, 
> "", ci->onlyread,
> sizeof(ci->onlyread), ODBC_INI);
>  
> @@ -725,6 +735,13 @@
>  								
>  ci->port,
>  								
>  ODBC_INI);
>  
> +#ifdef HAVE_UNIX_SOCKETS
> +	SQLWritePrivateProfileString(DSN,
> +								
>  INI_UDS,
> +								
>  ci->uds,
> +								
>  ODBC_INI);
> +#endif
> +
>  	SQLWritePrivateProfileString(DSN,
>  								
>  INI_USER,
>  								
>  ci->username,
> diff -Naur psqlodbc-08.00.0004/dlg_specific.h
> psqlodbc-08.00.0004.patch/dlg_specific.h
> --- psqlodbc-08.00.0004/dlg_specific.h	2005-01-28 
> 23:36:15.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/dlg_specific.h	2005-02-27 
> 14:10:03.393190000
> +0200
> @@ -38,6 +38,14 @@
>  #define INI_KDESC			"Description"	/* Data 
> source description */
>  #define INI_SERVER			"Servername"	/* Name 
> of Server running PostgreSQL */
>  #define INI_PORT			"Port"		/* Port 
> on which the Postmaster is listening */
> +
> +#if !defined WIN32 && defined HAVE_SYS_UN_H
> +#ifndef HAVE_UNIX_SOCKETS
> +#define HAVE_UNIX_SOCKETS
> +#endif
> +#define INI_UDS				"Uds"		
> /* Unix domain socket path*/
> +#endif
> +
>  #define INI_DATABASE			"Database"	/* 
> Database Name */
>  #define INI_USER			"Username"	/* 
> Default User Name */
>  #define INI_PASSWORD			"Password"	/* 
> Default Password */
> diff -Naur psqlodbc-08.00.0004/socket.c 
> psqlodbc-08.00.0004.patch/socket.c
> --- psqlodbc-08.00.0004/socket.c	2005-01-28 
> 23:36:20.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/socket.c	2005-02-27 
> 16:20:34.993553000 +0200
> @@ -109,7 +109,11 @@
>  
>  
>  char
> -SOCK_connect_to(SocketClass *self, unsigned short port, char 
> *hostname)
> +SOCK_connect_to(SocketClass *self, unsigned short port, char 
> *hostname
> +#ifdef HAVE_UNIX_SOCKETS
> +		, char *uds /* unix domain socket path */
> +#endif
> +		)
>  {
>  #if defined (POSIX_MULTITHREAD_SUPPORT)
>  	const int bufsz = 8192; 
> @@ -140,7 +144,7 @@
>  
>  
>  	/*
> -	 * If it is a valid IP address, use it. Otherwise use 
> hostname lookup.
> +	 * If it is a valid IP address, use it. Otherwise use 
> AF_UNIX socket.
>  	 */
>  	if (hostname && hostname[0])
>  	{
> @@ -196,7 +200,7 @@
>  		}
>  		un->sun_family = family = AF_UNIX;
>  		/* passing NULL means that this only suports 
> the pg default "/tmp" */
> -		UNIXSOCK_PATH(un, port, ((char *) NULL));
> +		UNIXSOCK_PATH(un, port, uds);
>  		sLen = UNIXSOCK_LEN(un);
>  		self->sadr = (struct sockaddr *) un;
>  	}
> diff -Naur psqlodbc-08.00.0004/socket.h 
> psqlodbc-08.00.0004.patch/socket.h
> --- psqlodbc-08.00.0004/socket.h	2005-01-28 
> 23:36:20.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/socket.h	2005-02-27 
> 16:18:22.733047000 +0200
> @@ -34,7 +34,7 @@
>  
>  #define SOCK_ERRNO	errno
>  #define SOCK_ERRNO_SET(e)	(errno = e)
> -#ifdef	HAVE_SYS_UN_H
> +#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
>  #define HAVE_UNIX_SOCKETS
>  #endif /* HAVE_SYS_UN_H */
>  #else
> @@ -121,7 +121,12 @@
>  /* Socket prototypes */
>  SocketClass *SOCK_Constructor(const ConnectionClass *conn);
>  void		SOCK_Destructor(SocketClass *self);
> -char		SOCK_connect_to(SocketClass *self, unsigned 
> short port, char *hostname);
> +char		SOCK_connect_to(SocketClass *self, unsigned short port,
> +				char *hostname
> +#ifdef HAVE_UNIX_SOCKETS
> +				, char *uds
> +#endif
> +				);
>  void		SOCK_get_n_char(SocketClass *self, char 
> *buffer, int len);
>  void		SOCK_put_n_char(SocketClass *self, char 
> *buffer, int len);
>  BOOL		SOCK_get_string(SocketClass *self, char 
> *buffer, int bufsize);
> 
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 



^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Unix domain socket
@ 2007-04-17 08:26 ramond@post.tau.ac.il
  0 siblings, 0 replies; 12+ messages in thread

From: ramond@post.tau.ac.il @ 2007-04-17 08:26 UTC (permalink / raw)
  To: pgsql-odbc; +Cc: Dave Page <dpage@vale-housing.co.uk>

Hi Dave,

Could u please let me know in which version this patch was eventually included?
Currently we still use our own modified driver (based on the 08.00.0004) and we
would like to upgrade.
Our best option would be to use a standard RedHat RPM (4.0/5.0 AS famiy).
Otherwise, we would use the latest from your site.
Thanks,
Ramon

BTW - the link to the original thread:
http://archives.postgresql.org/pgsql-odbc/2005-03/msg00010.php


Quoting Dave Page <dpage@vale-housing.co.uk>:

> Thanks Ramon, patch applied.
>
> Regards, Dave.
>
> > -----Original Message-----
> > From: Ramon Danieli [mailto:ramond@post.tau.ac.il]
> > Sent: 01 March 2005 09:01
> > To: pgsql-odbc@postgresql.org
> > Cc: Dave Page; Peter Eisentraut
> > Subject: Re: [ODBC] Unix domain socket
> >
> > Quoting Peter Eisentraut <peter_e@gmx.net>:
> >
> > > Dave Page wrote:
> > > > Hmm, did even realise it had crept in there. Well to enable it you
> > > > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > > > Does it then work? As for why it's done the way it is, I
> > have no idea
> > > > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > > > unfortunately though, he no longer works on psqlODBC.
> > >
> > > HAVE_UNIX_SOCKETS is defined in the server source tree, so
> > I guess this
> > > could be a leftover from those days.  Turn on the macro and
> > see if you
> > > get it working.
> > >
> > > --
> >
> > The macro is turned on automatically (RHL 4.0AS, gcc version
> > 3.4.2 20041017 (Red
> > Hat 3.4.2-6.fc3)) and it works.
> >
> > The following patch allow users to configure the Unix domain
> > socket path,
> > using the "Uds" property.
> > I took some code from the unixODBC PG driver and performed
> > the necessary
> > adjustments.
> > Please note that unlike unixODBC, I have followed the current
> > convention, which
> > means that:
> > 1) "Uds" is considered only if "Servername" is empty.
> > 2) Default path is "/tmp".
> > 3) The provided path should point the folder that comtains
> > the UDS node.
> >
> > Please let me know if you find anything wrong in this patch
> > and whether it will
> > be included sometimes in the near future.
> >
> > Thanks,
> > Ramon
> >
> >
> > diff -Naur psqlodbc-08.00.0004/connection.c
> > psqlodbc-08.00.0004.patch/connection.c
> > --- psqlodbc-08.00.0004/connection.c	2005-01-28
> > 23:36:14.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/connection.c	2005-02-27
> > 14:40:34.430232000 +0200
> > @@ -725,7 +725,16 @@
> >  			return 0;
> >  		}
> >
> > -		mylog("CC_connect(): DSN = '%s', server = '%s',
> > port = '%s', database = '%s',
> > username = '%s', password='%s'\n", ci->dsn, ci->server,
> > ci->port, ci->database,
> > ci->username, ci->password ? "xxxxx" : "");
> > +		mylog("CC_connect(): DSN = '%s', server = '%s',
> > port = '%s',"
> > +#ifdef HAVE_UNIX_SOCKETS
> > +		      " uds = '%s',"
> > +#endif
> > +		      " database = '%s', username = '%s',"
> > +		      " password='%s'\n", ci->dsn, ci->server, ci->port,
> > +#ifdef HAVE_UNIX_SOCKETS
> > +		      ci->uds,
> > +#endif
> > +		      ci->database, ci->username, ci->password
> > ? "xxxxx" : "");
> >
> >  another_version_retry:
> >
> > @@ -747,7 +756,11 @@
> >
> >  		mylog("connecting to the server socket...\n");
> >
> > -		SOCK_connect_to(sock, (short) atoi(ci->port),
> > ci->server);
> > +		SOCK_connect_to(sock, (short) atoi(ci->port), ci->server
> > +#ifdef HAVE_UNIX_SOCKETS
> > +				, ci->uds
> > +#endif
> > +				);
> >  		if (SOCK_get_errcode(sock) != 0)
> >  		{
> >  			mylog("connection to the server socket
> > failed.\n");
> > diff -Naur psqlodbc-08.00.0004/connection.h
> > psqlodbc-08.00.0004.patch/connection.h
> > --- psqlodbc-08.00.0004/connection.h	2005-01-28
> > 23:36:14.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/connection.h	2005-02-27
> > 16:04:37.469858000 +0200
> > @@ -19,6 +19,10 @@
> >  #include <pthread.h>
> >  #endif
> >
> > +#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined
> > HAVE_UNIX_SOCKETS
> > +#define HAVE_UNIX_SOCKETS
> > +#endif
> > +
> >  typedef enum
> >  {
> >  	CONN_NOT_CONNECTED,			/* Connection
> > has not been established */
> > @@ -239,6 +243,9 @@
> >  	char		conn_settings[LARGE_REGISTRY_LEN];
> >  	char		protocol[SMALL_REGISTRY_LEN];
> >  	char		port[SMALL_REGISTRY_LEN];
> > +#ifdef HAVE_UNIX_SOCKETS
> > +	char		uds[LARGE_REGISTRY_LEN];
> > +#endif
> >  	char		onlyread[SMALL_REGISTRY_LEN];
> >  	char		fake_oid_index[SMALL_REGISTRY_LEN];
> >  	char		show_oid_column[SMALL_REGISTRY_LEN];
> > diff -Naur psqlodbc-08.00.0004/dlg_specific.c
> > psqlodbc-08.00.0004.patch/dlg_specific.c
> > --- psqlodbc-08.00.0004/dlg_specific.c	2005-01-28
> > 23:36:15.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/dlg_specific.c	2005-02-27
> > 16:03:10.559495000
> > +0200
> > @@ -286,6 +286,11 @@
> >  	else if (stricmp(attribute, INI_PORT) == 0)
> >  		strcpy(ci->port, value);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > +	else if (stricmp(attribute, INI_UDS) == 0)
> > +		strcpy(ci->uds, value);
> > +#endif
> > +
> >  	else if (stricmp(attribute, INI_READONLY) == 0 ||
> > stricmp(attribute, "A0") ==
> > 0)
> >  		strcpy(ci->onlyread, value);
> >
> > @@ -492,6 +497,11 @@
> >  	if (ci->port[0] == '\0' || overwrite)
> >  		SQLGetPrivateProfileString(DSN, INI_PORT, "",
> > ci->port, sizeof(ci->port),
> > ODBC_INI);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > +	if (ci->uds[0] == '\0' || overwrite)
> > +		SQLGetPrivateProfileString(DSN, INI_UDS, "",
> > ci->uds, sizeof(ci->uds),
> > ODBC_INI);
> > +#endif
> > +
> >  	if (ci->onlyread[0] == '\0' || overwrite)
> >  		SQLGetPrivateProfileString(DSN, INI_READONLY,
> > "", ci->onlyread,
> > sizeof(ci->onlyread), ODBC_INI);
> >
> > @@ -725,6 +735,13 @@
> >
> >  ci->port,
> >
> >  ODBC_INI);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > +	SQLWritePrivateProfileString(DSN,
> > +
> >  INI_UDS,
> > +
> >  ci->uds,
> > +
> >  ODBC_INI);
> > +#endif
> > +
> >  	SQLWritePrivateProfileString(DSN,
> >
> >  INI_USER,
> >
> >  ci->username,
> > diff -Naur psqlodbc-08.00.0004/dlg_specific.h
> > psqlodbc-08.00.0004.patch/dlg_specific.h
> > --- psqlodbc-08.00.0004/dlg_specific.h	2005-01-28
> > 23:36:15.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/dlg_specific.h	2005-02-27
> > 14:10:03.393190000
> > +0200
> > @@ -38,6 +38,14 @@
> >  #define INI_KDESC			"Description"	/* Data
> > source description */
> >  #define INI_SERVER			"Servername"	/* Name
> > of Server running PostgreSQL */
> >  #define INI_PORT			"Port"		/* Port
> > on which the Postmaster is listening */
> > +
> > +#if !defined WIN32 && defined HAVE_SYS_UN_H
> > +#ifndef HAVE_UNIX_SOCKETS
> > +#define HAVE_UNIX_SOCKETS
> > +#endif
> > +#define INI_UDS				"Uds"
> > /* Unix domain socket path*/
> > +#endif
> > +
> >  #define INI_DATABASE			"Database"	/*
> > Database Name */
> >  #define INI_USER			"Username"	/*
> > Default User Name */
> >  #define INI_PASSWORD			"Password"	/*
> > Default Password */
> > diff -Naur psqlodbc-08.00.0004/socket.c
> > psqlodbc-08.00.0004.patch/socket.c
> > --- psqlodbc-08.00.0004/socket.c	2005-01-28
> > 23:36:20.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/socket.c	2005-02-27
> > 16:20:34.993553000 +0200
> > @@ -109,7 +109,11 @@
> >
> >
> >  char
> > -SOCK_connect_to(SocketClass *self, unsigned short port, char
> > *hostname)
> > +SOCK_connect_to(SocketClass *self, unsigned short port, char
> > *hostname
> > +#ifdef HAVE_UNIX_SOCKETS
> > +		, char *uds /* unix domain socket path */
> > +#endif
> > +		)
> >  {
> >  #if defined (POSIX_MULTITHREAD_SUPPORT)
> >  	const int bufsz = 8192;
> > @@ -140,7 +144,7 @@
> >
> >
> >  	/*
> > -	 * If it is a valid IP address, use it. Otherwise use
> > hostname lookup.
> > +	 * If it is a valid IP address, use it. Otherwise use
> > AF_UNIX socket.
> >  	 */
> >  	if (hostname && hostname[0])
> >  	{
> > @@ -196,7 +200,7 @@
> >  		}
> >  		un->sun_family = family = AF_UNIX;
> >  		/* passing NULL means that this only suports
> > the pg default "/tmp" */
> > -		UNIXSOCK_PATH(un, port, ((char *) NULL));
> > +		UNIXSOCK_PATH(un, port, uds);
> >  		sLen = UNIXSOCK_LEN(un);
> >  		self->sadr = (struct sockaddr *) un;
> >  	}
> > diff -Naur psqlodbc-08.00.0004/socket.h
> > psqlodbc-08.00.0004.patch/socket.h
> > --- psqlodbc-08.00.0004/socket.h	2005-01-28
> > 23:36:20.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/socket.h	2005-02-27
> > 16:18:22.733047000 +0200
> > @@ -34,7 +34,7 @@
> >
> >  #define SOCK_ERRNO	errno
> >  #define SOCK_ERRNO_SET(e)	(errno = e)
> > -#ifdef	HAVE_SYS_UN_H
> > +#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
> >  #define HAVE_UNIX_SOCKETS
> >  #endif /* HAVE_SYS_UN_H */
> >  #else
> > @@ -121,7 +121,12 @@
> >  /* Socket prototypes */
> >  SocketClass *SOCK_Constructor(const ConnectionClass *conn);
> >  void		SOCK_Destructor(SocketClass *self);
> > -char		SOCK_connect_to(SocketClass *self, unsigned
> > short port, char *hostname);
> > +char		SOCK_connect_to(SocketClass *self, unsigned short port,
> > +				char *hostname
> > +#ifdef HAVE_UNIX_SOCKETS
> > +				, char *uds
> > +#endif
> > +				);
> >  void		SOCK_get_n_char(SocketClass *self, char
> > *buffer, int len);
> >  void		SOCK_put_n_char(SocketClass *self, char
> > *buffer, int len);
> >  BOOL		SOCK_get_string(SocketClass *self, char
> > *buffer, int bufsize);
> >
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2007-04-17 08:26 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-07 14:26 Unix domain socket Ramon Danieli <ramond@post.tau.ac.il>
2005-02-09 07:10 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
2005-02-17 15:06 ` Ramon Danieli <ramond@post.tau.ac.il>
2005-02-23 09:09 ` Ramon Danieli <ramond@post.tau.ac.il>
2005-02-23 09:01 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
2005-02-23 22:14 ` Ramon Danieli <ramond@post.tau.ac.il>
2005-02-24 08:13 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
2005-02-24 20:16 ` Peter Eisentraut <peter_e@gmx.net>
2005-03-01 09:00   ` Ramon Danieli <ramond@post.tau.ac.il>
2005-03-02 15:31     ` Peter Eisentraut <peter_e@gmx.net>
2005-03-02 15:11 Re: Unix domain socket Dave Page <dpage@vale-housing.co.uk>
2007-04-17 08:26 Re: Unix domain socket ramond@post.tau.ac.il

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