diff options
Diffstat (limited to 'src/backend/libpq')
-rw-r--r-- | src/backend/libpq/auth.c | 9 | ||||
-rw-r--r-- | src/backend/libpq/be-dumpdata.c | 4 | ||||
-rw-r--r-- | src/backend/libpq/be-fsstubs.c | 28 | ||||
-rw-r--r-- | src/backend/libpq/hba.c | 37 | ||||
-rw-r--r-- | src/backend/libpq/portalbuf.c | 10 | ||||
-rw-r--r-- | src/backend/libpq/pqcomm.c | 23 | ||||
-rw-r--r-- | src/backend/libpq/pqformat.c | 9 | ||||
-rw-r--r-- | src/backend/libpq/pqpacket.c | 20 |
8 files changed, 74 insertions, 66 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index 0b62b29c797..890be537c2e 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.43 2000/01/26 05:56:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.44 2000/04/12 17:15:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -48,7 +48,7 @@ static int pg_passwordv0_recvauth(void *arg, PacketLen len, void *pkt); static int checkPassword(Port *port, char *user, char *password); static int old_be_recvauth(Port *port); static int map_old_to_new(Port *port, UserAuth old, int status); -static void auth_failed(Port *port); +static void auth_failed(Port *port); #ifdef KRB4 @@ -130,7 +130,7 @@ static int pg_krb4_recvauth(Port *port) { snprintf(PQerrormsg, PQERRORMSG_LENGTH, - "pg_krb4_recvauth: Kerberos not implemented on this server.\n"); + "pg_krb4_recvauth: Kerberos not implemented on this server.\n"); fputs(PQerrormsg, stderr); pqdebug("%s", PQerrormsg); @@ -455,7 +455,7 @@ be_recvauth(Port *port) * an error message into the postmaster logfile if it failed. */ - if (hba_getauthmethod(port) != STATUS_OK) + if (hba_getauthmethod(port) != STATUS_OK) PacketSendError(&port->pktInfo, "Missing or erroneous pg_hba.conf file, see postmaster log for details"); @@ -472,6 +472,7 @@ be_recvauth(Port *port) AuthRequest areq = AUTH_REQ_OK; PacketDoneProc auth_handler = NULL; + switch (port->auth_method) { case uaReject: diff --git a/src/backend/libpq/be-dumpdata.c b/src/backend/libpq/be-dumpdata.c index 296527337b4..fcc63e1e2a0 100644 --- a/src/backend/libpq/be-dumpdata.c +++ b/src/backend/libpq/be-dumpdata.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: be-dumpdata.c,v 1.32 2000/01/26 05:56:28 momjian Exp $ + * $Id: be-dumpdata.c,v 1.33 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -184,7 +184,7 @@ be_typeinit(PortalEntry *entry, for (i = 0; i < natts; ++i) { strncpy(group->types[i].name, - NameStr(attrs[i]->attname), NAMEDATALEN); + NameStr(attrs[i]->attname), NAMEDATALEN); group->types[i].typid = attrs[i]->atttypid; group->types[i].typlen = attrs[i]->attlen; } diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index c97bf0d0647..1ac73fa0ea4 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.43 2000/01/26 05:56:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.44 2000/04/12 17:15:14 momjian Exp $ * * NOTES * This should be moved to a more appropriate place. It is here @@ -18,7 +18,7 @@ * * These functions operate in a private GlobalMemoryContext, which means * that large object descriptors hang around until we destroy the context. - * That happens in lo_commit(). It'd be possible to prolong the lifetime + * That happens in lo_commit(). It'd be possible to prolong the lifetime * of the context so that LO FDs are good across transactions (for example, * we could release the context only if we see that no FDs remain open). * But we'd need additional state in order to do the right thing at the @@ -259,9 +259,9 @@ lo_tell(int fd) } /* - * We assume we do not need to switch contexts for inv_tell. - * That is true for now, but is probably more than this module - * ought to assume... + * We assume we do not need to switch contexts for inv_tell. That is + * true for now, but is probably more than this module ought to + * assume... */ return inv_tell(cookies[fd]); } @@ -269,10 +269,11 @@ lo_tell(int fd) int lo_unlink(Oid lobjId) { + /* - * inv_drop does not need a context switch, indeed it doesn't - * touch any LO-specific data structures at all. (Again, that's - * probably more than this module ought to be assuming.) + * inv_drop does not need a context switch, indeed it doesn't touch + * any LO-specific data structures at all. (Again, that's probably + * more than this module ought to be assuming.) * * XXX there ought to be some code to clean up any open LOs that * reference the specified relation... as is, they remain "open". @@ -417,9 +418,9 @@ lo_export(Oid lobjId, text *filename) /* * open the file to be written to * - * Note: we reduce backend's normal 077 umask to the slightly - * friendlier 022. This code used to drop it all the way to 0, - * but creating world-writable export files doesn't seem wise. + * Note: we reduce backend's normal 077 umask to the slightly friendlier + * 022. This code used to drop it all the way to 0, but creating + * world-writable export files doesn't seem wise. */ nbytes = VARSIZE(filename) - VARHDRSZ + 1; if (nbytes > FNAME_BUFSIZE) @@ -470,8 +471,9 @@ lo_commit(bool isCommit) currentContext = MemoryContextSwitchTo((MemoryContext) fscxt); - /* Clean out still-open index scans (not necessary if aborting) - * and clear cookies array so that LO fds are no longer good. + /* + * Clean out still-open index scans (not necessary if aborting) and + * clear cookies array so that LO fds are no longer good. */ for (i = 0; i < MAX_LOBJ_FDS; i++) { diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 799693ca51d..2bdf5fbf4b4 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -5,7 +5,7 @@ * wherein you authenticate a user by seeing what IP address the system * says he comes from and possibly using ident). * - * $Id: hba.c,v 1.50 2000/03/17 02:36:08 tgl Exp $ + * $Id: hba.c,v 1.51 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -209,31 +209,32 @@ process_hba_record(FILE *file, hbaPort *port, bool *matches_p, bool *error_p) */ if ((strcmp(db, port->database) != 0 && strcmp(db, "all") != 0 && - (strcmp(db, "sameuser") != 0 || strcmp(port->database, port->user) != 0)) || - port->raddr.sa.sa_family != AF_UNIX) + (strcmp(db, "sameuser") != 0 || strcmp(port->database, port->user) != 0)) || + port->raddr.sa.sa_family != AF_UNIX) return; } else if (strcmp(buf, "host") == 0 || strcmp(buf, "hostssl") == 0) { struct in_addr file_ip_addr, mask; - bool discard = 0; /* Discard this entry */ + bool discard = 0;/* Discard this entry */ #ifdef USE_SSL /* If SSL, then check that we are on SSL */ - if (strcmp(buf, "hostssl") == 0) { - if (!port->ssl) - discard = 1; - - /* Placeholder to require specific SSL level, perhaps? */ - /* Or a client certificate */ - - /* Since we were on SSL, proceed as with normal 'host' mode */ + if (strcmp(buf, "hostssl") == 0) + { + if (!port->ssl) + discard = 1; + + /* Placeholder to require specific SSL level, perhaps? */ + /* Or a client certificate */ + + /* Since we were on SSL, proceed as with normal 'host' mode */ } #else /* If not SSL, we don't support this */ - if (strcmp(buf,"hostssl") == 0) - goto syntax; + if (strcmp(buf, "hostssl") == 0) + goto syntax; #endif /* Get the database. */ @@ -286,7 +287,7 @@ process_hba_record(FILE *file, hbaPort *port, bool *matches_p, bool *error_p) * "out of sync" with the file. */ if (discard) - return; + return; /* * If this record isn't for our database, or this is the wrong @@ -294,8 +295,8 @@ process_hba_record(FILE *file, hbaPort *port, bool *matches_p, bool *error_p) */ if ((strcmp(db, port->database) != 0 && strcmp(db, "all") != 0 && - (strcmp(db, "sameuser") != 0 || strcmp(port->database, port->user) != 0)) || - port->raddr.sa.sa_family != AF_INET || + (strcmp(db, "sameuser") != 0 || strcmp(port->database, port->user) != 0)) || + port->raddr.sa.sa_family != AF_INET || ((file_ip_addr.s_addr ^ port->raddr.in.sin_addr.s_addr) & mask.s_addr) != 0x0000) return; } @@ -353,7 +354,7 @@ process_open_config_file(FILE *file, hbaPort *port, bool *hba_ok_p) /* If no matching entry was found, synthesize 'reject' entry. */ if (!found_entry) - port->auth_method = uaReject; + port->auth_method = uaReject; *hba_ok_p = true; } diff --git a/src/backend/libpq/portalbuf.c b/src/backend/libpq/portalbuf.c index 44be2950611..3cab2e4a7df 100644 --- a/src/backend/libpq/portalbuf.c +++ b/src/backend/libpq/portalbuf.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.23 2000/03/17 02:36:08 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.24 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ portals_realloc(size_t size) portals = newp; else libpq_raise(&PortalError, - vararg_format("Cannot alloc more memory in portals_realloc")); + vararg_format("Cannot alloc more memory in portals_realloc")); for (i = oldsize; i < (int) portals_array_size; i++) portals[i] = (PortalEntry *) NULL; @@ -461,7 +461,7 @@ pbuf_findGroup(PortalBuffer *portal, if (group == NULL) libpq_raise(&PortalError, - vararg_format("Group index %d out of bound.", group_index)); + vararg_format("Group index %d out of bound.", group_index)); return group; } @@ -484,7 +484,7 @@ pbuf_findFnumber(GroupBuffer *group, return i; libpq_raise(&PortalError, - vararg_format("Field-name %s does not exist.", field_name)); + vararg_format("Field-name %s does not exist.", field_name)); /* not reached, here to make compiler happy */ return 0; @@ -501,7 +501,7 @@ pbuf_checkFnumber(GroupBuffer *group, { if (field_number < 0 || field_number >= group->no_fields) libpq_raise(&PortalError, - vararg_format("Field number %d out of bound.", field_number)); + vararg_format("Field number %d out of bound.", field_number)); } /* -------------------------------- diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 3895ae546f0..61c9e97b392 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -29,7 +29,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pqcomm.c,v 1.87 2000/01/26 05:56:29 momjian Exp $ + * $Id: pqcomm.c,v 1.88 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -75,7 +75,7 @@ #include "postgres.h" #include "libpq/libpq.h" -#include "utils/trace.h" /* needed for HAVE_FCNTL_SETLK */ +#include "utils/trace.h" /* needed for HAVE_FCNTL_SETLK */ #include "miscadmin.h" @@ -270,7 +270,7 @@ StreamServerPort(char *hostName, unsigned short portName, int *fdP) { snprintf(PQerrormsg, PQERRORMSG_LENGTH, "FATAL: StreamServerPort: bind() failed: %s\n" - "\tIs another postmaster already running on that port?\n", + "\tIs another postmaster already running on that port?\n", strerror(errno)); if (family == AF_UNIX) snprintf(PQerrormsg + strlen(PQerrormsg), @@ -438,15 +438,15 @@ pq_recvbuf(void) for (;;) { int r; - + #ifdef USE_SSL if (MyProcPort->ssl) - r = SSL_read(MyProcPort->ssl, PqRecvBuffer + PqRecvLength, - PQ_BUFFER_SIZE - PqRecvLength); + r = SSL_read(MyProcPort->ssl, PqRecvBuffer + PqRecvLength, + PQ_BUFFER_SIZE - PqRecvLength); else #endif - r = recv(MyProcPort->sock, PqRecvBuffer + PqRecvLength, - PQ_BUFFER_SIZE - PqRecvLength, 0); + r = recv(MyProcPort->sock, PqRecvBuffer + PqRecvLength, + PQ_BUFFER_SIZE - PqRecvLength, 0); if (r < 0) { @@ -561,9 +561,7 @@ pq_getstring(StringInfo s) /* Read until we get the terminating '\0' */ while ((c = pq_getbyte()) != EOF && c != '\0') - { appendStringInfoChar(s, c); - } if (c == EOF) return EOF; @@ -614,12 +612,13 @@ pq_flush(void) while (bufptr < bufend) { int r; + #ifdef USE_SSL if (MyProcPort->ssl) - r = SSL_write(MyProcPort->ssl, bufptr, bufend - bufptr); + r = SSL_write(MyProcPort->ssl, bufptr, bufend - bufptr); else #endif - r = send(MyProcPort->sock, bufptr, bufend - bufptr, 0); + r = send(MyProcPort->sock, bufptr, bufend - bufptr, 0); if (r <= 0) { diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c index 9147039a008..7275893c5c0 100644 --- a/src/backend/libpq/pqformat.c +++ b/src/backend/libpq/pqformat.c @@ -16,7 +16,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pqformat.c,v 1.12 2000/01/26 05:56:29 momjian Exp $ + * $Id: pqformat.c,v 1.13 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -156,6 +156,7 @@ void pq_sendstring(StringInfo buf, const char *str) { int slen = strlen(str); + #ifdef MULTIBYTE char *p; @@ -237,13 +238,15 @@ int pq_puttextmessage(char msgtype, const char *str) { int slen = strlen(str); + #ifdef MULTIBYTE char *p; p = (char *) pg_server_to_client((unsigned char *) str, slen); if (p != str) /* actual conversion has been done? */ { - int result = pq_putmessage(msgtype, p, strlen(p) + 1); + int result = pq_putmessage(msgtype, p, strlen(p) + 1); + pfree(p); return result; } @@ -308,8 +311,10 @@ int pq_getstr(StringInfo s) { int result; + #ifdef MULTIBYTE char *p; + #endif result = pq_getstring(s); diff --git a/src/backend/libpq/pqpacket.c b/src/backend/libpq/pqpacket.c index 21dd26ca178..defc57f69af 100644 --- a/src/backend/libpq/pqpacket.c +++ b/src/backend/libpq/pqpacket.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.25 2000/03/19 22:10:07 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.26 2000/04/12 17:15:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -54,17 +54,17 @@ int PacketReceiveFragment(Port *port) { int got; - Packet *pkt = &port->pktInfo; + Packet *pkt = &port->pktInfo; #ifdef USE_SSL - if (port->ssl) - got = SSL_read(port->ssl, pkt->ptr, pkt->nrtodo); + if (port->ssl) + got = SSL_read(port->ssl, pkt->ptr, pkt->nrtodo); else #endif - got = read(port->sock, pkt->ptr, pkt->nrtodo); + got = read(port->sock, pkt->ptr, pkt->nrtodo); if (got > 0) { - pkt->nrtodo -= got; + pkt->nrtodo -= got; pkt->ptr += got; /* See if we have got what we need for the packet length. */ @@ -143,14 +143,14 @@ int PacketSendFragment(Port *port) { int done; - Packet *pkt = &port->pktInfo; + Packet *pkt = &port->pktInfo; #ifdef USE_SSL - if (port->ssl) - done = SSL_write(port->ssl, pkt->ptr, pkt->nrtodo); + if (port->ssl) + done = SSL_write(port->ssl, pkt->ptr, pkt->nrtodo); else #endif - done = write(port->sock, pkt->ptr, pkt->nrtodo); + done = write(port->sock, pkt->ptr, pkt->nrtodo); if (done > 0) { |