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
ab179d69
Commit
ab179d69
authored
Dec 12, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make password null on startup.
parent
c60f70b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
14 deletions
+35
-14
src/backend/commands/user.c
src/backend/commands/user.c
+28
-8
src/backend/libpq/be-pqexec.c
src/backend/libpq/be-pqexec.c
+3
-3
src/backend/libpq/crypt.c
src/backend/libpq/crypt.c
+2
-1
src/include/catalog/pg_user.h
src/include/catalog/pg_user.h
+2
-2
No files found.
src/backend/commands/user.c
View file @
ab179d69
...
...
@@ -152,11 +152,14 @@ void DefineUser(CreateUserStmt *stmt) {
/* Add the stuff here for groups.
*/
UpdatePgPwdFile
(
sql
);
/* This goes after the UpdatePgPwdFile to be certain that two backends to not
* attempt to write to the pg_pwd file at the same time.
*/
RelationUnsetLockForWrite
(
pg_user_rel
);
heap_close
(
pg_user_rel
);
UpdatePgPwdFile
(
sql
);
if
(
IsTransactionBlock
()
&&
!
inblock
)
EndTransactionBlock
();
}
...
...
@@ -195,6 +198,10 @@ extern void AlterUser(AlterUserStmt *stmt) {
*/
pg_user_rel
=
heap_openr
(
UserRelationName
);
pg_user_dsc
=
RelationGetTupleDescriptor
(
pg_user_rel
);
/* Secure a write lock on pg_user so we can be sure that when the dump of
* the pg_pwd file is done, there is not another backend doing the same.
*/
RelationSetLockForWrite
(
pg_user_rel
);
scan
=
heap_beginscan
(
pg_user_rel
,
false
,
false
,
0
,
NULL
);
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
,
&
buffer
)))
{
...
...
@@ -207,9 +214,10 @@ extern void AlterUser(AlterUserStmt *stmt) {
}
}
heap_endscan
(
scan
);
heap_close
(
pg_user_rel
);
if
(
!
exists
)
{
RelationUnsetLockForWrite
(
pg_user_rel
);
heap_close
(
pg_user_rel
);
UserAbortTransactionBlock
();
elog
(
WARN
,
"alterUser: user
\"
%s
\"
does not exist"
,
stmt
->
user
);
return
;
...
...
@@ -257,6 +265,9 @@ extern void AlterUser(AlterUserStmt *stmt) {
UpdatePgPwdFile
(
sql
);
RelationUnsetLockForWrite
(
pg_user_rel
);
heap_close
(
pg_user_rel
);
if
(
IsTransactionBlock
()
&&
!
inblock
)
EndTransactionBlock
();
}
...
...
@@ -265,7 +276,8 @@ extern void AlterUser(AlterUserStmt *stmt) {
extern
void
RemoveUser
(
char
*
user
)
{
char
*
pg_user
;
Relation
pg_rel
;
Relation
pg_user_rel
,
pg_rel
;
TupleDesc
pg_dsc
;
HeapScanDesc
scan
;
HeapTuple
tuple
;
...
...
@@ -295,10 +307,14 @@ extern void RemoveUser(char* user) {
/* Perform a scan of the pg_user relation to find the usesysid of the user to
* be deleted. If it is not found, then return a warning message.
*/
pg_rel
=
heap_openr
(
UserRelationName
);
pg_dsc
=
RelationGetTupleDescriptor
(
pg_rel
);
pg_user_rel
=
heap_openr
(
UserRelationName
);
pg_dsc
=
RelationGetTupleDescriptor
(
pg_user_rel
);
/* Secure a write lock on pg_user so we can be sure that when the dump of
* the pg_pwd file is done, there is not another backend doing the same.
*/
RelationSetLockForWrite
(
pg_user_rel
);
scan
=
heap_beginscan
(
pg_rel
,
false
,
false
,
0
,
NULL
);
scan
=
heap_beginscan
(
pg_
user_
rel
,
false
,
false
,
0
,
NULL
);
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
,
&
buffer
)))
{
datum
=
heap_getattr
(
tuple
,
buffer
,
Anum_pg_user_usename
,
pg_dsc
,
&
n
);
...
...
@@ -310,9 +326,10 @@ extern void RemoveUser(char* user) {
ReleaseBuffer
(
buffer
);
}
heap_endscan
(
scan
);
heap_close
(
pg_rel
);
if
(
usesysid
==
-
1
)
{
RelationUnsetLockForWrite
(
pg_user_rel
);
heap_close
(
pg_user_rel
);
UserAbortTransactionBlock
();
elog
(
WARN
,
"removeUser: user
\"
%s
\"
does not exist"
,
user
);
return
;
...
...
@@ -373,6 +390,9 @@ extern void RemoveUser(char* user) {
UpdatePgPwdFile
(
sql
);
RelationUnsetLockForWrite
(
pg_user_rel
);
heap_close
(
pg_user_rel
);
if
(
IsTransactionBlock
()
&&
!
inblock
)
EndTransactionBlock
();
}
src/backend/libpq/be-pqexec.c
View file @
ab179d69
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.1
0 1997/12/06 22:56:35
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.1
1 1997/12/12 16:26:14
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -143,11 +143,11 @@ PQexec(char *query)
be_portalpush
(
entry
);
/* ----------------
* pg_e
val
_dest will put the query results in a portal which will
* pg_e
xec_query
_dest will put the query results in a portal which will
* end up on the top of the portal stack.
* ----------------
*/
pg_e
val
_dest
(
query
,
(
char
**
)
NULL
,
(
Oid
*
)
NULL
,
0
,
Local
);
pg_e
xec_query
_dest
(
query
,
(
char
**
)
NULL
,
(
Oid
*
)
NULL
,
0
,
Local
);
/* ----------------
* pop the portal off the portal stack and return the
...
...
src/backend/libpq/crypt.c
View file @
ab179d69
...
...
@@ -17,6 +17,7 @@
#endif
#include "postgres.h"
#include "miscadmin.h"
#include "libpq/crypt.h"
#include "utils/nabstime.h"
#include "utils/palloc.h"
...
...
@@ -129,7 +130,7 @@ MsgType crypt_salt(const char* user) {
crypt_getloginfo
(
user
,
&
passwd
,
&
valuntil
);
if
(
passwd
==
NULL
||
*
passwd
==
'\0'
)
{
if
(
passwd
==
NULL
||
*
passwd
==
'\0'
||
!
strcmp
(
passwd
,
"
\\
N"
)
)
{
if
(
passwd
)
pfree
((
void
*
)
passwd
);
if
(
valuntil
)
pfree
((
void
*
)
valuntil
);
return
STARTUP_UNSALT_MSG
;
...
...
src/include/catalog/pg_user.h
View file @
ab179d69
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_user.h,v 1.
7 1997/12/09 03:11:25 scrappy
Exp $
* $Id: pg_user.h,v 1.
8 1997/12/12 16:26:36 momjian
Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -65,7 +65,7 @@ typedef FormData_pg_user *Form_pg_user;
* initial contents of pg_user
* ----------------
*/
DATA
(
insert
OID
=
0
(
postgres
PGUID
t
t
t
t
""
2116994400
));
DATA
(
insert
OID
=
0
(
postgres
PGUID
t
t
t
t
_null_
2116994400
));
BKI_BEGIN
#ifdef ALLOW_PG_GROUP
...
...
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