Skip to content

Commit c4e53a1

Browse files
committed
Fixes for:
Here are a few minor fixes to Postgres95. Mostly I have added const to some of the char pointers. There was also a missing header file and a place where it looks like "==" was used when "=" was meant. I also changed some variables from Pfin and Pfout tp pfin and pfout because the latter shadow global variables and that just seems like an unsafe practice which I like to avoid. Submitted by: "D'Arcy J.M. Cain" <darcy@druid.druid.com>
1 parent fd3b829 commit c4e53a1

File tree

6 files changed

+90
-89
lines changed

6 files changed

+90
-89
lines changed

src/interfaces/libpq/fe-auth.c

Lines changed: 14 additions & 14 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.3 1996/07/27 02:27:55 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.4 1996/08/06 16:16:42 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -162,16 +162,16 @@ pg_krb4_authname(char* PQerrormsg)
162162
* (canonicalized to omit all domain suffixes).
163163
*/
164164
static int
165-
pg_krb4_sendauth(char* PQerrormsg, int sock,
165+
pg_krb4_sendauth(const char* PQerrormsg, int sock,
166166
struct sockaddr_in *laddr,
167167
struct sockaddr_in *raddr,
168-
char *hostname)
168+
const char *hostname)
169169
{
170170
long krbopts = 0; /* one-way authentication */
171171
KTEXT_ST clttkt;
172172
int status;
173173
char hostbuf[MAXHOSTNAMELEN];
174-
char *realm = getenv("PGREALM"); /* NULL == current realm */
174+
const char *realm = getenv("PGREALM"); /* NULL == current realm */
175175

176176
if (!hostname || !(*hostname)) {
177177
if (gethostname(hostbuf, MAXHOSTNAMELEN) < 0)
@@ -227,7 +227,7 @@ pg_krb4_sendauth(char* PQerrormsg, int sock,
227227
* and we can't afford to punt.
228228
*/
229229
static char *
230-
pg_an_to_ln(char *aname)
230+
pg_an_to_ln(const char *aname)
231231
{
232232
char *p;
233233

@@ -246,7 +246,7 @@ pg_an_to_ln(char *aname)
246246
*
247247
*/
248248
static int
249-
krb5_ccache pg_krb5_init()
249+
krb5_ccache pg_krb5_init(void)
250250
{
251251
krb5_error_code code;
252252
char *realm, *defname;
@@ -287,8 +287,8 @@ krb5_ccache pg_krb5_init()
287287
*
288288
* We obtain this information by digging around in the ticket file.
289289
*/
290-
static char *
291-
pg_krb5_authname(char* PQerrormsg)
290+
static const char *
291+
pg_krb5_authname(const char* PQerrormsg)
292292
{
293293
krb5_ccache ccache;
294294
krb5_principal principal;
@@ -335,15 +335,15 @@ pg_krb5_authname(char* PQerrormsg)
335335
* in the PGREALM (or local) database. This is probably a bad assumption.
336336
*/
337337
static int
338-
pg_krb5_sendauth(char* PQerrormsg,int sock,
338+
pg_krb5_sendauth(const char* PQerrormsg,int sock,
339339
struct sockaddr_in *laddr,
340340
struct sockaddr_in *raddr,
341-
char *hostname)
341+
const char *hostname)
342342
{
343343
char servbuf[MAXHOSTNAMELEN + 1 +
344344
sizeof(PG_KRB_SRVNAM)];
345-
char *hostp;
346-
char *realm;
345+
const char *hostp;
346+
const char *realm;
347347
krb5_error_code code;
348348
krb5_principal client, server;
349349
krb5_ccache ccache;
@@ -430,7 +430,7 @@ pg_krb5_sendauth(char* PQerrormsg,int sock,
430430
* fe_sendauth -- client demux routine for outgoing authentication information
431431
*/
432432
int
433-
fe_sendauth(MsgType msgtype, Port *port, char *hostname, char* PQerrormsg)
433+
fe_sendauth(MsgType msgtype, Port *port, const char *hostname, const char* PQerrormsg)
434434
{
435435
switch (msgtype) {
436436
#ifdef KRB4
@@ -474,7 +474,7 @@ fe_sendauth(MsgType msgtype, Port *port, char *hostname, char* PQerrormsg)
474474
static pg_authsvc = -1;
475475

476476
void
477-
fe_setauthsvc(char *name, char* PQerrormsg)
477+
fe_setauthsvc(const char *name, char* PQerrormsg)
478478
{
479479
int i;
480480

src/interfaces/libpq/fe-auth.h

Lines changed: 3 additions & 3 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.1.1.1 1996/07/09 06:22:17 scrappy Exp $
9+
* $Id: fe-auth.h,v 1.2 1996/08/06 16:16:44 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -28,8 +28,8 @@
2828
#define DEFAULT_CLIENT_AUTHSVC "kerberos"
2929
#endif /* KRB4 || KRB5 */
3030

31-
extern int fe_sendauth(MsgType msgtype, Port *port, char *hostname, char* PQerromsg);
32-
extern void fe_setauthsvc(char *name, char* PQerrormsg);
31+
extern int fe_sendauth(MsgType msgtype, Port *port, const char *hostname, const char* PQerromsg);
32+
extern void fe_setauthsvc(const char *name, char* PQerrormsg);
3333

3434
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
3535
#define PG_KRB5_VERSION "PGVER5.1"

src/interfaces/libpq/fe-connect.c

Lines changed: 4 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.4 1996/07/23 03:35:12 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.5 1996/08/06 16:16:45 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -31,7 +31,7 @@
3131
standard function? (My, my. Touchy today, are we?) */
3232
static
3333
char *
34-
strdup(char *string)
34+
strdup(const char *string)
3535
{
3636
char *nstr;
3737

@@ -64,10 +64,10 @@ static void closePGconn(PGconn *conn);
6464
* ----------------
6565
*/
6666
PGconn*
67-
PQsetdb(char *pghost, char* pgport, char* pgoptions, char* pgtty, char* dbName)
67+
PQsetdb(const char *pghost, const char* pgport, const char* pgoptions, const char* pgtty, const char* dbName)
6868
{
6969
PGconn *conn;
70-
char *tmp;
70+
const char *tmp;
7171

7272
conn = (PGconn*)malloc(sizeof(PGconn));
7373

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy