Commit graph

12 commits

Author SHA1 Message Date
Valerie Snyder
18854bf4bc
Windows: Fix filepath basename issue
On Windows, the cli_basename function should treat both '/' and '\' as path
separators. Most Windows APIs also accept both.

On Linux/Unix, it makes sense when using a filepath that is more for
informational purposes or where it may have come from a Windows system,
to treat the '\' as a path separator.
But in situations where the the path is needed for some critical action,
like moving or deleting a file, we can't treat it as a path separator.
2025-08-11 18:14:19 -04:00
Micah Snyder
34bb516748
Windows: code quality improvement for --move and --remove options
When the --move or --remove options are used, ClamAV carefully traverses
the file path one layer at a time so as to avoid following a directory
that is a symlink or reparse point.
We do this for directories, but could also do it for files.
Only an admin should be able to create a reparse point for a file,
but it is better to be consistent.

Thank you to Maxim Suhanov for reporting this issue.
2025-03-19 17:36:05 -04:00
Val Snyder
7ff29b8c37
Bump copyright dates for 2025 2025-02-14 10:24:30 -05:00
Micah Snyder
9cb28e51e6 Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
Lodewyk van der Westhuizen
2e999a196a fix typos in function descriptions 2023-12-14 13:16:21 -05:00
RainRat
caf324e544
Fix typos (no functional changes) 2023-11-26 18:01:19 -05:00
Micah Snyder
6eebecc303 Bump copyright for 2023 2023-02-12 11:20:22 -08:00
Micah Snyder
289baa1a7b Formatting: work-around for clang-format-14 #ifdef bug 2022-12-02 14:22:31 -08:00
Micah Snyder
15eef50656 Code cleanup: Refactor to clean up formatting issues
Refactored the clamscan code that determines 'what to scan' in order
to clean up some very messy logic and also to get around a difference in
how vscode and clang-format handle formatting #ifdef blocks in the
middle of an else/if.

In addition to refactoring, there is a slight behavior improvement. With
this change, doing `clamscan blah -` will now scan `blah` and then also
scan `stdin`.  You can even do `clamscan - blah` to now scan `stdin` and
then scan `blah`. Before, The `-` had to be the only "filename" argument
in order to scan from stdin.

In addition, added a bunch of extra empty lines or changing multi-line
function calls to single-line function calls in order to get around a
bug in clang-format with these two options do not playing nice together:
- AlignConsecutiveAssignments: true
- AlignAfterOpenBracket: true

AlignAfterOpenBracket is not taking account the spaces inserted by
AlignConsecutiveAssignments, so you end up with stuff like this:
```c
    bleeblah = 1;
    blah     = function(arg1,
                    arg2,
                    arg3);

                //  ^--- these args 4-left from where they should be.
```

VSCode, meanwhile, somehow fixes this whitespace issue so code that is
correctly formatted by VSCode doesn't have this bug, meaning that:

1. The clang-format check in GH Actions fails.
2. We'd all have to stop using format-on-save in VSCode and accept the
  bug if we wanted those GH Actions tests to pass.

Adding an empty line before variable assignments from multi-line
function calls evades the buggy behavior.

This commit should resolve the clang-format github action test failures,
for now.
2022-03-22 10:42:46 -07:00
mko-x
a21cc6dcd7
Add explicit log level parameter to application logging API
* Added loglevel parameter to logg()

* Fix logg and mprintf internals with new loglevels

* Update all logg calls to set loglevel

* Update all mprintf calls to set loglevel

* Fix hidden logg calls

* Executed clam-format
2022-02-15 15:13:55 -08:00
micasnyd
140c88aa4e Bump copyright for 2022
Includes minor format corrections.
2022-01-09 14:23:25 -07:00
Micah Snyder
c025afd683 Rename "shared" library to "common"
The named "shared" is confusing, especially now that these features are
built as a static library instead of being directly compiled into the
various applications.
2021-04-20 17:31:19 -07:00
Renamed from shared/actions.c (Browse further)