bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2024-01-25 12:32:23 +01:00
parent a9ce2e003c
commit b7635f59ee
17 changed files with 32 additions and 31 deletions

View File

@@ -709,7 +709,7 @@ func (s *svc) Move(ctx context.Context, req *provider.MoveRequest) (*provider.Mo
if sourceProviderInfo.Address != destProviderInfo.Address {
return &provider.MoveResponse{
Status: status.NewPermissionDenied(ctx, nil, "cross storage moves are not permitted, use copy and delete"),
Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not supported, use copy and delete"),
}, nil
}

View File

@@ -68,7 +68,6 @@ type config struct {
}
type passwordPolicy struct {
Disabled bool `mapstructure:"disabled"`
MinCharacters int `mapstructure:"min_characters"`
MinLowerCaseCharacters int `mapstructure:"min_lowercase_characters"`
MinUpperCaseCharacters int `mapstructure:"min_uppercase_characters"`
@@ -174,10 +173,9 @@ func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) {
func newPasswordPolicy(c *passwordPolicy) password.Validator {
if c == nil {
return password.NewPasswordPolicy(true, 0, 0, 0, 0, 0, nil)
return password.NewPasswordPolicy(0, 0, 0, 0, 0, nil)
}
return password.NewPasswordPolicy(
c.Disabled,
c.MinCharacters,
c.MinLowerCaseCharacters,
c.MinUpperCaseCharacters,

View File

@@ -667,7 +667,7 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
if dstReceivedShare.Share.Id.OpaqueId != srcReceivedShare.Share.Id.OpaqueId {
return &provider.MoveResponse{
Status: status.NewPermissionDenied(ctx, nil, "cross storage moves are not permitted, use copy and delete"),
Status: status.NewUnimplemented(ctx, nil, "cross storage moves are not supported, use copy and delete"),
}, nil
}

View File

@@ -276,9 +276,8 @@ func (s *svc) handleNew(w http.ResponseWriter, r *http.Request) {
return
}
defer httpRes.Body.Close()
if httpRes.StatusCode == http.StatusForbidden {
if httpRes.StatusCode == http.StatusBadRequest {
// the file upload was already finished since it is a zero byte file
// TODO: why do we get a 401 then!?
} else if httpRes.StatusCode != http.StatusOK {
writeError(w, r, appErrorServerError, "failed to create the file", nil)
return

View File

@@ -117,7 +117,6 @@ type CapabilitiesGraph struct {
// CapabilitiesPasswordPolicy hold the password policy capabilities
type CapabilitiesPasswordPolicy struct {
Disabled bool `json:"disabled" xml:"disabled" mapstructure:"disabled"`
MinCharacters int `json:"min_characters" xml:"min_characters" mapstructure:"min_characters"`
MaxCharacters int `json:"max_characters" xml:"max_characters" mapstructure:"max_characters"`
MinLowerCaseCharacters int `json:"min_lowercase_characters" xml:"min_lowercase_characters" mapstructure:"min_lowercase_characters"`

View File

@@ -1714,10 +1714,9 @@ func publicPwdEnforced(c *config.Config) passwordEnforced {
func passwordPolicies(c *config.Config) password.Validator {
if c.Capabilities.Capabilities == nil || c.Capabilities.Capabilities.PasswordPolicy == nil {
return password.NewPasswordPolicy(true, 0, 0, 0, 0, 0, nil)
return password.NewPasswordPolicy(0, 0, 0, 0, 0, nil)
}
return password.NewPasswordPolicy(
c.Capabilities.Capabilities.PasswordPolicy.Disabled,
c.Capabilities.Capabilities.PasswordPolicy.MinCharacters,
c.Capabilities.Capabilities.PasswordPolicy.MinLowerCaseCharacters,
c.Capabilities.Capabilities.PasswordPolicy.MinUpperCaseCharacters,

View File

@@ -42,6 +42,8 @@ var (
PPStepPolicies Postprocessingstep = "policies"
// PPStepDelay is the step that processing. Useful for testing or user annoyment
PPStepDelay Postprocessingstep = "delay"
// PPStepFinished is the step that signals that postprocessing is finished, but storage provider hasn't acknowledged it yet
PPStepFinished Postprocessingstep = "finished"
// PPOutcomeDelete means that the file and the upload should be deleted
PPOutcomeDelete PostprocessingOutcome = "delete"
@@ -193,6 +195,7 @@ func (UploadReady) Unmarshal(v []byte) (interface{}, error) {
// ResumePostprocessing can be emitted to repair broken postprocessing
type ResumePostprocessing struct {
UploadID string
Step Postprocessingstep
Timestamp *types.Timestamp
}

View File

@@ -18,7 +18,6 @@ type Validator interface {
// Policies represents a password validation rules
type Policies struct {
disabled bool
minCharacters int
minLowerCaseCharacters int
minUpperCaseCharacters int
@@ -30,9 +29,8 @@ type Policies struct {
}
// NewPasswordPolicy returns a new NewPasswordPolicy instance
func NewPasswordPolicy(disabled bool, minCharacters, minLowerCaseCharacters, minUpperCaseCharacters, minDigits, minSpecialCharacters int, bannedPasswordsList map[string]struct{}) Validator {
func NewPasswordPolicy(minCharacters, minLowerCaseCharacters, minUpperCaseCharacters, minDigits, minSpecialCharacters int, bannedPasswordsList map[string]struct{}) Validator {
p := &Policies{
disabled: disabled,
minCharacters: minCharacters,
minLowerCaseCharacters: minLowerCaseCharacters,
minUpperCaseCharacters: minUpperCaseCharacters,
@@ -48,9 +46,6 @@ func NewPasswordPolicy(disabled bool, minCharacters, minLowerCaseCharacters, min
// Validate implements a password validation regarding the policy
func (s Policies) Validate(str string) error {
if s.disabled {
return nil
}
var allErr error
if !utf8.ValidString(str) {
return fmt.Errorf("the password contains invalid characters")

View File

@@ -93,6 +93,13 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
defer func() {
metrics.UploadsActive.Sub(1)
}()
if r.ContentLength == 0 {
sublog.Info().Msg("received invalid 0-byte PUT request")
w.WriteHeader(http.StatusBadRequest)
return
}
fn := r.URL.Path
defer r.Body.Close()

View File

@@ -286,8 +286,9 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}
var (
failed bool
keepUpload bool
failed bool
revertNodeMetadata bool
keepUpload bool
)
unmarkPostprocessing := true
@@ -297,12 +298,14 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
fallthrough
case events.PPOutcomeAbort:
failed = true
revertNodeMetadata = true
keepUpload = true
metrics.UploadSessionsAborted.Inc()
case events.PPOutcomeContinue:
if err := session.Finalize(); err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not finalize upload")
failed = true
revertNodeMetadata = false
keepUpload = true
// keep postprocessing status so the upload is not deleted during housekeeping
unmarkPostprocessing = false
@@ -311,6 +314,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}
case events.PPOutcomeDelete:
failed = true
revertNodeMetadata = true
metrics.UploadSessionsDeleted.Inc()
}
@@ -337,7 +341,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
}
}
fs.sessionStore.Cleanup(ctx, session, failed, keepUpload, unmarkPostprocessing)
fs.sessionStore.Cleanup(ctx, session, revertNodeMetadata, keepUpload, unmarkPostprocessing)
// remove cache entry in gateway
fs.cache.RemoveStatContext(ctx, ev.ExecutingUser.GetId(), &provider.ResourceId{SpaceId: n.SpaceID, OpaqueId: n.ID})

View File

@@ -295,13 +295,9 @@ func (s *OcisSession) MTime() time.Time {
return t
}
// IsProcessing returns true if the node has entered postprocessing state
// IsProcessing returns true if all bytes have been received. The session then has entered postprocessing state.
func (s *OcisSession) IsProcessing() bool {
n, err := s.Node(context.Background())
if err != nil {
return false
}
return n.IsProcessing(context.Background())
return s.info.Size == s.info.Offset
}
// binPath returns the path to the file storing the binary data.

View File

@@ -191,7 +191,7 @@ func (session *OcisSession) FinishUpload(ctx context.Context) error {
n, err := session.store.CreateNodeForUpload(session, attrs)
if err != nil {
session.store.Cleanup(ctx, session, true, false, true)
session.store.Cleanup(ctx, session, true, false, false)
return err
}