forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita7be2a6
committed
Add new function, PQchangePassword(), to libpq
Essentially this moves the non-interactive part of psql's "\password"command into an exported client function. The password is not sent to theserver in cleartext because it is "encrypted" (in the case of scram and md5it is actually hashed, but we have called these encrypted passwords for along time now) on the client side. This is good because it ensures thecleartext password is never known by the server, and therefore won't end upin logs, pg_stat displays, etc.In other words, it exists for the same reason as PQencryptPasswordConn(), butis more convenient as it both builds and runs the "ALTER USER" command foryou. PQchangePassword() uses PQencryptPasswordConn() to do the passwordencryption. PQencryptPasswordConn() is passed a NULL for the algorithmargument, hence encryption is done according to the server'spassword_encryption setting.Also modify the psql client to use the new function. That provides a builtintest case. Ultimately drivers built on top of libpq should expose thisfunction and its use should be generally encouraged over doing ALTER USERdirectly for password changes.Author: Joe ConwayReviewed-by: Tom LaneDiscussion:https://postgr.es/m/flat/b75955f7-e8cc-4bbd-817f-ef536bacbe93%40joeconway.com1 parentd596736 commita7be2a6
File tree
5 files changed
+125
-17
lines changed- doc/src/sgml
- src
- bin/psql
- interfaces/libpq
5 files changed
+125
-17
lines changedLines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7116 | 7116 |
| |
7117 | 7117 |
| |
7118 | 7118 |
| |
| 7119 | + | |
| 7120 | + | |
| 7121 | + | |
| 7122 | + | |
| 7123 | + | |
| 7124 | + | |
| 7125 | + | |
| 7126 | + | |
| 7127 | + | |
| 7128 | + | |
| 7129 | + | |
| 7130 | + | |
| 7131 | + | |
| 7132 | + | |
| 7133 | + | |
| 7134 | + | |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
| 7138 | + | |
| 7139 | + | |
| 7140 | + | |
| 7141 | + | |
| 7142 | + | |
| 7143 | + | |
| 7144 | + | |
| 7145 | + | |
| 7146 | + | |
| 7147 | + | |
| 7148 | + | |
| 7149 | + | |
| 7150 | + | |
| 7151 | + | |
| 7152 | + | |
| 7153 | + | |
| 7154 | + | |
| 7155 | + | |
| 7156 | + | |
| 7157 | + | |
7119 | 7158 |
| |
7120 | 7159 |
| |
7121 | 7160 |
| |
|
Lines changed: 3 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2158 | 2158 |
| |
2159 | 2159 |
| |
2160 | 2160 |
| |
2161 |
| - | |
| 2161 | + | |
2162 | 2162 |
| |
2163 |
| - | |
2164 |
| - | |
2165 |
| - | |
| 2163 | + | |
2166 | 2164 |
| |
2167 | 2165 |
| |
2168 | 2166 |
| |
2169 | 2167 |
| |
2170 |
| - | |
2171 |
| - | |
2172 |
| - | |
2173 | 2168 |
| |
2174 |
| - | |
2175 |
| - | |
2176 |
| - | |
2177 |
| - | |
2178 |
| - | |
2179 |
| - | |
2180 |
| - | |
2181 |
| - | |
2182 |
| - | |
2183 |
| - | |
| 2169 | + | |
2184 | 2170 |
| |
2185 | 2171 |
| |
2186 | 2172 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
191 | 191 |
| |
192 | 192 |
| |
193 | 193 |
| |
| 194 | + |
Lines changed: 81 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1372 | 1372 |
| |
1373 | 1373 |
| |
1374 | 1374 |
| |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
659 | 659 |
| |
660 | 660 |
| |
661 | 661 |
| |
| 662 | + | |
662 | 663 |
| |
663 | 664 |
| |
664 | 665 |
| |
|
0 commit comments
Comments
(0)