rebase: bump github.com/google/fscrypt from 0.3.3 to 0.3.4

Bumps [github.com/google/fscrypt](https://github.com/google/fscrypt) from 0.3.3 to 0.3.4.
- [Release notes](https://github.com/google/fscrypt/releases)
- [Changelog](https://github.com/google/fscrypt/blob/master/NEWS.md)
- [Commits](https://github.com/google/fscrypt/compare/v0.3.3...v0.3.4)

---
updated-dependencies:
- dependency-name: github.com/google/fscrypt
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-02-20 14:30:55 +00:00
committed by mergify[bot]
parent 991c21f7fd
commit f84d43c6d1
13 changed files with 852 additions and 441 deletions

View File

@ -35,7 +35,6 @@ package filesystem
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/user"
@ -45,9 +44,9 @@ import (
"syscall"
"time"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
"google.golang.org/protobuf/proto"
"github.com/google/fscrypt/metadata"
"github.com/google/fscrypt/util"
@ -335,7 +334,7 @@ func (m *Mount) PolicyPath(descriptor string) string {
// directory and returns a temporary Mount which represents this temporary
// directory. The caller is responsible for removing this temporary directory.
func (m *Mount) tempMount() (*Mount, error) {
tempDir, err := ioutil.TempDir(filepath.Dir(m.BaseDir()), tempPrefix)
tempDir, err := os.MkdirTemp(filepath.Dir(m.BaseDir()), tempPrefix)
return &Mount{Path: tempDir}, err
}
@ -393,7 +392,7 @@ func (m *Mount) isFscryptSetupAllowed() bool {
return true
}
switch m.FilesystemType {
case "ext4", "f2fs", "ubifs", "btrfs", "ceph", "xfs":
case "ext4", "f2fs", "ubifs", "btrfs", "ceph", "xfs", "lustre":
return true
default:
return false
@ -635,7 +634,7 @@ func (m *Mount) writeData(path string, data []byte, owner *user.User, mode os.Fi
// Write the data to a temporary file, sync it, then rename into place
// so that the operation will be atomic.
dirPath := filepath.Dir(path)
tempFile, err := ioutil.TempFile(dirPath, tempPrefix)
tempFile, err := os.CreateTemp(dirPath, tempPrefix)
if err != nil {
log.Print(err)
if os.IsPermission(err) {
@ -767,7 +766,7 @@ func readMetadataFileSafe(path string, trustedUser *user.User) ([]byte, int64, e
}
// Read the file contents, allowing at most maxMetadataFileSize bytes.
reader := &io.LimitedReader{R: file, N: maxMetadataFileSize + 1}
data, err := ioutil.ReadAll(reader)
data, err := io.ReadAll(reader)
if err != nil {
return nil, -1, err
}

View File

@ -25,7 +25,6 @@ import (
"bufio"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
@ -537,11 +536,15 @@ func getMountFromLink(link string) (*Mount, error) {
}
func (mnt *Mount) getFilesystemUUID() (string, error) {
dirContents, err := ioutil.ReadDir(uuidDirectory)
dirEntries, err := os.ReadDir(uuidDirectory)
if err != nil {
return "", err
}
for _, fileInfo := range dirContents {
for _, dirEntry := range dirEntries {
fileInfo, err := dirEntry.Info()
if err != nil {
continue
}
if fileInfo.Mode()&os.ModeSymlink == 0 {
continue // Only interested in UUID symlinks
}