From:             [EMAIL PROTECTED]
Operating system: linux 2.2.18 (rh 6.2)
PHP version:      4.0.4pl1
PHP Bug Type:     *Install and Config
Bug description:  crypt problems with openssl

MD5 crypt fails if PHP is compiled with openssl (specifically with the -lcrypto)

If the .c file comes before the libraries, gcc won't recognize MD5 crypt:

----- blah.c -----
root# cat blah.c 
#include <crypt.h>

main() {
    char salt[15], answer[40];

    salt[0]='$'; salt[1]='1'; salt[2]='$'; 
    salt[3]='r'; salt[4]='a'; salt[5]='s';
    salt[6]='m'; salt[7]='u'; salt[8]='s';
    salt[9]='l'; salt[10]='e'; salt[11]='$';
    salt[12]='\0';
    strcpy(answer,salt);
    strcat(answer,"rISCgZzpwk3UhDidwXvin0");
    printf("%s\n%s\n", (char *)crypt("rasmuslerdorf",salt), answer);
    exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
}

---- blah.c before libraries ----
root# gcc -o blah blah.c \
  -L/usr/local/openssl/lib -lcrypto -lcrypt

root# ./blah
$1Hat1hn6A1pw
$1$rasmusle$rISCgZzpwk3UhDidwXvin0

---- blah.c after libraries -----
root# gcc -o blah \
  -L/usr/local/openssl/lib -lcrypto -lcrypt blah.c

root# ./blah
$1$rasmusle$rISCgZzpwk3UhDidwXvin0
$1$rasmusle$rISCgZzpwk3UhDidwXvin0


-- 
Edit Bug report at: http://bugs.php.net/?id=9177&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to