- Notifications
You must be signed in to change notification settings - Fork28
Commit862861e
committed
Fix a couple of misbehaviors rooted in the fact that the default creation
namespace isn't necessarily first in the search path (there could be implicitschemas ahead of it). Examples aretest=# set search_path TO s1;test=# create view pg_timezone_names as select * from pg_timezone_names();ERROR: "pg_timezone_names" is already a viewtest=# create table pg_class (f1 int primary key);ERROR: permission denied: "pg_class" is a system catalogYou'd expect these commands to create the requested objects in s1, sincenames beginning with pg_ aren't supposed to be reserved anymore. What ishappening is that we create the requested base table and then executeadditional commands (here, CREATE RULE or CREATE INDEX), and that code ispassed the same RangeVar that was in the original command. Since thatRangeVar has schemaname = NULL, the secondary commands think they should do apath search, and that means they find system catalogs that are implicitly infront of s1 in the search path.This is perilously close to being a security hole: if the secondary commandfailed to apply a permission check then it'd be possible for unprivilegedusers to make schema modifications to system catalogs. But as far as I canfind, there is no code path in which a check doesn't occur. Which makes itjust a weird corner-case bug for people who are silly enough to want toname their tables the same as a system catalog.The relevant code has changed quite a bit since 8.2, which means this patchwouldn't work as-is in the back branches. Since it's a corner case no onehas reported from the field, I'm not going to bother trying to back-patch.1 parent6c96188 commit862861e
File tree
5 files changed
+66
-27
lines changed- src
- backend
- catalog
- commands
- parser
- rewrite
- include/rewrite
5 files changed
+66
-27
lines changedLines changed: 21 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| |||
228 | 228 |
| |
229 | 229 |
| |
230 | 230 |
| |
231 |
| - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
232 | 251 |
| |
233 | 252 |
| |
234 | 253 |
| |
|
Lines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
260 | 260 |
| |
261 | 261 |
| |
262 | 262 |
| |
263 |
| - | |
| 263 | + | |
264 | 264 |
| |
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
270 |
| - | |
| 270 | + | |
271 | 271 |
| |
272 | 272 |
| |
273 | 273 |
| |
| |||
404 | 404 |
| |
405 | 405 |
| |
406 | 406 |
| |
407 |
| - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
408 | 410 |
| |
409 | 411 |
| |
410 | 412 |
| |
| |||
441 | 443 |
| |
442 | 444 |
| |
443 | 445 |
| |
444 |
| - | |
| 446 | + | |
445 | 447 |
| |
446 | 448 |
| |
447 | 449 |
| |
|
Lines changed: 15 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| |||
143 | 143 |
| |
144 | 144 |
| |
145 | 145 |
| |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
146 | 160 |
| |
147 | 161 |
| |
148 | 162 |
| |
|
Lines changed: 21 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| 20 | + | |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
| |||
189 | 190 |
| |
190 | 191 |
| |
191 | 192 |
| |
| 193 | + | |
192 | 194 |
| |
193 | 195 |
| |
194 | 196 |
| |
195 | 197 |
| |
196 |
| - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
197 | 202 |
| |
198 |
| - | |
| 203 | + | |
199 | 204 |
| |
200 | 205 |
| |
201 | 206 |
| |
| |||
213 | 218 |
| |
214 | 219 |
| |
215 | 220 |
| |
216 |
| - | |
| 221 | + | |
217 | 222 |
| |
218 | 223 |
| |
219 | 224 |
| |
220 | 225 |
| |
221 | 226 |
| |
222 | 227 |
| |
223 | 228 |
| |
224 |
| - | |
225 | 229 |
| |
226 | 230 |
| |
227 | 231 |
| |
| |||
235 | 239 |
| |
236 | 240 |
| |
237 | 241 |
| |
238 |
| - | |
239 |
| - | |
| 242 | + | |
240 | 243 |
| |
241 | 244 |
| |
242 | 245 |
| |
243 | 246 |
| |
244 |
| - | |
| 247 | + | |
245 | 248 |
| |
246 | 249 |
| |
247 | 250 |
| |
| |||
352 | 355 |
| |
353 | 356 |
| |
354 | 357 |
| |
355 |
| - | |
| 358 | + | |
356 | 359 |
| |
357 | 360 |
| |
358 | 361 |
| |
359 | 362 |
| |
360 |
| - | |
| 363 | + | |
| 364 | + | |
361 | 365 |
| |
362 | 366 |
| |
363 | 367 |
| |
| |||
377 | 381 |
| |
378 | 382 |
| |
379 | 383 |
| |
380 |
| - | |
| 384 | + | |
381 | 385 |
| |
382 | 386 |
| |
383 | 387 |
| |
384 | 388 |
| |
385 | 389 |
| |
386 | 390 |
| |
387 |
| - | |
| 391 | + | |
388 | 392 |
| |
389 | 393 |
| |
390 | 394 |
| |
391 | 395 |
| |
392 | 396 |
| |
393 | 397 |
| |
394 |
| - | |
| 398 | + | |
395 | 399 |
| |
396 | 400 |
| |
397 | 401 |
| |
398 | 402 |
| |
399 | 403 |
| |
400 |
| - | |
| 404 | + | |
401 | 405 |
| |
402 | 406 |
| |
403 | 407 |
| |
| |||
449 | 453 |
| |
450 | 454 |
| |
451 | 455 |
| |
452 |
| - | |
| 456 | + | |
453 | 457 |
| |
454 | 458 |
| |
455 | 459 |
| |
| |||
465 | 469 |
| |
466 | 470 |
| |
467 | 471 |
| |
468 |
| - | |
| 472 | + | |
469 | 473 |
| |
470 | 474 |
| |
471 | 475 |
| |
| |||
701 | 705 |
| |
702 | 706 |
| |
703 | 707 |
| |
704 |
| - | |
| 708 | + | |
705 | 709 |
| |
706 | 710 |
| |
707 | 711 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
|
0 commit comments
Comments
(0)