Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
6e6bbca903
!37 Delete runpath or rpath in command file
From: @yixiangzhike 
Reviewed-by: @houmingyong 
Signed-off-by: @houmingyong
2023-11-09 08:04:31 +00:00
yixiangzhike
5b1bd2d31d Delete runpath or rpath in command file 2023-11-09 10:55:33 +08:00
openeuler-ci-bot
a7264bd1b7
!29 【openEuler-20.03-LTS-SP3】Fix issue of error length and truncate dict file
From: @yixiangzhike 
Reviewed-by: @houmingyong 
Signed-off-by: @houmingyong
2022-08-15 02:59:45 +00:00
yixiangzhike
39ac7856f5 Fix issue of error length and truncate dict file
Signed-off-by: yixiangzhike <yixiangzhike007@163.com>
2022-08-13 13:43:27 +08:00
openeuler-ci-bot
e02d2228f9 !19 【openEuler-20.03-LTS-SP3】Fix lookup for word in FindPW
From: @yixiangzhike
Reviewed-by: @zhujianwei001
Signed-off-by: @zhujianwei001
2021-12-06 11:50:54 +00:00
yixiangzhike
ccbaf43105 Fix lookup for word in FindPW() 2021-12-06 19:19:09 +08:00
openeuler-ci-bot
56f4bd51c8 !11 [sync] PR-9: 【openEuler-20.03-LTS-SP1】Add "%config(noreplace)" for pw_dict
From: @openeuler-sync-bot
Reviewed-by: @zhujianwei001
Signed-off-by: @zhujianwei001
2021-05-24 18:55:16 +08:00
yixiangzhike
dd30705c35 Add "%config(noreplace)" for pw_dict
(cherry picked from commit 48a12a5c8303146f80d2d09debd41fd989650e00)
2021-05-24 18:04:39 +08:00
openeuler-ci-bot
b53fcca797 !5 【openEuler-20.03-LTS】add python3-cracklib package
Merge pull request !5 from yixiangzhike/openEuler-20.03-LTS
2020-09-07 18:12:28 +08:00
yixiangzhike
6930616dd9 add python3-cracklib package 2020-09-07 14:23:57 +08:00
4 changed files with 245 additions and 6 deletions

View File

@ -0,0 +1,60 @@
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,19 +1,31 @@
%bcond_without python2
%bcond_without python3
%define dictdir %{_datadir}/cracklib
%define dictpath %{dictdir}/pw_dict
Name: cracklib
Version: 2.9.7
Release: 2
Release: 7
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
Patch9000: fix-problem-of-error-message-about-simplistic-passwo.patch
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
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel, chrpath
%if %{with python2}
BuildRequires: python2-devel
%endif
%if %{with python3}
BuildRequires: python3-devel
%endif
Conflicts: cracklib-dicts < 2.8
Requires: gzip
@ -42,6 +54,7 @@ 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}
@ -49,6 +62,17 @@ 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
@ -60,8 +84,15 @@ 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 \
@ -69,10 +100,39 @@ sed -i 's,util/cracklib-check <,util/cracklib-check $(DESTDIR)/$(DEFAULT_CRACKLI
--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 | \
@ -99,6 +159,14 @@ 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
@ -114,7 +182,7 @@ make test
%{_libdir}/libcrack.so.*
%{_libdir}/cracklib_dict.*
%dir %{_datadir}/cracklib
%{_datadir}/cracklib/pw_dict.*
%config(noreplace) %{_datadir}/cracklib/pw_dict.*
%{_datadir}/cracklib/cracklib-small.*
%{_datadir}/cracklib/cracklib.magic
@ -125,11 +193,36 @@ make test
%files help
%doc README README-WORDS NEWS
%if %{with python2}
%files -n python2-cracklib
%{_libdir}/python*/site-packages/_cracklib*.so
%{_libdir}/python*/site-packages/*.py*
%{_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
%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

@ -0,0 +1,25 @@
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

@ -0,0 +1,61 @@
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