Skip to content

Commit 9eca7e8

Browse files
Merge branch 'main' into user/sdou/ukiStubArm64
2 parents 4a9c362 + 535adbc commit 9eca7e8

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

test/vmtests/vmtests/utils/ssh_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from threading import Thread
1111
from typing import Any, Dict, List, Optional, Union
1212

13-
# CodeQL [SM04242] false positive: Paramiko is used in test-only code, not in production.
14-
# The warning is acceptable as it does not affect released artifacts.
13+
# CodeQL [SM04242] Paramiko is used in test-only code, not in production. The warning is acceptable as it does not affect released artifacts.
1514
from paramiko import AutoAddPolicy, SSHClient
1615
from paramiko.channel import ChannelFile, ChannelStderrFile
1716
from paramiko.ssh_exception import NoValidConnectionsError, SSHException

toolkit/tools/pkg/imagecustomizerlib/customizeusers.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ func addOrUpdateUser(user imagecustomizerapi.User, baseConfigPath string, imageC
5252
}
5353

5454
hashedPassword := ""
55+
shouldUpdatePassword := false
56+
5557
if user.Password != nil {
58+
shouldUpdatePassword = true
59+
5660
passwordIsFile := user.Password.Type == imagecustomizerapi.PasswordTypePlainTextFile ||
5761
user.Password.Type == imagecustomizerapi.PasswordTypeHashedFile
5862

@@ -92,10 +96,12 @@ func addOrUpdateUser(user imagecustomizerapi.User, baseConfigPath string, imageC
9296
user.HomeDirectory, user.Name)
9397
}
9498

95-
// Update the user's password.
96-
err = userutils.UpdateUserPassword(imageChroot.RootDir(), user.Name, hashedPassword)
97-
if err != nil {
98-
return err
99+
// Only update password if explicitly provided
100+
if shouldUpdatePassword {
101+
err = userutils.UpdateUserPassword(imageChroot.RootDir(), user.Name, hashedPassword)
102+
if err != nil {
103+
return err
104+
}
99105
}
100106
} else {
101107
var uidStr string

0 commit comments

Comments
 (0)