fix(host-deployer): remove escape character on windows passwd

This commit is contained in:
wanyaoqi
2021-01-29 11:52:42 +08:00
parent b2e00a8adb
commit 11896e65d3
+2 -2
View File
@@ -356,6 +356,8 @@ func (w *SWindowsRootFs) ChangeUserPasswd(part IDiskPartition, account, gid, pub
tool.CheckPath()
success := false
// symbol ^ is escape character is batch file.
password = strings.ReplaceAll(password, "^", "")
if rinfo != nil && version.GE(rinfo.Version, "6.1") {
success = w.deployPublicKeyByGuest(account, password)
} else {
@@ -408,8 +410,6 @@ func (w *SWindowsRootFs) deployPublicKeyByGuest(uname, passwd string) bool {
logPath := w.guestDebugLogPath
chksum := stringutils2.GetMD5Hash(passwd + logPath[(len(logPath)-10):])
// symbol ^ is escape character is batch file.
passwd = strings.ReplaceAll(passwd, "^", "^^")
chgpwdScript := strings.Join([]string{
w.MakeGuestDebugCmd("change password step 1"),
strings.Join([]string{