Skip to content

Commit ba1d990

Browse files
committed
pg_user cleanup.
1 parent ea89acc commit ba1d990

File tree

9 files changed

+46
-45
lines changed

9 files changed

+46
-45
lines changed

src/backend/commands/user.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void
8989
DefineUser(CreateUserStmt *stmt)
9090
{
9191

92-
char *pg_user;
92+
char *pg_shadow;
9393
Relation pg_shadow_rel;
9494
TupleDesc pg_shadow_dsc;
9595
HeapScanDesc scan;
@@ -112,12 +112,12 @@ DefineUser(CreateUserStmt *stmt)
112112
* Make sure the user attempting to create a user can insert into the
113113
* pg_shadow relation.
114114
*/
115-
pg_user = GetPgUserName();
116-
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK)
115+
pg_shadow = GetPgUserName();
116+
if (pg_aclcheck(ShadowRelationName, pg_shadow, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK)
117117
{
118118
UserAbortTransactionBlock();
119119
elog(ERROR, "defineUser: user \"%s\" does not have SELECT and INSERT privilege for \"%s\"",
120-
pg_user, ShadowRelationName);
120+
pg_shadow, ShadowRelationName);
121121
return;
122122
}
123123

@@ -220,7 +220,7 @@ extern void
220220
AlterUser(AlterUserStmt *stmt)
221221
{
222222

223-
char *pg_user;
223+
char *pg_shadow;
224224
Relation pg_shadow_rel;
225225
TupleDesc pg_shadow_dsc;
226226
HeapScanDesc scan;
@@ -242,12 +242,12 @@ AlterUser(AlterUserStmt *stmt)
242242
* Make sure the user attempting to create a user can insert into the
243243
* pg_shadow relation.
244244
*/
245-
pg_user = GetPgUserName();
246-
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
245+
pg_shadow = GetPgUserName();
246+
if (pg_aclcheck(ShadowRelationName, pg_shadow, ACL_RD | ACL_WR) != ACLCHECK_OK)
247247
{
248248
UserAbortTransactionBlock();
249249
elog(ERROR, "alterUser: user \"%s\" does not have SELECT and UPDATE privilege for \"%s\"",
250-
pg_user, ShadowRelationName);
250+
pg_shadow, ShadowRelationName);
251251
return;
252252
}
253253

@@ -347,7 +347,7 @@ extern void
347347
RemoveUser(char *user)
348348
{
349349

350-
char *pg_user;
350+
char *pg_shadow;
351351
Relation pg_shadow_rel,
352352
pg_rel;
353353
TupleDesc pg_dsc;
@@ -369,12 +369,12 @@ RemoveUser(char *user)
369369
* Make sure the user attempting to create a user can delete from the
370370
* pg_shadow relation.
371371
*/
372-
pg_user = GetPgUserName();
373-
if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
372+
pg_shadow = GetPgUserName();
373+
if (pg_aclcheck(ShadowRelationName, pg_shadow, ACL_RD | ACL_WR) != ACLCHECK_OK)
374374
{
375375
UserAbortTransactionBlock();
376376
elog(ERROR, "removeUser: user \"%s\" does not have SELECT and DELETE privilege for \"%s\"",
377-
pg_user, ShadowRelationName);
377+
pg_shadow, ShadowRelationName);
378378
return;
379379
}
380380

@@ -463,7 +463,7 @@ RemoveUser(char *user)
463463
* tables, views, etc owned by the user.
464464
*
465465
* The second option would be to create a means of deleting tables, view,
466-
* etc. owned by the user from other databases. Pg_user is global and
466+
* etc. owned by the user from other databases. pg_shadow is global and
467467
* so this must be done at some point.
468468
*
469469
* Let us not forget that the user should be removed from the pg_groups

src/backend/libpq/pg_hba.conf.sample

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@
6868
# by the host. If AUTH_ARGUMENT is specified then the password is
6969
# compared with the user's entry in that file (in the $PGDATA
7070
# directory). See pg_passwd(1). If it is omitted then the
71-
# password is compared with the user's entry in the pg_user table.
71+
# password is compared with the user's entry in the pg_shadow
72+
# table.
7273
#
7374
# crypt: Authentication is done by matching an encrypted password supplied
74-
# by the host with that held for the user in the pg_user table.
75+
# by the host with that held for the user in the pg_shadow table.
7576
#
7677
# krb4: Kerberos V4 authentication is used.
7778
#

src/man/alter_user.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_user.l,v 1.1 1998/01/25 07:42:00 scrappy Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_user.l,v 1.2 1998/03/06 18:02:49 momjian Exp $
44
.TH "ALTER USER" SQL 01/26/98 PostgreSQL PostgreSQL
55
.SH NAME
66
alter user -- alter user account information within a PostgreSQL instance
@@ -20,10 +20,10 @@ detailed description of each of the clause in the alter user statement,
2020
please see the create_user(l) manual page. Please note that it is not
2121
possible to alter a user's usesysid via the alter user statement. Also,
2222
it is only possible for the postgres user or any user with read and modify
23-
permissions on pg_user to alter user passwords.
23+
permissions on pg_shadow to alter user passwords.
2424

2525
If any of the clauses of the alter user statement are omitted, the
26-
corresponding value in the pg_user relation is left unchanged.
26+
corresponding value in the pg_shadow relation is left unchanged.
2727

2828
This statement can be used to modify users created with createuser(1).
2929

src/man/catalogs.3

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/catalogs.3,v 1.3 1998/01/11 22:17:06 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/catalogs.3,v 1.4 1998/03/06 18:03:02 momjian Exp $
44
.TH "SYSTEM CATALOGS" INTRO 03/13/94 PostgreSQL PostgreSQL
55
.SH "Section 7 - System Catalogs"
66
.de LS
@@ -43,7 +43,7 @@ the site:
4343
\fBname\fP \fBshared/local\fP \fBdescription\fP
4444
pg_database shared current databases
4545
pg_group shared user groups
46-
pg_user shared valid users
46+
pg_shadow shared valid users
4747
.LE
4848
.SH "RULE SYSTEM CATALOGS"
4949
.LS
@@ -339,7 +339,7 @@ pg_group
339339
int2 grolist[1] /* list of usesysids of group members */
340340
.fi
341341
.nf M
342-
pg_user
342+
pg_shadow
343343
NameData usename /* user's name */
344344
int2 usesysid /* user's UNIX user id */
345345
bool usecreatedb /* can user create databases? */

src/man/create_user.l

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_user.l,v 1.1 1998/01/25 07:42:01 scrappy Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_user.l,v 1.2 1998/03/06 18:03:21 momjian Exp $
44
.TH "CREATE USER" SQL 01/26/98 PostgreSQL PostgreSQL
55
.SH NAME
66
create user -- create a new user within a PostgreSQL instance
@@ -16,23 +16,23 @@ create user -- create a new user within a PostgreSQL instance
1616
.SH DESCRIPTION
1717
.BR "create user"
1818
will add a new user to an instance of PostgreSQL. The new user will be
19-
given a usesysid of 'SELECT max(usesysid) + 1 FROM pg_user'. This means
19+
given a usesysid of 'SELECT max(usesysid) + 1 FROM pg_shadow'. This means
2020
that a PostgreSQL user's usesysid will not correspond to their operating
2121
system(OS) user id. The exception to this rule is the 'postgres' user,
2222
whose OS user id is used as the usesysid during the initdb process. If
2323
you still want the OS user id and the usesysid to match for any given
2424
user, then use the createuser(1) script provided with the PostgreSQL
2525
distribution.
2626

27-
The 'with password' clause sets the user's password within the pg_user
28-
relation. For this reason, pg_user is no longer accessible to the
27+
The 'with password' clause sets the user's password within the pg_shadow
28+
relation. For this reason, pg_shadow is no longer accessible to the
2929
'public' group. Please note that when initdb(1) is executed for an
3030
instance of PostgreSQL that the postgres user's password is initially set
31-
to NULL. When a user's password in the pg_user relation is NULL, then
31+
to NULL. When a user's password in the pg_shadow relation is NULL, then
3232
user authentication proceeds as it historically has (HBA, PG_PASSWORD,
3333
etc). However, if a password is set for a user, then a new authentication
3434
system supplants any other configured for the PostgreSQL instance, and the
35-
password stored in the pg_user relation is used for authentication. For
35+
password stored in the pg_shadow relation is used for authentication. For
3636
more details on how this authentication system functions see pg_crypt(3).
3737
If the 'with password' clause is omitted, then the user's password is set
3838
to the empty string with equates to a NULL value in the authentication
@@ -54,9 +54,9 @@ defined in the pg_group relation).
5454

5555
Finally, the 'valid until' clause sets an absolute time after which the
5656
user's PostgreSQL login is no longer valid. Please note that if a user
57-
does not have a password defined in the pg_user relation, then the valid
57+
does not have a password defined in the pg_shadow relation, then the valid
5858
until date will not be checked during user authentication. If this clause
59-
is omitted, then a NULL value is stored in pg_user for this attribute, and
59+
is omitted, then a NULL value is stored in pg_shadow for this attribute, and
6060
the login will be valid for all time.
6161

6262
.SH EXAMPLES

