php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56555 I get an error when using crack_opendict even if the path is correct
Submitted: 2005-09-17 13:08 UTC Modified: 2005-09-18 09:50 UTC
From: svenpeter at gmail dot com Assigned: skettler (profile)
Status: Not a bug Package: crack (PECL)
PHP Version: 5.0.3 OS: Gentoo GNU/Linux
Private report: No CVE-ID: None
 [2005-09-17 13:08 UTC] svenpeter at gmail dot com
Description:
------------
I have tried to use the cracklib extension but I cannot get it to work.
I everytime get the error message "Warning: crack_opendict() [function.crack-opendict]: Unable to open a crack dictionary in /home/svpe/secret/public_html/cracklib_test.php on line 2 ".
The dictionary file exists and is readable by everyone:
$ ls -l /usr/share/dict/cracklib-words
-rw-r--r--  1 root root 17003670 17. Sep 18:49 /usr/share/dict/cracklib-words
I have tried the beta and the stable versions and both don't work.

Reproduce code:
---------------
<?php
$d = crack_opendict('/usr/share/dict/cracklib-words') or die();
if(crack_check($d, 'password'))
{
	echo 'good';
}
else
{
	printf('Not good: %s', crack_getlastmessage());
}
crack_closedict($d);
?>

Expected result:
----------------
The script should read the dictionary and either displays 'good' or 'Not good [reason]'.

Actual result:
--------------
I just get the error message "Warning: crack_opendict() [function.crack-opendict]: Unable to open a crack dictionary in /home/svpe/secret/public_html/cracklib_test.php on line 2 "

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-18 09:50 UTC] skettler@php.net
Cracklib expects two to three files when opening a dictionary. If you are opening the dictionary "/usr/share/dict/cracklib-words" it opens in fact the files /usr/share/dict/cracklib-words.pwd, /usr/share/dict/cracklib-words.pwi and optionally /usr/share/dict/cracklib-words.hwm.

You can create these files by using the mkdict program that comes with cracklib (this functionality is going to be accessible from inside PHP in a later version of the crack extension).
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Jun 22 17:01:44 2018 UTC