forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitff6ce9a
committed
Fix bugs in libpq's GSSAPI encryption support.
The critical issue fixed here is that if a GSSAPI-encrypted connectionis successfully made, pqsecure_open_gss() cleared conn->allow_ssl_try,as an admittedly-hacky way of preventing us from then trying to tunnelSSL encryption over the already-encrypted connection. The problemwith that is that if we abandon the GSSAPI connection because of afailure during authentication, we would not attempt SSL encryptionin the next try with the same server. This can lead to unexpectedconnection failure, or silently getting a non-encrypted connectionwhere an encrypted one is expected.Fortunately, we'd only manage to make a GSSAPI-encrypted connectionif both client and server hold valid tickets in the same Kerberosinfrastructure, which is a relatively uncommon environment.Nonetheless this is a very nasty bug with potential securityconsequences. To fix, don't reset the flag, instead adding acheck for conn->gssenc being already true when deciding whetherto try to initiate SSL.While here, fix some lesser issues in libpq's GSSAPI code:* Use the need_new_connection stanza when dropping an attemptedGSSAPI connection, instead of partially duplicating that code.The consequences of this are pretty minor: AFAICS it could onlylead to auth_req_received or password_needed remaining set whenthey shouldn't, which is not too harmful.* Fix pg_GSS_error() to not repeat the "mprefix" it's given multipletimes, and to notice any failure return from gss_display_status().* Avoid gratuitous dependency on NI_MAXHOST inpg_GSS_load_servicename().Per report from Mikael Gustavsson. Back-patch to v12 wherethis code was introduced.Discussion:https://postgr.es/m/e5b0b6ed05764324a2f3fe7acfc766d5@smhi.se1 parentcf61b07 commitff6ce9a
File tree
3 files changed
+29
-28
lines changed- src/interfaces/libpq
3 files changed
+29
-28
lines changedLines changed: 14 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2909 | 2909 |
| |
2910 | 2910 |
| |
2911 | 2911 |
| |
2912 |
| - | |
2913 |
| - | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
2914 | 2915 |
| |
2915 | 2916 |
| |
2916 |
| - | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
2917 | 2922 |
| |
2918 | 2923 |
| |
2919 | 2924 |
| |
| |||
3042 | 3047 |
| |
3043 | 3048 |
| |
3044 | 3049 |
| |
| 3050 | + | |
3045 | 3051 |
| |
3046 | 3052 |
| |
3047 | 3053 |
| |
| |||
3139 | 3145 |
| |
3140 | 3146 |
| |
3141 | 3147 |
| |
3142 |
| - | |
3143 |
| - | |
| 3148 | + | |
3144 | 3149 |
| |
3145 | 3150 |
| |
3146 | 3151 |
| |
| |||
3158 | 3163 |
| |
3159 | 3164 |
| |
3160 | 3165 |
| |
| 3166 | + | |
3161 | 3167 |
| |
3162 | 3168 |
| |
3163 | 3169 |
| |
| |||
3186 | 3192 |
| |
3187 | 3193 |
| |
3188 | 3194 |
| |
3189 |
| - | |
3190 |
| - | |
| 3195 | + | |
3191 | 3196 |
| |
3192 | 3197 |
| |
3193 | 3198 |
| |
| |||
3354 | 3359 |
| |
3355 | 3360 |
| |
3356 | 3361 |
| |
3357 |
| - | |
| 3362 | + | |
3358 | 3363 |
| |
3359 |
| - | |
3360 |
| - | |
| 3364 | + | |
3361 | 3365 |
| |
3362 | 3366 |
| |
3363 | 3367 |
| |
|
Lines changed: 12 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 |
| - | |
26 |
| - | |
| 26 | + | |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
35 |
| - | |
36 |
| - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
| |||
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
49 |
| - | |
50 |
| - | |
51 |
| - | |
52 |
| - | |
53 |
| - | |
54 |
| - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
106 |
| - | |
| 106 | + | |
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
647 | 647 |
| |
648 | 648 |
| |
649 | 649 |
| |
650 |
| - | |
651 |
| - | |
| 650 | + | |
| 651 | + | |
652 | 652 |
| |
653 |
| - | |
654 |
| - | |
655 |
| - | |
| 653 | + | |
656 | 654 |
| |
657 | 655 |
| |
658 | 656 |
| |
659 | 657 |
| |
660 |
| - | |
661 | 658 |
| |
662 | 659 |
| |
663 | 660 |
| |
|
0 commit comments
Comments
(0)