!20 sync by openEuler-22.03-LTS-SP3

From: @Venland 
Reviewed-by: @xzyangha 
Signed-off-by: @xzyangha
This commit is contained in:
openeuler-ci-bot 2024-06-19 06:47:41 +00:00 committed by Gitee
commit f3ebe50b81
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 78 additions and 125 deletions

View File

@ -1,17 +1,17 @@
From c80d5bd5718c2d56bd8498ffae9b766f5a07f9c7 Mon Sep 17 00:00:00 2001
From: songmingliang <songmingliang@uniontech.com>
Date: Fri, 13 May 2022 18:11:36 +0800
Subject: [PATCH] modify password policy
From 2e84087cd91a7a0b8b268d4e2d8c97f6c38afcb0 Mon Sep 17 00:00:00 2001
From: leeffo <leeffo@yeah.net>
Date: Tue, 21 Feb 2023 14:50:45 +0800
Subject: [PATCH] deepin-pw-check modify password policy
---
tool/pwd_conf_update.c | 154 +++++++++++++++++++++--------------------
1 file changed, 78 insertions(+), 76 deletions(-)
tool/pwd_conf_update.c | 148 +++++++++++++++++++++--------------------
1 file changed, 75 insertions(+), 73 deletions(-)
diff --git a/tool/pwd_conf_update.c b/tool/pwd_conf_update.c
index ddcb130..3f90ee6 100644
index ddcfca5..f30c2b8 100644
--- a/tool/pwd_conf_update.c
+++ b/tool/pwd_conf_update.c
@@ -85,15 +85,15 @@ const _default_conf default_conf[] = {
@@ -90,15 +90,15 @@ const _default_conf default_conf[] = {
[OS_EULER] =
{
.min_length = 8,
@ -19,8 +19,7 @@ index ddcb130..3f90ee6 100644
+ .max_length = 511,
.validate_policy = "1234567890;abcdefghijklmnopqrstuvwxyz;"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ;!\"#$%&'()*+,-./"
- ":;<=>?@[\\]^_`{|}~/",
+ ":;<=>?@[\\]^_`{|}~",
":;<=>?@[\\]^_`{|}~/",
.validate_required = 3,
.palindorme_num = 4,
.word_check = 1,
@ -31,7 +30,7 @@ index ddcb130..3f90ee6 100644
.first_letter_uppercase = 0,
},
};
@@ -247,15 +247,15 @@ int update_conf(OS_TYPE os_type) {
@@ -252,15 +252,15 @@ int update_conf(OS_TYPE os_type) {
} else {
// 如果找到了该字段
// 如果是服务器版,强制覆盖配置
@ -39,9 +38,9 @@ index ddcb130..3f90ee6 100644
- // sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
- // DEBUG("restore STRONG_PASSWORD");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
+ DEBUG("restore STRONG_PASSWORD");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
+ DEBUG("restore STRONG_PASSWORD");
+ } else {
// 如果不是服务器版,则维持原配置
sprintf(append_string + offset,
@ -52,7 +51,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -265,18 +265,18 @@ int update_conf(OS_TYPE os_type) {
@@ -270,18 +270,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].min_length);
DEBUG("set PASSWORD_MIN_LENGTH");
} else {
@ -62,11 +61,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].min_length);
- // DEBUG("restore PASSWORD_MIN_LENGTH");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "PASSWORD_MIN_LENGTH = %d\n",
+ default_conf[os_type].min_length);
+ DEBUG("restore PASSWORD_MIN_LENGTH");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "PASSWORD_MIN_LENGTH = %d\n",
+ default_conf[os_type].min_length);
+ DEBUG("restore PASSWORD_MIN_LENGTH");
+ } else {
sprintf(append_string + offset,
"PASSWORD_MIN_LENGTH = %d\n",
@ -78,7 +77,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -286,38 +286,40 @@ int update_conf(OS_TYPE os_type) {
@@ -291,18 +291,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].max_length);
DEBUG("set PASSWORD_MAX_LENGTH");
} else {
@ -88,11 +87,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].max_length);
- // DEBUG("restore PASSWORD_MAX_LENGTH");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "PASSWORD_MAX_LENGTH = %d\n",
+ default_conf[os_type].max_length);
+ DEBUG("restore PASSWORD_MAX_LENGTH");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "PASSWORD_MAX_LENGTH = %d\n",
+ default_conf[os_type].max_length);
+ DEBUG("restore PASSWORD_MAX_LENGTH");
+ } else {
sprintf(append_string + offset,
"PASSWORD_MAX_LENGTH = %d\n",
@ -104,13 +103,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
if (iniparser_find_entry(dic, "Password:VALIDATE_POLICY") == 0) {
sprintf(append_string + offset,
- "VALIDATE_POLICY = \"%s\"\n",
+ "VALIDATE_POLICY = %s \n",
default_conf[os_type].validate_policy);
DEBUG("set VALIDATE_POLICY");
} else {
@@ -315,14 +315,16 @@ int update_conf(OS_TYPE os_type) {
// char cmd[512];
// sprintf(cmd, "sed \"/^VALIDATE_POLICY.*/\"d -i %s", PASSWD_CONF_FILE_PATH);
// system(cmd);
@ -123,19 +116,19 @@ index ddcb130..3f90ee6 100644
- get_validate_policy(buff);
- sprintf(append_string + offset, "VALIDATE_POLICY = %s\n", buff);
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "VALIDATE_POLICY = %s \n",
+ default_conf[os_type].validate_policy);
+ DEBUG("set VALIDATE_POLICY after delete");
+ sprintf(append_string + offset,
+ "VALIDATE_POLICY = %s\n",
+ default_conf[os_type].validate_policy);
+ DEBUG("set VALIDATE_POLICY after delete");
+ } else {
+ char buff[512];
+ get_validate_policy(buff);
+ sprintf(append_string + offset, "VALIDATE_POLICY = %s\n", buff);
+ }
+ char buff[512];
+ get_validate_policy(buff);
+ sprintf(append_string + offset, "VALIDATE_POLICY = %s\n", buff);
+ }
}
offset = strlen(append_string);
@@ -327,18 +329,18 @@ int update_conf(OS_TYPE os_type) {
@@ -332,18 +334,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].validate_required);
DEBUG("set VALIDATE_REQUIRED");
} else {
@ -145,11 +138,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].validate_required);
- // DEBUG("restore VALIDATE_REQUIRED");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "VALIDATE_REQUIRED = %d\n",
+ default_conf[os_type].validate_required);
+ DEBUG("restore VALIDATE_REQUIRED");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "VALIDATE_REQUIRED = %d\n",
+ default_conf[os_type].validate_required);
+ DEBUG("restore VALIDATE_REQUIRED");
+ } else {
sprintf(append_string + offset,
"VALIDATE_REQUIRED = %d\n",
@ -161,7 +154,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -348,18 +350,18 @@ int update_conf(OS_TYPE os_type) {
@@ -353,18 +355,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].palindorme_num);
DEBUG("set PALINDROME_NUM");
} else {
@ -171,11 +164,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].palindorme_num);
- // DEBUG("restore PALINDROME_NUM");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "PALINDROME_NUM = %d\n",
+ default_conf[os_type].palindorme_num);
+ DEBUG("restore PALINDROME_NUM");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "PALINDROME_NUM = %d\n",
+ default_conf[os_type].palindorme_num);
+ DEBUG("restore PALINDROME_NUM");
+ } else {
sprintf(append_string + offset,
"PALINDROME_NUM = %d\n",
@ -187,7 +180,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -367,14 +369,14 @@ int update_conf(OS_TYPE os_type) {
@@ -372,14 +374,14 @@ int update_conf(OS_TYPE os_type) {
sprintf(append_string + offset, "WORD_CHECK = %d\n", default_conf[os_type].word_check);
DEBUG("set WORD_CHECK");
} else {
@ -195,9 +188,9 @@ index ddcb130..3f90ee6 100644
- // sprintf(append_string + offset, "WORD_CHECK = %d\n",
- // default_conf[os_type].word_check); DEBUG("restore WORD_CHECK");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset, "WORD_CHECK = %d\n",
+ default_conf[os_type].word_check); DEBUG("restore WORD_CHECK");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset, "WORD_CHECK = %d\n",
+ default_conf[os_type].word_check); DEBUG("restore WORD_CHECK");
+ } else {
sprintf(append_string + offset,
"WORD_CHECK = %d\n",
@ -207,7 +200,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -384,18 +386,18 @@ int update_conf(OS_TYPE os_type) {
@@ -389,18 +391,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].monotone_same_character_num);
DEBUG("set MONOTONE_CHARACTER_NUM");
} else {
@ -217,11 +210,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].monotone_same_character_num);
- // DEBUG("restore MONOTONE_CHARACTER_NUM");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "MONOTONE_CHARACTER_NUM = %d\n",
+ default_conf[os_type].monotone_same_character_num);
+ DEBUG("restore MONOTONE_CHARACTER_NUM");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "MONOTONE_CHARACTER_NUM = %d\n",
+ default_conf[os_type].monotone_same_character_num);
+ DEBUG("restore MONOTONE_CHARACTER_NUM");
+ } else {
sprintf(append_string + offset,
"MONOTONE_CHARACTER_NUM = %d\n",
@ -233,7 +226,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -405,18 +407,18 @@ int update_conf(OS_TYPE os_type) {
@@ -410,18 +412,18 @@ int update_conf(OS_TYPE os_type) {
default_conf[os_type].consecutive_same_character_num);
DEBUG("set CONSECUTIVE_SAME_CHARACTER_NUM");
} else {
@ -243,11 +236,11 @@ index ddcb130..3f90ee6 100644
- // default_conf[os_type].consecutive_same_character_num);
- // DEBUG("restore CONSECUTIVE_SAME_CHARACTER_NUM");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset,
+ "CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
+ default_conf[os_type].consecutive_same_character_num);
+ DEBUG("restore CONSECUTIVE_SAME_CHARACTER_NUM");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset,
+ "CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
+ default_conf[os_type].consecutive_same_character_num);
+ DEBUG("restore CONSECUTIVE_SAME_CHARACTER_NUM");
+ } else {
sprintf(append_string + offset,
"CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
@ -259,7 +252,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -424,14 +426,14 @@ int update_conf(OS_TYPE os_type) {
@@ -429,14 +431,14 @@ int update_conf(OS_TYPE os_type) {
sprintf(append_string + offset, "DICT_PATH = %s\n", "");
DEBUG("set DICT_PATH");
} else {
@ -267,9 +260,9 @@ index ddcb130..3f90ee6 100644
- // sprintf(append_string + offset, "DICT_PATH = %s\n", "");
- // DEBUG("restore DICT_PATH");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset, "DICT_PATH = %s\n", "");
+ DEBUG("restore DICT_PATH");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset, "DICT_PATH = %s\n", "");
+ DEBUG("restore DICT_PATH");
+ } else {
sprintf(append_string + offset,
"DICT_PATH = %s\n",
@ -279,7 +272,7 @@ index ddcb130..3f90ee6 100644
}
offset = strlen(append_string);
@@ -439,15 +441,15 @@ int update_conf(OS_TYPE os_type) {
@@ -444,15 +446,15 @@ int update_conf(OS_TYPE os_type) {
sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
DEBUG("set FIRST_LETTER_UPPERCASE");
} else {
@ -287,9 +280,9 @@ index ddcb130..3f90ee6 100644
- // sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
- // DEBUG("restore FIRST_LETTER_UPPERCASE");
- // } else {
+ if (OS_EULER == os_type) {
+ sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
+ DEBUG("restore FIRST_LETTER_UPPERCASE");
+ if (OS_SERVER == os_type) {
+ sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
+ DEBUG("restore FIRST_LETTER_UPPERCASE");
+ } else {
sprintf(append_string + offset,
"FIRST_LETTER_UPPERCASE = %s\n",
@ -300,13 +293,6 @@ index ddcb130..3f90ee6 100644
}
DEBUG("append string :%s", append_string);
@@ -491,4 +493,4 @@ int main(int argc, char **argv) {
}
return 0;
-}
\ No newline at end of file
+}
--
2.27.0
2.20.1

View File

@ -1,34 +0,0 @@
From f43960d62583c6e177079b3bab6795450cee3092 Mon Sep 17 00:00:00 2001
From: songmingliang <songmingliang@uniontech.com>
Date: Mon, 20 Jun 2022 13:48:00 +0800
Subject: [PATCH] delete blank
---
tool/pwd_conf_update.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tool/pwd_conf_update.c b/tool/pwd_conf_update.c
index 3f90ee6..cb417df 100644
--- a/tool/pwd_conf_update.c
+++ b/tool/pwd_conf_update.c
@@ -303,7 +303,7 @@ int update_conf(OS_TYPE os_type) {
if (iniparser_find_entry(dic, "Password:VALIDATE_POLICY") == 0) {
sprintf(append_string + offset,
- "VALIDATE_POLICY = %s \n",
+ "VALIDATE_POLICY = %s\n",
default_conf[os_type].validate_policy);
DEBUG("set VALIDATE_POLICY");
} else {
@@ -312,7 +312,7 @@ int update_conf(OS_TYPE os_type) {
// system(cmd);
if (OS_EULER == os_type) {
sprintf(append_string + offset,
- "VALIDATE_POLICY = %s \n",
+ "VALIDATE_POLICY = %s\n",
default_conf[os_type].validate_policy);
DEBUG("set VALIDATE_POLICY after delete");
} else {
--
2.27.0

Binary file not shown.

Binary file not shown.

View File

@ -7,8 +7,8 @@
%endif
Name: deepin-pw-check
Version: 5.1.4
Release: 2
Version: 5.1.17
Release: 1
Summary: Used to check password and manager the configuration for password.
License: GPL-3.0
URL: https://github.com/linuxdeepin/%{name}
@ -16,9 +16,8 @@ Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: dde.conf
Patch1000: 0001-fix-for-UonioTech.patch
Patch1001: 1000-deepin-pw-check-modify-password-policy.patch
Patch1002: 1001-deepin-pw-check-uos-delete-blank.patch
Patch1000: 0001-fix-for-UonioTech.patch
Patch1001: 1000-deepin-pw-check-modify-password-policy.patch
BuildRequires: golang
BuildRequires: pam-devel
@ -47,7 +46,6 @@ this interface is designed to adapt to fingerprint, face and other authenticatio
%setup -q
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
tar -xf %{SOURCE1}
@ -93,6 +91,9 @@ install -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/deepin/dde.conf
%{_includedir}/deepin_pw_check.h
%changelog
* Tue Jul 25 2023 leeffo <liweiganga@uniontech.com> - 5.1.17-1
- upgrade to version 5.1.17
* Wed Jun 28 2023 liweigang <liweiganga@uniontech.com> - 5.1.4-2
- feat: update golang.org/x/sys

Binary file not shown.