Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 85f1950

Browse files
committed
Remove NO_SECURITY define.
1 parent 17e3e47 commit 85f1950

File tree

12 files changed

+24
-81
lines changed

12 files changed

+24
-81
lines changed

src/backend/commands/analyze.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.7 2000/10/05 19:48:22 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.8 2000/10/16 17:08:05 momjian Exp $
1212
*
1313
1414
*-------------------------------------------------------------------------
@@ -98,7 +98,6 @@ analyze_rel(Oid relid, List *anal_cols2, int MESSAGE_LEVEL)
9898

9999
onerel = heap_open(relid, AccessShareLock);
100100

101-
#ifndef NO_SECURITY
102101
if (!pg_ownercheck(GetUserId(), RelationGetRelationName(onerel),
103102
RELNAME))
104103
{
@@ -110,7 +109,6 @@ analyze_rel(Oid relid, List *anal_cols2, int MESSAGE_LEVEL)
110109
CommitTransactionCommand();
111110
return;
112111
}
113-
#endif
114112

115113
elog(MESSAGE_LEVEL, "Analyzing...");
116114

src/backend/commands/command.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.106 2000/10/10 17:13:30 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.107 2000/10/16 17:08:05 momjian Exp $
1212
*
1313
* NOTES
1414
* The PerformAddAttribute() code, like most of the relation
@@ -311,10 +311,8 @@ AlterTableAddColumn(const char *relationName,
311311
if (!allowSystemTableMods && IsSystemRelationName(relationName))
312312
elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog",
313313
relationName);
314-
#ifndef NO_SECURITY
315314
if (!pg_ownercheck(GetUserId(), relationName, RELNAME))
316315
elog(ERROR, "ALTER TABLE: permission denied");
317-
#endif
318316

