On Tue, May 14, 2013 at 11:20 AM, Amit Langote <amitlangot...@gmail.com> wrote: > Hello, > > Is it right that it is only in the case a password prompt is needed > that a new connection is created after dropping the just-failed > connection? > I created a patch which enables it to use the existing connection in > such a case (unlike what we currently do). It modifies > connectDBComplete() and PQconnectPoll() to also include states > pertaining to password being accepted from the user. That is, the > state machine in PQconnectPoll() is further extended to include a > connection state called CONNECTION_ASKING_PASSWORD which is entered > when server sends AUTH_REQ_MD5 or AUTH_REQ_PASSWORD auth requests. > These two request types require a password to be entered by the user. > There is a new PostgresPollingStatusType value called > PGRES_POLLING_WAITING_PASSWORD which is the polling status while a > password is being entered by the user. > > When user enters the password the PQconnectPoll() continues forward in > CONNECTION_ASKING_PASSWORD wherein it sends the password to the server > (by calling pg_fe_sendauth() and this time with a potentially correct > password) and later goes back to CONNECTION_AWAITING_RESPONSE to read > server's response to the password just entered where it either > receives authorization OK or error response thus completing the > connection start-up process. > > The backend waits for the password until authentication timeout > happens in which case the client can not send the password anymore > since the backend has exited due to authentication timeout. I wonder > if this is one of the reasons why this has not already been > implemented? > > Comments?
Please add patches here so they don't get forgotten: https://commitfest.postgresql.org/action/commitfest_view/open Do we really need to add *2* new libpq functions just to support this? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers