Skip to content

Commit 9dbb1f5

Browse files
committed
int32
1 parent a66fe34 commit 9dbb1f5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

pkg/cmd/register/sshkeys.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func GrantSSHAccessToNode(
142142
reg *DeviceRegistration,
143143
targetUser *entity.User,
144144
osUser *user.User,
145-
port uint32,
145+
port int32,
146146
) error {
147147
if targetUser.PublicKey != "" {
148148
if added, err := InstallAuthorizedKey(osUser, targetUser.PublicKey, targetUser.ID); err != nil {
@@ -165,7 +165,7 @@ func GrantSSHAccessToNode(
165165
ExternalNodeId: reg.ExternalNodeID,
166166
UserId: targetUser.ID,
167167
LinuxUser: osUser.Username,
168-
Port: int32(port),
168+
Port: port,
169169
}))
170170
if err != nil {
171171
// Retryable error
@@ -199,18 +199,18 @@ const defaultSSHPort = 22
199199

200200
// testSSHPort is set by tests to avoid blocking on stdin. When non-nil,
201201
// PromptSSHPort returns this value without prompting.
202-
var testSSHPort *uint32
202+
var testSSHPort *int32
203203

204204
// SetTestSSHPort sets the port returned by PromptSSHPort without prompting.
205205
// Only for use in tests; call ClearTestSSHPort when done.
206-
func SetTestSSHPort(port uint32) { testSSHPort = &port }
206+
func SetTestSSHPort(port int32) { testSSHPort = &port }
207207

208208
// ClearTestSSHPort clears the test port override.
209209
func ClearTestSSHPort() { testSSHPort = nil }
210210

211211
// PromptSSHPort prompts the user for the target SSH port, defaulting to 22 if
212212
// they press Enter or leave it empty. Returns an error for invalid port numbers.
213-
func PromptSSHPort(t *terminal.Terminal) (uint32, error) {
213+
func PromptSSHPort(t *terminal.Terminal) (int32, error) {
214214
if testSSHPort != nil {
215215
return *testSSHPort, nil
216216
}
@@ -230,7 +230,7 @@ func PromptSSHPort(t *terminal.Terminal) (uint32, error) {
230230
if n < 1 || n > 65535 {
231231
return 0, fmt.Errorf("port must be between 1 and 65535, got %d", n)
232232
}
233-
return uint32(n), nil
233+
return int32(n), nil
234234
}
235235

236236
// InstallAuthorizedKey appends the given public key to the user's

0 commit comments

Comments
 (0)