Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8e789e8

Browse files
committed
From: Phil Thompson <phil@river-bank.demon.co.uk>
Attached is the patch to fix the warning messages from my code. I also fixed one which wasn't my code. Apart from the usual warnings about the bison/yacc generated code I only have one other warning message. This is in gramm.y around line 2234. I wasn't sure of the fix. I've also replaced all the calls to free() in gramm.y to calls to pfree(). Without these I was getting backend crashes with GRANT. This might already have been fixed.
1 parent 2780576 commit 8e789e8

File tree

7 files changed

+66
-65
lines changed

7 files changed

+66
-65
lines changed

src/backend/libpq/auth.c

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.23 1998/01/27 03:24:54 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.24 1998/01/29 03:23:05 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -390,80 +390,83 @@ void auth_failed(Port *port)
390390
*/
391391
void be_recvauth(Port *port)
392392
{
393-
AuthRequest areq;
394-
void (*auth_handler)();
395-
396393
/*
397394
* Get the authentication method to use for this frontend/database
398395
* combination.
399396
*/
400397

401398
if (hba_getauthmethod(&port->raddr, port->database, port->auth_arg,
402399
&port->auth_method) != STATUS_OK)
403-
{
404400
PacketSendError(&port->pktInfo, "Missing or mis-configured pg_hba.conf file");
405-
return;
406-
}
407401

408-
/* Handle old style authentication. */
409-
410-
if (PG_PROTOCOL_MAJOR(port->proto) == 0)
402+
else if (PG_PROTOCOL_MAJOR(port->proto) == 0)
411403
{
404+
/* Handle old style authentication. */
405+
412406
if (old_be_recvauth(port) != STATUS_OK)
413407
auth_failed(port);
414-
415-
return;
416408
}
417-
418-
/* Handle new style authentication. */
419-
420-
switch (port->auth_method)
409+
else
421410
{
422-
case uaReject:
423-
auth_failed(port);
424-
return;
425-
426-
case uaKrb4:
427-
areq = AUTH_REQ_KRB4;
428-
auth_handler = handle_krb4_auth;
429-
break;
411+
AuthRequest areq;
412+
void (*auth_handler)();
430413

431-
case uaKrb5:
432-
areq = AUTH_REQ_KRB5;
433-
auth_handler = handle_krb5_auth;
434-
break;
414+
/* Keep the compiler quiet. */
435415

436-
case uaTrust:
437416
areq = AUTH_REQ_OK;
438-
auth_handler = handle_done_auth;
439-
break;
440417

441-
case uaIdent:
442-
if (authident(&port->raddr.in, &port->laddr.in, port->user,
443-
port->auth_arg) != STATUS_OK)
418+
/* Handle new style authentication. */
419+
420+
auth_handler = NULL;
421+
422+
switch (port->auth_method)
444423
{
445-
auth_failed(port);
446-
return;
447-
}
424+
case uaReject:
425+
break;
426+
427+
case uaKrb4:
428+
areq = AUTH_REQ_KRB4;
429+
auth_handler = handle_krb4_auth;
430+
break;
448431

449-
areq = AUTH_REQ_OK;
450-
auth_handler = handle_done_auth;
451-
break;
432+
case uaKrb5:
433+
areq = AUTH_REQ_KRB5;
434+
auth_handler = handle_krb5_auth;
435+
break;
452436

453-
case uaPassword:
454-
areq = AUTH_REQ_PASSWORD;
455-
auth_handler = handle_password_auth;
456-
break;
437+
case uaTrust:
438+
areq = AUTH_REQ_OK;
439+
auth_handler = handle_done_auth;
440+
break;
457441

458-
case uaCrypt:
459-
areq = AUTH_REQ_CRYPT;
460-
auth_handler = handle_password_auth;
461-
break;
462-
}
442+
case uaIdent:
443+
if (authident(&port->raddr.in, &port->laddr.in,
444+
port->user, port->auth_arg) == STATUS_OK)
445+
{
446+
areq = AUTH_REQ_OK;
447+
auth_handler = handle_done_auth;
448+
}
449+
450+
break;
463451

464-
/* Tell the frontend what we want next. */
452+
case uaPassword:
453+
areq = AUTH_REQ_PASSWORD;
454+
auth_handler = handle_password_auth;
455+
break;
465456

466-
sendAuthRequest(port, areq, auth_handler);
457+
case uaCrypt:
458+
areq = AUTH_REQ_CRYPT;
459+
auth_handler = handle_password_auth;
460+
break;
461+
}
462+
463+
/* Tell the frontend what we want next. */
464+
465+
if (auth_handler != NULL)
466+
sendAuthRequest(port, areq, auth_handler);
467+
else
468+
auth_failed(port);
469+
}
467470
}
468471

469472

src/backend/utils/cache/lsyscache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.10 1998/01/20 05:04:32 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.11 1998/01/29 03:23:09 scrappy Exp $
1111
*
1212
* NOTES
1313
* Eventually, the index information should go through here, too.
@@ -173,7 +173,7 @@ get_atttypmod(Oid relid, AttrNumber attnum)
173173
0, 0))
174174
return att_tup.atttypmod;
175175
else
176-
return NULL;
176+
return -1;
177177
}
178178

179179
/* ---------- INDEX CACHE ---------- */

src/backend/utils/init/postinit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.21 1997/12/20 00:10:47 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.22 1998/01/29 03:23:28 scrappy Exp $
1111
*
1212
* NOTES
1313
* InitPostgres() is the function called from PostgresMain
@@ -66,7 +66,7 @@
6666
#include "catalog/catname.h"
6767
#include "catalog/pg_database.h"
6868

69-
#include "libpq/libpq-be.h"
69+
#include "libpq/libpq.h"
7070

7171
static void VerifySystemDatabase(void);
7272
static void VerifyMyDatabase(void);

src/interfaces/libpq/fe-auth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.13 1998/01/26 01:42:25 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.14 1998/01/29 03:24:03 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -477,7 +477,7 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
477477
*/
478478
int
479479
fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
480-
const char *password, const char *PQerrormsg)
480+
const char *password, char *PQerrormsg)
481481
{
482482
switch (areq)
483483
{

src/interfaces/libpq/fe-auth.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: fe-auth.h,v 1.7 1998/01/26 01:42:26 scrappy Exp $
9+
* $Id: fe-auth.h,v 1.8 1998/01/29 03:24:21 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -33,7 +33,7 @@
3333

3434
extern int
3535
fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
36-
const char *password, const char *PQerromsg);
36+
const char *password, char *PQerromsg);
3737
extern void fe_setauthsvc(const char *name, char *PQerrormsg);
3838

3939
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */

src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.60 1998/01/28 03:42:27 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.61 1998/01/29 03:24:30 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -808,9 +808,7 @@ PQreset(PGconn *conn)
808808
* SIDE_EFFECTS: may block.
809809
*/
810810
int
811-
packetSend(PGconn *conn,
812-
char *buf,
813-
size_t len)
811+
packetSend(PGconn *conn, const char *buf, size_t len)
814812
{
815813
/* Send the total packet size. */
816814

src/interfaces/libpq/fe-connect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: fe-connect.h,v 1.6 1998/01/26 01:42:30 scrappy Exp $
9+
* $Id: fe-connect.h,v 1.7 1998/01/29 03:24:36 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -23,6 +23,6 @@
2323
*----------------------------------------------------------------
2424
*/
2525

26-
int packetSend(PGconn *conn, char *buf, size_t len);
26+
int packetSend(PGconn *conn, const char *buf, size_t len);
2727

2828
#endif /* FE_CONNECT_H */

0 commit comments

Comments
 (0)