forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7d1a0f5
committed
Allow "-C variable" and "--describe-config" even to root users.
There's no really compelling reason to refuse to do these read-only,non-server-starting options as root, and there's at least one goodreason to allow -C: pg_ctl uses -C to find out the true data directorylocation when pointed at a config-only directory. On Windows, this isdone before dropping administrator privileges, which means that pg_ctlfails for administrators if and only if a config-only layout is used.Since the root-privilege check is done so early in startup, it's a bitawkward to check for these switches. Make the somewhat arbitrarydecision that we'll only skip the root check if -C is the first switch.This is not just to make the code a bit simpler: it also guarantees thatwe can't misinterpret a --boot mode switch. (While AuxiliaryProcessMaindoesn't currently recognize any such switch, it might have one in thefuture.) This is no particular problem for pg_ctl, and since the wholebehavior is undocumented anyhow, it's not a documentation issue either.(--describe-config only works as the first switch anyway, so this isno restriction for that case either.)Back-patch to 9.2 where pg_ctl first began to use -C.MauMau, heavily edited by me1 parent598f303 commit7d1a0f5
2 files changed
+28
-6
lines changedLines changed: 23 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
| 63 | + | |
62 | 64 |
| |
63 | 65 |
| |
64 | 66 |
| |
| |||
153 | 155 |
| |
154 | 156 |
| |
155 | 157 |
| |
156 |
| - | |
| 158 | + | |
| 159 | + | |
157 | 160 |
| |
158 | 161 |
| |
159 | 162 |
| |
| |||
167 | 170 |
| |
168 | 171 |
| |
169 | 172 |
| |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
170 | 188 |
| |
171 | 189 |
| |
172 | 190 |
| |
173 |
| - | |
| 191 | + | |
| 192 | + | |
174 | 193 |
| |
175 |
| - | |
| 194 | + | |
| 195 | + | |
176 | 196 |
| |
177 | 197 |
| |
178 | 198 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1962 | 1962 |
| |
1963 | 1963 |
| |
1964 | 1964 |
| |
1965 |
| - | |
1966 |
| - | |
1967 |
| - | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1968 | 1970 |
| |
1969 | 1971 |
| |
1970 | 1972 |
| |
|
0 commit comments
Comments
(0)