1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

First phase of FE/BE protocol modifications: new StartupPacket layout

with variable-width fields.  No more truncation of long user names.
Also, libpq can now send its environment-variable-driven SET commands
as part of the startup packet, saving round trips to server.
This commit is contained in:
Tom Lane
2003-04-17 22:26:02 +00:00
parent 76fd678c06
commit cb7fb3ca95
16 changed files with 436 additions and 300 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.97 2003/02/14 14:05:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.98 2003/04/17 22:26:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -29,7 +29,6 @@
#include "libpq/crypt.h"
#include "libpq/hba.h"
#include "libpq/libpq.h"
#include "libpq/password.h"
#include "libpq/pqcomm.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
@ -378,7 +377,7 @@ auth_failed(Port *port, int status)
}
elog(FATAL, "%s authentication failed for user \"%s\"",
authmethod, port->user);
authmethod, port->user_name);
/* doesn't return */
}
@ -427,7 +426,7 @@ ClientAuthentication(Port *port)
elog(FATAL,
"No pg_hba.conf entry for host %s, user %s, database %s",
hostinfo, port->user, port->database);
hostinfo, port->user_name, port->database_name);
break;
}
@ -638,10 +637,12 @@ CheckPAMAuth(Port *port, char *user, char *password)
* not allocated */
/* Optionally, one can set the service name in pg_hba.conf */
if (port->auth_arg[0] == '\0')
retval = pam_start(PGSQL_PAM_SERVICE, "pgsql@", &pam_passw_conv, &pamh);
if (port->auth_arg && port->auth_arg[0] != '\0')
retval = pam_start(port->auth_arg, "pgsql@",
&pam_passw_conv, &pamh);
else
retval = pam_start(port->auth_arg, "pgsql@", &pam_passw_conv, &pamh);
retval = pam_start(PGSQL_PAM_SERVICE, "pgsql@",
&pam_passw_conv, &pamh);
if (retval != PAM_SUCCESS)
{
@ -741,7 +742,7 @@ recv_and_check_password_packet(Port *port)
/* Do not echo password to logs, for security. */
elog(DEBUG5, "received password packet");
result = md5_crypt_verify(port, port->user, buf.data);
result = md5_crypt_verify(port, port->user_name, buf.data);
pfree(buf.data);
return result;