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

Improves the copy of directories from groups to multigroups #12516

Merged
merged 12 commits into from Mar 17, 2022

Conversation

Nicogp
Copy link
Member

@Nicogp Nicogp commented Mar 4, 2022

Related issue
#8593

Description

This PR allows the copying of files from group subfolders when multigroups are created. Also adds validation to files to be shared to agents within group subfolders:

  • Add the copy_directory function that recursively copies subdirectories
  • Add function validate_shared_files which recursively validates files in directories and subdirectories
  • Remove the recursion in the MergeAppendFile function, it became unnecessary
  • We limit the maximum size of a group file path to 200 characters, due to the Windows limitation that file path size cannot exceed 260 characters. A margin of 60 characters was left because the 200 character limit does not include the characters corresponding to the installation path.

Tests

  • Compilation without warnings in every supported platform
    • Linux
  • Source installation
  • Package installation
  • Source upgrade
  • Package upgrade
  • Review logs syntax and correct language
  • Memory tests for Linux
    • Scan-build report
    • Coverity
    • Valgrind (memcheck and descriptor leaks check)
  • Retrocompatibility with older Wazuh versions
  • Added unit tests (for new features)

   + Add the copy_directory function that recursively copies subdirectories
   + Add function validate_shared_files which recursively validates files in directories and subdirectories
   - Remove the recursion in the MergeAppendFile function, it became unnecessary
src/remoted/manager.c Show resolved Hide resolved
src/remoted/manager.c Outdated Show resolved Hide resolved
src/remoted/manager.c Outdated Show resolved Hide resolved
src/remoted/manager.c Outdated Show resolved Hide resolved
src/remoted/manager.c Show resolved Hide resolved
Base automatically changed from dev-improve-multi-groups to master March 4, 2022 17:33
 - Remove "files" from c_group function comments
 + Move some lines
 + Add return function to copy_directory
…ed_files logs. And set ignored=1 after checkBinaryFile
Added validate_shared_file UT
Added copy_directory UT
@Nicogp Nicogp marked this pull request as ready for review March 8, 2022 12:48
@Nicogp Nicogp requested a review from cborla March 8, 2022 13:20
Moves purge_group function call to copy_directory.
Fixes the UTs of c_multi_group and copy_directory.
cborla
cborla previously approved these changes Mar 15, 2022
Copy link
Member

@cborla cborla left a comment

Choose a reason for hiding this comment

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

LGTM

TomasTurina
TomasTurina previously approved these changes Mar 15, 2022
…d_files and copy_directory functions.

And prevents flooding when group files exceed the maximum size.
@Nicogp Nicogp dismissed stale reviews from TomasTurina and cborla via 6888216 March 16, 2022 18:06
Copy link
Member

@cborla cborla left a comment

Choose a reason for hiding this comment

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

LGTM

@vikman90 vikman90 merged commit 7cac3c1 into master Mar 17, 2022
@vikman90 vikman90 deleted the dev-improve-copy-file branch March 17, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/remote type/bug Something isn't working
Projects
None yet
4 participants