aboutsummaryrefslogtreecommitdiff
path: root/src/backend/libpq/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/libpq/auth.c')
-rw-r--r--src/backend/libpq/auth.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index aa9c541b168..e4f1753800a 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.18 1997/11/17 16:10:06 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.19 1997/12/04 00:26:50 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,6 +71,7 @@
#include <libpq/libpq-be.h>
#include <libpq/hba.h>
#include <libpq/password.h>
+#include <libpq/crypt.h>
static int be_getauthsvc(MsgType msgtype);
@@ -122,7 +123,8 @@ static struct authsvc authsvcs[] = {
#else
{"kerberos", STARTUP_KRB4_MSG, 1},
#endif
- {"password", STARTUP_PASSWORD_MSG, 1}
+ {"password", STARTUP_PASSWORD_MSG, 1},
+ {"crypt", STARTUP_CRYPT_MSG, 1}
};
static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
@@ -445,6 +447,28 @@ pg_password_recvauth(Port *port, char *database, char *DataDir)
return verify_password(user, password, port, database, DataDir);
}
+static int
+crypt_recvauth(Port *port)
+{
+ PacketBuf buf;
+ char *user,
+ *password;
+
+ if (PacketReceive(port, &buf, BLOCKING) != STATUS_OK)
+ {
+ sprintf(PQerrormsg,
+ "crypt_recvauth: failed to receive authentication packet.\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return STATUS_ERROR;
+ }
+
+ user = buf.data;
+ password = buf.data + strlen(user) + 1;
+
+ return crypt_verify(port, user, password);
+}
+
/*
* be_recvauth -- server demux routine for incoming authentication information
*/
@@ -571,6 +595,10 @@ be_recvauth(MsgType msgtype_arg, Port *port, char *username, StartupInfo *sp)
return (STATUS_ERROR);
}
break;
+ case STARTUP_CRYPT_MSG:
+ if (crypt_recvauth(port) != STATUS_OK)
+ return STATUS_ERROR;
+ break;
default:
sprintf(PQerrormsg,
"be_recvauth: unrecognized message type: %d\n",