mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 06:59:59 +00:00
commit
3ec99f13e7
@ -277,8 +277,13 @@ static int ReadKeyFile(const char *path, char *buf, size_t len)
|
||||
FSCRYPT_LOGE("target file size is not equal to buf len");
|
||||
return -EFAULT;
|
||||
}
|
||||
char *realPath = realpath(path, NULL);
|
||||
if (realPath == NULL) {
|
||||
FSCRYPT_LOGE("realpath failed");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
int fd = open(path, O_RDONLY);
|
||||
int fd = open(realPath, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
FSCRYPT_LOGE("key file read open failed");
|
||||
return -EFAULT;
|
||||
|
@ -64,7 +64,13 @@ long KeyCtrlUnlink(key_serial_t key, key_serial_t keyring)
|
||||
|
||||
static bool FsIoctl(const char *mnt, unsigned long cmd, void *arg)
|
||||
{
|
||||
int fd = open(mnt, O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||
char *realPath = realpath(mnt, NULL);
|
||||
if (realPath == NULL) {
|
||||
FSCRYPT_LOGE("realpath failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
int fd = open(realPath, O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
FSCRYPT_LOGE("open %s failed, errno:%d", mnt, errno);
|
||||
return false;
|
||||
@ -119,7 +125,13 @@ bool KeyCtrlGetPolicy(const char *path, struct fscrypt_policy *policy)
|
||||
|
||||
static uint8_t CheckKernelFscrypt(const char *mnt)
|
||||
{
|
||||
int fd = open(mnt, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
|
||||
char *realPath = realpath(mnt, NULL);
|
||||
if (realPath == NULL) {
|
||||
FSCRYPT_LOGE("realpath failed");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
int fd = open(realPath, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
FSCRYPT_LOGE("open policy file failed, errno: %d", errno);
|
||||
return FSCRYPT_INVALID;
|
||||
|
Loading…
Reference in New Issue
Block a user