- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb0635bf
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as wellas the existence of libcurl in the address space even if OAuth isn'tever used by a client, has raised some concerns. Split off thisdependency into a separate loadable module called libpq-oauth.When configured using --with-libcurl, libpq.so searches for this newmodule via dlopen(). End users may choose not to install the libpq-oauthmodule, in which case the default flow is disabled.For static applications using libpq.a, the libpq-oauth staticlib is amandatory link-time dependency for --with-libcurl builds. libpq.pc hasbeen updated accordingly.The default flow relies on some libpq internals. Some of these can besafely duplicated (such as the SIGPIPE handlers), but others need to beshared between libpq and libpq-oauth for thread-safety. To avoidexporting these internals to all libpq clients forever, thesedependencies are instead injected from the libpq side via aninitialization function. This also lets libpq communicate the offsets ofPGconn struct members to libpq-oauth, so that we can function withoutcrashing if the module on the search path came from a different build ofPostgres. (A minor-version upgrade could swap the libpq-oauth module outfrom under a long-running libpq client before it does its first load ofthe OAuth flow.)This ABI is considered "private". The module has no SONAME or versionsymlinks, and it's named libpq-oauth-<major>.so to avoid mixing andmatching across Postgres versions. (Future improvements may promote this"OAuth flow plugin" to a first-class concept, at which point we wouldneed a public API to replace this anyway.)Additionally, NLS support for error messages inb3f0be7 wasincomplete, because the new error macros weren't being scanned byxgettext. Fix that now.Per request from Tom Lane and Bruce Momjian. Based on an initial patchby Daniel Gustafsson, who also contributed docs changes. The "bare"dlopen() concept came from Thomas Munro. Many people reviewed the designand implementation; thank you!Co-authored-by: Daniel Gustafsson <daniel@yesql.se>Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Christoph Berg <myon@debian.org>Reviewed-by: Daniel Gustafsson <daniel@yesql.se>Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>Reviewed-by: Peter Eisentraut <peter@eisentraut.org>Reviewed-by: Wolfgang Walther <walther@technowledgy.de>Discussion:https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us1 parenta3ef0b5 commitb0635bf
File tree
25 files changed
+1079
-140
lines changed- config
- doc/src/sgml
- src
- interfaces
- libpq
- libpq-oauth
- makefiles
- test/modules/oauth_validator
- t
25 files changed
+1079
-140
lines changedLines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
286 | 286 |
| |
287 | 287 |
| |
288 | 288 |
| |
289 |
| - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
290 | 293 |
| |
291 | 294 |
| |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
292 | 303 |
| |
293 | 304 |
| |
294 | 305 |
| |
| |||
338 | 349 |
| |
339 | 350 |
| |
340 | 351 |
| |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
341 | 356 |
|
Lines changed: 39 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
655 | 655 |
| |
656 | 656 |
| |
657 | 657 |
| |
| 658 | + | |
658 | 659 |
| |
659 | 660 |
| |
660 | 661 |
| |
| |||
711 | 712 |
| |
712 | 713 |
| |
713 | 714 |
| |
| 715 | + | |
| 716 | + | |
714 | 717 |
| |
715 | 718 |
| |
716 | 719 |
| |
| |||
9053 | 9056 |
| |
9054 | 9057 |
| |
9055 | 9058 |
| |
9056 |
| - | |
9057 |
| - | |
| 9059 | + | |
| 9060 | + | |
| 9061 | + | |
| 9062 | + | |
| 9063 | + | |
| 9064 | + | |
| 9065 | + | |
9058 | 9066 |
| |
9059 | 9067 |
| |
9060 |
| - | |
| 9068 | + | |
9061 | 9069 |
| |
9062 | 9070 |
| |
9063 | 9071 |
| |
9064 | 9072 |
| |
9065 |
| - | |
| 9073 | + | |
9066 | 9074 |
| |
9067 | 9075 |
| |
9068 | 9076 |
| |
| 9077 | + | |
| 9078 | + | |
| 9079 | + | |
9069 | 9080 |
| |
9070 | 9081 |
| |
9071 | 9082 |
| |
| |||
12704 | 12715 |
| |
12705 | 12716 |
| |
12706 | 12717 |
| |
12707 |
| - | |
12708 |
| - | |
12709 |
| - | |
12710 | 12718 |
| |
12711 | 12719 |
| |
12712 | 12720 |
| |
| |||
12754 | 12762 |
| |
12755 | 12763 |
| |
12756 | 12764 |
| |
12757 |
| - | |
12758 |
| - | |
12759 |
| - | |
12760 | 12765 |
| |
12761 |
| - | |
| 12766 | + | |
| 12767 | + | |
| 12768 | + | |
| 12769 | + | |
| 12770 | + | |
12762 | 12771 |
| |
12763 | 12772 |
| |
12764 | 12773 |
| |
12765 | 12774 |
| |
12766 | 12775 |
| |
12767 | 12776 |
| |
| 12777 | + | |
| 12778 | + | |
| 12779 | + | |
| 12780 | + | |
| 12781 | + | |
| 12782 | + | |
| 12783 | + | |
| 12784 | + | |
12768 | 12785 |
| |
12769 | 12786 |
| |
12770 | 12787 |
| |
| |||
12868 | 12885 |
| |
12869 | 12886 |
| |
12870 | 12887 |
| |
| 12888 | + | |
| 12889 | + | |
| 12890 | + | |
| 12891 | + | |
12871 | 12892 |
| |
12872 | 12893 |
| |
12873 | 12894 |
| |
| |||
14516 | 14537 |
| |
14517 | 14538 |
| |
14518 | 14539 |
| |
| 14540 | + | |
| 14541 | + | |
| 14542 | + | |
| 14543 | + | |
| 14544 | + | |
| 14545 | + | |
| 14546 | + | |
14519 | 14547 |
| |
14520 | 14548 |
| |
14521 | 14549 |
| |
|
Lines changed: 19 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1033 | 1033 |
| |
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 |
| - | |
1037 |
| - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
1038 | 1043 |
| |
1039 | 1044 |
| |
1040 |
| - | |
| 1045 | + | |
1041 | 1046 |
| |
1042 | 1047 |
| |
1043 | 1048 |
| |
1044 | 1049 |
| |
1045 |
| - | |
| 1050 | + | |
1046 | 1051 |
| |
1047 | 1052 |
| |
1048 | 1053 |
| |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
1049 | 1057 |
| |
1050 | 1058 |
| |
1051 | 1059 |
| |
| |||
1354 | 1362 |
| |
1355 | 1363 |
| |
1356 | 1364 |
| |
1357 |
| - | |
1358 |
| - | |
1359 |
| - | |
1360 | 1365 |
| |
1361 | 1366 |
| |
1362 | 1367 |
| |
| |||
1654 | 1659 |
| |
1655 | 1660 |
| |
1656 | 1661 |
| |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1657 | 1669 |
| |
1658 | 1670 |
| |
1659 | 1671 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
313 | 313 |
| |
314 | 314 |
| |
315 | 315 |
| |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
316 | 324 |
| |
317 | 325 |
| |
318 | 326 |
| |
|
Lines changed: 22 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10226 | 10226 |
| |
10227 | 10227 |
| |
10228 | 10228 |
| |
10229 |
| - | |
| 10229 | + | |
10230 | 10230 |
| |
10231 | 10231 |
| |
10232 |
| - | |
| 10232 | + | |
| 10233 | + | |
| 10234 | + | |
| 10235 | + | |
| 10236 | + | |
| 10237 | + | |
| 10238 | + | |
10233 | 10239 |
| |
10234 | 10240 |
| |
10235 | 10241 |
| |
10236 |
| - | |
10237 |
| - | |
| 10242 | + | |
10238 | 10243 |
| |
10239 | 10244 |
| |
10240 | 10245 |
| |
| |||
10251 | 10256 |
| |
10252 | 10257 |
| |
10253 | 10258 |
| |
| 10259 | + | |
| 10260 | + | |
| 10261 | + | |
| 10262 | + | |
| 10263 | + | |
10254 | 10264 |
| |
10255 | 10265 |
| |
10256 | 10266 |
| |
| |||
10366 | 10376 |
| |
10367 | 10377 |
| |
10368 | 10378 |
| |
10369 |
| - | |
| 10379 | + | |
| 10380 | + | |
| 10381 | + | |
10370 | 10382 |
| |
10371 | 10383 |
| |
10372 | 10384 |
| |
| |||
10378 | 10390 |
| |
10379 | 10391 |
| |
10380 | 10392 |
| |
10381 |
| - | |
| 10393 | + | |
| 10394 | + | |
10382 | 10395 |
| |
10383 | 10396 |
| |
10384 | 10397 |
| |
| |||
10400 | 10413 |
| |
10401 | 10414 |
| |
10402 | 10415 |
| |
10403 |
| - | |
10404 |
| - | |
| 10416 | + | |
| 10417 | + | |
| 10418 | + | |
10405 | 10419 |
| |
10406 | 10420 |
| |
10407 | 10421 |
| |
|
Lines changed: 25 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
| 110 | + | |
110 | 111 |
| |
111 | 112 |
| |
112 | 113 |
| |
| |||
860 | 861 |
| |
861 | 862 |
| |
862 | 863 |
| |
| 864 | + | |
| 865 | + | |
863 | 866 |
| |
864 | 867 |
| |
865 | 868 |
| |
866 | 869 |
| |
867 | 870 |
| |
868 |
| - | |
869 |
| - | |
870 | 871 |
| |
871 | 872 |
| |
872 | 873 |
| |
| |||
938 | 939 |
| |
939 | 940 |
| |
940 | 941 |
| |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
941 | 958 |
| |
942 | 959 |
| |
943 | 960 |
| |
| |||
3272 | 3289 |
| |
3273 | 3290 |
| |
3274 | 3291 |
| |
3275 |
| - | |
3276 |
| - | |
3277 |
| - | |
3278 |
| - | |
3279 | 3292 |
| |
3280 | 3293 |
| |
3281 | 3294 |
| |
3282 | 3295 |
| |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
3283 | 3300 |
| |
3284 |
| - | |
| 3301 | + | |
3285 | 3302 |
| |
| 3303 | + | |
3286 | 3304 |
| |
3287 | 3305 |
| |
3288 | 3306 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
| 350 | + | |
| 351 | + | |
| 352 | + | |
350 | 353 |
| |
351 | 354 |
| |
352 | 355 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 |
| |
| 24 | + | |
18 | 25 |
| |
19 | 26 |
| |
20 | 27 |
| |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + |
0 commit comments
Comments
(0)