mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-07 21:53:41 +08:00
update test recipes
cd test/recipes sed -i "" 's/\"openssl\"/\"gmssl\"/g' *.t
This commit is contained in:
@@ -25,7 +25,7 @@ my $testsrc = srctop_file("test","recipes",basename($0));
|
|||||||
|
|
||||||
my $test = catfile(".", "p");
|
my $test = catfile(".", "p");
|
||||||
|
|
||||||
my $cmd = "openssl";
|
my $cmd = "gmssl";
|
||||||
|
|
||||||
my @ciphers =
|
my @ciphers =
|
||||||
map { s/^\s+//; s/\s+$//; split /\s+/ }
|
map { s/^\s+//; s/\s+$//; split /\s+/ }
|
||||||
|
|||||||
@@ -21,24 +21,24 @@ setup("test_rehash");
|
|||||||
#If "openssl rehash -help" fails it's most likely because we're on a platform
|
#If "openssl rehash -help" fails it's most likely because we're on a platform
|
||||||
#that doesn't support the rehash command (e.g. Windows)
|
#that doesn't support the rehash command (e.g. Windows)
|
||||||
plan skip_all => "test_rehash is not available on this platform"
|
plan skip_all => "test_rehash is not available on this platform"
|
||||||
unless run(app(["openssl", "rehash", "-help"]));
|
unless run(app(["gmssl", "rehash", "-help"]));
|
||||||
|
|
||||||
plan tests => 5;
|
plan tests => 5;
|
||||||
|
|
||||||
indir "rehash.$$" => sub {
|
indir "rehash.$$" => sub {
|
||||||
prepare();
|
prepare();
|
||||||
ok(run(app(["openssl", "rehash", curdir()])),
|
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||||
'Testing normal rehash operations');
|
'Testing normal rehash operations');
|
||||||
}, create => 1, cleanup => 1;
|
}, create => 1, cleanup => 1;
|
||||||
|
|
||||||
indir "rehash.$$" => sub {
|
indir "rehash.$$" => sub {
|
||||||
prepare(sub { chmod 400, $_ foreach (@_); });
|
prepare(sub { chmod 400, $_ foreach (@_); });
|
||||||
ok(run(app(["openssl", "rehash", curdir()])),
|
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||||
'Testing rehash operations on readonly files');
|
'Testing rehash operations on readonly files');
|
||||||
}, create => 1, cleanup => 1;
|
}, create => 1, cleanup => 1;
|
||||||
|
|
||||||
indir "rehash.$$" => sub {
|
indir "rehash.$$" => sub {
|
||||||
ok(run(app(["openssl", "rehash", curdir()])),
|
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||||
'Testing rehash operations on empty directory');
|
'Testing rehash operations on empty directory');
|
||||||
}, create => 1, cleanup => 1;
|
}, create => 1, cleanup => 1;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ indir "rehash.$$" => sub {
|
|||||||
close FOO;
|
close FOO;
|
||||||
skip "It's pointless to run the next test as root", 1;
|
skip "It's pointless to run the next test as root", 1;
|
||||||
}
|
}
|
||||||
isnt(run(app(["openssl", "rehash", curdir()])), 1,
|
isnt(run(app(["gmssl", "rehash", curdir()])), 1,
|
||||||
'Testing rehash operations on readonly directory');
|
'Testing rehash operations on readonly directory');
|
||||||
}
|
}
|
||||||
chmod 0700, curdir(); # make it writable again, so cleanup works
|
chmod 0700, curdir(); # make it writable again, so cleanup works
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ my @handmessages = (
|
|||||||
|
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
undef,
|
undef,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ plan skip_all => "$test_name needs TLSv1.2 enabled"
|
|||||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&add_empty_recs_filter,
|
\&add_empty_recs_filter,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ my $ticketseen = 0;
|
|||||||
|
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
undef,
|
undef,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ plan skip_all => "$test_name needs TLS enabled"
|
|||||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&ske_0_p_filter,
|
\&ske_0_p_filter,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ plan skip_all => "$test_name needs TLS enabled"
|
|||||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&vers_tolerance_filter,
|
\&vers_tolerance_filter,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ my $fullhand = 0;
|
|||||||
|
|
||||||
my $proxy = TLSProxy::Proxy->new(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&extms_filter,
|
\&extms_filter,
|
||||||
cmdstr(app(["openssl"]), display => 1),
|
cmdstr(app(["gmssl"]), display => 1),
|
||||||
srctop_file("apps", "server.pem"),
|
srctop_file("apps", "server.pem"),
|
||||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file/;
|
|||||||
|
|
||||||
setup("test_ca");
|
setup("test_ca");
|
||||||
|
|
||||||
$ENV{OPENSSL} = cmdstr(app(["openssl"]), display => 1);
|
$ENV{OPENSSL} = cmdstr(app(["gmssl"]), display => 1);
|
||||||
my $std_openssl_cnf =
|
my $std_openssl_cnf =
|
||||||
srctop_file("apps", $^O eq "VMS" ? "openssl-vms.cnf" : "openssl.cnf");
|
srctop_file("apps", $^O eq "VMS" ? "openssl-vms.cnf" : "openssl.cnf");
|
||||||
|
|
||||||
|
|||||||
@@ -391,8 +391,8 @@ subtest "CMS => PKCS#7 compatibility tests\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "smime", @{$$_[2]}]))
|
&& run(app(["gmssl", "smime", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
@@ -406,8 +406,8 @@ subtest "CMS <= PKCS#7 compatibility tests\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "smime", @{$$_[1]}]))
|
ok(run(app(["gmssl", "smime", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
@@ -422,8 +422,8 @@ subtest "CMS <=> CMS consistency tests\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
@@ -433,8 +433,8 @@ subtest "CMS <=> CMS consistency tests\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
@@ -450,8 +450,8 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
@@ -467,8 +467,8 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
|
|||||||
my $skip_reason = check_availability($$_[0]);
|
my $skip_reason = check_availability($$_[0]);
|
||||||
skip $skip_reason, 1 if $skip_reason;
|
skip $skip_reason, 1 if $skip_reason;
|
||||||
|
|
||||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||||
&& compare_text($smcont, "smtst.txt") == 0,
|
&& compare_text($smcont, "smtst.txt") == 0,
|
||||||
$$_[0]);
|
$$_[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ sub test_ocsp {
|
|||||||
my $CAfile = shift;
|
my $CAfile = shift;
|
||||||
my $expected_exit = shift;
|
my $expected_exit = shift;
|
||||||
|
|
||||||
run(app(["openssl", "base64", "-d",
|
run(app(["gmssl", "base64", "-d",
|
||||||
"-in", catfile($ocspdir,$inputfile),
|
"-in", catfile($ocspdir,$inputfile),
|
||||||
"-out", "ocsp-resp-fff.dat"]));
|
"-out", "ocsp-resp-fff.dat"]));
|
||||||
with({ exit_checker => sub { return shift == $expected_exit; } },
|
with({ exit_checker => sub { return shift == $expected_exit; } },
|
||||||
sub { ok(run(app(["openssl", "ocsp", "-respin", "ocsp-resp-fff.dat",
|
sub { ok(run(app(["gmssl", "ocsp", "-respin", "ocsp-resp-fff.dat",
|
||||||
"-partial_chain", @check_time,
|
"-partial_chain", @check_time,
|
||||||
"-CAfile", catfile($ocspdir, $CAfile),
|
"-CAfile", catfile($ocspdir, $CAfile),
|
||||||
"-verify_other", catfile($ocspdir, $CAfile),
|
"-verify_other", catfile($ocspdir, $CAfile),
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ $ENV{OPENSSL_WIN32_UTF8}=1;
|
|||||||
plan tests => 1;
|
plan tests => 1;
|
||||||
|
|
||||||
# just see that we can read shibboleth.pfx protected with $pass
|
# just see that we can read shibboleth.pfx protected with $pass
|
||||||
ok(run(app(["openssl", "pkcs12", "-noout",
|
ok(run(app(["gmssl", "pkcs12", "-noout",
|
||||||
"-password", "pass:$pass",
|
"-password", "pass:$pass",
|
||||||
"-in", srctop_file("test", "shibboleth.pfx")])),
|
"-in", srctop_file("test", "shibboleth.pfx")])),
|
||||||
"test_pkcs12");
|
"test_pkcs12");
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ plan skip_all => "No SSL/TLS/DTLS protocol is support by this OpenSSL build"
|
|||||||
if $no_anytls && $no_anydtls;
|
if $no_anytls && $no_anydtls;
|
||||||
|
|
||||||
my $digest = "-sha1";
|
my $digest = "-sha1";
|
||||||
my @reqcmd = ("openssl", "req");
|
my @reqcmd = ("gmssl", "req");
|
||||||
my @x509cmd = ("openssl", "x509", $digest);
|
my @x509cmd = ("gmssl", "x509", $digest);
|
||||||
my @verifycmd = ("openssl", "verify");
|
my @verifycmd = ("gmssl", "verify");
|
||||||
my @gendsacmd = ("openssl", "gendsa");
|
my @gendsacmd = ("gmssl", "gendsa");
|
||||||
my $dummycnf = srctop_file("apps", "openssl.cnf");
|
my $dummycnf = srctop_file("apps", "openssl.cnf");
|
||||||
|
|
||||||
my $CAkey = "keyCA.ss";
|
my $CAkey = "keyCA.ss";
|
||||||
@@ -225,7 +225,7 @@ sub testss {
|
|||||||
SKIP: {
|
SKIP: {
|
||||||
$ENV{CN2} = "ECDSA Certificate";
|
$ENV{CN2} = "ECDSA Certificate";
|
||||||
skip 'failure', 4 unless
|
skip 'failure', 4 unless
|
||||||
ok(run(app(["openssl", "ecparam", "-name", "P-256",
|
ok(run(app(["gmssl", "ecparam", "-name", "P-256",
|
||||||
"-out", "ecp.ss"])),
|
"-out", "ecp.ss"])),
|
||||||
"make EC parameters");
|
"make EC parameters");
|
||||||
skip 'failure', 3 unless
|
skip 'failure', 3 unless
|
||||||
@@ -321,7 +321,7 @@ sub testssl {
|
|||||||
my $serverinfo = srctop_file("test","serverinfo.pem");
|
my $serverinfo = srctop_file("test","serverinfo.pem");
|
||||||
|
|
||||||
my $dsa_cert = 0;
|
my $dsa_cert = 0;
|
||||||
if (grep /DSA Public Key/, run(app(["openssl", "x509", "-in", $cert,
|
if (grep /DSA Public Key/, run(app(["gmssl", "x509", "-in", $cert,
|
||||||
"-text", "-noout"]), capture => 1)) {
|
"-text", "-noout"]), capture => 1)) {
|
||||||
$dsa_cert = 1;
|
$dsa_cert = 1;
|
||||||
}
|
}
|
||||||
@@ -452,7 +452,7 @@ sub testssl {
|
|||||||
my %ciphersuites =
|
my %ciphersuites =
|
||||||
map { my @c =
|
map { my @c =
|
||||||
map { split(/:/, $_) }
|
map { split(/:/, $_) }
|
||||||
run(app(["openssl", "ciphers", "${_}:$ciphers"]),
|
run(app(["gmssl", "ciphers", "${_}:$ciphers"]),
|
||||||
capture => 1);
|
capture => 1);
|
||||||
map { s/\R//; } @c; # chomp @c;
|
map { s/\R//; } @c; # chomp @c;
|
||||||
$protocolciphersuitcount += scalar @c;
|
$protocolciphersuitcount += scalar @c;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ plan skip_all => "TS is not supported by this OpenSSL build"
|
|||||||
# here, however, to be available in all subroutines.
|
# here, however, to be available in all subroutines.
|
||||||
my $testtsa;
|
my $testtsa;
|
||||||
my $CAtsa;
|
my $CAtsa;
|
||||||
my @RUN = ("openssl", "ts");
|
my @RUN = ("gmssl", "ts");
|
||||||
|
|
||||||
sub create_tsa_cert {
|
sub create_tsa_cert {
|
||||||
my $INDEX = shift;
|
my $INDEX = shift;
|
||||||
@@ -33,11 +33,11 @@ sub create_tsa_cert {
|
|||||||
my $r = 1;
|
my $r = 1;
|
||||||
$ENV{TSDNSECT} = "ts_cert_dn";
|
$ENV{TSDNSECT} = "ts_cert_dn";
|
||||||
|
|
||||||
ok(run(app(["openssl", "req", "-new",
|
ok(run(app(["gmssl", "req", "-new",
|
||||||
"-out", "tsa_req${INDEX}.pem",
|
"-out", "tsa_req${INDEX}.pem",
|
||||||
"-keyout", "tsa_key${INDEX}.pem"])));
|
"-keyout", "tsa_key${INDEX}.pem"])));
|
||||||
note "using extension $EXT";
|
note "using extension $EXT";
|
||||||
ok(run(app(["openssl", "x509", "-req",
|
ok(run(app(["gmssl", "x509", "-req",
|
||||||
"-in", "tsa_req${INDEX}.pem",
|
"-in", "tsa_req${INDEX}.pem",
|
||||||
"-out", "tsa_cert${INDEX}.pem",
|
"-out", "tsa_cert${INDEX}.pem",
|
||||||
"-CA", "tsaca.pem", "-CAkey", "tsacakey.pem",
|
"-CA", "tsaca.pem", "-CAkey", "tsacakey.pem",
|
||||||
@@ -86,14 +86,14 @@ indir "tsa" => sub
|
|||||||
$ENV{OPENSSL_CONF} = srctop_file("test", "CAtsa.cnf");
|
$ENV{OPENSSL_CONF} = srctop_file("test", "CAtsa.cnf");
|
||||||
# Because that's what ../apps/CA.pl really looks at
|
# Because that's what ../apps/CA.pl really looks at
|
||||||
$ENV{OPENSSL_CONFIG} = "-config ".$ENV{OPENSSL_CONF};
|
$ENV{OPENSSL_CONFIG} = "-config ".$ENV{OPENSSL_CONF};
|
||||||
$ENV{OPENSSL} = cmdstr(app(["openssl"]), display => 1);
|
$ENV{OPENSSL} = cmdstr(app(["gmssl"]), display => 1);
|
||||||
$testtsa = srctop_file("test", "recipes", "80-test_tsa.t");
|
$testtsa = srctop_file("test", "recipes", "80-test_tsa.t");
|
||||||
$CAtsa = srctop_file("test", "CAtsa.cnf");
|
$CAtsa = srctop_file("test", "CAtsa.cnf");
|
||||||
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
$ENV{TSDNSECT} = "ts_ca_dn";
|
$ENV{TSDNSECT} = "ts_ca_dn";
|
||||||
skip "failed", 19
|
skip "failed", 19
|
||||||
unless ok(run(app(["openssl", "req", "-new", "-x509", "-nodes",
|
unless ok(run(app(["gmssl", "req", "-new", "-x509", "-nodes",
|
||||||
"-out", "tsaca.pem", "-keyout", "tsacakey.pem"])),
|
"-out", "tsaca.pem", "-keyout", "tsacakey.pem"])),
|
||||||
'creating a new CA for the TSA tests');
|
'creating a new CA for the TSA tests');
|
||||||
|
|
||||||
|
|||||||
92
util/shlib_wrap.sh
Executable file
92
util/shlib_wrap.sh
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ $# -ne 0 ] || set -x # debug mode without arguments:-)
|
||||||
|
|
||||||
|
THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.."
|
||||||
|
[ -d "${THERE}" ] || exec "$@" # should never happen...
|
||||||
|
|
||||||
|
# Alternative to this is to parse ${THERE}/Makefile...
|
||||||
|
LIBCRYPTOSO="${THERE}/libcrypto.so"
|
||||||
|
if [ -f "$LIBCRYPTOSO" ]; then
|
||||||
|
while [ -h "$LIBCRYPTOSO" ]; do
|
||||||
|
LIBCRYPTOSO="${THERE}/`ls -l "$LIBCRYPTOSO" | sed -e 's|.*\-> ||'`"
|
||||||
|
done
|
||||||
|
SOSUFFIX=`echo ${LIBCRYPTOSO} | sed -e 's|.*\.so||' 2>/dev/null`
|
||||||
|
LIBSSLSO="${THERE}/libssl.so${SOSUFFIX}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SYSNAME=`(uname -s) 2>/dev/null`;
|
||||||
|
case "$SYSNAME" in
|
||||||
|
SunOS|IRIX*)
|
||||||
|
# SunOS and IRIX run-time linkers evaluate alternative
|
||||||
|
# variables depending on target ABI...
|
||||||
|
rld_var=LD_LIBRARY_PATH
|
||||||
|
case "`(/usr/bin/file "$LIBCRYPTOSO") 2>/dev/null`" in
|
||||||
|
*ELF\ 64*SPARC*|*ELF\ 64*AMD64*)
|
||||||
|
[ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64
|
||||||
|
LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64
|
||||||
|
preload_var=LD_PRELOAD_64
|
||||||
|
;;
|
||||||
|
*ELF\ 32*SPARC*|*ELF\ 32*80386*)
|
||||||
|
# We only need to change LD_PRELOAD_32 and LD_LIBRARY_PATH_32
|
||||||
|
# on a multi-arch system. Otherwise, trust the fallbacks.
|
||||||
|
if [ -f /lib/64/ld.so.1 ]; then
|
||||||
|
[ -n "$LD_LIBRARY_PATH_32" ] && rld_var=LD_LIBRARY_PATH_32
|
||||||
|
LD_PRELOAD_32="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_32
|
||||||
|
preload_var=LD_PRELOAD_32
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
# Why are newly built .so's preloaded anyway? Because run-time
|
||||||
|
# .so lookup path embedded into application takes precedence
|
||||||
|
# over LD_LIBRARY_PATH and as result application ends up linking
|
||||||
|
# to previously installed .so's. On IRIX instead of preloading
|
||||||
|
# newly built .so's we trick run-time linker to fail to find
|
||||||
|
# the installed .so by setting _RLD_ROOT variable.
|
||||||
|
*ELF\ 32*MIPS*)
|
||||||
|
#_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD_LIST
|
||||||
|
_RLD_ROOT=/no/such/dir; export _RLD_ROOT
|
||||||
|
eval $rld_var=\"/usr/lib'${'$rld_var':+:$'$rld_var'}'\"
|
||||||
|
preload_var=_RLD_LIST
|
||||||
|
;;
|
||||||
|
*ELF\ N32*MIPS*)
|
||||||
|
[ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH
|
||||||
|
#_RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST
|
||||||
|
_RLDN32_ROOT=/no/such/dir; export _RLDN32_ROOT
|
||||||
|
eval $rld_var=\"/usr/lib32'${'$rld_var':+:$'$rld_var'}'\"
|
||||||
|
preload_var=_RLDN32_LIST
|
||||||
|
;;
|
||||||
|
*ELF\ 64*MIPS*)
|
||||||
|
[ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH
|
||||||
|
#_RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST
|
||||||
|
_RLD64_ROOT=/no/such/dir; export _RLD64_ROOT
|
||||||
|
eval $rld_var=\"/usr/lib64'${'$rld_var':+:$'$rld_var'}'\"
|
||||||
|
preload_var=_RLD64_LIST
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
eval $rld_var=\"${THERE}'${'$rld_var':+:$'$rld_var'}'\"; export $rld_var
|
||||||
|
unset rld_var
|
||||||
|
;;
|
||||||
|
*) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX
|
||||||
|
DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
|
||||||
|
SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
|
||||||
|
LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
|
||||||
|
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
|
||||||
|
# Even though $PATH is adjusted [for Windows sake], it doesn't
|
||||||
|
# necessarily does the trick. Trouble is that with introduction
|
||||||
|
# of SafeDllSearchMode in XP/2003 it's more appropriate to copy
|
||||||
|
# .DLLs in vicinity of executable, which is done elsewhere...
|
||||||
|
if [ "$OSTYPE" != msdosdjgpp ]; then
|
||||||
|
PATH="${THERE}:$PATH"; export PATH
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
|
||||||
|
shift
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@"
|
||||||
|
else
|
||||||
|
exec "$cmd" "$@"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user