1010 * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
1111 *
1212 * IDENTIFICATION
13- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.72 2002/12/03 22:09:20 momjian Exp $
13+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.73 2003/01/29 01:18:21 tgl Exp $
1414 *
1515 *-------------------------------------------------------------------------
1616 */
@@ -686,7 +686,14 @@ MsgType
686686fe_getauthsvc (char * PQerrormsg )
687687{
688688if (pg_authsvc < 0 || pg_authsvc >=n_authsvcs )
689+ {
689690fe_setauthsvc (DEFAULT_CLIENT_AUTHSVC ,PQerrormsg );
691+ if (pg_authsvc < 0 || pg_authsvc >=n_authsvcs )
692+ {
693+ /* Can only get here if DEFAULT_CLIENT_AUTHSVC is misdefined */
694+ return 0 ;
695+ }
696+ }
690697return authsvcs [pg_authsvc ].msgtype ;
691698}
692699
@@ -704,6 +711,10 @@ fe_getauthname(char *PQerrormsg)
704711
705712authsvc = fe_getauthsvc (PQerrormsg );
706713
714+ /* this just guards against broken DEFAULT_CLIENT_AUTHSVC, see above */
715+ if (authsvc == 0 )
716+ return NULL ;/* leave original error message in place */
717+
707718#ifdef KRB4
708719if (authsvc == STARTUP_KRB4_MSG )
709720name = pg_krb4_authname (PQerrormsg );