From 1d8879ef7bf1a275650ae1d393d7565526feeea1 Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Tue, 15 Dec 2020 16:54:53 +0800 Subject: [PATCH] fix(host): fix set windows password with escape charater --- pkg/hostman/guestfs/fsdriver/windows.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/hostman/guestfs/fsdriver/windows.go b/pkg/hostman/guestfs/fsdriver/windows.go index 7d073e0e30..5f6d0deebe 100644 --- a/pkg/hostman/guestfs/fsdriver/windows.go +++ b/pkg/hostman/guestfs/fsdriver/windows.go @@ -408,6 +408,8 @@ 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{