Commit Graph

65 Commits

Author SHA1 Message Date
Marc G. Fournier 5bdda53f12 From: Bryan Henderson <bryanh@giraffe-data.com>
Here's a fix for a tiny memory leak in PQsetdb/PQfinish.

(Analysis of a running program indicates there are several others, but
this is the only obvious one I saw in the code).
1998-04-21 04:00:06 +00:00
Bruce Momjian f07c7bf4e7 I have been troubled by a segmentation fault when reloading from
a dumpall.  This has been happening when a second \connect is
encountered.

The faulty code was in fe-connect.c, where the memory for the user
password was freed, but the pointer itself was not set to NULL.
Later, the memory was reused and the password appeared not to be
empty, so that an attempt was made to reference it.

Oliver Elphick
1998-03-26 23:46:14 +00:00
Bruce Momjian a32450a585 pgindent run before 6.3 release, with Thomas' requested changes. 1998-02-26 04:46:47 +00:00
Marc G. Fournier 7a33578436 From: Phil Thompson <phil@river-bank.demon.co.uk>
I haven't had final confirmation from Peter yet, but the attached patch
needs to be applied for the Beta otherwise password and crypt
authentication just won't work.

It puts back the loop in libpq and also fixes a couple of problems with
maintaining compatability with pre-6.3 drivers.
1998-01-31 21:27:28 +00:00
Marc G. Fournier 8e789e8ef1 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.
1998-01-29 03:24:36 +00:00
Marc G. Fournier 8a02b22e89 From: Peter T Mount <patches@maidast.demon.co.uk>
This has a problem when using any authentication other than trust or
ident.

Anything using libpq will hang, because the client will go into a loop
while connecting. The following patch simply comments out two lines (a do
and a while), removing the loop. Going through the new scheme, I can't see
why this do..while loop is in there.
1998-01-28 03:42:27 +00:00
Marc G. Fournier d5bbe2aca5 From: Phil Thompson <phil@river-bank.demon.co.uk>
I've completed the patch to fix the protocol and authentication issues I
was discussing a couple of weeks ago.  The particular changes are:

- the protocol has a version number
- network byte order is used throughout
- the pg_hba.conf file is used to specify what method is used to
  authenticate a frontend (either password, ident, trust, reject, krb4
  or krb5)
- support for multiplexed backends is removed
- appropriate changes to man pages
- the -a switch to many programs to specify an authentication service
  no longer has any effect
- the libpq.so version number has changed to 1.1

The new backend still supports the old protocol so old interfaces won't
break.
1998-01-26 01:42:53 +00:00
Marc G. Fournier c487962dd7 Fixes a free() problem under FreeBSD
Fixed pointed out by: jwieck@debis.com (Jan Wieck)
1998-01-23 02:31:18 +00:00
Marc G. Fournier 98c7cb11de From: Jan Wilhelm <Jan_Wilhelm@Physik.TU-Muenchen.DE>
a) psql dumps core when using -a password and PGUSER is set but PGPASSWORD
   not set.
1998-01-17 23:17:46 +00:00
Bruce Momjian cb3ce64f2e Cleanup of prototypes. FIx for PQtrace start/stop several times. 1998-01-14 15:48:51 +00:00
Vadim B. Mikheev 1fd402be54 Remove unused "option" from PQconnectdb(). 1998-01-13 14:57:25 +00:00
Marc G. Fournier 602b0d0c1c From: Goran Thyni <goran@bildbasen.se>
OK, here comes a patch, DBD::Pg (and possibly other 3rd party clients)
can connect to unix sockets.
Patch is against current source tree.

Background:
libpq set some policy for client, which it should not
IMHO. It prevent some 3rd party clients to connect with
unix domain sockets etc.
1998-01-13 04:24:10 +00:00
Bruce Momjian 5a5cb30096 Fix tolower loops to go in proper direction for cache. 1997-12-05 01:13:24 +00:00
Bruce Momjian 8d30b40843 Update description for PGHOST and unix domain sockets. Add warning for failed connections. 1997-12-04 20:32:35 +00:00
Bruce Momjian 7d2fafe636 Update description for PGHOST and unix domain sockets. Add warning for failed connections. 1997-12-04 20:26:37 +00:00
Marc G. Fournier 4c04f7724e From: todd brandys <brandys@eng3.hep.uiuc.edu>
An extension to the code to allow for a pg_password authentication database
that is *seperate* from the system password file
1997-12-04 00:28:15 +00:00
Bruce Momjian b05eddaaab Fix pg_dump, and libpq changes. 1997-12-01 22:02:49 +00:00
Bruce Momjian dfc1a6a848 Document pg_dump -z, clean up option list. Fix problem with libpq handling of field names uppercase code. 1997-12-01 21:01:24 +00:00
Thomas G. Lockhart 80c1e82232 Unscramble port selection logic to avoid compiler complaints about
uninitialized variables. I _think_ the logic is preserved...
1997-11-17 16:42:39 +00:00
Thomas G. Lockhart 3a73060ba5 Add other initialization environment variables:
PGCOSTHEAP, PGCOSTINDEX, PGRPLANS, PGGEQO
 (PGDATESTYLE, PGTZ already defined)
1997-11-14 15:38:31 +00:00
Thomas G. Lockhart 367089b0c1 Add PGTZ environment variable to initialization code.
Rename PG_DATESTYLE to PGDATESTYLE environment variable.
Move environment variable code to a different place so it now works!
Note that regression tests can now run with "setenv PGTZ PST8PDT"
 at the frontend rather than requiring the backend to have TZ set.
1997-11-10 15:41:58 +00:00
Bruce Momjian baeb8790ac Fix case issues with quotes. 1997-11-10 05:10:50 +00:00
Bruce Momjian c17fa36d3c Add Unix domain socket support, from Goran Thyni, goran@bildbasen.se 1997-11-07 20:52:15 +00:00
Bruce Momjian 3f365ba0fc Inline memset() as MemSet(). 1997-09-18 20:22:58 +00:00
Bruce Momjian 59f6a57e59 Used modified version of indent that understands over 100 typedefs. 1997-09-08 21:56:23 +00:00
Bruce Momjian 319dbfa736 Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
Bruce Momjian 1ccd423235 Massive commit to run PGINDENT on all *.c and *.h files. 1997-09-07 05:04:48 +00:00
Bruce Momjian 868d708188 Add // comments. 1997-09-05 00:09:47 +00:00
Marc G. Fournier 8d1f52ef24 From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] More psql and libpq patches

Well..these would be the last patches until the release (I hope)...
I ran the regression tests while watching psql under purify, and it did
not leak even one byte.

In this patch:

* Plugged a major leak when PSQL reads files for input (either through
  \i options or through -f option)
* Fixed the one remaining leak in PSQL in not clearing PGresult *results
  everywhere it is supposed to. (Thanks Tymm)
* Fixed A small leak in PSQL not clearing all the PGsettings correctly.
* A not-so-obvious (but small) leak in Libpq when PQsetdb fails for any
  reason.
* Added \n to some Libpq error messages to make them easier to digest..
* Finally, added /* PURIFY */ comment to some of the code indicating
  the reason for why it was added/changed...for future developers.
1997-06-06 01:42:02 +00:00
Marc G. Fournier 9a5529f4d1 From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] memory leak patches in libpq and psql

A couple of small memory leak patches (detected with Purify) primarily
in libpq.

* Fixed (NULL) border problem in psql (run psql, do \m, then select
  something from a table...row separators will be nulls)
* Fixed memory leak with the abovementioned border not being freed
  properly.
* Fixed memory leak in freePGconn() not freeing conn->port
* Fixed up PQclear() to free parts of PGresult only if these
  parts are not null.
