forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4d5111b
committed
More use of getpwuid_r() directly
Remove src/port/user.c, call getpwuid_r() directly. This reduces somecomplexity and allows better control of the error behavior. Forexample, the old code would in some circumstances silently truncatethe result string, or produce error message strings that the callerwouldn't use.src/port/user.c used to be called src/port/thread.c and containedvarious portability complications to support thread-safety. These areall obsolete, and all but the user-lookup functions have already beenremoved. This patch completes this by also removing the user-lookupfunctions.Also convert src/backend/libpq/auth.c to use getpwuid_r() forthread-safety.Originally, I tried to be overly correct by usingsysconf(_SC_GETPW_R_SIZE_MAX) to get the buffer size for getpwuid_r(),but that doesn't work on FreeBSD. All the OS where I could find thesource code internally use 1024 as the suggested buffer size, so Ijust ended up hardcoding that. The previous code used BUFSIZ, whichis an unrelated constant from stdio.h, so its use seemedinappropriate.Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Discussion:https://www.postgresql.org/message-id/flat/5f293da9-ceb4-4937-8e52-82c25db8e4d3%40eisentraut.org1 parent2313828 commit4d5111b
File tree
10 files changed
+72
-123
lines changed- src
- backend/libpq
- bin/psql
- include
- interfaces/libpq
- port
10 files changed
+72
-123
lines changedLines changed: 13 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1857 | 1857 |
| |
1858 | 1858 |
| |
1859 | 1859 |
| |
| 1860 | + | |
1860 | 1861 |
| |
| 1862 | + | |
| 1863 | + | |
1861 | 1864 |
| |
1862 | 1865 |
| |
1863 | 1866 |
| |
| |||
1876 | 1879 |
| |
1877 | 1880 |
| |
1878 | 1881 |
| |
1879 |
| - | |
1880 |
| - | |
1881 |
| - | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1882 | 1891 |
| |
1883 |
| - | |
1884 |
| - | |
1885 | 1892 |
| |
1886 |
| - | |
1887 |
| - | |
1888 |
| - | |
| 1893 | + | |
1889 | 1894 |
| |
1890 | 1895 |
| |
1891 | 1896 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 |
| - | |
27 |
| - | |
| 26 | + | |
28 | 27 |
| |
29 | 28 |
| |
30 | 29 |
| |
|
Lines changed: 0 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 | 439 |
| |
446 | 440 |
| |
447 | 441 |
| |
|
Lines changed: 18 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
1203 | 1204 |
| |
1204 | 1205 |
| |
1205 | 1206 |
| |
1206 |
| - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1207 | 1211 |
| |
1208 | 1212 |
| |
1209 | 1213 |
| |
| |||
1214 | 1218 |
| |
1215 | 1219 |
| |
1216 | 1220 |
| |
1217 |
| - | |
1218 |
| - | |
1219 |
| - | |
1220 |
| - | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1221 | 1234 |
| |
1222 | 1235 |
| |
1223 | 1236 |
| |
|
Lines changed: 19 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
| 53 | + | |
53 | 54 |
| |
54 | 55 |
| |
55 | 56 |
| |
| |||
7702 | 7703 |
| |
7703 | 7704 |
| |
7704 | 7705 |
| |
7705 |
| - | |
7706 |
| - | |
7707 |
| - | |
7708 |
| - | |
| 7706 | + | |
| 7707 | + | |
| 7708 | + | |
| 7709 | + | |
| 7710 | + | |
| 7711 | + | |
| 7712 | + | |
| 7713 | + | |
| 7714 | + | |
| 7715 | + | |
| 7716 | + | |
| 7717 | + | |
| 7718 | + | |
| 7719 | + | |
| 7720 | + | |
| 7721 | + | |
| 7722 | + | |
| 7723 | + | |
7709 | 7724 |
| |
7710 | 7725 |
| |
7711 | 7726 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
17 |
| - | |
| 16 | + | |
18 | 17 |
| |
19 | 18 |
| |
20 | 19 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
61 |
| - | |
| 60 | + | |
62 | 61 |
| |
63 | 62 |
| |
64 | 63 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 | 23 |
| |
25 | 24 |
| |
26 | 25 |
| |
|
Lines changed: 19 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
35 | 36 |
| |
36 | 37 |
| |
37 | 38 |
| |
| |||
934 | 935 |
| |
935 | 936 |
| |
936 | 937 |
| |
937 |
| - | |
938 |
| - | |
939 |
| - | |
940 |
| - | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
941 | 956 |
| |
942 | 957 |
| |
943 | 958 |
| |
|
Lines changed: 0 additions & 89 deletions
This file was deleted.
0 commit comments
Comments
(0)