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

Commitc8df46b

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 parentf159f18 commitc8df46b

File tree

1 file changed

+58
-25
lines changed

1 file changed

+58
-25
lines changed

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

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,77 @@
1616
{
1717
planskip_all=>'LDAP not supported by this build';
1818
}
19-
elsif ($^Oeq'darwin' &&-d'/opt/homebrew/opt/openldap')
19+
# Find the OpenLDAP server binary and directory containing schema
20+
# definition files.
21+
elsif ($^Oeq'darwin')
2022
{
21-
# typical paths for Homebrew on ARM
22-
$slapd ='/opt/homebrew/opt/openldap/libexec/slapd';
23-
$ldap_schema_dir ='/opt/homebrew/etc/openldap/schema';
24-
}
25-
elsif ($^Oeq'darwin' &&-d'/usr/local/opt/openldap')
26-
{
27-
# typical paths for Homebrew on Intel
28-
$slapd ='/usr/local/opt/openldap/libexec/slapd';
29-
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
30-
}
31-
elsif ($^Oeq'darwin' &&-d'/opt/local/etc/openldap')
32-
{
33-
# typical paths for MacPorts
34-
$slapd ='/opt/local/libexec/slapd';
35-
$ldap_schema_dir ='/opt/local/etc/openldap/schema';
23+
if (-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 (-d'/usr/local/opt/openldap')
30+
{
31+
# typical paths for Homebrew on Intel
32+
$slapd ='/usr/local/opt/openldap/libexec/slapd';
33+
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
34+
}
35+
elsif (-d'/opt/local/etc/openldap')
36+
{
37+
# typical paths for MacPorts
38+
$slapd ='/opt/local/libexec/slapd';
39+
$ldap_schema_dir ='/opt/local/etc/openldap/schema';
40+
}
41+
else
42+
{
43+
planskip_all=>"OpenLDAP server installation not found";
44+
}
3645
}
3746
elsif ($^Oeq'linux')
3847
{
39-
$slapd ='/usr/sbin/slapd';
40-
$ldap_schema_dir ='/etc/ldap/schema'if-d'/etc/ldap/schema';
41-
$ldap_schema_dir ='/etc/openldap/schema'if-d'/etc/openldap/schema';
48+
if (-d'/etc/ldap/schema')
49+
{
50+
$slapd ='/usr/sbin/slapd';
51+
$ldap_schema_dir ='/etc/ldap/schema';
52+
}
53+
elsif (-d'/etc/openldap/schema')
54+
{
55+
$slapd ='/usr/sbin/slapd';
56+
$ldap_schema_dir ='/etc/openldap/schema';
57+
}
58+
else
59+
{
60+
planskip_all=>"OpenLDAP server installation not found";
61+
}
4262
}
4363
elsif ($^Oeq'freebsd')
4464
{
45-
$slapd ='/usr/local/libexec/slapd';
46-
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
65+
if (-d'/usr/local/etc/openldap/schema')
66+
{
67+
$slapd ='/usr/local/libexec/slapd';
68+
$ldap_schema_dir ='/usr/local/etc/openldap/schema';
69+
}
70+
else
71+
{
72+
planskip_all=>"OpenLDAP server installation not found";
73+
}
4774
}
4875
elsif ($^Oeq'openbsd')
4976
{
50-
$slapd ='/usr/local/libexec/slapd';
51-
$ldap_schema_dir ='/usr/local/share/examples/openldap/schema';
77+
if (-d'/usr/local/share/examples/openldap/schema')
78+
{
79+
$slapd ='/usr/local/libexec/slapd';
80+
$ldap_schema_dir ='/usr/local/share/examples/openldap/schema';
81+
}
82+
else
83+
{
84+
planskip_all=>"OpenLDAP server installation not found";
85+
}
5286
}
5387
else
5488
{
55-
planskip_all=>
56-
"ldap tests not supported on $^O or dependencies not installed";
89+
planskip_all=>"ldap tests not supported on $^O";
5790
}
5891

5992
# make your own edits here

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp