blob: cb3e169002f361b7ee28c7fc10249d919e58f43e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Copyright (c) 2021-2025, PostgreSQL Global Development Group
# Tests targeting SSPI on Windows.
use strict;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;
if (!$windows_os || $use_unix_sockets)
{
plan skip_all =>
"SSPI tests require Windows (without PG_TEST_USE_UNIX_SOCKETS)";
}
# Initialize primary node
my $node = PostgreSQL::Test::Cluster->new('primary');
$node->init;
$node->append_conf('postgresql.conf', "log_connections = authentication\n");
$node->start;
my $huge_pages_status =
$node->safe_psql('postgres', q(SHOW huge_pages_status;));
isnt($huge_pages_status, 'unknown', "check huge_pages_status");
# SSPI is set up by default. Make sure it interacts correctly with
# require_auth.
$node->connect_ok("require_auth=sspi",
"SSPI authentication required, works with SSPI auth");
$node->connect_fails(
"require_auth=!sspi",
"SSPI authentication forbidden, fails with SSPI auth",
expected_stderr =>
qr/authentication method requirement "!sspi" failed: server requested SSPI authentication/
);
$node->connect_fails(
"require_auth=scram-sha-256",
"SCRAM authentication required, fails with SSPI auth",
expected_stderr =>
qr/authentication method requirement "scram-sha-256" failed: server requested SSPI authentication/
);
done_testing();
|