Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cf1964

Browse files
committed
From: Jan Wieck <jwieck@debis.com>
So if the relname is given to acldefault() in utils/adt/acl.c, it can do a IsSystemRelationName() on it and return ACL_RD instead of ACL_WORLD_DEFAULT.
1 parent751ebd2 commit5cf1964

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

‎src/backend/catalog/aclchk.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.5 1998/02/11 19:09:42 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.6 1998/02/24 03:31:45 scrappy Exp $
1111
*
1212
* NOTES
1313
* See acl.h.
@@ -39,7 +39,7 @@
3939
#include"utils/tqual.h"
4040
#include"fmgr.h"
4141

42-
staticint32aclcheck(Acl*acl,AclIdid,AclIdTypeidtype,AclModemode);
42+
staticint32aclcheck(char*relname,Acl*acl,AclIdid,AclIdTypeidtype,AclModemode);
4343

4444
/*
4545
* Enable use of user relations in place of real system catalogs.
@@ -150,7 +150,7 @@ ChangeAcl(char *relname,
150150
elog(DEBUG,"ChangeAcl: using default ACL");
151151
#endif
152152
/*old_acl = acldefault(((Form_pg_class) GETSTRUCT(htp))->relowner); */
153-
old_acl=acldefault();
153+
old_acl=acldefault(relname);
154154
free_old_acl=1;
155155
}
156156

@@ -281,7 +281,7 @@ in_group(AclId uid, AclId gid)
281281
* any one of the requirements of 'mode'. Returns 0 otherwise.
282282
*/
283283
staticint32
284-
aclcheck(Acl*acl,AclIdid,AclIdTypeidtype,AclModemode)
284+
aclcheck(char*relname,Acl*acl,AclIdid,AclIdTypeidtype,AclModemode)
285285
{
286286
unsignedi;
287287
AclItem*aip,
@@ -292,7 +292,7 @@ aclcheck(Acl *acl, AclId id, AclIdType idtype, AclMode mode)
292292
/* if no acl is found, use world default */
293293
if (!acl)
294294
{
295-
acl=acldefault();
295+
acl=acldefault(relname);
296296
}
297297

298298
num=ACL_NUM(acl);
@@ -475,7 +475,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
475475
Anum_pg_class_relowner,
476476
RelationGetTupleDescriptor(relation),
477477
(bool*)NULL);
478-
acl=aclownerdefault(ownerId);
478+
acl=aclownerdefault(relname,ownerId);
479479
}
480480
#else
481481
{/* This is why the syscache is great... */
@@ -511,7 +511,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
511511
heap_close(relation);
512512
}
513513
#endif
514-
result=aclcheck(acl,id, (AclIdType)ACL_IDTYPE_UID,mode);
514+
result=aclcheck(relname,acl,id, (AclIdType)ACL_IDTYPE_UID,mode);
515515
if (acl)
516516
pfree(acl);
517517
return (result);

‎src/backend/utils/adt/acl.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.24 1998/02/11 19:12:03 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.25 1998/02/24 03:31:47 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -18,6 +18,7 @@
1818
#include<utils/memutils.h>
1919
#include"utils/acl.h"
2020
#include"utils/syscache.h"
21+
#include"catalog/catalog.h"
2122
#include"catalog/pg_user.h"
2223
#include"miscadmin.h"
2324

@@ -342,7 +343,7 @@ aclitemgt(AclItem *a1, AclItem *a2)
342343
}
343344

344345
Acl*
345-
aclownerdefault(AclIdownerid)
346+
aclownerdefault(char*relname,AclIdownerid)
346347
{
347348
Acl*acl;
348349
AclItem*aip;
@@ -351,15 +352,15 @@ aclownerdefault(AclId ownerid)
351352
aip=ACL_DAT(acl);
352353
aip[0].ai_idtype=ACL_IDTYPE_WORLD;
353354
aip[0].ai_id=ACL_ID_WORLD;
354-
aip[0].ai_mode=ACL_WORLD_DEFAULT;
355+
aip[0].ai_mode=IsSystemRelationName(relname) ?ACL_RD :ACL_WORLD_DEFAULT;
355356
aip[1].ai_idtype=ACL_IDTYPE_UID;
356357
aip[1].ai_id=ownerid;
357358
aip[1].ai_mode=ACL_OWNER_DEFAULT;
358359
return (acl);
359360
}
360361

361362
Acl*
362-
acldefault(void)
363+
acldefault(char*relname)
363364
{
364365
Acl*acl;
365366
AclItem*aip;
@@ -368,7 +369,7 @@ acldefault(void)
368369
aip=ACL_DAT(acl);
369370
aip[0].ai_idtype=ACL_IDTYPE_WORLD;
370371
aip[0].ai_id=ACL_ID_WORLD;
371-
aip[0].ai_mode=ACL_WORLD_DEFAULT;
372+
aip[0].ai_mode=IsSystemRelationName(relname) ?ACL_RD :ACL_WORLD_DEFAULT;
372373
return (acl);
373374
}
374375

‎src/include/utils/acl.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: acl.h,v 1.14 1998/02/23 18:43:13 scrappy Exp $
9+
* $Id: acl.h,v 1.15 1998/02/24 03:31:50 scrappy Exp $
1010
*
1111
* NOTES
1212
* For backward-compatability purposes we have to allow there
@@ -135,8 +135,8 @@ extern char *aclcheck_error_strings[];
135135
/*
136136
* routines used internally (parser, etc.)
137137
*/
138-
externAcl*aclownerdefault(AclIdownerid);
139-
externAcl*acldefault(void);
138+
externAcl*aclownerdefault(char*relname,AclIdownerid);
139+
externAcl*acldefault(char*relname);
140140
externAcl*aclinsert3(Acl*old_acl,AclItem*mod_aip,unsignedmodechg);
141141

142142
externchar*aclmakepriv(char*old_privlist,charnew_priv);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp