Compare commits

..

No commits in common. "6e6bbca903c6b394b7c51fcb769b32c950e831fe" and "d42d04fc96db5a3608340bedb94850367b049e08" have entirely different histories.

4 changed files with 6 additions and 245 deletions

View File

@ -1,60 +0,0 @@
diff -up cracklib-2.9.6/lib/packlib.c.lookup cracklib-2.9.6/lib/packlib.c
--- cracklib-2.9.6/lib/packlib.c.lookup 2018-10-10 14:19:06.988958835 +0200
+++ cracklib-2.9.6/lib/packlib.c 2018-11-26 16:04:34.648256614 +0100
@@ -585,12 +585,11 @@ fprintf(stderr, "look for (%s)\n", strin
fprintf(stderr, "---- %lu, %lu ----\n", lwm, hwm);
#endif
- middle = lwm + ((hwm - lwm + 1) / 2);
-
for (;;)
{
int cmp;
+ middle = lwm + ((hwm - lwm + 1) / 2);
#if DEBUG
fprintf(stderr, "lwm = %lu, middle = %lu, hwm = %lu\n", lwm, middle, hwm);
@@ -617,24 +616,28 @@ fprintf(stderr, "look for (%s)\n", strin
return(middle);
}
- if (middle == hwm)
- {
-#if DEBUG
- fprintf(stderr, "at terminal subdivision, stopping search\n");
-#endif
- break;
- }
-
if (cmp < 0)
{
- hwm = middle;
- middle = lwm + ((hwm - lwm ) / 2);
- }
+ if (middle == lwm)
+ {
+#if DEBUG
+ fprintf(stderr, "at terminal subdivision from right, stopping search\n");
+#endif
+ break;
+ }
+ hwm = middle - 1;
+ }
else if (cmp > 0)
{
- lwm = middle;
- middle = lwm + ((hwm - lwm + 1) / 2);
- }
+ if (middle == hwm)
+ {
+#if DEBUG
+ fprintf(stderr, "at terminal subdivision from left, stopping search\n");
+#endif
+ break;
+ }
+ lwm = middle + 1;
+ }
}
return (PW_WORDS(pwp));

View File

