Skip to content

Commit 8ac0567

Browse files
yosuke-wolfsslejohnstown
authored andcommitted
Update the skip guard for Mac environment
1 parent 1d2b95f commit 8ac0567

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/wolfsshd/test/test_configuration.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,8 +1049,14 @@ static int test_CheckPasswordHashUnix(void)
10491049
int rc;
10501050

10511051
hash = crypt(correct, salt);
1052-
if (hash == NULL || hash[0] == '*' || WSTRLEN(hash) == 0) {
1053-
Log(" crypt() unavailable or refused salt, skipping.\n");
1052+
/* Skip if crypt() did not honor the $6$ SHA-512 request. macOS/Darwin and
1053+
* some BSD libc only implement legacy DES, which ignores the modular salt,
1054+
* truncates the password to 8 bytes, and returns a valid-looking 13-char
1055+
* hash that begins "$6l..." (no second '$'). A real $6$ hash begins with
1056+
* "$6$<salt>$", so the prefix check cleanly distinguishes them. */
1057+
if (hash == NULL || hash[0] == '*' || WSTRLEN(hash) == 0 ||
1058+
WSTRNCMP(hash, "$6$", 3) != 0) {
1059+
Log(" crypt() did not honor $6$ SHA-512, skipping.\n");
10541060
return WS_SUCCESS;
10551061
}
10561062
if (WSTRLEN(hash) >= sizeof(stored)) {

0 commit comments

Comments
 (0)