src/man/createuser.1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/createuser.1,v 1.6 1998/01/26 01:42:44 scrappy Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/createuser.1,v 1.7 1998/03/06 18:03:31 momjian Exp $
44
.TH CREATEUSER UNIX 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
createuser - create a Postgres user
@@ -19,7 +19,7 @@ port]
1919
.SH DESCRIPTION
2020
.IR Createuser
2121
creates a new Postgres user. Only users with \*(lqusesuper\*(rq set in
22-
the \*(lqpg_user\*(rq class can create new Postgres users. As shipped,
22+
the \*(lqpg_shadow\*(rq class can create new Postgres users. As shipped,
2323
the user \*(lqpostgres\*(rq can create users.
2424
.PP
2525
.IR Createuser
@@ -96,8 +96,8 @@ is running on the proper host and that you have specified the proper
9696
port. If your site uses an authentication system, ensure that you
9797
have obtained the required authentication credentials.
9898
.TP
99-
.BI "user \*(lq" "username" "\*(rq is not in \*(lqpg_user\*(rq"
100-
You do not have a valid entry in the relation \*(lqpg_user\*(rq and
99+
.BI "user \*(lq" "username" "\*(rq is not in \*(lqpg_shadow\*(rq"
100+
You do not have a valid entry in the relation \*(lqpg_shadow\*(rq and
101101
cannot do anything with Postgres at all; contact your Postgres site
102102
administrator.
103103
.TP
@@ -106,7 +106,7 @@ You do not have permission to create new users; contact your Postgres
106106
site administrator.
107107
.TP
108108
.BI "user \*(lq" "username" "\*(rq already exists"
109-
The user to be added already has an entry in the \*(lqpg_user\*(rq
109+
The user to be added already has an entry in the \*(lqpg_shadow\*(rq
110110
class.
111111
.TP
112112
.BR "database access failed"

src/man/destroyuser.1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/destroyuser.1,v 1.6 1998/01/26 01:42:46 scrappy Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/destroyuser.1,v 1.7 1998/03/06 18:03:35 momjian Exp $
44
.TH DESTROYUSER UNIX 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
destroyuser - destroy a Postgres user and associated databases
@@ -21,7 +21,7 @@ port]
2121
.IR Destroyuser
2222
destroys an existing Postgres user and the databases for which that user
2323
is database administrator. Only users with \*(lqusesuper\*(rq set in
24-
the \*(lqpg_user\*(rq class can destroy new Postgres users. As shipped,
24+
the \*(lqpg_shadow\*(rq class can destroy new Postgres users. As shipped,
2525
the user \*(lqpostgres\*(rq can destroy users.
2626
.PP
2727
.IR Destroyuser
@@ -92,8 +92,8 @@ is running on the proper host and that you have specified the proper
9292
port. If your site uses an authentication system, ensure that you
9393
have obtained the required authentication credentials.
9494
.TP
95-
.BI "user \*(lq" "username" "\*(rq is not in \*(lqpg_user\*(rq"
96-
You do not have a valid entry in the relation \*(lqpg_user\*(rq and
95+
.BI "user \*(lq" "username" "\*(rq is not in \*(lqpg_shadow\*(rq"
96+
You do not have a valid entry in the relation \*(lqpg_shadow\*(rq and
9797
cannot do anything with Postgres at all; contact your Postgres site
9898
administrator.
9999
.TP
@@ -102,7 +102,7 @@ You do not have permission to delete users; contact your Postgres site
102102
administrator.
103103
.TP
104104
.BI "user \*(lq" "username" "\*(rq does not exist"
105-
The user to be removed does not have an entry in the \*(lqpg_user\*(rq
105+
The user to be removed does not have an entry in the \*(lqpg_shadow\*(rq
106106
class.
107107
.TP
108108
.BR "database access failed"

src/man/pg_dumpall.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dumpall.1,v 1.3 1998/01/11 22:17:47 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dumpall.1,v 1.4 1998/03/06 18:03:37 momjian Exp $
44
.TH pg_dumpall UNIX 1/20/96 PostgreSQL PostgreSQL
55
.SH NAME
66
pg_dumpall - dumps out all Postgres databases into a script file
@@ -10,7 +10,7 @@ pg_dumpall - dumps out all Postgres databases into a script file
1010
.SH DESCRIPTION
1111
.IR "pg_dumpall"
1212
is a utility for dumping out all Postgres databases into one file.
13-
It also dumps the pg_user table, which is global to all databases.
13+
It also dumps the pg_shadow table, which is global to all databases.
1414
pg_dumpall creates each dumped database before loading.
1515
pg_dumpall takes all pg_dump options, but \fB-f\fR and \fBdbname\fR
1616
should not be used.

src/man/pg_hba.conf.5

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" This is -*-nroff-*-
2-
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_hba.conf.5,v 1.4 1998/01/27 03:25:14 scrappy Exp $
2+
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_hba.conf.5,v 1.5 1998/03/06 18:03:38 momjian Exp $
33
.TH pg_hba.conf 5 1/26/98 PostgreSQL PostgreSQL
44
.SH NAME
55
$PGDATA/pg_hba.conf
@@ -61,16 +61,16 @@ domain sockets.
6161
.PP
6262
.IR crypt
6363
- the client is asked for a password for the user. This is sent encrypted
64-
(using crypt(3)) and compared against the password held in the pg_user table.
64+
(using crypt(3)) and compared against the password held in the pg_shadow table.
6565
If the passwords match, the connection is allowed.
6666
.PP
6767
.IR password
6868
- the client is asked for a password for the user. This is sent in clear
69-
and compared against the password held in the pg_user table.
69+
and compared against the password held in the pg_shadow table.
7070
If the passwords match, the connection is allowed. An optional password file
7171
may be specified after the
7272
.IR password
73-
keyword which is used to match the supplied password rather than the pg_user
73+
keyword which is used to match the supplied password rather than the pg_shadow
7474
table. See pg_passwd(1).
7575
.PP
7676
The following authentication methods are supported for TCP/IP

0 commit comments

Comments
 (0)