Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmpfiles.c: prevent nftw follow symbolic links #409

Merged

Conversation

liuming50
Copy link
Contributor

When dealing with "L+" and "R", the function call 'nftw' should not follow symbolic links, otherwise, it would also delete the targets which is wrong.

For instance, if there is already a symbolic link:

/path/to/the/link -> /path/to/some/folder

if we set the following in a tmpfile conf:

L+ /path/to/the/link -    -    -     - /path/to/the/target

the result would be /path/to/some/folder also get deleted, which it should not.

it could be even worse, when the symbolic link already is pointing to: /path/to/the/target, the whole /path/to/the/target would be deleted on next system boot.

When dealing with "L+" and "R", the function call 'nftw' should not
follow symbolic links, otherwise, it would also delete the targets
which is wrong.

For instance, if there is already a symbolic link:
```
/path/to/the/link -> /path/to/some/folder
```

if we set the following in a tmpfile conf:

```
L+ /path/to/the/link -    -    -     - /path/to/the/target
```

the result would be /path/to/some/folder also get deleted, which it
should not.

it could be even worse, when the symbolic link already is pointing to:
/path/to/the/target, the whole /path/to/the/target would be deleted on
next system boot.

Signed-off-by: Mathias Thore <[email protected]>
Signed-off-by: Ming Liu <[email protected]>
Copy link
Owner

@troglobit troglobit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! And I just love the exhaustive commit message, thank you!

@troglobit troglobit merged commit 2daa953 into troglobit:master Aug 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants