[PATCH] Tests: fixed auth_basic.t on OpenBSD

Maxim Dounin mdounin at mdounin.ru
Wed May 1 00:57:20 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1714524954 -10800
#      Wed May 01 03:55:54 2024 +0300
# Node ID cee70d7876a81d3d44f862fc551324fdd766bf8d
# Parent  fe6f22da53ec760f7ab138d1d32b7a03ea7bdea3
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$".

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