- Notifications
You must be signed in to change notification settings - Fork5
Commitb203c57
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 parent2209c0f commitb203c57
2 files changed
+28
-6
lines changedLines changed: 23 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
61 | 63 |
| |
62 | 64 |
| |
63 | 65 |
| |
| |||
151 | 153 |
| |
152 | 154 |
| |
153 | 155 |
| |
154 |
| - | |
| 156 | + | |
| 157 | + | |
155 | 158 |
| |
156 | 159 |
| |
157 | 160 |
| |
| |||
165 | 168 |
| |
166 | 169 |
| |
167 | 170 |
| |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
168 | 186 |
| |
169 | 187 |
| |
170 | 188 |
| |
171 |
| - | |
| 189 | + | |
| 190 | + | |
172 | 191 |
| |
173 |
| - | |
| 192 | + | |
| 193 | + | |
174 | 194 |
| |
175 | 195 |
| |
176 | 196 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2034 | 2034 |
| |
2035 | 2035 |
| |
2036 | 2036 |
| |
2037 |
| - | |
2038 |
| - | |
2039 |
| - | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
2040 | 2042 |
| |
2041 | 2043 |
| |
2042 | 2044 |
| |
|
0 commit comments
Comments
(0)