#
# spec file for package cracklib
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           cracklib
#BuildRequires:  automake
#BuildRequires:  gzip
#BuildRequires:  libtool
#BuildRequires:  translation-update-upstream
#BuildRequires:  zlib-devel
Url:            http://sourceforge.net/projects/cracklib
# bug437293
%ifarch ppc64
Obsoletes:      cracklib-64bit
%endif
#
Version:        2.9.0
Release:        1.3
Requires:       cracklib-dict
Summary:        Library to crack passwords using dictionaries
License:        LGPL-2.1
Group:          System/Libraries
Source:         http://prdownloads.sourceforge.net/cracklib/cracklib-%{version}.tar.gz
Source2:        baselibs.conf
# PATCH-FIX-OPENSUSE (should be upstreamed)
# Remove support for broken 64bit indexes from magic entry [bnc#106007]
Patch:          cracklib-magic.diff
# PATCH-FIX-OPENSUSE Hide non-public functions
Patch1:         cracklib-visibility.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:	i486

%description
CrackLib tests passwords to determine whether they match
certainsecurity-oriented characteristics. You can use CrackLib to
stopusers from choosing passwords that are too simple.This package
contains a full dictionary file used by cracklib.



%package devel
Summary:        Header files and libraries for developing apps which will use CrackLib
Group:          Development/Libraries/C and C++
Provides:       cracklib:/usr/include/crack.h
Requires:       glibc-devel
Requires:       libcrack2 = %{version}

%description devel
The cracklib-devel package contains the header files and libraries
needed to develop programs that use the CrackLib functions to to
determine whether passwords match certain security-oriented
characteristics.


%package -n libcrack2
Summary:        Library to crack passwords using dictionaries
Group:          System/Libraries
Requires:       cracklib >= %{version}

%description -n libcrack2
CrackLib tests passwords to determine whether they match
certainsecurity-oriented characteristics. You can use CrackLib to
stopusers from choosing passwords that are too simple.This package
contains a full dictionary file used by cracklib.

%package dict-small
Summary:        Small dictionary for cracklib - A Password-Checking Library
Group:          System/Libraries
Provides:       cracklib-dict
Conflicts:      cracklib-dict-full

%description dict-small
CrackLib tests passwords to determine whether they match certain
security-oriented characteristics. You can use CrackLib to stop users
from choosing passwords that are easy to guess.

This package contains a small dictionay file used by cracklib.



%prep
%setup -q
translation-update-upstream
%patch
%patch1

%build
AUTOPOINT=true autoreconf -fi
%configure --enable-hidden-symbols  --with-pic
%{__make} %{?_smp_mflags}
#make -C po update-po

%install
mkdir -p $RPM_BUILD_ROOT/usr/lib
make install DESTDIR=$RPM_BUILD_ROOT
# libtool is broken by design, remove this *.la files ...
rm $RPM_BUILD_ROOT/%{_libdir}/libcrack.la
# set executable
chmod 755 ./util/cracklib-format
# Adjust path in comment
sed "s,/usr/lib/cracklib_dict,%{_datadir}/cracklib/pw_dict,g" lib/crack.h > $RPM_BUILD_ROOT/%{_includedir}/crack.h
./util/cracklib-format ./dicts/cracklib-small | \
./util/cracklib-packer $RPM_BUILD_ROOT/%{_datadir}/cracklib/pw_dict
ln -s cracklib-format $RPM_BUILD_ROOT/%{_sbindir}/mkdict
ln -s cracklib-packer $RPM_BUILD_ROOT/%{_sbindir}/packer
rm -f $RPM_BUILD_ROOT/%{_datadir}/cracklib/cracklib-small
ln -sf %{_datadir}/cracklib/pw_dict.hwm $RPM_BUILD_ROOT/usr/lib/cracklib_dict.hwm
ln -sf %{_datadir}/cracklib/pw_dict.pwd $RPM_BUILD_ROOT/usr/lib/cracklib_dict.pwd
ln -sf %{_datadir}/cracklib/pw_dict.pwi $RPM_BUILD_ROOT/usr/lib/cracklib_dict.pwi
#
# using zip'ed dict takes too long for a check. But the support
# for this is still in the lib. 
#
#gzip $RPM_BUILD_ROOT/%{_datadir}/cracklib/pw_dict.pwd
#ln -sf %{_datadir}/cracklib/pw_dict.pwd.gz $RPM_BUILD_ROOT/usr/lib/cracklib_dict.pwd.gz
%{find_lang} %{name}
%ifnarch ppc64
nm -C -D %{buildroot}%{_libdir}/libcrack.so.2 | grep ' T '
%endif

%check
make check

%post -n libcrack2 -p /sbin/ldconfig

%postun -n libcrack2 -p /sbin/ldconfig

%files -n libcrack2
%defattr(-,root,root)
%{_libdir}/libcrack.so.2
%{_libdir}/libcrack.so.2.*

%files -f %{name}.lang
%defattr(-,root,root)
%doc README README-WORDS NEWS README-LICENSE README-DAWG AUTHORS COPYING.LIB
/usr/sbin/create-cracklib-dict
/usr/sbin/mkdict
/usr/sbin/packer
/usr/sbin/cracklib-check
/usr/sbin/cracklib-format
/usr/sbin/cracklib-packer
/usr/sbin/cracklib-unpacker
%dir %{_datadir}/cracklib
%{_datadir}/cracklib/cracklib.magic
/usr/lib/cracklib_dict.hwm
/usr/lib/cracklib_dict.pwd
/usr/lib/cracklib_dict.pwi

%files devel
%defattr(644,root,root,755)
%{_includedir}/crack.h
%{_includedir}/packer.h
%{_libdir}/libcrack.so
%{_libdir}/libcrack.a

%files dict-small
%defattr(-,root,root)
%{_datadir}/cracklib/pw_dict.hwm
%{_datadir}/cracklib/pw_dict.pwd
%{_datadir}/cracklib/pw_dict.pwi

%changelog
* Sat Jun  8 2013 mc@suse.com
- update to version 2.9.0
  * add new FascistCheckUser function
- remove translation-fix.dif
  * text changed - get translation via translation-update-upstream
* Tue Jan 29 2013 dmueller@suse.com
- update to 2.8.22:
  - add words from "The Top 500 Worst Passwords of All Time"
  - python 3 support (not yet packaged)