319317
/*
320318
* Grab an exclusive lock on the target table, which we will NOT
@@ -1149,7 +1147,7 @@ AlterTableAddConstraint(char *relationName,
11491147
scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
11501148
AssertState(scan != NULL);
11511149

1152-
/*
1150+
/*
11531151
* We need to make a parse state and range table to allow
11541152
* us to transformExpr and fix_opids to get a version of
11551153
* the expression we can pass to ExecQual
@@ -1195,7 +1193,7 @@ AlterTableAddConstraint(char *relationName,
11951193
rte->eref->relname = relationName;
11961194
rtlist = makeList1(rte);
11971195

1198-
/*
1196+
/*
11991197
* Scan through the rows now, making the necessary things
12001198
* for ExecQual, and then call it to evaluate the
12011199
* expression.
@@ -1224,13 +1222,13 @@ AlterTableAddConstraint(char *relationName,
12241222
pfree(rte);
12251223

12261224
heap_endscan(scan);
1227-
heap_close(rel, NoLock);
1225+
heap_close(rel, NoLock);
12281226

1229-
if (!successful)
1227+
if (!successful)
12301228
{
12311229
elog(ERROR, "AlterTableAddConstraint: rejected due to CHECK constraint %s", name);
12321230
}
1233-
/*
1231+
/*
12341232
* Call AddRelationRawConstraints to do the real adding --
12351233
* It duplicates some of the above, but does not check the
12361234
* validity of the constraint against tuples already in
@@ -1274,7 +1272,7 @@ AlterTableAddConstraint(char *relationName,
12741272

12751273
pkrel = heap_openr(fkconstraint->pktable_name, AccessExclusiveLock);
12761274
if (pkrel->rd_rel->relkind != RELKIND_RELATION)
1277-
elog(ERROR, "referenced table \"%s\" not a relation",
1275+
elog(ERROR, "referenced table \"%s\" not a relation",
12781276
fkconstraint->pktable_name);
12791277

12801278
/*
@@ -1328,7 +1326,7 @@ AlterTableAddConstraint(char *relationName,
13281326
}
13291327
}
13301328
if (found)
1331-
break;
1329+
break;
13321330
indexStruct = NULL;
13331331
}
13341332
if (!found)
@@ -1591,7 +1589,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
15911589

15921590
if (((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid != InvalidOid)
15931591
{
1594-
if (silent)
1592+
if (silent)
15951593
{
15961594
heap_close(rel, NoLock);
15971595
heap_close(class_rel, NoLock);
@@ -1601,14 +1599,14 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
16011599

16021600
elog(ERROR, "ALTER TABLE: relation \"%s\" already has a toast table",
16031601
relationName);
1604-
}
1602+
}
16051603

16061604
/*
16071605
* Check to see whether the table actually needs a TOAST table.
16081606
*/
16091607
if (! needs_toast_table(rel))
16101608
{
1611-
if (silent)
1609+
if (silent)
16121610
{
16131611
heap_close(rel, NoLock);
16141612
heap_close(class_rel, NoLock);
@@ -1784,7 +1782,7 @@ LockTableCommand(LockStmt *lockstmt)
17841782
if (rel->rd_rel->relkind != RELKIND_RELATION)
17851783
elog(ERROR, "LOCK TABLE: %s is not a table", lockstmt->relname);
17861784

1787-
if (is_view(rel))
1785+
if (is_view(rel))
17881786
elog(ERROR, "LOCK TABLE: cannot lock a view");
17891787

17901788
if (lockstmt->mode == AccessShareLock)
@@ -1842,7 +1840,7 @@ is_view(Relation rel)
18421840

18431841
while (HeapTupleIsValid(tuple = heap_getnext(scanDesc, 0)))
18441842
{
1845-
if (tuple->t_data != NULL)
1843+
if (tuple->t_data != NULL)
18461844
{
18471845
data = (Form_pg_rewrite) GETSTRUCT(tuple);
18481846
if (data->ev_type == '1')
@@ -1856,6 +1854,6 @@ is_view(Relation rel)
18561854

18571855
heap_endscan(scanDesc);
18581856
heap_close(RewriteRelation, RowExclusiveLock);
1859-
1857+
18601858
return retval;
18611859
}

src/backend/commands/comment.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,8 @@ CommentRelation(int reltype, char *relname, char *comment)
283283

284284
/*** First, check object security ***/
285285

286-
#ifndef NO_SECURITY
287286
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
288287
elog(ERROR, "you are not permitted to comment on class '%s'", relname);
289-
#endif
290288

291289
/*** Now, attempt to find the oid in the cached version of pg_class ***/
292290

@@ -349,10 +347,8 @@ CommentAttribute(char *relname, char *attrname, char *comment)
349347

350348
/*** First, check object security ***/
351349

352-
#ifndef NO_SECURITY
353350
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
354351
elog(ERROR, "you are not permitted to comment on class '%s\'", relname);
355-
#endif
356352

357353
/*** Now, fetch the attribute oid from the system cache ***/
358354

src/backend/commands/remove.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.53 2000/10/07 00:58:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.54 2000/10/16 17:08:05 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -81,13 +81,11 @@ RemoveOperator(char *operatorName, /* operator name */
8181

8282
if (HeapTupleIsValid(tup))
8383
{
84-
#ifndef NO_SECURITY
8584
if (!pg_ownercheck(GetUserId(),
8685
(char *) ObjectIdGetDatum(tup->t_data->t_oid),
8786
OPEROID))
8887
elog(ERROR, "RemoveOperator: operator '%s': permission denied",
8988
operatorName);
90-
#endif
9189

9290
/*** Delete any comments associated with this operator ***/
9391

@@ -250,11 +248,9 @@ RemoveType(char *typeName) /* type name to be removed */
250248
Oid typeOid;
251249
char *shadow_type;
252250

253-
#ifndef NO_SECURITY
254251
if (!pg_ownercheck(GetUserId(), typeName, TYPENAME))
255252
elog(ERROR, "RemoveType: type '%s': permission denied",
256253
typeName);
257-
#endif
258254

259255
relation = heap_openr(TypeRelationName, RowExclusiveLock);
260256

@@ -334,13 +330,11 @@ RemoveFunction(char *functionName, /* function name to be removed */
334330
}
335331
}
336332

337-
#ifndef NO_SECURITY
338333
if (!pg_func_ownercheck(GetUserId(), functionName, nargs, argList))
339334
{
340335
elog(ERROR, "RemoveFunction: function '%s': permission denied",
341336
functionName);
342337
}
343-
#endif
344338

345339
relation = heap_openr(ProcedureRelationName, RowExclusiveLock);
346340
tup = SearchSysCacheTuple(PROCNAME,
@@ -396,7 +390,6 @@ RemoveAggregate(char *aggName, char *aggType)
396390
else
397391
basetypeID = 0;
398392

399-
#ifndef NO_SECURITY
400393
if (!pg_aggr_ownercheck(GetUserId(), aggName, basetypeID))
401394
{
402395
if (aggType)
@@ -410,7 +403,6 @@ RemoveAggregate(char *aggName, char *aggType)
410403
aggName);
411404
}
412405
}
413-
#endif
414406

415407
relation = heap_openr(AggregateRelationName, RowExclusiveLock);
416408
tup = SearchSysCacheTuple(AGGNAME,

src/backend/commands/rename.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.48 2000/10/16 14:52:03 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.49 2000/10/16 17:08:05 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -71,12 +71,10 @@ renameatt(char *relname,
7171
if (!allowSystemTableMods && IsSystemRelationName(relname))
7272
elog(ERROR, "renameatt: class \"%s\" is a system catalog",
7373
relname);
74-
#ifndef NO_SECURITY
7574
if (!IsBootstrapProcessingMode() &&
7675
!pg_ownercheck(GetUserId(), relname, RELNAME))
7776
elog(ERROR, "renameatt: you do not own class \"%s\"",
7877
relname);
79-
#endif
8078

8179
/*
8280
* Grab an exclusive lock on the target table, which we will NOT

src/backend/commands/sequence.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,9 @@ nextval(PG_FUNCTION_ARGS)
201201
next,
202202
rescnt = 0;
203203

204-
#ifndef NO_SECURITY
205204
if (pg_aclcheck(seqname, GetUserId(), ACL_WR) != ACLCHECK_OK)
206205
elog(ERROR, "%s.nextval: you don't have permissions to set sequence %s",
207206
seqname, seqname);
208-
#endif
209207

210208
/* open and AccessShareLock sequence */
211209
elm = init_sequence("nextval", seqname);
@@ -298,11 +296,9 @@ currval(PG_FUNCTION_ARGS)
298296
SeqTable elm;
299297
int32 result;
300298

301-
#ifndef NO_SECURITY
302299
if (pg_aclcheck(seqname, GetUserId(), ACL_RD) != ACLCHECK_OK)
303300
elog(ERROR, "%s.currval: you don't have permissions to read sequence %s",
304301
seqname, seqname);
305-
#endif
306302

307303
/* open and AccessShareLock sequence */
308304
elm = init_sequence("currval", seqname);
@@ -318,18 +314,16 @@ currval(PG_FUNCTION_ARGS)
318314
PG_RETURN_INT32(result);
319315
}
320316

321-
static void
317+
static void
322318
do_setval(char *seqname, int32 next, bool iscalled)
323319
{
324320
SeqTable elm;
325321
Buffer buf;
326322
Form_pg_sequence seq;
327323

328-
#ifndef NO_SECURITY
329324
if (pg_aclcheck(seqname, GetUserId(), ACL_WR) != ACLCHECK_OK)
330325
elog(ERROR, "%s.setval: you don't have permissions to set sequence %s",
331326
seqname, seqname);
332-
#endif
333327

334328
/* open and AccessShareLock sequence */
335329
elm = init_sequence("setval", seqname);

src/backend/commands/trigger.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.77 2000/09/06 14:15:16 petere Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.78 2000/10/16 17:08:05 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -68,10 +68,8 @@ CreateTrigger(CreateTrigStmt *stmt)
6868
if (!allowSystemTableMods && IsSystemRelationName(stmt->relname))
6969
elog(ERROR, "CreateTrigger: can't create trigger for system relation %s", stmt->relname);
7070

71-
#ifndef NO_SECURITY
7271
if (!pg_ownercheck(GetUserId(), stmt->relname, RELNAME))
7372
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
74-
#endif
7573

7674
/* ----------
7775
* If trigger is a constraint, user trigger name as constraint
@@ -308,10 +306,8 @@ DropTrigger(DropTrigStmt *stmt)
308306
int found = 0;
309307
int tgfound = 0;
310308

311-
#ifndef NO_SECURITY
312309
if (!pg_ownercheck(GetUserId(), stmt->relname, RELNAME))
313310
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
314-
#endif
315311

316312
rel = heap_openr(stmt->relname, AccessExclusiveLock);
317313

src/backend/commands/vacuum.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.167 2000/10/05 19:48:22 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.168 2000/10/16 17:08:05 momjian Exp $
1212
*
1313
1414
*-------------------------------------------------------------------------
@@ -397,7 +397,6 @@ vacuum_rel(Oid relid, bool analyze, bool is_toastrel)
397397
*/
398398
onerel = heap_open(relid, AccessExclusiveLock);
399399

400-
#ifndef NO_SECURITY
401400
if (!pg_ownercheck(GetUserId(), RelationGetRelationName(onerel),
402401
RELNAME))
403402
{
@@ -408,7 +407,6 @@ vacuum_rel(Oid relid, bool analyze, bool is_toastrel)
408407
CommitTransactionCommand();
409408
return;
410409
}
411-
#endif
412410

413411
/*
414412
* Remember the relation'ss TOAST relation for later

src/backend/executor/execMain.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*
2929
* IDENTIFICATION
30-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.129 2000/10/05 19:11:26 tgl Exp $
30+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.130 2000/10/16 17:08:06 momjian Exp $
3131
*
3232
*-------------------------------------------------------------------------
3333
*/
@@ -619,9 +619,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
619619
/*
620620
* Do permissions checks.
621621
*/
622-
#ifndef NO_SECURITY
623622
ExecCheckQueryPerms(operation, parseTree, plan);
624-
#endif
625623

626624
/*
627625
* get information from query descriptor

0 commit comments

Comments
 (0)