MCPcopy Index your code
hub / github.com/OpenListTeam/OpenList / GetConfig

Method GetConfig

server/sftp.go:37–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func (d *SftpDriver) GetConfig() *sftpd.Config {
38 if d.config != nil {
39 return d.config
40 }
41 var pwdAuth func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) = nil
42 if !setting.GetBool(conf.SFTPDisablePasswordLogin) {
43 pwdAuth = d.PasswordAuth
44 }
45 serverConfig := ssh.ServerConfig{
46 NoClientAuth: true,
47 NoClientAuthCallback: d.NoClientAuth,
48 PasswordCallback: pwdAuth,
49 PublicKeyCallback: d.PublicKeyAuth,
50 AuthLogCallback: d.AuthLogCallback,
51 BannerCallback: d.GetBanner,
52 }
53 for _, k := range sftp.SSHSigners {
54 serverConfig.AddHostKey(k)
55 }
56 d.config = &sftpd.Config{
57 ServerConfig: serverConfig,
58 HostPort: conf.Conf.SFTP.Listen,
59 ErrorLogFunc: utils.Log.Error,
60 // DebugLogFunc: utils.Log.Debugf,
61 }
62 return d.config
63}
64
65func (d *SftpDriver) GetFileSystem(sc *ssh.ServerConn) (sftpd.FileSystem, error) {
66 userObj, err := op.GetUserByName(sc.User())

Callers

nothing calls this directly

Calls 1

GetBoolFunction · 0.92

Tested by

no test coverage detected