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

Replace g_file_test with gvm-libs file tests (20.08) #1391

Merged
merged 5 commits into from
Jan 20, 2021

Conversation

timopollmeier
Copy link
Member

@timopollmeier timopollmeier commented Jan 15, 2021

What:
This replaces the g_file_test calls with the functions gvm_file_exists
gvm_file_is_executable and gvm_file_is_readable, which were added
in greenbone/gvm-libs#422.

Why:
The new functions use the effective UID/GID when checking if a file is
accessible so gvmd can be used with the file flags to set UID and GID.

How did you test it:

  • Running gvmd with the --relay-mapper option with
    • a file that does not exists
    • a file the user has no permissions for
    • a file the user can access but that is not executable
    • an executable file the user can access
  • Exporting a report

Checklist:

The new functions use the effective UID/GID when checking if a file is
accessible so gvmd can be used with the file flags to set UID and GID.
@timopollmeier timopollmeier changed the base branch from master to gvmd-20.08 January 15, 2021 10:29
@timopollmeier timopollmeier marked this pull request as ready for review January 15, 2021 10:32
mattmundell
mattmundell previously approved these changes Jan 19, 2021
@@ -9297,7 +9297,7 @@ alert_script_exec (const char *alert_id, const char *command_args,

script = g_build_filename (script_dir, "alert", NULL);

if (!g_file_test (script, G_FILE_TEST_EXISTS))
if (! gvm_file_is_readable (script))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about the space, everywhere else uses !call.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this in 2ffceab.

@mattmundell mattmundell merged commit de1d165 into greenbone:gvmd-20.08 Jan 20, 2021
@timopollmeier timopollmeier added the backport-to-main This pull request will be ported to the master branch label Feb 8, 2021
timopollmeier added a commit that referenced this pull request Feb 8, 2021
Replace g_file_test with gvm-libs file tests (20.08) (bp #1391)
@timopollmeier timopollmeier deleted the file-tests-20.08 branch October 15, 2021 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-main This pull request will be ported to the master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants