Revert patch that removed BUFSIZ usage. The memory has to hold the
authorBruce Momjian <bruce@momjian.us>
Tue, 28 Sep 2004 00:07:01 +0000 (00:07 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 28 Sep 2004 00:07:01 +0000 (00:07 +0000)
structures plus pointers used by the structure.

src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-secure.c
src/port/getaddrinfo.c
src/port/thread.c

index 71159134b63d1514c71735569dd3d12fcb8f34e4..17862a0c807d3c77ea8570b832066a108872df90 100644 (file)
@@ -10,7 +10,7 @@
  * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.92 2004/09/27 23:38:45 momjian Exp $
+ *   $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.93 2004/09/28 00:06:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -749,7 +749,7 @@ fe_getauthname(char *PQerrormsg)
        if (GetUserName(username, &namesize))
            name = username;
 #else
-       char        pwdbuf[sizeof(struct passwd)];
+       char        pwdbuf[BUFSIZ];
        struct passwd pwdstr;
        struct passwd *pw = NULL;
 
index d4f93733da4658c35d7f62b81a89a1a778b4dc64..199ae9c2fd85d2fc476d31646c800a66b62cb95f 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.53 2004/09/27 23:38:45 momjian Exp $
+ *   $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.54 2004/09/28 00:06:02 momjian Exp $
  *
  * NOTES
  *   [ Most of these notes are wrong/obsolete, but perhaps not all ]
@@ -512,7 +512,7 @@ verify_peer(PGconn *conn)
 
    {
        struct hostent hpstr;
-       char        buf[sizeof(struct hostent)];
+       char        buf[BUFSIZ];
        int         herrno = 0;
 
        /*
@@ -598,7 +598,7 @@ load_dh_file(int keylength)
 #ifdef WIN32
    return NULL;
 #else
-   char        pwdbuf[sizeof(struct passwd)];
+   char        pwdbuf[BUFSIZ];
    struct passwd pwdstr;
    struct passwd *pwd = NULL;
    FILE       *fp;
@@ -745,7 +745,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
 #ifdef WIN32
    return 0;
 #else
-   char        pwdbuf[sizeof(struct passwd)];
+   char        pwdbuf[BUFSIZ];
    struct passwd pwdstr;
    struct passwd *pwd = NULL;
    struct stat buf,
@@ -952,7 +952,7 @@ initialize_SSL(PGconn *conn)
 {
 #ifndef WIN32
    struct stat buf;
-   char        pwdbuf[sizeof(struct passwd)];
+   char        pwdbuf[BUFSIZ];
    struct passwd pwdstr;
    struct passwd *pwd = NULL;
    char        fnbuf[MAXPGPATH];
index 283d45b26fc57fbc4e6e64dd1e97c3696d9619e0..ee4d71b10711059b29ab03f905ecba4122369f51 100644 (file)
@@ -12,7 +12,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.14 2004/09/27 23:39:14 momjian Exp $
+ *   $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.15 2004/09/28 00:07:01 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,7 +85,7 @@ getaddrinfo(const char *node, const char *service,
 
 #ifdef FRONTEND
            struct hostent hpstr;
-           char        buf[sizeof(struct hostent)];
+           char        buf[BUFSIZ];
            int         herrno = 0;
 
            pqGethostbyname(node, &hpstr, buf, sizeof(buf),
index cbf8f4ddefbb97842f41ab2950b0ba564d62762d..0b4414e7b1a6d5643cb3033d1ee401202ee40fae 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/port/thread.c,v 1.27 2004/09/27 23:39:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/thread.c,v 1.28 2004/09/28 00:07:01 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -103,6 +103,7 @@ pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
    /* POSIX version */
    getpwuid_r(uid, resultbuf, buffer, buflen, result);
 #else
+
    /*
     * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
     * getpwuid_r(uid, resultbuf, buffer, buflen)
@@ -110,6 +111,7 @@ pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
    *result = getpwuid_r(uid, resultbuf, buffer, buflen);
 #endif
 #else
+
    /* no getpwuid_r() available, just use getpwuid() */
    *result = getpwuid(uid);
 #endif