<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4419</bug_id>
          
          <creation_ts>2013-04-25 15:28:33 +0000</creation_ts>
          <short_desc>cracklib : default dictionary should be generated for target endianness</short_desc>
          <delta_ts>2013-06-05 06:44:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.5 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Donnelly">martin.donnelly</reporter>
          <assigned_to name="Hongxu Jia">hongxu.jia</assigned_to>
          <cc>hongxu.jia</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ning.zhang</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>sen.zhang</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>32650</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Donnelly">martin.donnelly</who>
    <bug_when>2013-04-25 15:28:33 +0000</bug_when>
    <thetext>cracklib expects its dictionaries to be target-endian and generating them during the build using cracklib-native generates them host-endian. This works unless host and target are different endianness.

The best fix would be to generate them using cracklib-native for the desired target-endian format or to change cracklib to be fixed endian (this could have a small performance impact depending on the format).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32693</commentid>
    <comment_count>1</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-04-27 05:42:59 +0000</bug_when>
    <thetext>This is a well known defect of cracklib, see the README of cracklib:
...
160 These files are NOT byte-order independent, in fact they are probably
161 ARCHITECTURE SPECIFIC, mostly due to speed constraints.
...

There are 4 solutions to fix this issue:

*1
Unify to create the dict files in big endian, and convert to host endian
while load them. This could fix the endian issue on multi platform.
Modify the source file of cracklib: lib/packlib.c

*2
Create the dict files at the target run time rather than build time, it workarounds this issue.
Modify cracklib_2.8.22.bb
...
pkg_postinst_${PN} () {
	if [ -n &quot;$D&quot; ]; then
		exit 1
	fi
	/usr/sbin/create-cracklib-dict ${datadir}/${PN}/*
}
...

*3
Create the dict files at the build time with option to tell which type
of endian(big or little) is used according to the target&apos;s endian.

Modify cracklib_2.8.22.bb, script create-cracklib-dict, source file of
cracklib: lib/packlib.c, util/packer.c

*4
Load dict files with checking to tell what the dict&apos;s endian is, if it is
different with target, convert it. This could fix the endian issue
on multi platform.

Tell the dict&apos;s endian by the value of magic flag in dict file.
Modify source file of cracklib: lib/packlib.c.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32697</commentid>
    <comment_count>2</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-04-28 03:21:59 +0000</bug_when>
    <thetext>I have sent the pull request about solution 1, this is the endian issue on multiple platforms, and the host/network byte order convert is the classic solution to resolve the similar problem.

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32731</commentid>
    <comment_count>3</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2013-04-29 17:41:53 +0000</bug_when>
    <thetext>The first solution would cause a change on the target system, and would not work for Read-Only systems.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32832</commentid>
    <comment_count>4</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-05-02 01:36:43 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; The first solution would cause a change on the target system, and would not
&gt; work for Read-Only systems.

Hi Saul,

Maybe the description about solution 1 is not clear, the creation of dict files is still at build time but in big endian rather than host endian, and it could work for Read-Only system.

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32833</commentid>
    <comment_count>5</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-05-02 01:46:52 +0000</bug_when>
    <thetext>In meta/recipes-extended/cracklib/cracklib_2.8.22.bb
...
 24 do_install_append_class-target() {
 25     create-cracklib-dict -o ${D}${datadir}/cracklib/pw_dict ${D}${datadir}/cracklib/cracklib-small
 26 }
...
It will invoke the previous function at build time in which create-cracklib-dict is cracklib-native&apos;s.

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33145</commentid>
    <comment_count>6</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-05-20 00:49:39 +0000</bug_when>
    <thetext>Merged into master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=a28959eae74049c2d3719a3fe1bd8cce2a2edbe1

Please verify.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33606</commentid>
    <comment_count>7</comment_count>
    <who name="Ning Zhang">ning.zhang</who>
    <bug_when>2013-06-05 06:44:23 +0000</bug_when>
    <thetext>Verified with poky (master:676fd3f394a0c0576b63c77ed2184bf5f42c29b6)

Verify steps:

1. set below lines in conf/local.conf
     MACHINE ?= &quot;qemumips&quot;
     IMAGE_INSTALL_append = &quot; cracklib&quot;
     DISTRO_FEATURES_append += &quot; pam&quot;
2. bitbake core-image-sato-sdk
3. do pam test
    a. scp pam-plugin-debug-1.1.6-r2.mips32.rpm pam-plugin-access-1.1.6-r2.mips32.rpm pam-plugin-cracklib-1.1.6-r2.mips32.rpm pam-plugin-time-1.1.6-r2.mips32.rpm pam-plugin-pwhistory-1.1.6-r2.mips32.rpm pam-plugin-succeed-if-1.1.6-r2.mips32.rpm root@192.168.7.2:~/
    b. scp libpam-xtests-1.1.6-r2.mips32.rpm root@192.168.7.2:~/
    c. inatall the rpm files on qemu
    d. on qemu, cd /usr/share/Linux-PAM/xtests
    e. ./run-xtests.sh . tst-pam_cracklib1
    f. ./run-xtests.sh . tst-pam_cracklib2
4. do cracklib sanity test
    a. cd /tmp/work/mips32-poky-linux/cracklib/2.8.22-r0/build/util/.libs
    b. scp test* root@192.168.7.2:/home/root
    c. on qemu, test the 3 applications: testlib  testnum  teststr</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>