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

Allow group access to lockfile and fix growing or empty timestamp #1213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Outdated references to "openvassd" have been updated to "openvas" [#1189](https://github.com/greenbone/gvmd/pull/1189)
- Quote identifiers in SQL functions using EXECUTE [#1192](https://github.com/greenbone/gvmd/pull/1192)
- Fix handling of interrupted tasks [#1207](https://github.com/greenbone/gvmd/pull/1207)
- Allow group access to lockfile and fix growing or empty timestamp [#1213](https://github.com/greenbone/gvmd/pull/1213)

### Removed
- Remove support for "All SecInfo": removal of "allinfo" for type in get_info [#790](https://github.com/greenbone/gvmd/pull/790)
Expand Down
6 changes: 3 additions & 3 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12368,9 +12368,9 @@ get_feed_lock_status (const char *lockfile_name, gchar **timestamp)
ret = 0;

lockfile = open (lockfile_name,
O_RDWR | O_CREAT | O_APPEND,
/* "-rw-r--r--" */
S_IWUSR | S_IRUSR | S_IROTH | S_IRGRP);
O_RDWR | O_CREAT,
/* "-rw-rw-r--" */
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
if (lockfile == -1)
g_warning ("%s: failed to open lock file '%s': %s", __func__,
lockfile_name, strerror (errno));
Expand Down
6 changes: 3 additions & 3 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ lock_internal (lockfile_t *lockfile, const gchar *lockfile_name,
else
full_name = g_build_filename (GVM_RUN_DIR, lockfile_name, NULL);

fd = open (full_name, O_RDWR | O_CREAT | O_APPEND,
/* "-rw-r--r--" */
S_IWUSR | S_IRUSR | S_IROTH | S_IRGRP);
fd = open (full_name, O_RDWR | O_CREAT,
/* "-rw-rw-r--" */
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
if (fd == -1)
{
g_warning ("Failed to open lock file '%s': %s", full_name,
Expand Down
3 changes: 2 additions & 1 deletion tools/greenbone-feed-sync.in
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ then
exit 0
fi
(
chmod +660 $LOCK_FILE
flock -n 9
if [ $? -eq 1 ] ; then
log_notice "Sync in progress, exiting."
Expand All @@ -604,6 +605,6 @@ fi
date > $LOCK_FILE
sync_feed_data
echo -n > $LOCK_FILE
) 9>$LOCK_FILE
) 9>>$LOCK_FILE

exit 0