custom actions: add env vars

action parameters can now be readed from env vars too.
Added a timeout for the command execution
This commit is contained in:
Nicola Murino
2020-01-09 12:00:37 +01:00
parent 37c602a477
commit eec60d6309
9 changed files with 169 additions and 73 deletions

View File

@@ -324,7 +324,7 @@ func (c Connection) handleSFTPRename(sourcePath string, targetPath string, reque
return getSFTPErrorFromOSError(err)
}
logger.CommandLog(renameLogSender, sourcePath, targetPath, c.User.Username, "", c.ID, c.protocol, -1, -1, "", "", "")
go executeAction(operationRename, c.User.Username, sourcePath, targetPath, "")
go executeAction(operationRename, c.User.Username, sourcePath, targetPath, "", 0)
return nil
}
@@ -414,7 +414,7 @@ func (c Connection) handleSFTPRemove(filePath string, request *sftp.Request) err
if fi.Mode()&os.ModeSymlink != os.ModeSymlink {
dataprovider.UpdateUserQuota(dataProvider, c.User, -1, -size, false)
}
go executeAction(operationDelete, c.User.Username, filePath, "", "")
go executeAction(operationDelete, c.User.Username, filePath, "", "", fi.Size())
return sftp.ErrSSHFxOk
}