* Mon Jan  2 2012 mc@suse.de
- fix broken chinese translation (bnc#726059)
* Fri Dec 30 2011 meissner@suse.com
- do not run update-po to make build-compare work.
  (Likely added for translation-update-upstream, but this should just
  change the .po files, no need for a .pot change?)
* Wed Nov 30 2011 coolo@suse.com
- add automake and libtool as buildrequire to avoid implicit dependency
* Sat Sep 17 2011 jengelh@medozas.de
- Remove redundant tags/sections from specfile
- Add cracklib-devel to baselibs
* Wed May 18 2011 meissner@suse.de
- ppc64 has different symbols in nm output.
* Mon Mar  7 2011 cdenicolo@novell.com
- license update: LGPLv2.1
  Project has changed license to LGPLv2.1
* Mon Feb 14 2011 sbrabec@suse.cz
- Added support for translation-update-upstream.
* Sat Oct 30 2010 cristian.rodriguez@opensuse.org
- Support GCC visibility
* Thu Oct 21 2010 ro@suse.de
- update to 2.8.18
  - make sure python lib builds against build dir instead of system
    installed libs
- update to 2.8.17
  - updated Hindi translation
  - fixed NLS issue in cracklib-check
  - add Ukrainian translation
  - fix segmentation fault in Python extension
  - add -Wall to AM_CFLAGS to discover possible programming errors
  - updated Wei Liu (zh_CN) translation
  - fixed NLS support in python module compilation
- removed patch:
  datarootdir.patch (old buildfix, not needed anymore)
* Mon Jun 28 2010 jengelh@medozas.de
- use %%_smp_mflags
* Fri Jun 25 2010 dmueller@suse.de
- obsolete the old package
* Fri Mar  5 2010 coolo@novell.com
- fix baselibs.conf
* Thu Mar  4 2010 coolo@novell.com
- update to version 2.8.16
    update licensing information in Python extension (Jan Dittberner)
    make translations work in Python extension (Jan Dittberner)
    fix Python extension compilation warning (Jan Dittberner)
    add a long description to Python extension (Jan Dittberner)
    add Hindi translation (Rajesh Ranjan)
    add Korean translation (Eunju Kim)
    updated Russian translation (Yulia Poyarko)
    fix filename output in Python exceptions (Nalin Dahyabhai)
    fix format strings in util/packer.c (Mike Frysinger)
    improvement to rules based checking in fascist.c for better checking of closely related letter pairs (Ben Karsin)
    allow building of Python extension outside source folder (Jan Dittberner)
    fix type on Python extension's trove classifier
    reflect license change discussion that was never actually implemented in the repository and update to LGPL
    Added Assamese translation (Amitakhya Phukan)
    Added Bengali India translation (Runa Bhattacharjee)
    Added Gujarati translation (Ankit Patel)
    Added Kannada translation (shankysringeri)
    Added Malayalam translation (Ani Peter)
    Added Marathi translation (Sandeep Shedmake)
    Added Oriya translation (Manoj Giri)
    Added Russian translation (Anton Dobkin)
    Added Tamil translation (I. Felix)
    Added Telugu translation (Krishna Babu)
    Updated Polish translation (Piotr DrÄ…g)
    Updated Panjabi translation (A S Alam)
    optimize order of commands in util/cracklib-format (Jan Dittberner, Debian)
    fix several CC warnings (Jan Dittberner, Debian)
    add a function GetDefaultCracklibDict() to libcrack
    bump library revision
    add python/setup.py.in to allow building eggs
- removed old translations
- split libcrack2 package out
* Sun Dec 13 2009 jengelh@medozas.de
- add baselibs.conf as a source
* Wed May 20 2009 mc@suse.de
- update to version 2.8.13
  * Compressed dictionary support and better python module
- remove zlib patch which is now upstream.
* Sat Apr  4 2009 crrodriguez@suse.de
- remove static libraries
* Wed Feb  4 2009 mc@suse.de
- update translations
* Wed Dec 10 2008 olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
  (bnc#437293)
* Fri Nov 21 2008 mc@suse.de
- update translations
* Wed Nov  5 2008 mc@suse.de
- update translations
* Thu Oct 30 2008 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Mon Sep  1 2008 mc@suse.de
- do not zip the dict by default. A check takes too long.
  The support for zip'ed dicts is still available
* Fri Jun 20 2008 mc@suse.de
- implement reading compressed password databases
  (FATE#303536)
- compress password database
* Fri Jun  6 2008 mc@suse.de
- update i18n files
* Fri May  9 2008 mc@suse.de
- update i18n files
* Mon Apr 14 2008 mc@suse.de
- update i18n files
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Tue Mar 18 2008 schwab@suse.de
- Don't use autopoint.
* Tue Feb 12 2008 mc@suse.de
- update to version 2.8.12
  * minor bugfixes
- update localization files
* Fri Sep 21 2007 mc@suse.de
- update localization files
* Fri Aug 31 2007 mc@suse.de
- update localization files
* Mon Aug 20 2007 mc@suse.de
- update localization files
* Tue Jun  5 2007 mc@suse.de
- update i18n
* Thu May  3 2007 mc@suse.de
- add translations from Novell
* Mon Apr 23 2007 mc@suse.de
- added cracklib-dict-small and splitted the full dictionary
  into a seperate package. [#265733]
- cracklib requires cracklib-dict
* Mon Apr 16 2007 mc@suse.de
- update to version 2.8.10
  * better hanlding of cracklist dictionary paths in
    python binding.
* Wed Aug  2 2006 mc@suse.de
- update to version 2.8.9
- ChangeLog, configure.in: bump version numbers, skipped a couple
  due to packaging/disting issues with sf
- lib/packlib.c: also close wfp fd if it was opened
* Wed Jul  5 2006 aj@suse.de
- Fix build.
* Mon Jun 12 2006 kukuk@suse.de
- Update sl_SI translation
* Mon Mar 27 2006 kukuk@suse.de
- Update pl and fi translations
* Mon Mar  6 2006 kukuk@suse.de
- Add km and uk translations, update fi translation
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Nov 18 2005 kukuk@suse.de
- Update to 2.8.6 (merge locale and compile fixes)
* Wed Oct  5 2005 kukuk@suse.de
- Fix installing of translations
* Thu Sep 29 2005 kukuk@suse.de
- Update to official 2.8.5
- Fix warnings about undeclared functions
* Mon Aug 29 2005 kukuk@suse.de
- Add translations for fi, sl_SI and el
* Thu Aug 25 2005 kukuk@suse.de
- Add pl translation
* Tue Aug 23 2005 kukuk@suse.de
- Remove support for broken 64bit indexes from
  magic entry [Bug #106007]
* Fri Aug 19 2005 kukuk@suse.de
- Add Novell Tier1 translations
* Wed Aug 17 2005 kukuk@suse.de
- Add translations for da, lt, nb, pa and pt
- Fixes #105413
* Tue Jul 26 2005 kukuk@suse.de
- Update to internal version 2.8.3.0.2 (based on CVS)
* Thu Jun 23 2005 kukuk@suse.de
- Update to internal version 2.8.3.0.1 (based on CVS)
* Fri Jun  3 2005 kukuk@suse.de
- Update to version 2.8.3
- Fix compiler warnings
* Sat Apr  2 2005 kukuk@suse.de
- Remove words from neededforbuild
* Fri Apr  1 2005 kukuk@suse.de
- Update to version 2.8.2
* Tue Feb 15 2005 ro@suse.de
- fix Makefile (no need to add Makefile to ar archive)
* Mon Jan 26 2004 kukuk@suse.de
- Use reentrant getpwuid function
- Revert last change
* Sun Jan 18 2004 meissner@suse.de
- Compile with -fPIC.
* Fri Jan 16 2004 kukuk@suse.de
- Add italian translation
* Wed Jan  7 2004 kukuk@suse.de
- Add translation for hu
* Mon Dec 15 2003 kukuk@suse.de
- Add translation for nl
* Tue Dec  9 2003 kukuk@suse.de
- Add translations for es and fr
* Mon Dec  1 2003 kukuk@suse.de
- Fix all compiler warnings
- Add german translation
* Fri Nov 21 2003 kukuk@suse.de
- Compile with no execstack
- Build as normal user
* Fri Sep 19 2003 kukuk@suse.de
- Add czech translation
* Mon Aug 25 2003 kukuk@suse.de
- Add slovak translation
* Mon Jul 28 2003 kukuk@suse.de
- Make similar error messages unique
* Tue May 27 2003 kukuk@suse.de
- Make crack.h header C++ conform
- Build static library
- Create cracklib-devel sub package
* Mon May 12 2003 kukuk@suse.de
- Add defattr
* Thu May  8 2003 kukuk@suse.de
- Add patch which allows translation of cracklib messages
* Tue Aug 13 2002 ademar@conectiva.com.br
- Added several en wordlists and pt_BR and es dictionaries
* Fri May 11 2001 schwab@suse.de
- Fix portability bugs.
* Tue Oct  3 2000 kukuk@suse.de
- Use gcc for creating shared library
- Add support for 32/64bit library path
* Wed May 31 2000 kukuk@suse.de
- Use new URL, add Group tag
* Mon Nov 15 1999 kukuk@suse.de
- Remove ldconfig calls
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Tue May  4 1999 kukuk@suse.de
- initial version of cracklib