Skip to content

Commit

Permalink
Merge pull request #1213 from timopollmeier/feed-sync-chmod-20.08
Browse files Browse the repository at this point in the history
Allow group access to lockfile and fix growing or empty timestamp
  • Loading branch information
mattmundell authored Aug 3, 2020
2 parents c341a8f + 7b5c8cc commit 4fe4638
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,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

0 comments on commit 4fe4638

Please sign in to comment.