* Fixed a decent memory leak that occured after executing every command
  in psql. PGresult *results was not freed most of the time.

There is still a leak being detected (2 bytes) in readline functions, but
I think this is old readline library. I will install new one and test it.
1997-06-01 15:39:08 +00:00
Bruce Momjian a1157deb57 Added fcvt() prot for bsdi.
Made PQsetdb() and PQfnumber() case-insensitive.
Removed attempt to set table ownership via pg_dumpall.
1997-05-20 03:39:02 +00:00
Bruce Momjian b6b41172f6 fix for sizeof pointed out by Ed Buddington 1997-05-13 01:46:00 +00:00
Marc G. Fournier 498d2d1edc From: Edmund Mergl <E.Mergl@bawue.de>
Subject: [PATCHES] libpq patch

Hi,

here is a small patch which fixes two problems:

1. libpq/libpq-fe.h:

somehow disappeared the line

#define DefaultOption ""

now compilation stops with an error complainig an
unknown DefaultOption (970508).


2. Same patch as I sent already twice, but it never made it
  into the source tree:  there is no default value for
  AuthType and Password. This way any libpq-application
  (i.e. perl-scripts) which use the function PQconnectdb
  will break with PostgreSQL-6.1. The patch simply uses
  an empty string as default value.
1997-05-09 03:28:54 +00:00
Marc G. Fournier 8217202134 From: "Martin J. Laubach" <mjl@CSlab.tuwien.ac.at>
Subject: [PATCHES] libpq SET var TO patch

  One last, I hope. This one corrects a bogus format string, and
actually sends the contents of PG_DATESTYLE to the backend. That
means, you can do a setenv PG_DATESTYLE 'iso', and your libpq
will pick that up and tell the backend.
1997-05-07 03:13:50 +00:00
Marc G. Fournier cbaa98835c From: Raymond Toy <toy@rtp.ericsson.se>
Subject: [PATCHES] 970417:  some large object patches


Two patches here, made against 970417.  Both have to do with large
objects:

        1.  lobjfuncs was not initialized in PQconnectdb.  This causes
            failure later if large objects are used.  (Someone already
            caught this error in PQsetdb.)

        2.  Postgres functions lo_import and lo_export sometimes
            produce garbage for the file names because the filename
            strings aren't always terminated by \0.  (VARDATA isn't
            necessarily null terminated.)
1997-04-17 20:39:31 +00:00
Vadim B. Mikheev be0e8f7fb0 connectDB(): setsockopt (..., TCP_NODELAY, ...) added. 1997-04-16 06:29:19 +00:00
Marc G. Fournier cacaaed62b A couple of cleanups from Scott Harrison <Scott_Harrison@next.com> 1997-04-15 19:08:13 +00:00
Marc G. Fournier 920c58df71 From: "Martin J. Laubach" <mjl@CSlab.tuwien.ac.at>
Subject: [HACKERS] libpq variable set patch

  Just a small change, so the automatic variable setting on
connection startup actually works...
1997-04-02 18:26:25 +00:00
Marc G. Fournier 6304e2c273 Here's two more diffs...
The first fixes a warning from gcc about the assignment within the condition.
The extra set of parens should not make a difference, but with -Werror, they
are necessary.

The second fixes an "ln -s" invocation that assumes the current directory is
implicitly the target if not specified.  Not true in all cases, and again, it
should not make a difference except to those implementation that it does.

