Bug 23204

Summary: length of salt in crypt() is not the same as described in man 3 crypt
Product: Base System Reporter: andre <andre>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description andre 2000-12-01 10:50:01 UTC
man 3 crypt:
Modular crypt:

     If the salt begins with the string $digit$ then the Modular Crypt Format
     is used.  The digit represents which algorithm is used in encryption.
     Following the token is the actual salt to use in the encryption.  The
     length of the salt is limited to 16 characters--because the length of the
                    ^^^^^^^^^^^^^^^^^^^^^
     returned output is also limited (_PASSWORD_LEN).  The salt must be termi-
     nated with the end of the string (NULL) or a dollar sign.  Any characters
     after the dollar sign are ignored.

     Currently supported algorithms are:

           1          MD5
===========================================================
In reality length of salt is limited to 8 characters.

How-To-Repeat: $cat crp.c
#include <unistd.h>
#include <stdio.h>

main () {
    char passwd[]="testpasswd";
    char salt[]="$1$1234567890$";
    char *hash;
    
    hash = crypt(passwd, salt);  
    printf("%s\n", hash);
}

$cc -o crp crp.c -lcrypt
$./crp
$1$12345678$VYreJG4qkG1D4.4X8s6o41
Comment 1 le freebsd_committer freebsd_triage 2004-06-15 00:12:25 UTC
State Changed
From-To: open->closed

This is a documentation bug, not a code bug, and it was fixed with 
PR docs/36782.