Skip to content

Commit 005b117

Browse files
committed
check for empty homedir
1 parent b5eb5f8 commit 005b117

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/shellexec/shellexec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ func StartRemoteShellProc(ctx context.Context, logCtx context.Context, termSize
339339
if err != nil {
340340
return nil, fmt.Errorf("unable to obtain client info: %w", err)
341341
}
342+
if remoteInfo.HomeDir == "" {
343+
return nil, fmt.Errorf("unable to obtain home directory from remote machine")
344+
}
342345
log.Printf("client info collected: %+#v", remoteInfo)
343346
var shellPath string
344347
if cmdOpts.ShellPath != "" {
@@ -467,6 +470,9 @@ func StartRemoteShellJob(ctx context.Context, logCtx context.Context, termSize w
467470
if err != nil {
468471
return "", fmt.Errorf("unable to obtain client info: %w", err)
469472
}
473+
if remoteInfo.HomeDir == "" {
474+
return "", fmt.Errorf("unable to obtain home directory from remote machine")
475+
}
470476
log.Printf("client info collected: %+#v", remoteInfo)
471477
var shellPath string
472478
if cmdOpts.ShellPath != "" {

0 commit comments

Comments
 (0)