[nginx-tests] Tests: fixed auth_basic.t on OpenBSD.

Maxim Dounin mdounin at mdounin.ru
Sun May 5 20:56:58 UTC 2024


details:   http://freenginx.org/hg/nginx-tests/rev/f1ba89f735ba
branches:  
changeset: 1962:f1ba89f735ba
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Sun May 05 23:56:07 2024 +0300
description:
Tests: fixed auth_basic.t on OpenBSD.

OpenBSD does not provide any crypt() schemes except bcrypt-based "$2"
anymore.  As such, relevant tests are now skipped not for win32 only,
but based on crypt() results.

Note that just testing crypt('password', 'salt') is not enough, since
Perl on win32 provides its own crypt() implementation, which is able
to handle traditional DES crypt(), but rejects "$1$".

diffstat:

 auth_basic.t |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff --git a/auth_basic.t b/auth_basic.t
--- a/auth_basic.t
+++ b/auth_basic.t
@@ -86,7 +86,9 @@ like(http_get('/'), qr!401 Unauthorized!
 
 SKIP: {
 
-skip 'no crypt on win32', 5 if $^O eq 'MSWin32';
+skip 'no crypt', 5
+	if not crypt('password', 'salt')
+	or not crypt('password', '$1$salt$');
 
 like(http_get_auth('/', 'crypt', 'password'), qr!SEETHIS!, 'normal crypt');
 unlike(http_get_auth('/', 'crypt', '123'), qr!SEETHIS!, 'normal wrong');



More information about the nginx-devel mailing list