mirror of https://github.com/Cisco-Talos/clamav
The `realpath()` function on macOS will fail when scanning a symlink that doesn't exist because it tries to determine the real path of the thing the symlink points to and fails when that thing doesn't exist. This behavior is different than on Linux or FreeBSD Unix. I'm fixing this by opening the symlink with `O_SYMLINK` then getting realpath of the link using `cli_get_filepath_from_filedesc()`, much like we do on Windows. Side note: I did try using macOS's _DARWIN_BETTER_REALPATH variant to see if that resolved the issue, but it didn't seem to. This resolves https://bugzilla.clamav.net/show_bug.cgi?id=12792 This commit also removes the problematic "access denied" clamd test from the test suite. This commit broke that test on macOS because the error message when clamdscan fails to `open()` the file to check the realpath() is different than the error message when clamd tries to scan it, but has access denied. (It's like "Permission denied" instead of "Access denied") It's not worth #ifdef'ing around macOS to get a test pass because this test is already causing problems in 32-bit Docker environments where access isn't actually denied to the user (!). Honestly, it's not worth keeping the test that simply verifies ClamD's error message when denied matches expectations. I also switched to use the C_DARWIN macro instead of __APPLE__ because I kno C_DARWIN is defined in clamav-config.h on macOS, and I found that __APPLE__ wasn't defined when I tested.pull/347/head
parent
dfb1e20563
commit
78f99bef34
Loading…
Reference in new issue