Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1843a27

Browse files
committed
Improve check in LDAP test to find the OpenLDAP installation
If the OpenLDAP installation directory is not found, set $setup to 0so that the LDAP tests are skipped. The macOS checks were alreadydoing that, but the checks on other OS's were not. While we're at it,improve the error message when the tests are skipped, to specifywhether the OS is supported at all, or if we just didn't find theinstallation directory.This was accidentally "working" without this, i.e. we were skippingthe tests if the OpenLDAP installation was not found, because of a bugin the LdapServer test module: the END block clobbered the exit codeso if the script die()s before running the first subtest, the wholetest script was marked as SKIPped. The next commit will fix that bug,but we need to fix the setup code first.These checks should probably go into configure/meson, but this isbetter than nothing and allows fixing the bug in the END block.Backpatch to all supported versions.Discussion:https://www.postgresql.org/message-id/fb898a70-3a88-4629-88e9-f2375020061d@iki.fi
1 parentd3167ed commit1843a27

File tree

1 file changed

+56
-28
lines changed

1 file changed

+56
-28
lines changed

‎src/test/ldap/t/001_auth.pl

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,73 @@
77
use PostgresNode;
88
use Test::More;
99

10-
if ($ENV{with_ldap}eq'yes')
11-
{
12-
plantests=> 28;
13-
}
14-
else
15-
{
16-
planskip_all=>'LDAP not supported by this build';
17-
}
18-
1910
my ($slapd,$ldap_bin_dir,$ldap_schema_dir);
2011

2112
$ldap_bin_dir =undef;# usually in PATH
2213

23-
if ($^Oeq'darwin' &&-d'/opt/homebrew/opt/openldap')
24-
{
25-
# typical paths for Homebrew on ARM
26-
$slapd ='/opt/homebrew/opt/openldap/libexec/slapd';
27-
$ldap_schema_dir ='/opt/homebrew/etc/openldap/schema';
28-
}
29-
elsif ($^Oeq'darwin' &&-d'/usr/local/opt/openldap')
14+
if ($ENV{with_ldap}ne'yes')
3015
{
31-
# typical paths for Homebrew on Intel
32-
$slapd ='/usr/local/opt/openldap/libexec/slapd';
33-
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
16+
planskip_all=>'LDAP not supported by this build';
3417
}
35-
elsif ($^Oeq'darwin' &&-d'/opt/local/etc/openldap')
18+
# Find the OpenLDAP server binary and directory containing schema
19+
# definition files.
20+
elsif ($^Oeq'darwin')
3621
{
37-
# typical paths for MacPorts
38-
$slapd ='/opt/local/libexec/slapd';
39-
$ldap_schema_dir ='/opt/local/etc/openldap/schema';
22+
if (-d'/opt/homebrew/opt/openldap')
23+
{
24+
# typical paths for Homebrew on ARM
25+
$slapd ='/opt/homebrew/opt/openldap/libexec/slapd';
26+
$ldap_schema_dir ='/opt/homebrew/etc/openldap/schema';
27+
}
28+
elsif (-d'/usr/local/opt/openldap')
29+
{
30+
# typical paths for Homebrew on Intel
31+
$slapd ='/usr/local/opt/openldap/libexec/slapd';
32+
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
33+
}
34+
elsif (-d'/opt/local/etc/openldap')
35+
{
36+
# typical paths for MacPorts
37+
$slapd ='/opt/local/libexec/slapd';
38+
$ldap_schema_dir ='/opt/local/etc/openldap/schema';
39+
}
40+
else
41+
{
42+
planskip_all=>"OpenLDAP server installation not found";
43+
}
4044
}
4145
elsif ($^Oeq'linux')
4246
{
43-
$slapd ='/usr/sbin/slapd';
44-
$ldap_schema_dir ='/etc/ldap/schema'if-d'/etc/ldap/schema';
45-
$ldap_schema_dir ='/etc/openldap/schema'if-d'/etc/openldap/schema';
47+
if (-d'/etc/ldap/schema')
48+
{
49+
$slapd ='/usr/sbin/slapd';
50+
$ldap_schema_dir ='/etc/ldap/schema';
51+
}
52+
elsif (-d'/etc/openldap/schema')
53+
{
54+
$slapd ='/usr/sbin/slapd';
55+
$ldap_schema_dir ='/etc/openldap/schema';
56+
}
57+
else
58+
{
59+
planskip_all=>"OpenLDAP server installation not found";
60+
}
4661
}
4762
elsif ($^Oeq'freebsd')
4863
{
49-
$slapd ='/usr/local/libexec/slapd';
50-
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
64+
if (-d'/usr/local/etc/openldap/schema')
65+
{
66+
$slapd ='/usr/local/libexec/slapd';
67+
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
68+
}
69+
else
70+
{
71+
planskip_all=>"OpenLDAP server installation not found";
72+
}
73+
}
74+
else
75+
{
76+
planskip_all=>"ldap tests not supported on $^O";
5177
}
5278

5379
# make your own edits here
@@ -374,3 +400,5 @@ sub test_access
374400

375401
$ENV{"PGPASSWORD"} ='secret1';
376402
test_access($node,'test1', 2,'bad combination of LDAPS and StartTLS');
403+
404+
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp