Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8afe005f
Commit
8afe005f
authored
Jan 08, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consistently use geteuid() not getuid(); there were a few places deviating
from our long-established standard.
parent
b5adf46c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
16 deletions
+14
-16
contrib/mSQL-interface/mpgsql.c
contrib/mSQL-interface/mpgsql.c
+3
-2
src/backend/libpq/be-secure.c
src/backend/libpq/be-secure.c
+2
-2
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+3
-3
src/bin/psql/help.c
src/bin/psql/help.c
+2
-2
src/bin/scripts/common.c
src/bin/scripts/common.c
+2
-2
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/fe-secure.c
+2
-5
No files found.
contrib/mSQL-interface/mpgsql.c
View file @
8afe005f
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "msql.h"
#include "libpq-fe.h"
...
...
@@ -264,7 +265,7 @@ msqlListTables(int a)
snprintf
(
tbuf
,
BUFSIZ
,
"select relname from pg_class where relkind='r' and relowner=%d"
,
getuid
());
get
e
uid
());
if
(
msqlQuery
(
a
,
tbuf
)
>
0
)
{
m
=
msqlStoreResult
();
...
...
@@ -288,7 +289,7 @@ msqlListIndex(int a, char *b, char *c)
snprintf
(
tbuf
,
BUFSIZ
,
"select relname from pg_class where relkind='i' and relowner=%d"
,
getuid
());
get
e
uid
());
if
(
msqlQuery
(
a
,
tbuf
)
>
0
)
{
m
=
msqlStoreResult
();
...
...
src/backend/libpq/be-secure.c
View file @
8afe005f
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.5
5 2004/12/31 21:59:50 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.5
6 2005/01/08 22:51:12 tg
l Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
...
...
@@ -676,7 +676,7 @@ initialize_SSL(void)
*/
#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
!=
get
e
uid
())
ereport
(
FATAL
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"unsafe permissions on private key file
\"
%s
\"
"
,
...
...
src/bin/initdb/initdb.c
View file @
8afe005f
...
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.7
2 2004/12/31 22:02:59 pgsq
l Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.7
3 2005/01/08 22:51:12 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -628,11 +628,11 @@ get_id(void)
struct
passwd
*
pw
;
pw
=
getpwuid
(
getuid
());
pw
=
getpwuid
(
get
e
uid
());
#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
"
...
...
src/bin/psql/help.c
View file @
8afe005f
...
...
@@ -3,7 +3,7 @@
*
* 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"
...
...
@@ -19,7 +19,7 @@
#include <pwd.h>
/* for getpwuid() */
#endif
#include <sys/types.h>
/* (ditto) */
#include <unistd.h>
/* for getuid() */
#include <unistd.h>
/* for get
e
uid() */
#else
#include <win32.h>
#endif
...
...
src/bin/scripts/common.c
View file @
8afe005f
...
...
@@ -5,7 +5,7 @@
* 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.1
5 2004/12/31 22:03:17 pgsq
l Exp $
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.1
6 2005/01/08 22:51:14 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -27,7 +27,7 @@ get_user_name(const char *progname)
#ifndef WIN32
struct
passwd
*
pw
;
pw
=
getpwuid
(
getuid
());
pw
=
getpwuid
(
get
e
uid
());
if
(
!
pw
)
{
fprintf
(
stderr
,
_
(
"%s: could not obtain information about current user: %s
\n
"
),
...
...
src/interfaces/libpq/fe-secure.c
View file @
8afe005f
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.6
5 2005/01/06 21:41:44
tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.6
6 2005/01/08 22:51:15
tgl Exp $
*
* NOTES
* [ Most of these notes are wrong/obsolete, but perhaps not all ]
...
...
@@ -79,12 +79,9 @@
#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"
...
...
@@ -819,7 +816,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
}
#ifndef WIN32
if
(
!
S_ISREG
(
buf
.
st_mode
)
||
(
buf
.
st_mode
&
0077
)
||
buf
.
st_uid
!=
getuid
())
buf
.
st_uid
!=
get
e
uid
())
{
printfPQExpBuffer
(
&
conn
->
errorMessage
,
libpq_gettext
(
"private key file
\"
%s
\"
has wrong permissions
\n
"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment