修复预安装创建用户时输入密码未进行合理报错等问题

This commit is contained in:
z00793368
2023-02-20 10:28:01 +08:00
parent e814051d4c
commit 68c33cc0a9
2 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,6 @@
import re
from gspylib.common.ErrorCode import ErrorCode
class PasswordUtil:
@staticmethod
def checkPasswordVaild(password):
@ -11,7 +10,7 @@ class PasswordUtil:
output: NA
"""
# check if the password contains illegal characters
res = re.search(r'^[A-Za-z0-9~!@#%^*$-_=+?,.:/]+$', password)
res = re.search(r'^[A-Za-z0-9~!@#%^*_=+?,.:/$-]+$', password)
if not res:
raise Exception(ErrorCode.GAUSS_502['GAUSS_50219'] %
"the password" + " The password contains illegal "

View File

@ -38,6 +38,7 @@ import csv
import copy
from subprocess import PIPE
from subprocess import Popen
from base_utils.os.password_util import PasswordUtil
# The installation starts, but the package is not decompressed completely.
# The lib64/libz.so.1 file is incomplete, and the hashlib depends on the
@ -3830,6 +3831,8 @@ class ClusterCommand():
@staticmethod
def aes_cbc_encrypt_with_multi(passwd, dest_path, logger):
# # check if the password contains illegal characters
PasswordUtil.checkPasswordVaild(passwd)
# encrypt tool path
encrypt_path = os.path.realpath("%s/../clib" % os.path.dirname(os.path.realpath(__file__)))
# encrypt ca path