summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth.c
AgeCommit message (Collapse)Author
2006-02-12> I've now tested this patch at home w/ 8.2HEAD and it seems to fix theBruce Momjian
> bug. I plan on testing it under 8.1.2 at work tommorow with > mod_auth_krb5, etc, and expect it'll work there. Assuming all goes > well and unless someone objects I'll forward the patch to -patches. > It'd be great to have this fixed as it'll allow us to use Kerberos to > authenticate to phppgadmin and other web-based tools which use > Postgres. While playing with this patch under 8.1.2 at home I discovered a mistake in how I manually applied one of the hunks to fe-auth.c. Basically, the base code had changed and so the patch needed to be modified slightly. This is because the code no longer either has a freeable pointer under 'name' or has 'name' as NULL. The attached patch correctly frees the string from pg_krb5_authname (where it had been strdup'd) if and only if pg_krb5_authname returned a string (as opposed to falling through and having name be set using name = pw->name;). Also added a comment to this effect. Please review. Stephen Frost (sfrost@snowman.net) wrote:
2005-12-26Rename pg_make_encrypted_password to PQencryptPassword.Peter Eisentraut
2005-12-23Add an officially exported libpq function to encrypt passwords, andTom Lane
modify the previous \password patch to use it instead of depending on a not-officially-exported function. Per discussion.
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-10-24I have applied the following patch to document PQinitSSL() andBruce Momjian
PQregisterThreadLock(). I also remove the crypt() mention in the libpq threading section and added a single sentence in the client-auth manual page under crypt(). Crypt authentication is so old now that a separate paragraph about it seemed unwise. I also added a comment about our use of locking around pqGetpwuid().
2005-10-17Clean up libpq's pollution of application namespace by renaming theTom Lane
exported routines of ip.c, md5.c, and fe-auth.c to begin with 'pg_'. Also get rid of the vestigial fe_setauthsvc/fe_getauthsvc routines altogether.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-10-08Fix Kerberos authentication in wake of virtual-hosts changes --- needTom Lane
to call krb5_sname_to_principal() always. Also, use krb_srvname rather than the hardwired string 'postgres' as the appl_version string in the krb5_sendauth/recvauth calls, to avoid breaking compatibility with PG 8.0. Magnus Hagander
2005-06-30Fix a theoretical memory leak in pg_password_sendauth(). If the firstNeil Conway
malloc() succeeded but the second failed, the buffer allocated by the first malloc() would be leaked. Fix this by allocating both buffers via a single malloc(), as suggested by Tom. Per Coverity static analysis performed by EnterpriseDB.
2005-06-27Remove support for Kerberos V4. It seems no one is using this, it hasNeil Conway
some security issues, and upstream has declared it "dead". Patch from Magnus Hagander, minor editorialization from Neil Conway.
2005-06-04Allow kerberos name and username case sensitivity to be specified fromBruce Momjian
postgresql.conf. --------------------------------------------------------------------------- Here's an updated version of the patch, with the following changes: 1) No longer uses "service name" as "application version". It's instead hardcoded as "postgres". It could be argued that this part should be backpatched to 8.0, but it doesn't make a big difference until you can start changing it with GUC / connection parameters. This change only affects kerberos 5, not 4. 2) Now downcases kerberos usernames when the client is running on win32. 3) Adds guc option for "krb_caseins_users" to make the server ignore case mismatch which is required by some KDCs such as Active Directory. Off by default, per discussion with Tom. This change only affects kerberos 5, not 4. 4) Updated so it doesn't conflict with the rendevouz/bonjour patch already in ;-) Magnus Hagander
2005-03-25Kerberos fixes from Magnus Hagander --- in theory Kerberos 5 authTom Lane
should work on Windows now. Also, rename set_noblock to pg_set_noblock; since it is included in libpq, the former name polluted application namespace.
2005-01-12Add conditional inclusion of <com_err.h> to support old 'heimdal'Tom Lane
version of Kerberos. Per report from Reinhard Max.
2005-01-04Clean up code in libpq that obtains user's home directory: make a singleTom Lane
subroutine that can hide platform dependencies. The WIN32 path is still a stub, but I await a fix from one of the win32 hackers. Also clean up unnecessary #ifdef WIN32 ugliness in a couple of places.
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
2004-12-20Remove direct inclusions of <com_err.h> as well as configure test forTom Lane
its presence. This amounts to desupporting Kerberos 5 releases 1.0.*, which is small loss, and simplifies use of our Kerberos code on platforms with Red-Hat-style include file layouts. Per gripe from John Gray and followup discussion.
2004-11-09Get rid of perror(), substitute some better phrased error messages.Peter Eisentraut
malloc() doesn't set errno, so most uses were buggy anyway.
2004-10-16Allow pg_ctl to determine the server is up when getting a request for aBruce Momjian
password. Make password error message a #define and use it consistently. Sean Chittenden
2004-09-28Revert patch that removed BUFSIZ usage. The memory has to hold theBruce Momjian
structures plus pointers used by the structure.
2004-09-27Remove use of large BUFSIZ for buffers and use the proper struct sizes.Bruce Momjian
This greatly helps threaded libpq programs.
2004-08-29Update copyright to 2004.Bruce Momjian
2004-03-24Add thread locking to SSL and Kerberos connections.Bruce Momjian
I have removed the docs mentioning that SSL and Kerberos are not thread-safe. Manfred Spraul
2004-01-07More janitorial work: remove the explicit casting of NULL literals to aNeil Conway
pointer type when it is not necessary to do so. For future reference, casting NULL to a pointer type is only necessary when (a) invoking a function AND either (b) the function has no prototype OR (c) the function is a varargs function.
2003-12-20Dept. of third thoughts: in fact, libpq should support SCM_CREDS challengeTom Lane
even when HAVE_GETPEEREID is defined, else it will be unable to connect to pre-7.4 backends that are using IDENT authentication.
2003-12-20Fix broken IDENT support for FreeBSD (appears to have been broken byTom Lane
ill-considered conditional logic in getpeereid patch of 3-Dec-2002). Per bug #1021.
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-11-26Cast field-length variables used in printf to int, because sometimesPeter Eisentraut
they might be of a wider type.
2003-10-25Remove socket credentials defines not referenced.Bruce Momjian
2003-08-04Update copyrights to 2003.Bruce Momjian
2003-08-04pgindent run.Bruce Momjian
2003-06-25> This change (I'm sure this will wrap poorly -- sorry):Bruce Momjian
> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/include/libpq/pqcomm.h.diff?r1=1.85&r2=1.86 > > modified SockAddr, but no corresponding change was made here > (fe-auth.c:612): > > case AUTH_REQ_KRB5: > #ifdef KRB5 > if (pg_krb5_sendauth(PQerrormsg, conn->sock, &conn->laddr.in, > &conn->raddr.in, > hostname) != STATUS_OK) > > It's not obvious to me what the change ought to be though. This patch should hopefully fix both kerberos 4 and 5. Kurt Roeckx
2003-06-14Make libpq thread-safe with configure --with-threads option.Bruce Momjian
Lee Kindness
2003-06-08libpq can now talk to either 3.0 or 2.0 protocol servers. It first triesTom Lane
protocol 3, then falls back to 2 if postmaster rejects the startup packet with an old-format error message. A side benefit of the rewrite is that SSL-encrypted connections can now be made without blocking. (I think, anyway, but do not have a good way to test.)
2003-05-16Revert kerberos code breakage.Tom Lane
2003-05-15Allow Win32 to compile under MinGW. Major changes are:Bruce Momjian
Win32 port is now called 'win32' rather than 'win' add -lwsock32 on Win32 make gethostname() be only used when kerberos4 is enabled use /port/getopt.c new /port/opendir.c routines disable GUC unix_socket_group on Win32 convert some keywords.c symbols to KEYWORD_P to prevent conflict create new FCNTL_NONBLOCK macro to turn off socket blocking create new /include/port.h file that has /port prototypes, move out of c.h new /include/port/win32_include dir to hold missing include files work around ERROR being defined in Win32 includes
2003-04-19Second round of FE/BE protocol changes. Frontend->backend messages nowTom Lane
have length counts, and COPY IN data is packetized into messages.
2003-04-17First phase of FE/BE protocol modifications: new StartupPacket layoutTom Lane
with variable-width fields. No more truncation of long user names. Also, libpq can now send its environment-variable-driven SET commands as part of the startup packet, saving round trips to server.
2003-03-10This patch fixes a bunch of spelling mistakes in comments throughout theTom Lane
PostgreSQL source code. Neil Conway
2003-01-29Guard against array overrun, per report from Yichen Xie. This caseTom Lane
can only occur if the constant DEFAULT_CLIENT_AUTHSVC is given a bogus value, so it doesn't seem worth back-patching, but I'll fix it in HEAD.
2002-12-03Deal with cases where getpeereid _and_ another creditial method isBruce Momjian
supported.
2002-09-04pgindent run.Bruce Momjian
2002-09-02I checked all the previous string handling errors and most of them wereBruce Momjian
already fixed by You. However there were a few left and attached patch should fix the rest of them. I used StringInfo only in 2 places and both of them are inside debug ifdefs. Only performance penalty will come from using strlen() like all the other code does. I also modified some of the already patched parts by changing snprintf(buf, 2 * BUFSIZE, ... style lines to snprintf(buf, sizeof(buf), ... where buf is an array. Jukka Holappa
2002-08-29Remove support for version-0 FE/BE protocol, per pghackers discussion.Tom Lane
This breaks support for 6.2 or older client libraries.
2002-07-20Hello, i noticed that win32 native stopped working/compiling after the SSL mergeBruce Momjian
. So i took the opportunity to fix some stuff: 1. Made the thing compile (typos & needed definitions) with the new pqsecure_* s tuff, and added fe-secure.c to the win32.mak makefile. 2. Fixed some MULTIBYTE compile errors (when building without MB support). 3. Made it do that you can build with debug info: "nmake -f win32.mak DEBUG=1". 4. Misc small compiler speedup changes. The resulting .dll has been tested in production, and everything seems ok. I CC:ed -hackers because i'm not sure about two things: 1. In libpq-int.h I typedef ssize_t as an int because Visual C (v6.0) doesn't de fine ssize_t. Is that ok, or is there any standard about what type should be use d for ssize_t? 2. To keep the .dll api consistent regarding MULTIBYTE I just return -1 in fe-connect.c:PQsetClientEncoding() instead of taking away the whole function. I wonder if i should do any compares with the conn->client_encoding and return 0 if not hing would have changed (if so how do i check that?). Regards Magnus Naeslund
2002-06-20Update copyright to 2002.Bruce Momjian
2002-06-11Katherine Ward wrote:Jan Wieck
> Changes to avoid collisions with WIN32 & MFC names... > 1. Renamed: > a. PROC => PGPROC > b. GetUserName() => GetUserNameFromId() > c. GetCurrentTime() => GetCurrentDateTime() > d. IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim > > 2. Added _P to some lex/yacc tokens: > CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT Jan
2002-04-24Remove reference to NAMEDATALEN, which wasn't necessary anyway.Peter Eisentraut
2002-02-23Heimdal support (Kerberos V implementation from KTH)Peter Eisentraut
2001-11-05New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian
initdb/regression tests pass.
2001-10-25pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian
tests pass.