Re: [HACKERS] DefaultHost
От | Goran Thyni |
---|---|
Тема | Re: [HACKERS] DefaultHost |
Дата | |
Msg-id | 19980110152452.6095.qmail@guevara.bildbasen.se обсуждение исходный текст |
Ответ на | Re: [HACKERS] DefaultHost (Goran Thyni <goran@bildbasen.se>) |
Список | pgsql-hackers |
OK, here comes a patch, DBD::Pg (and possibly other 3rd party clients) can connect to unix sockets. Patch is against current source tree. Background: libpq set some policy for client, which it should not IMHO. It prevent some 3rd party clients to connect with unix domain sockets etc. regards, -- --------------------------------------------- Göran Thyni, sysadm, JMS Bildbasen, Kiruna ------------------------- snip --------------------------------- diff -cr pg-sup/pgsql/src/interfaces/libpq/fe-connect.c pgsql-hack/src/interfaces/libpq/fe-connect.c *** pg-sup/pgsql/src/interfaces/libpq/fe-connect.c Fri Dec 5 17:33:44 1997 --- pgsql-hack/src/interfaces/libpq/fe-connect.c Sat Jan 10 16:09:37 1998 *************** *** 150,156 **** PGconn *conn; PQconninfoOption *option; char errorMessage[ERROR_MSG_LENGTH]; ! /* ---------- * Allocate memory for the conn structure * ---------- --- 150,156 ---- PGconn *conn; PQconninfoOption *option; char errorMessage[ERROR_MSG_LENGTH]; ! char* tmp; /* ---------- * Allocate memory for the conn structure * ---------- *************** *** 177,213 **** } /* ---------- - * Check that we have all connection parameters - * ---------- - */ - for (option = PQconninfoOptions; option->keyword != NULL; option++) - { - if (option->val != NULL) - continue; /* Value was in conninfo */ - - /* ---------- - * No value was found for this option. Return an error. - * ---------- - */ - conn->status = CONNECTION_BAD; - sprintf(conn->errorMessage, - "ERROR: PQconnectdb(): Cannot determine a value for option '%s'.\n", - option->keyword); - strcat(conn->errorMessage, - "Option not specified in conninfo string"); - if (option->environ) - { - strcat(conn->errorMessage, - ", environment variable "); - strcat(conn->errorMessage, option->environ); - strcat(conn->errorMessage, "\nnot set"); - } - strcat(conn->errorMessage, " and no compiled in default value.\n"); - conninfo_free(); - return conn; - } - - /* ---------- * Setup the conn structure * ---------- */ --- 177,182 ---- *************** *** 218,231 **** conn->port = NULL; conn->notifyList = DLNewList(); ! conn->pghost = strdup(conninfo_getval("host")); ! conn->pgport = strdup(conninfo_getval("port")); ! conn->pgtty = strdup(conninfo_getval("tty")); ! conn->pgoptions = strdup(conninfo_getval("options")); ! conn->pguser = strdup(conninfo_getval("user")); ! conn->pgpass = strdup(conninfo_getval("password")); ! conn->pgauth = strdup(conninfo_getval("authtype")); ! conn->dbName = strdup(conninfo_getval("dbname")); /* ---------- * Free the connection info - all is in conn now --- 187,208 ---- conn->port = NULL; conn->notifyList = DLNewList(); ! tmp = conninfo_getval("host"); ! conn->pghost = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("port"); ! conn->pgport = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("tty"); ! conn->pgtty = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("options"); ! conn->pgoptions = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("user"); ! conn->pguser = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("password"); ! conn->pgpass = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("authtype"); ! conn->pgauth = tmp ? strdup(tmp) : NULL; ! tmp = conninfo_getval("dbname"); ! conn->dbName = tmp ? strdup(tmp) : NULL; /* ---------- * Free the connection info - all is in conn now
В списке pgsql-hackers по дате отправления: