*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.5 1998/02/11 19:09:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.6 1998/02/24 03:31:45 scrappy Exp $
*
* NOTES
* See acl.h.
#include "utils/tqual.h"
#include "fmgr.h"
-static int32 aclcheck(Acl *acl, AclId id, AclIdType idtype, AclMode mode);
+static int32 aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode);
/*
* Enable use of user relations in place of real system catalogs.
elog(DEBUG, "ChangeAcl: using default ACL");
#endif
/* old_acl = acldefault(((Form_pg_class) GETSTRUCT(htp))->relowner); */
- old_acl = acldefault();
+ old_acl = acldefault(relname);
free_old_acl = 1;
}
* any one of the requirements of 'mode'. Returns 0 otherwise.
*/
static int32
-aclcheck(Acl *acl, AclId id, AclIdType idtype, AclMode mode)
+aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
{
unsigned i;
AclItem *aip,
/* if no acl is found, use world default */
if (!acl)
{
- acl = acldefault();
+ acl = acldefault(relname);
}
num = ACL_NUM(acl);
Anum_pg_class_relowner,
RelationGetTupleDescriptor(relation),
(bool *) NULL);
- acl = aclownerdefault(ownerId);
+ acl = aclownerdefault(relname, ownerId);
}
#else
{ /* This is why the syscache is great... */
heap_close(relation);
}
#endif
- result = aclcheck(acl, id, (AclIdType) ACL_IDTYPE_UID, mode);
+ result = aclcheck(relname, acl, id, (AclIdType) ACL_IDTYPE_UID, mode);
if (acl)
pfree(acl);
return (result);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.24 1998/02/11 19:12:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.25 1998/02/24 03:31:47 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include
#include "utils/acl.h"
#include "utils/syscache.h"
+#include "catalog/catalog.h"
#include "catalog/pg_user.h"
#include "miscadmin.h"
}
Acl *
-aclownerdefault(AclId ownerid)
+aclownerdefault(char *relname, AclId ownerid)
{
Acl *acl;
AclItem *aip;
aip = ACL_DAT(acl);
aip[0].ai_idtype = ACL_IDTYPE_WORLD;
aip[0].ai_id = ACL_ID_WORLD;
- aip[0].ai_mode = ACL_WORLD_DEFAULT;
+ aip[0].ai_mode = IsSystemRelationName(relname) ? ACL_RD : ACL_WORLD_DEFAULT;
aip[1].ai_idtype = ACL_IDTYPE_UID;
aip[1].ai_id = ownerid;
aip[1].ai_mode = ACL_OWNER_DEFAULT;
}
Acl *
-acldefault(void)
+acldefault(char *relname)
{
Acl *acl;
AclItem *aip;
aip = ACL_DAT(acl);
aip[0].ai_idtype = ACL_IDTYPE_WORLD;
aip[0].ai_id = ACL_ID_WORLD;
- aip[0].ai_mode = ACL_WORLD_DEFAULT;
+ aip[0].ai_mode = IsSystemRelationName(relname) ? ACL_RD : ACL_WORLD_DEFAULT;
return (acl);
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: acl.h,v 1.14 1998/02/23 18:43:13 scrappy Exp $
+ * $Id: acl.h,v 1.15 1998/02/24 03:31:50 scrappy Exp $
*
* NOTES
* For backward-compatability purposes we have to allow there
/*
* routines used internally (parser, etc.)
*/
-extern Acl *aclownerdefault(AclId ownerid);
-extern Acl *acldefault(void);
+extern Acl *aclownerdefault(char *relname, AclId ownerid);
+extern Acl *acldefault(char *relname);
extern Acl *aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg);
extern char *aclmakepriv(char *old_privlist, char new_priv);