sftpd: handle setstat requests with multiple attrs
This commit is contained in:
parent
9fb43b2c46
commit
531cb5b5a1
1 changed files with 13 additions and 7 deletions
|
@ -573,16 +573,22 @@ func (c *BaseConnection) SetStat(virtualPath string, attributes *StatAttributes)
|
||||||
}
|
}
|
||||||
pathForPerms := c.getPathForSetStatPerms(fs, fsPath, virtualPath)
|
pathForPerms := c.getPathForSetStatPerms(fs, fsPath, virtualPath)
|
||||||
|
|
||||||
|
if attributes.Flags&StatAttrTimes != 0 {
|
||||||
|
if err = c.handleChtimes(fs, fsPath, pathForPerms, attributes); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if attributes.Flags&StatAttrPerms != 0 {
|
if attributes.Flags&StatAttrPerms != 0 {
|
||||||
return c.handleChmod(fs, fsPath, pathForPerms, attributes)
|
if err = c.handleChmod(fs, fsPath, pathForPerms, attributes); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if attributes.Flags&StatAttrUIDGID != 0 {
|
if attributes.Flags&StatAttrUIDGID != 0 {
|
||||||
return c.handleChown(fs, fsPath, pathForPerms, attributes)
|
if err = c.handleChown(fs, fsPath, pathForPerms, attributes); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if attributes.Flags&StatAttrTimes != 0 {
|
|
||||||
return c.handleChtimes(fs, fsPath, pathForPerms, attributes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if attributes.Flags&StatAttrSize != 0 {
|
if attributes.Flags&StatAttrSize != 0 {
|
||||||
|
@ -590,7 +596,7 @@ func (c *BaseConnection) SetStat(virtualPath string, attributes *StatAttributes)
|
||||||
return c.GetPermissionDeniedError()
|
return c.GetPermissionDeniedError()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.truncateFile(fs, fsPath, virtualPath, attributes.Size); err != nil {
|
if err = c.truncateFile(fs, fsPath, virtualPath, attributes.Size); err != nil {
|
||||||
c.Log(logger.LevelWarn, "failed to truncate path %#v, size: %v, err: %+v", fsPath, attributes.Size, err)
|
c.Log(logger.LevelWarn, "failed to truncate path %#v, size: %v, err: %+v", fsPath, attributes.Size, err)
|
||||||
return c.GetFsError(fs, err)
|
return c.GetFsError(fs, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue