sftpd: add support for chmod/chown

added matching permissions too and a new setting "setstat_mode".
Setting setstat_mode to 1 you can keep the previous behaviour that
silently ignore setstat requests
This commit is contained in:
Nicola Murino
2019-11-15 12:15:07 +01:00
parent 206799ff1c
commit bb37a1c1ce
13 changed files with 291 additions and 101 deletions

View File

@@ -601,14 +601,14 @@ func (c *scpCommand) sendProtocolMessage(message string) error {
func (c *scpCommand) sendExitStatus(err error) {
status := uint32(0)
if err != nil {
status = 1
status = uint32(1)
}
ex := exitStatusMsg{
exitStatus := sshSubsystemExitStatus{
Status: status,
}
c.connection.Log(logger.LevelDebug, logSenderSCP, "send exit status for command with args: %v user: %v err: %v",
c.args, c.connection.User.Username, err)
c.connection.channel.SendRequest("exit-status", false, ssh.Marshal(&ex))
c.connection.channel.SendRequest("exit-status", false, ssh.Marshal(&exitStatus))
c.connection.channel.Close()
}