Skip to content

Commit 34c3f91

Browse files
authored
fix(agent/agentssh): check for hushlogin via afero fs (#8358)
1 parent 2594530 commit 34c3f91

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agent/agentssh/agentssh.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
358358
}
359359
}
360360

361-
if !isQuietLogin(session.RawCommand()) {
361+
if !isQuietLogin(s.fs, session.RawCommand()) {
362362
manifest := s.Manifest.Load()
363363
if manifest != nil {
364364
err := showMOTD(s.fs, session, manifest.MOTDFile)
@@ -763,7 +763,7 @@ func isLoginShell(rawCommand string) bool {
763763
// isQuietLogin checks if the SSH server should perform a quiet login or not.
764764
//
765765
// https://github.com/openssh/openssh-portable/blob/25bd659cc72268f2858c5415740c442ee950049f/session.c#L816
766-
func isQuietLogin(rawCommand string) bool {
766+
func isQuietLogin(fs afero.Fs, rawCommand string) bool {
767767
// We are always quiet unless this is a login shell.
768768
if !isLoginShell(rawCommand) {
769769
return true
@@ -776,7 +776,7 @@ func isQuietLogin(rawCommand string) bool {
776776
return false
777777
}
778778

779-
_, err = os.Stat(filepath.Join(homedir, ".hushlogin"))
779+
_, err = fs.Stat(filepath.Join(homedir, ".hushlogin"))
780780
return err == nil
781781
}
782782

0 commit comments

Comments
 (0)