mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
From: Jan Wieck <jwieck@debis.com>
seems that my last post didn't make it through. That's good
since the diff itself didn't covered the renaming of
pg_user.h to pg_shadow.h and it's new content.
Here it's again. The complete regression test passwd with
only some float diffs. createuser and destroyuser work.
pg_shadow cannot be read by ordinary user.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.25 1998/02/24 03:31:47 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.26 1998/02/25 13:07:43 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "utils/acl.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/pg_user.h"
|
||||
#include "catalog/pg_shadow.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
static char *getid(char *s, char *n);
|
||||
@@ -158,7 +158,7 @@ aclparse(char *s, AclItem *aip, unsigned *modechg)
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(htp))
|
||||
elog(ERROR, "aclparse: non-existent user \"%s\"", name);
|
||||
aip->ai_id = ((Form_pg_user) GETSTRUCT(htp))->usesysid;
|
||||
aip->ai_id = ((Form_pg_shadow) GETSTRUCT(htp))->usesysid;
|
||||
break;
|
||||
case ACL_IDTYPE_GID:
|
||||
aip->ai_id = get_grosysid(name);
|
||||
@@ -285,7 +285,7 @@ aclitemout(AclItem *aip)
|
||||
pfree(tmp);
|
||||
}
|
||||
else
|
||||
strncat(p, (char *) &((Form_pg_user)
|
||||
strncat(p, (char *) &((Form_pg_shadow)
|
||||
GETSTRUCT(htp))->usename,
|
||||
sizeof(NameData));
|
||||
break;
|
||||
|
||||
16
src/backend/utils/cache/syscache.c
vendored
16
src/backend/utils/cache/syscache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.14 1998/02/11 19:12:49 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.15 1998/02/25 13:07:50 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* These routines allow the parser/planner/executor to perform
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/pg_rewrite.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_user.h"
|
||||
#include "catalog/pg_shadow.h"
|
||||
#include "storage/large_object.h"
|
||||
#include "catalog/pg_listener.h"
|
||||
|
||||
@@ -254,22 +254,22 @@ static struct cachedesc cacheinfo[] = {
|
||||
sizeof(FormData_pg_listener),
|
||||
NULL,
|
||||
(ScanFunc) NULL},
|
||||
{UserRelationName, /* USENAME */
|
||||
{ShadowRelationName, /* USENAME */
|
||||
1,
|
||||
{Anum_pg_user_usename,
|
||||
{Anum_pg_shadow_usename,
|
||||
0,
|
||||
0,
|
||||
0},
|
||||
sizeof(FormData_pg_user),
|
||||
sizeof(FormData_pg_shadow),
|
||||
NULL,
|
||||
(ScanFunc) NULL},
|
||||
{UserRelationName, /* USESYSID */
|
||||
{ShadowRelationName, /* USESYSID */
|
||||
1,
|
||||
{Anum_pg_user_usesysid,
|
||||
{Anum_pg_shadow_usesysid,
|
||||
0,
|
||||
0,
|
||||
0},
|
||||
sizeof(FormData_pg_user),
|
||||
sizeof(FormData_pg_shadow),
|
||||
NULL,
|
||||
(ScanFunc) NULL},
|
||||
{GroupRelationName, /* GRONAME */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.19 1998/01/26 01:41:42 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.20 1998/02/25 13:08:00 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Globals used all over the place should be declared here and not
|
||||
@@ -110,7 +110,7 @@ char *SharedSystemRelationNames[] = {
|
||||
DatabaseRelationName,
|
||||
GroupRelationName,
|
||||
LogRelationName,
|
||||
UserRelationName,
|
||||
ShadowRelationName,
|
||||
VariableRelationName,
|
||||
0
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.10 1998/02/24 15:20:16 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.11 1998/02/25 13:08:09 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "miscadmin.h" /* where the declarations go */
|
||||
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/pg_user.h"
|
||||
#include "catalog/pg_shadow.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
@@ -483,6 +483,6 @@ SetUserId()
|
||||
if (!HeapTupleIsValid(userTup))
|
||||
elog(FATAL, "SetUserId: user \"%s\" is not in \"%s\"",
|
||||
userName,
|
||||
UserRelationName);
|
||||
UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid;
|
||||
ShadowRelationName);
|
||||
UserId = (Oid) ((Form_pg_shadow) GETSTRUCT(userTup))->usesysid;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.4 1997/09/08 02:32:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.5 1998/02/25 13:08:23 scrappy Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* See superuser().
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <postgres.h>
|
||||
#include <utils/syscache.h>
|
||||
#include <catalog/pg_user.h>
|
||||
#include <catalog/pg_shadow.h>
|
||||
|
||||
bool
|
||||
superuser(void)
|
||||
@@ -33,5 +33,5 @@ superuser(void)
|
||||
utup = SearchSysCacheTuple(USENAME, PointerGetDatum(UserName),
|
||||
0, 0, 0);
|
||||
Assert(utup != NULL);
|
||||
return ((Form_pg_user) GETSTRUCT(utup))->usesuper;
|
||||
return ((Form_pg_shadow) GETSTRUCT(utup))->usesuper;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user