|
68 | 68 | test_auth($node2, $db2, "t2",
|
69 | 69 | "SCRAM auth directly on foreign server should still succeed");
|
70 | 70 |
|
71 |
| -# Ensure that trust connections fail without superuser opt-in. |
72 |
| -unlink($node1->data_dir . '/pg_hba.conf'); |
73 |
| -unlink($node2->data_dir . '/pg_hba.conf'); |
| 71 | +SKIP: |
| 72 | +{ |
| 73 | + skip "test requires Unix-domain sockets", 4 if !$use_unix_sockets; |
| 74 | + |
| 75 | + # Ensure that trust connections fail without superuser opt-in. |
| 76 | + unlink($node1->data_dir . '/pg_hba.conf'); |
| 77 | + unlink($node2->data_dir . '/pg_hba.conf'); |
74 | 78 |
|
75 |
| -$node1->append_conf( |
76 |
| - 'pg_hba.conf', qq{ |
| 79 | + $node1->append_conf( |
| 80 | + 'pg_hba.conf', qq{ |
77 | 81 | local db0 all scram-sha-256
|
78 | 82 | local db1 all trust
|
79 | 83 | }
|
80 |
| -); |
81 |
| -$node2->append_conf( |
82 |
| - 'pg_hba.conf', qq{ |
| 84 | + ); |
| 85 | + $node2->append_conf( |
| 86 | + 'pg_hba.conf', qq{ |
83 | 87 | local all all password
|
84 | 88 | }
|
85 |
| -); |
86 |
| - |
87 |
| -$node1->restart; |
88 |
| -$node2->restart; |
89 |
| - |
90 |
| -my ($ret, $stdout, $stderr) = $node1->psql( |
91 |
| - $db0, |
92 |
| - qq'select count(1) from t', |
93 |
| - connstr => $node1->connstr($db0) . " user=$user"); |
94 |
| - |
95 |
| -is($ret, 3, 'loopback trust fails on the same cluster'); |
96 |
| -like( |
97 |
| - $stderr, |
98 |
| - qr/failed: authentication method requirement "scram-sha-256"/, |
99 |
| - 'expected error from loopback trust (same cluster)'); |
100 |
| - |
101 |
| -($ret, $stdout, $stderr) = $node1->psql( |
102 |
| - $db0, |
103 |
| - qq'select count(1) from t2', |
104 |
| - connstr => $node1->connstr($db0) . " user=$user"); |
105 |
| - |
106 |
| -is($ret, 3, 'loopback password fails on a different cluster'); |
107 |
| -like( |
108 |
| - $stderr, |
109 |
| - qr/failed: authentication method requirement "scram-sha-256"/, |
110 |
| - 'expected error from loopback password (different cluster)'); |
| 89 | + ); |
| 90 | + |
| 91 | + $node1->restart; |
| 92 | + $node2->restart; |
| 93 | + |
| 94 | + my ($ret, $stdout, $stderr) = $node1->psql( |
| 95 | + $db0, |
| 96 | + qq'select count(1) from t', |
| 97 | + connstr => $node1->connstr($db0) . " user=$user"); |
| 98 | + |
| 99 | + is($ret, 3, 'loopback trust fails on the same cluster'); |
| 100 | + like( |
| 101 | + $stderr, |
| 102 | + qr/failed: authentication method requirement "scram-sha-256"/, |
| 103 | + 'expected error from loopback trust (same cluster)'); |
| 104 | + |
| 105 | + ($ret, $stdout, $stderr) = $node1->psql( |
| 106 | + $db0, |
| 107 | + qq'select count(1) from t2', |
| 108 | + connstr => $node1->connstr($db0) . " user=$user"); |
| 109 | + |
| 110 | + is($ret, 3, 'loopback password fails on a different cluster'); |
| 111 | + like( |
| 112 | + $stderr, |
| 113 | + qr/failed: authentication method requirement "scram-sha-256"/, |
| 114 | + 'expected error from loopback password (different cluster)'); |
| 115 | +} |
111 | 116 |
|
112 | 117 | # Helper functions
|
113 | 118 |
|
|
0 commit comments