from our long-established standard.
#include <time.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include "msql.h"
#include "libpq-fe.h"
snprintf(tbuf, BUFSIZ,
"select relname from pg_class where relkind='r' and relowner=%d",
- getuid());
+ geteuid());
if (msqlQuery(a, tbuf) > 0)
{
m = msqlStoreResult();
snprintf(tbuf, BUFSIZ,
"select relname from pg_class where relkind='i' and relowner=%d",
- getuid());
+ geteuid());
if (msqlQuery(a, tbuf) > 0)
{
m = msqlStoreResult();
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.55 2004/12/31 21:59:50 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.56 2005/01/08 22:51:12 tgl Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
*/
#if !defined(WIN32) && !defined(__CYGWIN__)
if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
- buf.st_uid != getuid())
+ buf.st_uid != geteuid())
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("unsafe permissions on private key file \"%s\"",
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.72 2004/12/31 22:02:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.73 2005/01/08 22:51:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
struct passwd *pw;
- pw = getpwuid(getuid());
+ pw = getpwuid(geteuid());
#ifndef __BEOS__ /* no root check on BEOS */
- if (!geteuid()) /* 0 is root's uid */
+ if (geteuid() == 0) /* 0 is root's uid */
{
fprintf(stderr,
_("%s: cannot be run as root\n"
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.99 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.100 2005/01/08 22:51:13 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
#include <pwd.h> /* for getpwuid() */
#endif
#include <sys/types.h> /* (ditto) */
-#include <unistd.h> /* for getuid() */
+#include <unistd.h> /* for geteuid() */
#else
#include <win32.h>
#endif
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.15 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.16 2005/01/08 22:51:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef WIN32
struct passwd *pw;
- pw = getpwuid(getuid());
+ pw = getpwuid(geteuid());
if (!pw)
{
fprintf(stderr, _("%s: could not obtain information about current user: %s\n"),
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.65 2005/01/06 21:41:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.66 2005/01/08 22:51:15 tgl Exp $
*
* NOTES
* [ Most of these notes are wrong/obsolete, but perhaps not all ]
#include "postgres_fe.h"
-#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
-#include <errno.h>
#include <ctype.h>
-#include <string.h>
#include "libpq-fe.h"
#include "libpq-int.h"
}
#ifndef WIN32
if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0077) ||
- buf.st_uid != getuid())
+ buf.st_uid != geteuid())
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("private key file \"%s\" has wrong permissions\n"),