Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e426492549 | ||
|
|
82cb84b201 | ||
|
|
7d9963121a | ||
|
|
98d4e8f369 | ||
|
|
ea9f816061 | ||
|
|
dfbe3ae1d0 | ||
|
|
6a4b77208e |
No files matched your search
@@ -19,5 +19,6 @@ Thumbs.db
|
||||
__pycache__
|
||||
.DS_Store
|
||||
resource_windows_*.syso
|
||||
/librclone.h
|
||||
.devcontainer
|
||||
/cmd/bisync/testdata/bisync_vscode_debuggers_launch.json
|
||||
@@ -285,7 +285,7 @@ endif
|
||||
|
||||
# Fetch the binary builds from GitHub actions
|
||||
fetch_binaries:
|
||||
rclone -P sync --exclude "/testbuilds/**" --delete-excluded $(BETA_UPLOAD) build/
|
||||
rclone -P sync --exclude "/testbuilds/**" --exclude "/index.{html,json}" --delete-excluded $(BETA_UPLOAD) build/
|
||||
|
||||
serve: website
|
||||
cd docs && hugo server --logLevel info -w --disableFastRender --ignoreCache
|
||||
|
||||
+7
-3
@@ -32,10 +32,14 @@ This file describes how to make the various kinds of releases
|
||||
- git commit -a -v -m "Version v1.XX.0"
|
||||
- make check # if this fails, fix, git commit --amend and run it again
|
||||
- make retag # moves the tag onto the Version commit
|
||||
- git push origin # without --follow-tags so it doesn't push the tag if it fails
|
||||
- git push origin # without --follow-tags so it doesn't push the tag yet
|
||||
- Wait for the GitHub actions build of master to complete and check it is
|
||||
green - this is the first time CI sees any commits which were only local,
|
||||
such as security fixes, so it must pass before the tag is pushed
|
||||
- if it fails: fix, git commit, make retag, git push origin and wait again
|
||||
- git push --follow-tags origin
|
||||
- \# Wait for the GitHub builds to complete then...
|
||||
- \# Don't commit anything until after make upload_github as these steps
|
||||
- \# Wait for the GitHub builds of the tag to complete then...
|
||||
- \# Don't commit or push anything until after make upload_github as these steps
|
||||
use the tag on HEAD to find the version
|
||||
- make fetch_binaries
|
||||
- make tarball
|
||||
|
||||
+14
-2
@@ -887,13 +887,25 @@ func (f *Fs) nativePath(name string) string {
|
||||
// happen depending on the encoding.
|
||||
func (f *Fs) localPath(name string) (string, error) {
|
||||
localPath := filepath.Join(f.root, f.nativePath(name))
|
||||
rel, err := filepath.Rel(f.root, localPath)
|
||||
rel, err := f.relToRoot(localPath)
|
||||
if err != nil || rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
|
||||
return "", fserrors.NoRetryError(fmt.Errorf("%q: %w", name, errPathEscapes))
|
||||
}
|
||||
return localPath, nil
|
||||
}
|
||||
|
||||
// relToRoot returns localPath relative to f.root.
|
||||
func (f *Fs) relToRoot(localPath string) (string, error) {
|
||||
// On Windows filepath.Rel loops forever if the base is a bare UNC
|
||||
// share and the target is the same share with a trailing
|
||||
// separator, eg `\\server\share` and `\\server\share\`, which is
|
||||
// what filepath.Join makes of f.root and "".
|
||||
if localPath == f.root || localPath == f.root+string(filepath.Separator) {
|
||||
return ".", nil
|
||||
}
|
||||
return filepath.Rel(f.root, localPath)
|
||||
}
|
||||
|
||||
// Put the Object to the local filesystem
|
||||
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
// Temporary Object under construction - info filled in by Update()
|
||||
@@ -1594,7 +1606,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
||||
// f.root is the trusted destination the user chose, so it is created (and
|
||||
// followed if it is itself a symlink) before being opened.
|
||||
func (f *Fs) osRoot(localPath string) (root *os.Root, rel string, err error) {
|
||||
rel, err = filepath.Rel(f.root, localPath)
|
||||
rel, err = f.relToRoot(localPath)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
@@ -597,6 +597,12 @@ func TestMkdirMetadataThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
// TestRemoveThroughPlantedSymlinkBlocked checks Remove and Rmdir can't
|
||||
// delete anything outside the root through a planted symlink.
|
||||
func TestRemoveThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
// os.Root.Symlink makes a file symlink to a directory outside
|
||||
// the root, which Windows can't traverse, so the planted link
|
||||
// can't reach the outside files.
|
||||
t.Skip("planted directory symlinks can't be traversed on Windows")
|
||||
}
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
"github.com/rclone/rclone/fstest"
|
||||
@@ -38,3 +39,36 @@ func TestRmdirWindows(t *testing.T) {
|
||||
err = operations.Rmdir(context.Background(), r.Flocal, "testdir")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// TestLocalPathUNCShareRoot checks localPath works when the root is a
|
||||
// bare UNC share, where filepath.Rel would never return.
|
||||
func TestLocalPathUNCShareRoot(t *testing.T) {
|
||||
for _, root := range []string{`\\server\share`, `\\?\UNC\server\share`} {
|
||||
f := &Fs{root: root}
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
want string
|
||||
}{
|
||||
{name: "", want: root + `\`},
|
||||
{name: "file.txt", want: root + `\file.txt`},
|
||||
{name: "sub/file.txt", want: root + `\sub\file.txt`},
|
||||
} {
|
||||
type result struct {
|
||||
path string
|
||||
err error
|
||||
}
|
||||
done := make(chan result, 1)
|
||||
go func() {
|
||||
path, err := f.localPath(test.name)
|
||||
done <- result{path, err}
|
||||
}()
|
||||
select {
|
||||
case res := <-done:
|
||||
require.NoError(t, res.err, root, test.name)
|
||||
assert.Equal(t, test.want, res.path, root, test.name)
|
||||
case <-time.After(10 * time.Second):
|
||||
t.Fatalf("localPath(%q) with root %q did not return", test.name, root)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
v1.76.0
|
||||
v1.77.0
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fs
|
||||
|
||||
// VersionTag of rclone
|
||||
var VersionTag = "v1.76.0"
|
||||
var VersionTag = "v1.77.0"
|
||||
+21
-16
@@ -245,23 +245,28 @@ func TestMiddlewareAuth(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// minAuthTime returns the shortest time handler took to reject user
|
||||
// with a wrong password over a few attempts.
|
||||
func minAuthTime(t *testing.T, handler http.Handler, user string) time.Duration {
|
||||
var best time.Duration
|
||||
for i := range 10 {
|
||||
// authTime returns the average time handler takes to reject user with
|
||||
// a wrong password.
|
||||
//
|
||||
// It times many attempts with testing.Benchmark rather than timing them
|
||||
// one at a time as a single rejection can take less than the resolution
|
||||
// of the clock on Windows.
|
||||
func authTime(t *testing.T, handler http.Handler, user string) time.Duration {
|
||||
t.Helper()
|
||||
reject := func() int {
|
||||
req := httptest.NewRequest("GET", "/", nil)
|
||||
req.SetBasicAuth(user, "definitely-wrong-password")
|
||||
rec := httptest.NewRecorder()
|
||||
start := time.Now()
|
||||
handler.ServeHTTP(rec, req)
|
||||
elapsed := time.Since(start)
|
||||
require.Equal(t, http.StatusUnauthorized, rec.Code)
|
||||
if i == 0 || elapsed < best {
|
||||
best = elapsed
|
||||
}
|
||||
return rec.Code
|
||||
}
|
||||
return best
|
||||
require.Equal(t, http.StatusUnauthorized, reject())
|
||||
result := testing.Benchmark(func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
return time.Duration(result.NsPerOp())
|
||||
}
|
||||
|
||||
// Rejecting an unknown user must take about as long as rejecting a
|
||||
@@ -269,16 +274,16 @@ func minAuthTime(t *testing.T, handler http.Handler, user string) time.Duration
|
||||
// users exist.
|
||||
func TestMiddlewareAuthHtpasswdUnknownUserTiming(t *testing.T) {
|
||||
handler := MiddlewareAuthHtpasswd("./testdata/.htpasswd", "test")(testEchoHandler([]byte("ok")))
|
||||
known := minAuthTime(t, handler, "bcrypt")
|
||||
unknown := minAuthTime(t, handler, "nosuchuser")
|
||||
known := authTime(t, handler, "bcrypt")
|
||||
unknown := authTime(t, handler, "nosuchuser")
|
||||
assert.Greater(t, unknown, known/4, "unknown user rejected in %v but known user in %v", unknown, known)
|
||||
}
|
||||
|
||||
// As TestMiddlewareAuthHtpasswdUnknownUserTiming but for --user/--pass
|
||||
func TestMiddlewareAuthBasicUnknownUserTiming(t *testing.T) {
|
||||
handler := MiddlewareAuthBasic("user", "pass", "test", "dlPL2MqE")(testEchoHandler([]byte("ok")))
|
||||
known := minAuthTime(t, handler, "user")
|
||||
unknown := minAuthTime(t, handler, "nosuchuser")
|
||||
known := authTime(t, handler, "user")
|
||||
unknown := authTime(t, handler, "nosuchuser")
|
||||
assert.Greater(t, unknown, known/4, "unknown user rejected in %v but known user in %v", unknown, known)
|
||||
|
||||
req := httptest.NewRequest("GET", "/", nil)
|
||||
|
||||
Reference in new issue
Block a user