Commit 29ac718f authored by Magnus Hagander's avatar Magnus Hagander

Use PQExpBuffer for error message in fe-auth.c.

In passing, change functions that passedin both PGconn and
parts of it to just pass in the PGconn.
parent aa81c558
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.26 2007/01/05 22:20:00 momjian Exp $ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.27 2007/07/23 17:52:06 mha Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include "libpq-int.h" #include "libpq-int.h"
extern int pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, extern int pg_fe_sendauth(AuthRequest areq, PGconn *conn);
const char *password, char *PQerrormsg); extern char *pg_fe_getauthname(PQExpBuffer errorMessage);
extern char *pg_fe_getauthname(char *PQerrormsg);
#endif /* FE_AUTH_H */ #endif /* FE_AUTH_H */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.350 2007/07/23 10:16:54 mha Exp $ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.351 2007/07/23 17:52:06 mha Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1723,12 +1723,7 @@ keep_going: /* We will come back to here until there is ...@@ -1723,12 +1723,7 @@ keep_going: /* We will come back to here until there is
* avoid the Kerberos code doing a hostname look-up. * avoid the Kerberos code doing a hostname look-up.
*/ */
/* if (pg_fe_sendauth(areq, conn) != STATUS_OK)
* XXX fe-auth.c has not been fixed to support PQExpBuffers,
* so:
*/
if (pg_fe_sendauth(areq, conn, conn->pghost, conn->pgpass,
conn->errorMessage.data) != STATUS_OK)
{ {
conn->errorMessage.len = strlen(conn->errorMessage.data); conn->errorMessage.len = strlen(conn->errorMessage.data);
goto error_return; goto error_return;
...@@ -3074,7 +3069,6 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -3074,7 +3069,6 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
char *cp2; char *cp2;
PQconninfoOption *options; PQconninfoOption *options;
PQconninfoOption *option; PQconninfoOption *option;
char errortmp[PQERRORMSG_LENGTH];
/* Make a working copy of PQconninfoOptions */ /* Make a working copy of PQconninfoOptions */
options = malloc(sizeof(PQconninfoOptions)); options = malloc(sizeof(PQconninfoOptions));
...@@ -3297,8 +3291,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -3297,8 +3291,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
*/ */
if (strcmp(option->keyword, "user") == 0) if (strcmp(option->keyword, "user") == 0)
{ {
option->val = pg_fe_getauthname(errortmp); option->val = pg_fe_getauthname(errorMessage);
/* note any error message is thrown away */
continue; continue;
} }
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.124 2007/07/23 10:16:54 mha Exp $ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.125 2007/07/23 17:52:06 mha Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -76,7 +76,6 @@ typedef struct { ...@@ -76,7 +76,6 @@ typedef struct {
/* /*
* POSTGRES backend dependent Constants. * POSTGRES backend dependent Constants.
*/ */
#define PQERRORMSG_LENGTH 1024
#define CMDSTATUS_LEN 40 #define CMDSTATUS_LEN 40
/* /*
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.17 2007/01/05 22:20:01 momjian Exp $ * $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.18 2007/07/23 17:52:06 mha Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -49,7 +49,7 @@ typedef PQExpBufferData *PQExpBuffer; ...@@ -49,7 +49,7 @@ typedef PQExpBufferData *PQExpBuffer;
/*------------------------ /*------------------------
* Initial size of the data buffer in a PQExpBuffer. * Initial size of the data buffer in a PQExpBuffer.
* NB: this must be large enough to hold error messages that might * NB: this must be large enough to hold error messages that might
* be returned by PQrequestCancel() or any routine in fe-auth.c. * be returned by PQrequestCancel().
*------------------------ *------------------------
*/ */
#define INITIAL_EXPBUFFER_SIZE 256 #define INITIAL_EXPBUFFER_SIZE 256
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment