Initialize for cracklib

This commit is contained in:
zyppe 2024-02-06 16:51:07 +08:00
commit 4fe6c22f06
7 changed files with 588 additions and 0 deletions

1
.cracklib.metadata Normal file
View file

@ -0,0 +1 @@
adb851985cad319f3bb3626c8bcb9a7fc5d07294dcd58d2c61ea66a30e0f0fe2 cracklib-2.9.7.tar.bz2

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
cracklib-2.9.7.tar.bz2

17
0001-cracklib-magic.diff Normal file
View file

@ -0,0 +1,17 @@
Index: doc/cracklib.magic
===================================================================
--- doc/cracklib.magic.orig
+++ doc/cracklib.magic
@@ -1,10 +1,5 @@
# cracklib: file (1) magic for cracklib v2.7
0 lelong 0x70775631 Cracklib password index, little endian
->4 long >0 (%i words)
->4 long 0 ("64-bit")
->>8 long >-1 (%i words)
+>4 lelong >0 (%i words)
0 belong 0x70775631 Cracklib password index, big endian
->4 belong >-1 (%i words)
-0 long 0
->4 belong 0x70775631 Cracklib password index, big endian ("64-bit")
->12 belong >0 (%i words)
+>4 belong >0 (%i words)

View file

@ -0,0 +1,120 @@
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -97,6 +97,45 @@ AM_CONDITIONAL(BUILD_PYTHON,[test "$buil
dnl Handle local dict compiling properly
AC_SUBST(CROSS_COMPILING, $cross_compiling)
+ dnl ************************************************************
+ dnl Enable hiding of internal symbols in library to reduce its size and
+ dnl speed dynamic linking of applications. This currently is only supported
+ dnl on gcc >= 4.0 and SunPro C.
+ dnl
+ AC_MSG_CHECKING([whether to enable hidden symbols in the library])
+ AC_ARG_ENABLE(hidden-symbols,
+ AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
+ AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
+ [ case "$enableval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_CHECKING([whether $CC supports it])
+ if test "$GCC" = yes ; then
+ if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(CRACKLIB_API, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ else
+ dnl Test for SunPro cc
+ if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(CRACKLIB_API, [__global], [to make a symbol visible])
+ CFLAGS="$CFLAGS -xldscope=hidden"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ )
+
AC_OUTPUT(util/Makefile lib/Makefile doc/Makefile python/Makefile Makefile \
python/setup.py \
po/Makefile.in m4/Makefile dicts/Makefile cracklib.spec)
Index: lib/crack.h
===================================================================
--- lib/crack.h.orig
+++ lib/crack.h
@@ -5,6 +5,10 @@
extern "C" {
#endif
+#ifndef CRACKLIB_API
+#define CRACKLIB_API extern
+#endif
+
/* Pass these functions a password (pw) and a path to the
* dictionaries (/usr/lib/cracklib_dict should be specified)
* and it will either return a NULL string, meaning that the
@@ -18,13 +22,13 @@ extern "C" {
* You must link with -lcrack
*/
-extern const char *FascistCheck(const char *pw, const char *dictpath);
-extern const char *FascistCheckUser(const char *pw, const char *dictpath,
+CRACKLIB_API const char *FascistCheck(const char *pw, const char *dictpath);
+CRACKLIB_API const char *FascistCheckUser(const char *pw, const char *dictpath,
const char *user, const char *gecos);
/* This function returns the compiled in value for DEFAULT_CRACKLIB_DICT.
*/
-extern const char *GetDefaultCracklibDict(void);
+CRACKLIB_API const char *GetDefaultCracklibDict(void);
#ifdef __cplusplus
};
Index: lib/packer.h
===================================================================
--- lib/packer.h.orig
+++ lib/packer.h
@@ -76,7 +76,7 @@ typedef struct
#define PIH_MAGIC 0x70775631
/* Internal routines */
-extern char *GetPW(PWDICT *pwp, uint32_t number);
+CRACKLIB_API char *GetPW(PWDICT *pwp, uint32_t number);
#else
@@ -87,15 +87,15 @@ typedef struct {
#endif
-extern PWDICT *PWOpen(const char *prefix, char *mode);
-extern int PWClose(PWDICT *pwp);
-extern unsigned int FindPW(PWDICT *pwp, char *string);
-extern int PutPW(PWDICT *pwp, char *string);
-extern int PMatch(char *control, char *string);
-extern char *Mangle(char *input, char *control);
-extern char Chop(char *string);
-extern char *Trim(char *string);
-extern char *FascistLook(PWDICT *pwp, char *instring);
+CRACKLIB_API PWDICT *PWOpen(const char *prefix, char *mode);
+CRACKLIB_API int PWClose(PWDICT *pwp);
+CRACKLIB_API unsigned int FindPW(PWDICT *pwp, char *string);
+CRACKLIB_API int PutPW(PWDICT *pwp, char *string);
+CRACKLIB_API int PMatch(char *control, char *string);
+CRACKLIB_API char *Mangle(char *input, char *control);
+CRACKLIB_API char Chop(char *string);
+CRACKLIB_API char *Trim(char *string);
+CRACKLIB_API char *FascistLook(PWDICT *pwp, char *instring);
extern char *FascistLookUser(PWDICT *pwp, char *instring, const char *user, const char *gecos);
extern char *FascistGecos(char *password, int uid);
extern char *FascistGecosUser(char *password, const char *user, const char *gecos);

5
baselibs.conf Normal file
View file

@ -0,0 +1,5 @@
libcrack2
obsoletes "cracklib-<targettype> <= 2.8.15"
cracklib-devel
requires -cracklib-<targettype>
requires "libcrack2-<targettype> = <version>"

293
cracklib.changes Normal file
View file

@ -0,0 +1,293 @@
* Fri Nov 12 2021 pgajdos@suse.com
- %%check: really test the package [bsc#1191736]
* Tue Jun 2 2020 mgorse@suse.com
- Update to version 2.9.7:
+ fix a buffer overflow processing long words.
- Drop 0003-overflow-processing-gecos.patch and
0004-overflow-processing-long-words.patch: fixed upstream.
- Update source URI.
- Remove use of translation-update-upstream. It cannot be added to
ring 0 on leap, and 2.9.7 has some translation fixes
(bsc#1172396).
* Fri May 22 2020 mgorse@suse.com
- Enable translation-update-upstream on leap, to remove the use of
is_opensuse (jsc#SLE-12096).
* Wed May 6 2020 pgajdos@suse.com
- use /usr/lib instead of %%{_libexecdir}, %%{_libexecdir} should
contain internal binaries, not data
* Thu Feb 22 2018 fvogt@suse.com
- Use %%license (boo#1082318)
* Sat Nov 11 2017 aavindraa@gmail.com
- Update to 2.9.6
* fix issue with sort and locale
* some particularly bad cases to the cracklib small dictionary
* updates to cracklib-words (adds a bunch of other dictionary lists)
* migration to github
- run spec-cleaner
* Mon Dec 12 2016 dimstar@opensuse.org
- Only buildrequire and call translation-update-upstream on SLE:
the package in openSUSE is a dummy and is empty.
* Wed Aug 17 2016 hguo@suse.com
- Add patch 0004-overflow-processing-long-words.patch
to fix a new buffer overflow identified together with bsc#992966.
* Mon Aug 15 2016 hguo@suse.com
- Relabel patches:
cracklib-magic.diff -> 0001-cracklib-magic.diff
cracklib-2.9.2-visibility.patch -> 0002-cracklib-2.9.2-visibility.patch
- Add patch 0003-overflow-processing-gecos.patch
to fix a buffer overflow in GECOS parser (bsc#992966 CVE-2016-6318)
* Tue Aug 18 2015 mpluskal@suse.com
- Update to 2.9.5
* fix matching against first password in dictionary (Anton Dobkin)
- Changes for 2.9.4
* remove doubled prototype
- Changes for 2.9.3
* expose additional functions externally
* Fri Apr 3 2015 mpluskal@suse.com
- Cleanup spec file with spec-cleaner
- Remove old ppc provides/obsoletes
* Sun Jan 4 2015 p.drouand@gmail.com
- Update to version 2.9.2
+ support build of python support outside of source tree
+ fix bug in Python string distance calculation
+ fix bug #16 / debian bug 724570 - broken optimization with packlib
prevblock
- Adapt patch to upstream changes
+ cracklib-visibility.patch > cracklib-2.9.2-visibility.patch
* 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

151
cracklib.spec Normal file
View file

@ -0,0 +1,151 @@
#
# spec file for package cracklib
#
# Copyright (c) 2022-2023 ZhuningOS
#
Name: cracklib
Version: 2.9.7
Release: 11.6.1
Summary: Library to crack passwords using dictionaries
License: LGPL-2.1-only
Group: System/Libraries
URL: http://sourceforge.net/projects/cracklib
Source: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.bz2
Source2: baselibs.conf
# PATCH-FIX-OPENSUSE (should be upstreamed)
# Remove support for broken 64bit indexes from magic entry [bnc#106007]
Patch1: 0001-cracklib-magic.diff
# PATCH-FIX-OPENSUSE Hide non-public functions
Patch2: 0002-cracklib-2.9.2-visibility.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gzip
BuildRequires: libtool
BuildRequires: zlib-devel
Requires: cracklib-dict
%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++
Requires: glibc-devel
Requires: libcrack2 = %{version}
Provides: cracklib:%{_includedir}/crack.h
%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
Conflicts: cracklib-dict-full
Provides: cracklib-dict
%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
%patch1
%patch2
%build
AUTOPOINT=true autoreconf -fi
%configure \
--enable-hidden-symbols \
--disable-static \
--with-pic
make %{?_smp_mflags}
#make -C po update-po
%install
mkdir -p %{buildroot}%{_prefix}/lib
%make_install
# libtool is broken by design, remove this *.la files ...
rm %{buildroot}/%{_libdir}/libcrack.la
# set executable
chmod 755 ./util/cracklib-format
# Adjust path in comment
sed "s,%{_libexecdir}/cracklib_dict,%{_datadir}/cracklib/pw_dict,g" lib/crack.h > %{buildroot}/%{_includedir}/crack.h
./util/cracklib-format ./dicts/cracklib-small | \
./util/cracklib-packer %{buildroot}/%{_datadir}/cracklib/pw_dict
ln -s cracklib-format %{buildroot}/%{_sbindir}/mkdict
ln -s cracklib-packer %{buildroot}/%{_sbindir}/packer
rm -f %{buildroot}/%{_datadir}/cracklib/cracklib-small
ln -sf %{_datadir}/cracklib/pw_dict.hwm %{buildroot}/usr/lib/cracklib_dict.hwm
ln -sf %{_datadir}/cracklib/pw_dict.pwd %{buildroot}/usr/lib/cracklib_dict.pwd
ln -sf %{_datadir}/cracklib/pw_dict.pwi %{buildroot}/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
sed -i 's:\(util/cracklib-check\):\1 %{buildroot}/usr/lib/cracklib_dict:' Makefile
make test
%post -n libcrack2 -p /sbin/ldconfig
%postun -n libcrack2 -p /sbin/ldconfig
%files -n libcrack2
%{_libdir}/libcrack.so.2
%{_libdir}/libcrack.so.2.*
%files -f %{name}.lang
%license COPYING.LIB
%doc README README-WORDS NEWS README-LICENSE README-DAWG AUTHORS
%{_sbindir}/create-cracklib-dict
%{_sbindir}/mkdict
%{_sbindir}/packer
%{_sbindir}/cracklib-check
%{_sbindir}/cracklib-format
%{_sbindir}/cracklib-packer
%{_sbindir}/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
%{_includedir}/crack.h
%{_includedir}/packer.h
%{_libdir}/libcrack.so
%files dict-small
%{_datadir}/cracklib/pw_dict.hwm
%{_datadir}/cracklib/pw_dict.pwd
%{_datadir}/cracklib/pw_dict.pwi
%changelog