pg.ddx.io pgsql-odbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #14260: psqlODBC does not support sslXXXXX variables 4+ messages / 3 participants [nested] [flat]
* BUG #14260: psqlODBC does not support sslXXXXX variables @ 2016-07-19 14:00 krayner@raynersoft.net 2016-07-19 23:54 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Michael Paquier <michael.paquier@gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: krayner@raynersoft.net @ 2016-07-19 14:00 UTC (permalink / raw) To: pgsql-bugs@postgresql.org The following bug has been logged on the website: Bug reference: 14260 Logged by: Kurt Rayner Email address: krayner@raynersoft.net PostgreSQL version: 9.5.3 Operating system: Windows Description: pSQLODBC does not accept the sslXXX options for OpenSSL that other database clients do): sslcert sslkey sslrootcert sslcrl sslcipher (doesn't appear to be supported by libpq). This is more of a deficiency, but in a multi-threaded client where each connection can have different values putenv() really doesn't cut it. It is a relatively minor change to add the certificate/path values to the options for the ODBC client (admittedly more work to update the dialogs). I've looked at doing this myself, but would rather see it in the mainline. Not sure what the process is for acceptance of updates, but if I can help... Thanks in advance! -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables 2016-07-19 14:00 BUG #14260: psqlODBC does not support sslXXXXX variables krayner@raynersoft.net @ 2016-07-19 23:54 ` Michael Paquier <michael.paquier@gmail.com> 2016-07-20 23:52 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Lindsay Stevens <lindsay.stevens.au@gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Michael Paquier @ 2016-07-19 23:54 UTC (permalink / raw) To: krayner@raynersoft.net; +Cc: pgsql-odbc On Tue, Jul 19, 2016 at 11:00 PM, <krayner@raynersoft.net> wrote: > Bug reference: 14260 > Logged by: Kurt Rayner > Email address: krayner@raynersoft.net > PostgreSQL version: 9.5.3 > Operating system: Windows > Description: Postgres ODBC and Postgres server code are two different things. Note that the last versions of the Postgres ODBC driver have a hard dependency with libpq, but I guess you know that. By the way, pgsql-bugs applies to bugs of Postgres code code, as this is an ODBC-related problem I am moving this thread to pgsql-odbc. > pSQLODBC does not accept the sslXXX options for OpenSSL that other database > clients do): > sslcert > sslkey > sslrootcert > sslcrl > sslcipher (doesn't appear to be supported by libpq). > > This is more of a deficiency, but in a multi-threaded client where each > connection can have different values putenv() really doesn't cut it. Agreed. hose are definitely missing from ConnInfo and should be enforced in LIBPQ_connect@connection.c when passing the list of libpq parameters to PQconnectDBParams. I have not looked at the code in details, but this also needs some work in the files dlg_*.c to be able to build correctly, and this needs dedicated parameters for the .ini configuration file. > Not sure what the process is for acceptance of updates, but if I can > help... Patches are welcome! Development of ODBC is an on-going process. -- Michael -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables 2016-07-19 14:00 BUG #14260: psqlODBC does not support sslXXXXX variables krayner@raynersoft.net 2016-07-19 23:54 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Michael Paquier <michael.paquier@gmail.com> @ 2016-07-20 23:52 ` Lindsay Stevens <lindsay.stevens.au@gmail.com> 2016-07-21 00:33 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Michael Paquier <michael.paquier@gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Lindsay Stevens @ 2016-07-20 23:52 UTC (permalink / raw) To: pgsql-odbc I long while back I had a similar issue and drafted a patch (working code / build but no test) to add some libpq parameter support. It was for pg_service, which can point to a connection config file and leverages libpq's ability to read that for any / all possible parameters. At the time, Heikki was doing the only commits and suggested a non file based approach where we pass in to libpq any provided parameters not currently explicitly handled. This has the advantage over pg_service of not having to supply a service config file with the application. I wasn't sure how to do that though (rudimentary C skills...) and had a workaround for the motivating problem so I left it alone. What would be the current preferred approach? E.g. (or some combination of) 1. write boilerplate-ish code to explicitly handle all current libpq parameters, or 2. write the above pass-all-in feature, or 3. use pg_service. I've attached my patch for 3, and could work on 1, but I'd need some pointers (ha) on doing 2. Best regards, Lindsay -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc Attachments:^ permalink raw reply [nested|flat] 4+ messages in threadadd_service_dsn_parameter.patch (text/x-patch, 3.1K) download
diff --git a/connection.c b/connection.c index 131a0e7..63af8ca 100644 --- a/connection.c +++ b/connection.c @@ -312,6 +312,7 @@ CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci) NAME_TO_NAME(ci->password, sci->password); CORR_STRCPY(port); CORR_STRCPY(sslmode); + CORR_STRCPY(service); CORR_STRCPY(onlyread); CORR_STRCPY(fake_oid_index); CORR_STRCPY(show_oid_column); @@ -2510,6 +2511,10 @@ LIBPQ_connect(ConnectionClass *self) opts[cnt] = "sslmode"; vals[cnt++] = ci->sslmode; } + if (ci->service[0]) + { + opts[cnt] = "service"; vals[cnt++] = ci->service; + } if (NAME_IS_VALID(ci->password)) { opts[cnt] = "password"; vals[cnt++] = SAFE_NAME(ci->password); diff --git a/connection.h b/connection.h index 20d0bbb..f8aa808 100644 --- a/connection.h +++ b/connection.h @@ -218,6 +218,7 @@ typedef struct pgNAME password; char port[SMALL_REGISTRY_LEN]; char sslmode[16]; + char service[MEDIUM_REGISTRY_LEN]; char onlyread[SMALL_REGISTRY_LEN]; char fake_oid_index[SMALL_REGISTRY_LEN]; char show_oid_column[SMALL_REGISTRY_LEN]; diff --git a/dlg_specific.c b/dlg_specific.c index 6ab7464..cdc1a0d 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -289,6 +289,7 @@ inolog("hlen=%d", hlen); strcpy(protocol_and, "7.4"); olen = snprintf(&connect_string[hlen], nlen, ";" INI_SSLMODE "=%s;" + INI_SERVICE "=%s;" INI_READONLY "=%s;" INI_PROTOCOL "=%s;" INI_FAKEOIDINDEX "=%s;" @@ -323,6 +324,7 @@ inolog("hlen=%d", hlen); INI_XAOPT "=%d" /* XAOPT */ #endif /* _HANDLE_ENLIST_IN_DTC_ */ ,ci->sslmode + ,ci->service ,ci->onlyread ,protocol_and ,ci->fake_oid_index @@ -660,6 +662,8 @@ copyAttributes(ConnInfo *ci, const char *attribute, const char *value) break; } } + else if (stricmp(attribute, INI_SERVICE) == 0 || stricmp(attribute, ABBR_SERVICE) == 0) + strcpy(ci->service, value); else if (stricmp(attribute, INI_ABBREVIATE) == 0) unfoldCXAttribute(ci, value); #ifdef _HANDLE_ENLIST_IN_DTC_ @@ -1000,6 +1004,9 @@ getDSNinfo(ConnInfo *ci, char overwrite) if (ci->sslmode[0] == '\0' || overwrite) SQLGetPrivateProfileString(DSN, INI_SSLMODE, "", ci->sslmode, sizeof(ci->sslmode), ODBC_INI); + if (ci->service[0] == '\0' || overwrite) + SQLGetPrivateProfileString(DSN, INI_SERVICE, "", ci->service, sizeof(ci->service), ODBC_INI); + #ifdef _HANDLE_ENLIST_IN_DTC_ if (ci->xa_opt < 0 || overwrite) { @@ -1270,6 +1277,10 @@ writeDSNinfo(const ConnInfo *ci) INI_SSLMODE, ci->sslmode, ODBC_INI); + SQLWritePrivateProfileString(DSN, + INI_SERVICE, + ci->service, + ODBC_INI); sprintf(temp, "%d", ci->keepalive_idle); SQLWritePrivateProfileString(DSN, INI_KEEPALIVETIME, diff --git a/dlg_specific.h b/dlg_specific.h index 30ea389..ceb3bea 100644 --- a/dlg_specific.h +++ b/dlg_specific.h @@ -157,6 +157,8 @@ extern "C" { #define ABBR_LOWERCASEIDENTIFIER "C9" #define INI_SSLMODE "SSLmode" #define ABBR_SSLMODE "CA" +#define INI_SERVICE "service" +#define ABBR_SERVICE "SE" #define INI_EXTRAOPTIONS "AB" #define INI_LOGDIR "Logdir" #define INI_GSSAUTHUSEGSSAPI "GssAuthUseGSS"
* Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables 2016-07-19 14:00 BUG #14260: psqlODBC does not support sslXXXXX variables krayner@raynersoft.net 2016-07-19 23:54 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Michael Paquier <michael.paquier@gmail.com> 2016-07-20 23:52 ` Re: [BUGS] BUG #14260: psqlODBC does not support sslXXXXX variables Lindsay Stevens <lindsay.stevens.au@gmail.com> @ 2016-07-21 00:33 ` Michael Paquier <michael.paquier@gmail.com> 0 siblings, 0 replies; 4+ messages in thread From: Michael Paquier @ 2016-07-21 00:33 UTC (permalink / raw) To: Lindsay Stevens <lindsay.stevens.au@gmail.com>; +Cc: pgsql-odbc; Heikki Linnakangas <hlinnaka@iki.fi> On Thu, Jul 21, 2016 at 8:52 AM, Lindsay Stevens <lindsay.stevens.au@gmail.com> wrote: > I long while back I had a similar issue and drafted a patch (working code / > build but no test) to add some libpq parameter support. It was for > pg_service, which can point to a connection config file and leverages > libpq's ability to read that for any / all possible parameters. Do you have any reference to pg_service? I am not very familiar with that. Still it sounds weird to > At the time, Heikki was doing the only commits and suggested a non file > based approach where we pass in to libpq any provided parameters not > currently explicitly handled. This has the advantage over pg_service of not > having to supply a service config file with the application. I wasn't sure > how to do that though (rudimentary C skills...) and had a workaround for the > motivating problem so I left it alone. So that's a deal to avoid bloating up the number of parameters present directly in > What would be the current preferred approach? E.g. (or some combination of) > > 1. write boilerplate-ish code to explicitly handle all current libpq > parameters, or That's rally bloaty. Many parameters are not supported in the driver now. > 2. write the above pass-all-in feature, or OK, I think I see. I am not sure what Heikki had in mind here, but a pure guess is that this is a method using PQconndefaults. Now I am not sure about something... How do we pass new parameters and custom values? > 3. use pg_service. OK, I see. This looks quite promising as libpq already has logic to handle the service configuration file. -- Michael -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2016-07-21 00:33 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-07-19 14:00 BUG #14260: psqlODBC does not support sslXXXXX variables krayner@raynersoft.net 2016-07-19 23:54 ` Michael Paquier <michael.paquier@gmail.com> 2016-07-20 23:52 ` Lindsay Stevens <lindsay.stevens.au@gmail.com> 2016-07-21 00:33 ` Michael Paquier <michael.paquier@gmail.com>
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