From: "Michael P. Snyder" <msnyder@hawkeye.huntersmoon.com>
1997-03-25 09:08:06 +00:00
Marc G. Fournier ef56e51cd3 - Renamed the variable names to something shorter, and I hope
nicer. Also, I grabbed my copy of the Informix manual, and
    added a couple of variables that make sense (formats for
    money, time, a language setting, a timezone).

  - New functions SetPGVariable() and GetPGVariable() in tcop/*.
    These don't actually do anything for the moment, but should
    be enough to implement the SET var_name TO var_val in the
    parser?

    SetPGVariable() expects just two strings, the var_name and
    the var_value from above, and is expected to do the right thing.
    Returns TRUE if  everything okay.


From: "Martin J. Laubach" <mjl@wwx.vip.at>
1997-03-25 02:37:21 +00:00
Marc G. Fournier 812a6c2b54 - Move most of the I/O in both libpq and the backend to a set
of common routines in pqcomprim.c (pq communication primitives).
    Not all adapted to it yet, but it's a start.

  - Rewritten some of those routines, to write/read bigger chunks of
    data, precomputing stuff in buffers instead of sending out byte
    by byte.

  - As a consequence, I need to know the endianness of the machine.
    Currently I rely on getting it from machine/endian.h, but this
    may not be available everywhere? (Who the hell thought it was
    a good idea to pass integers to the backend the other way around
    than the normal network byte order? *argl*)

  - Libpq looks in the environment for magic variables, and upon
    establishing a connection to the backend, sends it queries
    of the form "SET var_name TO 'var_value'". This needs a change
    in the backend parser (Mr. Parser, are you there? :)

  - Currently it looks for two Env-Vars, namely PG_DATEFORMAT
    and PG_FLOATFORMAT. What else makes sense? PG_TIMEFORMAT?
    PG_TIMEZONE?

From: "Martin J. Laubach" <mjl@wwx.vip.at>
1997-03-18 20:15:39 +00:00
Marc G. Fournier 3a7c93e7f3 From: Dan McGuirk <mcguirk@indirect.com>
Subject: [HACKERS] password authentication

This patch adds support for plaintext password authentication.  To use
it, you add a line like

host         all         0.0.0.0       0.0.0.0           password  pg_pwd.conf


to your pg_hba.conf, where 'pg_pwd.conf' is the name of a file containing
the usernames and password hashes in the format of the first two fields
of a Unix /etc/passwd file.  (Of course, you can use a specific database
name or IP instead.)

Then, to connect with a password through libpq, you use the PQconnectdb()
function, specifying the "password=" tag in the connect string and also
adding the tag "authtype=password".

I also added a command-line switch '-u' to psql that tells it to prompt
for a username and password and use password authentication.
1997-03-12 21:23:16 +00:00
Marc G. Fournier a5494a2d92 Various patches for nextstep by GregorHoffleit
Replaced NEED_STRDUP by !HAVE_STRDUP
1997-02-13 08:32:20 +00:00
Bryan Henderson f0e7004d29 Make strdup work for Ultrix. Thanks Erik Bertelsen 1996-11-28 03:32:18 +00:00
Bryan Henderson 93f722536f Whoops, redo Ultrix patch so the other ports still compile. 1996-11-26 07:39:11 +00:00
Bryan Henderson 46d58fba33 Make it compile on Ultrix. Thanks Erik Bertelson. 1996-11-26 03:20:35 +00:00
Bryan Henderson f64b840387 Remove most compile-time options, add a few runtime options to make up for it.
In particular, no more compiled-in default for PGDATA or LIBDIR.  Commands
that need them need either invocation options or environment variables.
PGPORT default is hardcoded as 5432, but overrideable with options or
environment variables.
1996-11-14 10:25:54 +00:00
Marc G. Fournier 41b8c2c849 As proposed,
following is the patch to libpq's large object interface that
    removes the requirement to  include  fmgr.h  into  fe-lobj.c.
    The  large object interface now ask's the backend to tell the
    OID's of all the required functions in pg_proc.

From: wieck@sapserv.debis.de (Jan Wieck)
1996-11-11 12:16:57 +00:00
Bruce Momjian aaeef4d17d All external function definitions now have prototypes that are checked. 1996-11-10 03:06:38 +00:00
Bryan Henderson 2e21b7e4bc Add #include <ctype.h> to quiet compiler about missing declaration of isspace(). 1996-11-10 01:46:14 +00:00