MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / NoClientAuth

Method NoClientAuth

server/sftp.go:81–93  ·  view source on GitHub ↗
(conn ssh.ConnMetadata)

Source from the content-addressed store, hash-verified

79}
80
81func (d *SftpDriver) NoClientAuth(conn ssh.ConnMetadata) (*ssh.Permissions, error) {
82 if conn.User() != "guest" {
83 return nil, errors.New("only guest is allowed to login without authorization")
84 }
85 guest, err := op.GetGuest()
86 if err != nil {
87 return nil, err
88 }
89 if guest.Disabled || !guest.CanFTPAccess() {
90 return nil, errors.New("user is not allowed to access via SFTP")
91 }
92 return nil, nil
93}
94
95func (d *SftpDriver) PasswordAuth(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
96 ip := conn.RemoteAddr().String()

Callers

nothing calls this directly

Calls 3

GetGuestFunction · 0.92
CanFTPAccessMethod · 0.80
UserMethod · 0.65

Tested by

no test coverage detected