Bug 224347

Summary: python binding behaves poorly when specifying dictpath
Product: [Fedora] Fedora Reporter: Nils Philippsen <nphilipp>
Component: cracklibAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 6Keywords: EasyFix
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.8.9-7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-25 17:33:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 225858, 225860    

Description Nils Philippsen 2007-01-25 11:53:35 UTC
FascistCheck() exhibits two problems when specifying a dictpath:

1.) It checks for the existence of the path, not the path plus ".pwd" as with
the default. This means you can't specify an alternative path at all because
it'll throw an exception in any case. You can't work around it either because
2.) if you specify the path plus ".pwd" yourself, the python module now finds
the file, passes path+".pwd" to cracklib which barfs on the non-existence of
path+".pwd.pwd" and apparently calls exit() or something else which ends the
python interpreter (without traceback or other such superfluopus things ;-).

Version-Release number of selected component (if applicable):
cracklib-2.8.9-3.1
Judging from the code, this problem exists in Rawhide (cracklib-2.8.9-6) as well.

How reproducible:
Easy

Steps to Reproduce:
1. Run this test program:

--- 8< ---
#!/usr/bin/python

from cracklib import *

for path in ('/usr/share/cracklib/pw_dict', '/usr/share/cracklib/pw_dict.pwd'):
    try:
        print FascistCheck ('foo', path)
    except Exception, e:
        print e

print "foo"
  
Actual results:
nils@wombat:~> ./fc.py 
[Errno 2] No such file or directory: '/usr/share/cracklib/pw_dict'
/usr/share/cracklib/pw_dict.pwd.pwd: No such file or directory
PWOpen: Illegal seek

Expected results:
No traceback with the first path in the list, a (caught) traceback with the
second path, and the line "foo".

Comment 1 Nalin Dahyabhai 2007-01-25 17:33:32 UTC
Quite right.  Fixing in Raw Hide shortly.  Let me know if you need this updated
in FC6 as well.

Comment 2 Nils Philippsen 2007-01-29 16:48:05 UTC
As I have dicovered now, I don't need to specify the dictpath to use the
standard dictionary. Would it be much work to change the module so that "pydoc
cracklib" on the cmdline or "help(FascistCheck)" from within python would
mention that, i.e. not only have "FascistCheck(...)" without the arguments?