Compare commits
10 Commits
6e531dd5dc
...
ed3e1f5827
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed3e1f5827 | ||
|
|
e75e9342ae | ||
|
|
0ea1a55294 | ||
|
|
5cbb52dc07 | ||
|
|
dbf023406f | ||
|
|
677dc97d9b | ||
|
|
6eac6d5124 | ||
|
|
294e3a45ae | ||
|
|
c36ed26ed7 | ||
|
|
3fd3714e1e |
37
0001-Mangle-Suit-Cracklib2.9.6.patch
Normal file
37
0001-Mangle-Suit-Cracklib2.9.6.patch
Normal file
@ -0,0 +1,37 @@
|
||||
diff --git a/docs/technical_solution.md b/docs/technical_solution.md
|
||||
index 882b75a..246506f 100644
|
||||
--- a/docs/technical_solution.md
|
||||
+++ b/docs/technical_solution.md
|
||||
@@ -212,8 +212,9 @@
|
||||
for (int i = 0; r_destructors[i]; i++)
|
||||
{
|
||||
char *a;
|
||||
+ char *area = NULL;
|
||||
|
||||
- if (!(a = Mangle((char*)pw, r_destructors[i])))
|
||||
+ if (!(a = Mangle((char*)pw, r_destructors[i], area)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -336,4 +337,4 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
|
||||
}
|
||||
```
|
||||
## 总结
|
||||
-使用以上方案,使用同一套代码校验规则,可以解决当前uos系统上遇到的密码校验规则不一致导致的一系列问题。
|
||||
\ No newline at end of file
|
||||
+使用以上方案,使用同一套代码校验规则,可以解决当前uos系统上遇到的密码校验规则不一致导致的一系列问题。
|
||||
diff --git a/lib/word_check.c b/lib/word_check.c
|
||||
index fc32446..ab70346 100644
|
||||
--- a/lib/word_check.c
|
||||
+++ b/lib/word_check.c
|
||||
@@ -394,8 +394,9 @@ int word_check(const char* pw,const char* dict_path) {
|
||||
for (int i = 0; r_destructors[i]; i++)
|
||||
{
|
||||
char *a;
|
||||
+ char *area = NULL;
|
||||
|
||||
- if (!(a = Mangle((char*)pw, r_destructors[i])))
|
||||
+ if (!(a = Mangle((char*)pw, r_destructors[i], area)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
24
0001-fix-for-UonioTech.patch
Normal file
24
0001-fix-for-UonioTech.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 35976a0..6fc6112 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,5 +1,8 @@
|
||||
|
||||
PREFIX=/usr
|
||||
+ifeq (${LIBDIR},)
|
||||
+LIBDIR := lib
|
||||
+endif
|
||||
GOPKG_PREFIX = service
|
||||
GOBUILD = go build $(GO_BUILD_FLAGS)
|
||||
ifeq (${PAM_MODULE_DIR},)
|
||||
@@ -51,8 +54,8 @@ build: prepare $(addprefix out/bin/, ${BINARIES}) out/${LIBRARIES} static_lib ou
|
||||
install: translate
|
||||
mkdir -pv ${DESTDIR}${PREFIX}/share/locale
|
||||
- cp -rf out/locale/* ${DESTDIR}${PREFIX}/share/locale
|
||||
- mkdir -p ${DESTDIR}${PREFIX}/lib
|
||||
- cp -f out/lib* ${DESTDIR}${PREFIX}/lib
|
||||
+ mkdir -p ${DESTDIR}${PREFIX}/${LIBDIR}
|
||||
+ cp -f out/lib* ${DESTDIR}${PREFIX}/${LIBDIR}
|
||||
mkdir -p ${DESTDIR}${PREFIX}/include
|
||||
cp lib/deepin_pw_check.h ${DESTDIR}${PREFIX}/include/
|
||||
mkdir -pv ${DESTDIR}/${PKG_FILE_DIR}
|
||||
312
1000-deepin-pw-check-modify-password-policy.patch
Normal file
312
1000-deepin-pw-check-modify-password-policy.patch
Normal file
@ -0,0 +1,312 @@
|
||||
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
|
||||
|
||||
---
|
||||
tool/pwd_conf_update.c | 154 +++++++++++++++++++++--------------------
|
||||
1 file changed, 78 insertions(+), 76 deletions(-)
|
||||
|
||||
diff --git a/tool/pwd_conf_update.c b/tool/pwd_conf_update.c
|
||||
index ddcb130..3f90ee6 100644
|
||||
--- a/tool/pwd_conf_update.c
|
||||
+++ b/tool/pwd_conf_update.c
|
||||
@@ -85,15 +85,15 @@ const _default_conf default_conf[] = {
|
||||
[OS_EULER] =
|
||||
{
|
||||
.min_length = 8,
|
||||
- .max_length = 510,
|
||||
+ .max_length = 511,
|
||||
.validate_policy = "1234567890;abcdefghijklmnopqrstuvwxyz;"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ;!\"#$%&'()*+,-./"
|
||||
- ":;<=>?@[\\]^_`{|}~/",
|
||||
+ ":;<=>?@[\\]^_`{|}~",
|
||||
.validate_required = 3,
|
||||
.palindorme_num = 4,
|
||||
.word_check = 1,
|
||||
- .monotone_same_character_num = 3,
|
||||
- .consecutive_same_character_num = 3,
|
||||
+ .monotone_same_character_num = 0,
|
||||
+ .consecutive_same_character_num = 0,
|
||||
.first_letter_uppercase = 0,
|
||||
},
|
||||
};
|
||||
@@ -247,15 +247,15 @@ int update_conf(OS_TYPE os_type) {
|
||||
} else {
|
||||
// 如果找到了该字段
|
||||
// 如果是服务器版,强制覆盖配置
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // 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");
|
||||
+ } else {
|
||||
// 如果不是服务器版,则维持原配置
|
||||
sprintf(append_string + offset,
|
||||
"STRONG_PASSWORD = %s\n",
|
||||
iniparser_getboolean(dic, "Password:STRONG_PASSWORD", false) ? "true" : "false");
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -265,18 +265,18 @@ int update_conf(OS_TYPE os_type) {
|
||||
default_conf[os_type].min_length);
|
||||
DEBUG("set PASSWORD_MIN_LENGTH");
|
||||
} else {
|
||||
- // 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 {
|
||||
+ 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"PASSWORD_MIN_LENGTH = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PASSWORD_MIN_LENGTH",
|
||||
default_conf[os_type].min_length));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -286,38 +286,40 @@ int update_conf(OS_TYPE os_type) {
|
||||
default_conf[os_type].max_length);
|
||||
DEBUG("set PASSWORD_MAX_LENGTH");
|
||||
} else {
|
||||
- // 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 {
|
||||
+ 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"PASSWORD_MAX_LENGTH = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PASSWORD_MAX_LENGTH",
|
||||
default_conf[os_type].max_length));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
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 {
|
||||
// char cmd[512];
|
||||
// sprintf(cmd, "sed \"/^VALIDATE_POLICY.*/\"d -i %s", PASSWD_CONF_FILE_PATH);
|
||||
// system(cmd);
|
||||
- // sprintf(append_string + offset,
|
||||
- // "VALIDATE_POLICY = \"%s\"\n",
|
||||
- // default_conf[os_type].validate_policy);
|
||||
- // DEBUG("set VALIDATE_POLICY after delete");
|
||||
-
|
||||
- char buff[512];
|
||||
- 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");
|
||||
+ } else {
|
||||
+ 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) {
|
||||
default_conf[os_type].validate_required);
|
||||
DEBUG("set VALIDATE_REQUIRED");
|
||||
} else {
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // sprintf(append_string + offset,
|
||||
- // "VALIDATE_REQUIRED = %d\n",
|
||||
- // 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"VALIDATE_REQUIRED = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:VALIDATE_REQUIRED",
|
||||
default_conf[os_type].validate_required));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -348,18 +350,18 @@ int update_conf(OS_TYPE os_type) {
|
||||
default_conf[os_type].palindorme_num);
|
||||
DEBUG("set PALINDROME_NUM");
|
||||
} else {
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // sprintf(append_string + offset,
|
||||
- // "PALINDROME_NUM = %d\n",
|
||||
- // 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"PALINDROME_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PALINDROME_NUM",
|
||||
default_conf[os_type].palindorme_num));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -367,14 +369,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 {
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"WORD_CHECK = %d\n",
|
||||
iniparser_getint(dic, "Password:WORD_CHECK", default_conf[os_type].word_check));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -384,18 +386,18 @@ int update_conf(OS_TYPE os_type) {
|
||||
default_conf[os_type].monotone_same_character_num);
|
||||
DEBUG("set MONOTONE_CHARACTER_NUM");
|
||||
} else {
|
||||
- // 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 {
|
||||
+ 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"MONOTONE_CHARACTER_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:MONOTONE_CHARACTER_NUM",
|
||||
default_conf[os_type].monotone_same_character_num));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -405,18 +407,18 @@ int update_conf(OS_TYPE os_type) {
|
||||
default_conf[os_type].consecutive_same_character_num);
|
||||
DEBUG("set CONSECUTIVE_SAME_CHARACTER_NUM");
|
||||
} else {
|
||||
- // 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 {
|
||||
+ 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:CONSECUTIVE_SAME_CHARACTER_NUM",
|
||||
default_conf[os_type].consecutive_same_character_num));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -424,14 +426,14 @@ int update_conf(OS_TYPE os_type) {
|
||||
sprintf(append_string + offset, "DICT_PATH = %s\n", "");
|
||||
DEBUG("set DICT_PATH");
|
||||
} else {
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"DICT_PATH = %s\n",
|
||||
iniparser_getstring(dic, "Password:DICT_PATH", ""));
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
offset = strlen(append_string);
|
||||
|
||||
@@ -439,15 +441,15 @@ int update_conf(OS_TYPE os_type) {
|
||||
sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
|
||||
DEBUG("set FIRST_LETTER_UPPERCASE");
|
||||
} else {
|
||||
- // if (OS_SERVER == os_type) {
|
||||
- // 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");
|
||||
+ } else {
|
||||
sprintf(append_string + offset,
|
||||
"FIRST_LETTER_UPPERCASE = %s\n",
|
||||
iniparser_getboolean(dic, "Password:FIRST_LETTER_UPPERCASE", false) ? "true"
|
||||
: "false");
|
||||
- // }
|
||||
+ }
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
34
1001-deepin-pw-check-uos-delete-blank.patch
Normal file
34
1001-deepin-pw-check-uos-delete-blank.patch
Normal file
@ -0,0 +1,34 @@
|
||||
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
|
||||
|
||||
12
dde.conf
12
dde.conf
@ -1,12 +0,0 @@
|
||||
[Password]
|
||||
STRONG_PASSWORD = true
|
||||
PASSWORD_MIN_LENGTH = 8
|
||||
PASSWORD_MAX_LENGTH = 511
|
||||
VALIDATE_POLICY = 1234567890;abcdefghijklmnopqrstuvwxyz;ABCDEFGHIJKLMNOPQRSTUVWXYZ;!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
||||
VALIDATE_REQUIRED = 3
|
||||
PALINDROME_NUM = 4
|
||||
WORD_CHECK = 1
|
||||
MONOTONE_CHARACTER_NUM = 0
|
||||
CONSECUTIVE_SAME_CHARACTER_NUM = 0
|
||||
DICT_PATH =
|
||||
FIRST_LETTER_UPPERCASE = false
|
||||
Binary file not shown.
BIN
deepin-pw-check-5.1.4.tar.gz
Normal file
BIN
deepin-pw-check-5.1.4.tar.gz
Normal file
Binary file not shown.
@ -6,28 +6,34 @@
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
Name: deepin-pw-check
|
||||
Version: 5.0.20.7
|
||||
Release: 2
|
||||
Version: 5.1.4
|
||||
Release: 1
|
||||
Summary: Used to check password and manager the configuration for password.
|
||||
License: GPL-3.0
|
||||
URL: https://github.com/linuxdeepin/%{name}
|
||||
Source0: %{name}-%{version}.orig.tar.xz
|
||||
Source1: vendor.tar.gz
|
||||
Source2: dde.conf
|
||||
License: GPLv3
|
||||
URL: %{gourl}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: golang
|
||||
Patch1000: 0001-fix-for-UonioTech.patch
|
||||
#uelc patch
|
||||
Patch1001: 0001-Mangle-Suit-Cracklib2.9.6.patch
|
||||
#uel patch
|
||||
Patch1002: 1000-deepin-pw-check-modify-password-policy.patch
|
||||
Patch1003: 1001-deepin-pw-check-uos-delete-blank.patch
|
||||
|
||||
BuildRequires: compiler(go-compiler)
|
||||
BuildRequires: pam-devel
|
||||
BuildRequires: pkgconfig(gio-2.0)
|
||||
BuildRequires: pkgconfig(gdk-3.0)
|
||||
BuildRequires: deepin-gettext-tools
|
||||
BuildRequires: gocode
|
||||
BuildRequires: cracklib-devel
|
||||
BuildRequires: iniparser
|
||||
|
||||
Patch0: fix-pwd-pam-update-error.patch
|
||||
Patch1: fix-deepin_pw_check.c-sprintf-error.patch
|
||||
BuildRequires: golang-github-linuxdeepin-go-dbus-factory-devel
|
||||
BuildRequires: go-lib-devel
|
||||
BuildRequires: go-gir-generator
|
||||
|
||||
Requires: polkit
|
||||
|
||||
Requires: license-config
|
||||
%description
|
||||
In order to unify the authentication interface,
|
||||
this interface is designed to adapt to fingerprint, face and other authentication methods.
|
||||
@ -43,23 +49,30 @@ this interface is designed to adapt to fingerprint, face and other authenticatio
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
patch -p1 < rpm/0001-fix-for-UonioTech.patch
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
tar -xf %{SOURCE1}
|
||||
%patch1000 -p1
|
||||
%patch1002 -p1
|
||||
%patch1003 -p1
|
||||
|
||||
%build
|
||||
go env -w GO111MODULE=auto
|
||||
%ifarch loongarch64
|
||||
export CGO_ENABLED=1
|
||||
export GOOS="linux"
|
||||
%endif
|
||||
|
||||
BUILDID="0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"
|
||||
export GOPATH=%{_builddir}/%{name}-%{version}/vendor:$GOPATH
|
||||
export GOPATH=/usr/share/gocode
|
||||
%make_build GO_BUILD_FLAGS=-trimpath GOBUILD="go build -compiler gc -ldflags \"-B $BUILDID\""
|
||||
|
||||
%post
|
||||
|
||||
pwd-conf-update
|
||||
sed -i "s/pam_pwquality.so/pam_deepin_pw_check.so/g" /etc/pam.d/system-auth
|
||||
sed -i "s/pam_pwquality.so/pam_deepin_pw_check.so/g" /etc/pam.d/password-auth
|
||||
|
||||
%postun
|
||||
|
||||
if [ "$1" = "0" ] ; then
|
||||
sed -i "s/pam_deepin_pw_check.so/pam_pwquality.so/g" /etc/pam.d/system-auth
|
||||
sed -i "s/pam_deepin_pw_check.so/pam_pwquality.so/g" /etc/pam.d/password-auth
|
||||
fi
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{_sysconfdir}/deepin
|
||||
@ -68,29 +81,44 @@ export PKG_FILE_DIR=%{_libdir}/pkgconfig
|
||||
%make_install PKG_FILE_DIR=%{_libdir}/pkgconfig LIBDIR=lib64 PAM_MODULE_DIR=%{_libdir}/security GOBUILD="go build -compiler gc -ldflags \"-B $BUILDID\""
|
||||
%find_lang deepin-pw-check
|
||||
|
||||
install -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/deepin/dde.conf
|
||||
|
||||
%ifarch i686
|
||||
mv %{buildroot}/usr/lib64/libdeepin_pw_check.so* %{buildroot}/usr/lib/
|
||||
%endif
|
||||
|
||||
%files -f deepin-pw-check.lang
|
||||
%doc README.md
|
||||
%license
|
||||
%dir %{_sysconfdir}/deepin
|
||||
%{_sysconfdir}/deepin/dde.conf
|
||||
%{_bindir}/pwd-conf-update
|
||||
%{_prefix}/lib/deepin-pw-check/deepin-pw-check
|
||||
%{_libdir}/libdeepin_pw_check.so.*
|
||||
%ifarch i686
|
||||
/usr/lib/security/pam_deepin_pw_check.so
|
||||
%else
|
||||
%{_libdir}/security/pam_deepin_pw_check.so
|
||||
%endif
|
||||
%{_datadir}/dbus-1/system-services/*.service
|
||||
%{_datadir}/dbus-1/system.d/*.conf
|
||||
%{_datadir}/polkit-1/actions/*.policy
|
||||
|
||||
%files devel
|
||||
%ifarch i686
|
||||
/usr/lib64/libdeepin_pw_check.a
|
||||
/usr/lib/pkgconfig/libdeepin_pw_check.pc
|
||||
%else
|
||||
%{_libdir}/libdeepin_pw_check.a
|
||||
%{_libdir}/libdeepin_pw_check.so
|
||||
%{_libdir}/pkgconfig/libdeepin_pw_check.pc
|
||||
%endif
|
||||
%{_libdir}/libdeepin_pw_check.so
|
||||
%{_includedir}/deepin_pw_check.h
|
||||
|
||||
%changelog
|
||||
* Fri Dec 01 2023 zhangshaoning <zhangshaoning@uniontech.com> -5.1.4-1
|
||||
- rebase to deepin-pw-check-5.1.4-1
|
||||
|
||||
* Wed Dec 21 2022 liweiganga <liweiganga@uniontech.com> - 5.0.20.7-3
|
||||
- enable debuginfo for fix strip
|
||||
|
||||
* Tue Aug 02 2022 liweiganga <liweiganga@uniontech.com> - 5.0.20.7-2
|
||||
- add dde.conf
|
||||
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
version_control: github
|
||||
src_repo: linuxdeepin/deepin-pw-check
|
||||
tag_prefix: ^v
|
||||
seperator: .
|
||||
@ -1,37 +0,0 @@
|
||||
From b1e0ad33fc949d9bb9aa6f4ce2d566c39e089819 Mon Sep 17 00:00:00 2001
|
||||
From: panchenbo <panchenbo@uniontech.com>
|
||||
Date: Mon, 16 Aug 2021 11:40:16 +0800
|
||||
Subject: [PATCH] fix deepin_pw_check.c sprintf error
|
||||
|
||||
---
|
||||
lib/deepin_pw_check.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/deepin_pw_check.c b/lib/deepin_pw_check.c
|
||||
index d528ad9..f5fcc99 100644
|
||||
--- a/lib/deepin_pw_check.c
|
||||
+++ b/lib/deepin_pw_check.c
|
||||
@@ -255,7 +255,9 @@ bool is_type_valid(const char *pw, char *character_type, int character_num_requi
|
||||
|
||||
p = strtok(character_type_tmp, ";");
|
||||
int length = strlen(pw);
|
||||
- char all_character[512] = "\0";
|
||||
+ char all_character[512];
|
||||
+ memset(all_character, 0, sizeof(all_character));
|
||||
+ int offset = 0;
|
||||
|
||||
while (p != NULL) {
|
||||
char *next_data_addr = NULL;
|
||||
@@ -287,7 +289,8 @@ bool is_type_valid(const char *pw, char *character_type, int character_num_requi
|
||||
}
|
||||
}
|
||||
|
||||
- sprintf(all_character, "%s%s", all_character, p);
|
||||
+ offset = strlen(all_character);
|
||||
+ sprintf(all_character + offset, "%s", p);
|
||||
DEBUG("p is %s, all_character is %s", p, all_character);
|
||||
int ok = 0;
|
||||
for (int i = 0; i < length; i++) {
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,319 +0,0 @@
|
||||
From 2d590fae89f2455893b509d3861f832e31f1a3c9 Mon Sep 17 00:00:00 2001
|
||||
From: panchenbo <panchenbo@uniontech.com>
|
||||
Date: Tue, 10 Aug 2021 16:22:25 +0800
|
||||
Subject: [PATCH] debug
|
||||
|
||||
---
|
||||
tool/pwd_conf_update.c | 157 ++++++++++++++++++-----------------------
|
||||
1 file changed, 70 insertions(+), 87 deletions(-)
|
||||
|
||||
diff --git a/tool/pwd_conf_update.c b/tool/pwd_conf_update.c
|
||||
index 580e471..c9f9747 100644
|
||||
--- a/tool/pwd_conf_update.c
|
||||
+++ b/tool/pwd_conf_update.c
|
||||
@@ -189,232 +189,215 @@ int update_conf(OS_TYPE os_type) {
|
||||
}
|
||||
|
||||
char append_string[2048] = {0};
|
||||
- sprintf(append_string, "[Password]\n");
|
||||
+ int offset = 0;
|
||||
+ sprintf(append_string + offset, "[Password]\n");
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
// 如果找不到该字段,则写默认的
|
||||
if (iniparser_find_entry(dic, "Password:STRONG_PASSWORD") == 0) {
|
||||
- sprintf(append_string, "%sSTRONG_PASSWORD = %s\n", append_string, "true");
|
||||
+ sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
|
||||
DEBUG("set STRONG_PASSWORD");
|
||||
} else {
|
||||
// 如果找到了该字段
|
||||
// 如果是服务器版,强制覆盖配置
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string, "%sSTRONG_PASSWORD = %s\n", append_string, "true");
|
||||
+ sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
|
||||
DEBUG("restore STRONG_PASSWORD");
|
||||
} else {
|
||||
// 如果不是服务器版,则维持原配置
|
||||
- sprintf(append_string, "%sSTRONG_PASSWORD = %s\n", append_string, "true");
|
||||
+ sprintf(append_string + offset, "STRONG_PASSWORD = %s\n", "true");
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:PASSWORD_MIN_LENGTH") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MIN_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MIN_LENGTH = %d\n",
|
||||
default_conf[os_type].min_length);
|
||||
DEBUG("set PASSWORD_MIN_LENGTH");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MIN_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MIN_LENGTH = %d\n",
|
||||
default_conf[os_type].min_length);
|
||||
DEBUG("restore PASSWORD_MIN_LENGTH");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MIN_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MIN_LENGTH = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PASSWORD_MIN_LENGTH",
|
||||
default_conf[os_type].min_length));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:PASSWORD_MAX_LENGTH") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MAX_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MAX_LENGTH = %d\n",
|
||||
default_conf[os_type].max_length);
|
||||
DEBUG("set PASSWORD_MAX_LENGTH");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MAX_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MAX_LENGTH = %d\n",
|
||||
default_conf[os_type].max_length);
|
||||
DEBUG("restore PASSWORD_MAX_LENGTH");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sPASSWORD_MAX_LENGTH = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PASSWORD_MAX_LENGTH = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PASSWORD_MAX_LENGTH",
|
||||
default_conf[os_type].max_length));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:VALIDATE_POLICY") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sVALIDATE_POLICY = \"%s\"\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "VALIDATE_POLICY = \"%s\"\n",
|
||||
default_conf[os_type].validate_policy);
|
||||
DEBUG("set VALIDATE_POLICY");
|
||||
} else {
|
||||
char cmd[512];
|
||||
sprintf(cmd, "sed \"/^VALIDATE_POLICY.*/\"d -i %s", PASSWD_CONF_FILE_PATH);
|
||||
system(cmd);
|
||||
- sprintf(append_string,
|
||||
- "%sVALIDATE_POLICY = \"%s\"\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "VALIDATE_POLICY = \"%s\"\n",
|
||||
default_conf[os_type].validate_policy);
|
||||
DEBUG("set VALIDATE_POLICY after delete");
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:VALIDATE_REQUIRED") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sVALIDATE_REQUIRED = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "VALIDATE_REQUIRED = %d\n",
|
||||
default_conf[os_type].validate_required);
|
||||
DEBUG("set VALIDATE_REQUIRED");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sVALIDATE_REQUIRED = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "VALIDATE_REQUIRED = %d\n",
|
||||
default_conf[os_type].validate_required);
|
||||
DEBUG("restore VALIDATE_REQUIRED");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sVALIDATE_REQUIRED = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "VALIDATE_REQUIRED = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:VALIDATE_REQUIRED",
|
||||
default_conf[os_type].validate_required));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:PALINDROME_NUM") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sPALINDROME_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PALINDROME_NUM = %d\n",
|
||||
default_conf[os_type].palindorme_num);
|
||||
DEBUG("set PALINDROME_NUM");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sPALINDROME_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PALINDROME_NUM = %d\n",
|
||||
default_conf[os_type].palindorme_num);
|
||||
DEBUG("restore PALINDROME_NUM");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sPALINDROME_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "PALINDROME_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:PALINDROME_NUM",
|
||||
default_conf[os_type].palindorme_num));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:WORD_CHECK") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sWORD_CHECK = %d\n",
|
||||
- append_string,
|
||||
- default_conf[os_type].word_check);
|
||||
+ sprintf(append_string + offset, "WORD_CHECK = %d\n", default_conf[os_type].word_check);
|
||||
DEBUG("set WORD_CHECK");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sWORD_CHECK = %d\n",
|
||||
- append_string,
|
||||
- default_conf[os_type].word_check);
|
||||
+ sprintf(append_string + offset, "WORD_CHECK = %d\n", default_conf[os_type].word_check);
|
||||
DEBUG("restore WORD_CHECK");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sWORD_CHECK = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "WORD_CHECK = %d\n",
|
||||
iniparser_getint(dic, "Password:WORD_CHECK", default_conf[os_type].word_check));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:MONOTONE_CHARACTER_NUM") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sMONOTONE_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "MONOTONE_CHARACTER_NUM = %d\n",
|
||||
default_conf[os_type].monotone_same_character_num);
|
||||
DEBUG("set MONOTONE_CHARACTER_NUM");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sMONOTONE_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ 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,
|
||||
- "%sMONOTONE_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "MONOTONE_CHARACTER_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:MONOTONE_CHARACTER_NUM",
|
||||
default_conf[os_type].monotone_same_character_num));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:CONSECUTIVE_SAME_CHARACTER_NUM") == 0) {
|
||||
- sprintf(append_string,
|
||||
- "%sCONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
default_conf[os_type].consecutive_same_character_num);
|
||||
DEBUG("set CONSECUTIVE_SAME_CHARACTER_NUM");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string,
|
||||
- "%sCONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ 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,
|
||||
- "%sCONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "CONSECUTIVE_SAME_CHARACTER_NUM = %d\n",
|
||||
iniparser_getint(dic,
|
||||
"Password:CONSECUTIVE_SAME_CHARACTER_NUM",
|
||||
default_conf[os_type].consecutive_same_character_num));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:DICT_PATH") == 0) {
|
||||
- sprintf(append_string, "%sDICT_PATH = %s\n", append_string, "");
|
||||
- DEBUG("set WORD_CHECK");
|
||||
+ sprintf(append_string + offset, "DICT_PATH = %s\n", "");
|
||||
+ DEBUG("set DICT_PATH");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string, "%sDICT_PATH = %s\n", append_string, "");
|
||||
+ sprintf(append_string + offset, "DICT_PATH = %s\n", "");
|
||||
DEBUG("restore DICT_PATH");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sDICT_PATH = %s\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "DICT_PATH = %s\n",
|
||||
iniparser_getstring(dic, "Password:DICT_PATH", ""));
|
||||
}
|
||||
}
|
||||
+ offset = strlen(append_string);
|
||||
|
||||
if (iniparser_find_entry(dic, "Password:FIRST_LETTER_UPPERCASE") == 0) {
|
||||
- sprintf(append_string, "%sFIRST_LETTER_UPPERCASE = %s\n", append_string, "false");
|
||||
+ sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
|
||||
DEBUG("set FIRST_LETTER_UPPERCASE");
|
||||
} else {
|
||||
if (OS_SERVER == os_type) {
|
||||
- sprintf(append_string, "%sFIRST_LETTER_UPPERCASE = %s\n", append_string, "false");
|
||||
+ sprintf(append_string + offset, "FIRST_LETTER_UPPERCASE = %s\n", "false");
|
||||
DEBUG("restore FIRST_LETTER_UPPERCASE");
|
||||
} else {
|
||||
- sprintf(append_string,
|
||||
- "%sFIRST_LETTER_UPPERCASE = %s\n",
|
||||
- append_string,
|
||||
+ sprintf(append_string + offset,
|
||||
+ "FIRST_LETTER_UPPERCASE = %s\n",
|
||||
iniparser_getboolean(dic, "Password:FIRST_LETTER_UPPERCASE", false) ? "true"
|
||||
: "false");
|
||||
}
|
||||
}
|
||||
|
||||
- DEBUG("append string is %s", append_string);
|
||||
+ DEBUG("append string :%s", append_string);
|
||||
|
||||
if (strlen(append_string) == 0) {
|
||||
return 0;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
BIN
vendor.tar.gz
BIN
vendor.tar.gz
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user