* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.66 2000/08/03 16:34:01 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.67 2000/08/27 21:50:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
fp = AllocateFile(tempname, "w");
umask(oumask);
if (fp == NULL)
- elog(ERROR, "%s: %m", tempname);
+ elog(ERROR, "write_password_file: unable to write %s: %m", tempname);
/* read table */
scan = heap_beginscan(rel, false, SnapshotSelf, 0, NULL);
filename = crypt_getpwdreloadfilename();
flagfd = BasicOpenFile(filename, O_WRONLY | O_CREAT, 0600);
if (flagfd < 0)
- elog(NOTICE, "%s: %m", filename);
+ elog(NOTICE, "write_password_file: unable to write %s: %m", filename);
else
close(flagfd);
pfree((void *) filename);
* Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed.
*
- * $Id: crypt.c,v 1.28 2000/07/12 22:58:59 petere Exp $
+ * $Id: crypt.c,v 1.29 2000/08/27 21:50:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
+#include <errno.h>
#include <unistd.h>
#include "postgres.h"
/*-------------------------------------------------------------------------*/
char *
-crypt_getpwdfilename()
+crypt_getpwdfilename(void)
{
-
- static char *pfnam = NULL;
int bufsize;
+ char *pfnam;
bufsize = strlen(DataDir) + 8 + strlen(CRYPT_PWD_FILE) + 1;
pfnam = (char *) palloc(bufsize);
/*-------------------------------------------------------------------------*/
char *
-crypt_getpwdreloadfilename()
+crypt_getpwdreloadfilename(void)
{
-
- static char *rpfnam = NULL;
char *pwdfilename;
int bufsize;
+ char *rpfnam;
pwdfilename = crypt_getpwdfilename();
bufsize = strlen(pwdfilename) + strlen(CRYPT_PWD_RELOAD_SUFX) + 1;
/*-------------------------------------------------------------------------*/
-static
-FILE *
-crypt_openpwdfile()
+static FILE *
+crypt_openpwdfile(void)
{
char *filename;
FILE *pwdfile;
filename = crypt_getpwdfilename();
pwdfile = AllocateFile(filename, PG_BINARY_R);
+ if (pwdfile == NULL)
+ fprintf(stderr, "Couldn't read %s: %s\n",
+ filename, strerror(errno));
+
return pwdfile;
}
/*-------------------------------------------------------------------------*/
-static
-int
+static int
compar_user(const void *user_a, const void *user_b)
{
/*-------------------------------------------------------------------------*/
-static
-void
-crypt_loadpwdfile()
+static void
+crypt_loadpwdfile(void)
{
char *filename;
/*-------------------------------------------------------------------------*/
-static
-void
+static void
crypt_parsepwdentry(char *buffer, char **pwd, char **valdate)
{
/*-------------------------------------------------------------------------*/
-static
-int
+static int
crypt_getloginfo(const char *user, char **passwd, char **valuntil)
{
-
char *pwd,
*valdate;
void *fakeout;
* 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.53 2000/07/08 03:04:39 tgl Exp $
+ * $Id: hba.c,v 1.54 2000/08/27 21:50:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* The open of the config file failed. */
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "find_hba_entry: Host-based authentication config file "
- "does not exist or permissions are not setup correctly! "
- "Unable to open file \"%s\".\n",
- conf_file);
+ "find_hba_entry: Unable to open authentication config file \"%s\": %s\n",
+ conf_file, strerror(errno));
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
}
{
/* The open of the map file failed. */
- *checks_out_p = false;
-
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "verify_against_usermap: usermap file for Ident-based "
- "authentication "
- "does not exist or permissions are not setup correctly! "
- "Unable to open file \"%s\".\n",
- map_file);
+ "verify_against_usermap: Unable to open usermap file \"%s\": %s\n",
+ map_file, strerror(errno));
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
+
+ *checks_out_p = false;
}
else
{
snprintf(map_file, bufsize, "%s/%s", DataDir, CHARSET_FILE);
file = AllocateFile(map_file, PG_BINARY_R);
if (file == NULL)
+ {
+ /* XXX should we log a complaint? */
return;
+ }
while (!eof)
{
c = getc(file);
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: password.c,v 1.31 2000/07/08 03:04:40 tgl Exp $
+ * $Id: password.c,v 1.32 2000/08/27 21:50:18 tgl Exp $
*
*/
+#include <errno.h>
#include <unistd.h>
#include "postgres.h"
if (!pw_file)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "verify_password: couldn't open password file '%s'\n",
- pw_file_fullname);
+ "verify_password: Unable to open password file \"%s\": %s\n",
+ pw_file_fullname, strerror(errno));
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);