Fix issue of error length and truncate dict file

Signed-off-by: yixiangzhike <yixiangzhike007@163.com>
This commit is contained in:
yixiangzhike 2022-08-13 13:29:36 +08:00
parent e0059e6f68
commit a3e940f65b
3 changed files with 94 additions and 1 deletions

View File

@ -5,7 +5,7 @@
Name: cracklib
Version: 2.9.7
Release: 7
Release: 8
Summary: A password-checking library
License: LGPLv2+
@ -14,6 +14,9 @@ Source0: https://github.com/cracklib/cracklib/releases/download/v%{version}/crac
Source1: https://github.com/cracklib/cracklib/releases/download/v%{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
BuildRequires: gcc, words, gettext, gettext-autopoint, zlib-devel
%if %{with python3}
@ -151,6 +154,10 @@ make test
%endif
%changelog
* Sat Aug 13 2022 yixiangzhike <yixiangzhike007@163.com> - 2.9.7-8
- 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-7
- fix lookup for word in FindPW()

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