forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd3befe9
committed
Fix unportable use of getnameinfo() in pg_hba_file_rules view.
fill_hba_line() thought it could get away with passing sizeof(structsockaddr_storage) rather than the actual addrlen previously returnedby getaddrinfo(). While that appears to work on many platforms,it does not work on FreeBSD 11: you get back a failure, which leadsto the view showing NULL for the address and netmask columns in allrows. The POSIX spec for getnameinfo() is pretty clearly onFreeBSD's side here: you should pass the actual address length.So it seems plausible that there are other platforms where thiscoding also fails, and we just hadn't noticed.Also, IMO the fact that getnameinfo() failure leads to a NULL outputis pretty bogus in itself. Our pg_getnameinfo_all() wrapper iscareful to emit "???" on failure, and we should use that in suchcases. NULL should only be emitted in rows that don't have IPaddresses.Per bug #16695 from Peter Vandivier. Back-patch to v10 where thiscode was added.Discussion:https://postgr.es/m/16695-a665558e2f630be7@postgresql.org1 parent5ba4987 commitd3befe9
2 files changed
+27
-10
lines changedLines changed: 21 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1166 | 1166 |
| |
1167 | 1167 |
| |
1168 | 1168 |
| |
| 1169 | + | |
1169 | 1170 |
| |
1170 | 1171 |
| |
| 1172 | + | |
| 1173 | + | |
1171 | 1174 |
| |
1172 | 1175 |
| |
1173 | 1176 |
| |
| |||
1216 | 1219 |
| |
1217 | 1220 |
| |
1218 | 1221 |
| |
| 1222 | + | |
1219 | 1223 |
| |
1220 | 1224 |
| |
1221 | 1225 |
| |
| |||
1266 | 1270 |
| |
1267 | 1271 |
| |
1268 | 1272 |
| |
| 1273 | + | |
1269 | 1274 |
| |
1270 | 1275 |
| |
1271 | 1276 |
| |
| |||
2518 | 2523 |
| |
2519 | 2524 |
| |
2520 | 2525 |
| |
2521 |
| - | |
2522 |
| - | |
2523 |
| - | |
2524 |
| - | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
2525 | 2531 |
| |
2526 |
| - | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
2527 | 2537 |
| |
2528 | 2538 |
| |
2529 |
| - | |
2530 |
| - | |
2531 |
| - | |
2532 |
| - | |
| 2539 | + | |
2533 | 2540 |
| |
2534 |
| - | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
2535 | 2546 |
| |
2536 | 2547 |
| |
2537 | 2548 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 |
| |
46 | 50 |
| |
47 | 51 |
| |
| |||
108 | 112 |
| |
109 | 113 |
| |
110 | 114 |
| |
| 115 | + | |
| 116 | + | |
111 | 117 |
| |
112 | 118 |
| |
113 | 119 |
| |
|
0 commit comments
Comments
(0)