@ -1,31 +1,19 @@
%bcond_without python2
%bcond_without python3
%define dictdir %{_datadir}/cracklib
%define dictpath %{dictdir}/pw_dict
Name: cracklib
Version: 2.9.7
Release: 7
Release: 2
Summary: A password-checking library
License: LGPLv2+
URL: http://sourceforge.net/projects/cracklib/
Source0: https://github.com/cracklib/cracklib/releases/download/cracklib-%{version}/cracklib-%{version}.tar.gz
Source1: https://github.com/cracklib/cracklib/releases/download/cracklib-%{version}/cracklib-words-%{version}.gz
Patch0: fix-problem-of-error-message-about-simplistic-passwo.patch
Patch1: backport-cracklib-2.9.6-lookup.patch
# After fix-problem-of-error-message-about-simplistic-passwo.patch
Patch2: fix-error-length-about-simplistic-password.patch
Patch3: fix-truncating-dict-file-without-input-data.patch
Patch9000: fix-problem-of-error-message-about-simplistic-passwo.patch
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel, chrpath
%if %{with python2}
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel
BuildRequires: python2-devel
%endif
%if %{with python3}
BuildRequires: python3-devel
%endif
Conflicts: cracklib-dicts < 2.8
Requires: gzip
@ -54,7 +42,6 @@ for compiling applications which use cracklib.
%package_help
%if %{with python2}
%package -n python2-cracklib
Summary: Python 2 bindings for applications which use cracklib
Requires: %{name} = %{version}-%{release}
@ -62,17 +49,6 @@ Requires: %{name} = %{version}-%{release}
%description -n python2-cracklib
The python2-cracklib package contains a module which permits applications
written in the Python 2 programming language to use cracklib.
%endif
%if %{with python3}
%package -n python3-cracklib
Summary: Python 3 bindings for applications which use cracklib
Requires: %{name} = %{version}-%{release}
%description -n python3-cracklib
The python3-cracklib package contains a module which permits applications
written in the Python 3 programming language to use cracklib.
%endif
%prep
%autosetup -n %{name}-%{version} -p1
@ -84,15 +60,8 @@ do
done
chmod +x util/cracklib-format
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%if %{with python2}
sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in
export PYTHON=%{__python2}
%configure \
--disable-static \
--with-pic \
@ -100,39 +69,10 @@ export PYTHON=%{__python2}
--with-default-dict=%{dictpath}
make -C po update-gmo
make
%endif
%if %{with python3}
pushd %{py3dir}
sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLIB_DICT) <,' Makefile.in
py3include=`python3-config --includes | awk -F' ' '{print $1;}'`
export PYTHON=%{__python3}
export CFLAGS="%{optflags} $py3include"
abiflags=`python3-config --abiflags`
py_version="%{python3_version}$abiflags"
%configure \
am_cv_python_version="$py_version" \
--disable-static \
--with-pic \
--with-python \
--with-default-dict=%{dictpath}
make -C po update-gmo
make
popd
%endif
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%if %{with python2}
make install DESTDIR=$RPM_BUILD_ROOT 'pythondir=${pyexecdir}'
%endif
%if %{with python3}
pushd %{py3dir}
make install DESTDIR=$RPM_BUILD_ROOT 'pythondir=${pyexecdir}'
popd
%endif
./util/cracklib-format cracklib-dicts/* | \
./util/cracklib-packer $RPM_BUILD_ROOT/%{dictpath}
./util/cracklib-format $RPM_BUILD_ROOT/%{dictdir}/cracklib-small | \
@ -159,14 +99,6 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libcrack.la
%find_lang %{name}
# delete runpath/rpath in command file
# /usr/sbin/cracklib-check
# /usr/sbin/cracklib-packer
# /usr/sbin/cracklib-unpacker
chrpath -d $RPM_BUILD_ROOT/%{_sbindir}/cracklib-check
chrpath -d $RPM_BUILD_ROOT/%{_sbindir}/cracklib-packer
chrpath -d $RPM_BUILD_ROOT/%{_sbindir}/cracklib-unpacker
%check
make test
@ -182,7 +114,7 @@ make test
%{_libdir}/libcrack.so.*
%{_libdir}/cracklib_dict.*
%dir %{_datadir}/cracklib
%config(noreplace) %{_datadir}/cracklib/pw_dict.*
%{_datadir}/cracklib/pw_dict.*
%{_datadir}/cracklib/cracklib-small.*
%{_datadir}/cracklib/cracklib.magic
@ -193,36 +125,11 @@ make test
%files help
%doc README README-WORDS NEWS
%if %{with python2}
%files -n python2-cracklib
%{_libdir}/python2*/site-packages/_cracklib*.so
%{_libdir}/python2*/site-packages/*.py*
%endif
%if %{with python3}
%files -n python3-cracklib
%{_libdir}/python3*/site-packages/_cracklib*.so
%{_libdir}/python3*/site-packages/*.py*
%{_libdir}/python3*/site-packages/__pycache__/*
%endif
%{_libdir}/python*/site-packages/_cracklib*.so
%{_libdir}/python*/site-packages/*.py*
%changelog
* Thu Nov 9 2023 yixiangzhike <yixiangzhike007@163.com> - 2.9.7-7
- delete runpath or rpath in command file
* Sat Aug 13 2022 yixiangzhike <yixiangzhike007@163.com> - 2.9.7-6
- fix issue of truncating dict file without input data
- fix error length about simplistic password
* Mon Dec 6 2021 yixiangzhike <yixiangzhike007@163.com> - 2.9.7-5
- Fix lookup for word in FindPW()
* Mon May 17 2021 yixiangzhike <zhangxingliang3@huawei.com> - 2.9.7-4
- Add %%config(noreplace) for pw_dict
* Mon Sep 7 2020 zhangxingliang <zhangxingliang3@huawei.com> - 2.9.7-3
- Add python3-cracklib package
* Sat Jan 18 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.9.7-2
- fix problem of error message about simplistic password

View File

@ -1,25 +0,0 @@
From 7d4b42752a11b12088baad881a6e2cac3da638e7 Mon Sep 17 00:00:00 2001
From: yixiangzhike <yixiangzhike007@163.com>
Date: Sat, 13 Aug 2022 13:04:17 +0800
Subject: [PATCH] fix error length about simplistic password
---
util/cracklib-format | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/cracklib-format b/util/cracklib-format
index 360d109..2c1f61f 100755
--- a/util/cracklib-format
+++ b/util/cracklib-format
@@ -6,7 +6,7 @@
LC_ALL=C
export LC_ALL
gzip -cdf "$@" |
- grep -a -E -v '^.{30,}$' |
+ grep -a -E -v '^.{32,}$' |
tr '[:upper:]' '[:lower:]' |
sed s/[[:space:]]//g |
sort -u
--
2.33.0

View File

@ -1,61 +0,0 @@
From 17970a5f2092f699ffb2f22a7fd6c40456907987 Mon Sep 17 00:00:00 2001
From: yixiangzhike <yixiangzhike007@163.com>
Date: Sat, 13 Aug 2022 12:01:45 +0800
Subject: [PATCH] Fix truncating dict file without input data
diff --git a/util/packer.c b/util/packer.c
index e3f9500..4867641 100644
--- a/util/packer.c
+++ b/util/packer.c
@@ -22,6 +22,7 @@ main(argc, argv)
PWDICT *pwp;
char buffer[STRINGSIZE], prev[STRINGSIZE];
char *file;
+ char opened = 0;
if (argc <= 1)
{
@@ -39,12 +40,6 @@ main(argc, argv)
return (-1);
}
- if (!(pwp = PWOpen(file, "w")))
- {
- perror(file);
- return (-1);
- }
-
wrote = 0;
prev[0] = '\0';
@@ -62,6 +57,16 @@ main(argc, argv)
continue;
}
+ if (!opened)
+ {
+ if (!(pwp = PWOpen(file, "w")))
+ {
+ perror(file);
+ return (-1);
+ }
+ opened = 1;
+ }
+
/*
* If this happens, strcmp() in FindPW() in packlib.c will be unhappy.
*/
@@ -79,7 +84,8 @@ main(argc, argv)
wrote++;
}
- PWClose(pwp);
+ if (opened)
+ PWClose(pwp);
printf("%lu %lu\n", readed, wrote);
--
2.33.0