Skip to content

Commit

Permalink
Merge pull request #574 from cfi-gb/feed_dir_cmake
Browse files Browse the repository at this point in the history
Make the feed lock path configurable via cmake.
  • Loading branch information
bjoernricks committed Aug 10, 2020
2 parents c6e609e + fec11dd commit 5dd941c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Allow to set all legal types of icmp v6 in icmp header in openvas-nasl. [#542](https://github.com/greenbone/openvas/pull/542)
- The output of the NASL dump_* packet forgery functions was made consistent. [#555](https://github.com/greenbone/openvas/pull/555)
- Make drop_privileges setting a scanner-only preference. [#557](https://github.com/greenbone/openvas/pull/557)
- Feed lock path is now configurable. [#574](https://github.com/greenbone/openvas/pull/574)

### Fixed
- Improve signal handling when update vhosts list. [#425](https://github.com/greenbone/openvas/pull/425)
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ if (NOT OPENVAS_RUN_DIR)
set (OPENVAS_RUN_DIR "${LOCALSTATEDIR}/run")
endif (NOT OPENVAS_RUN_DIR)

if (NOT OPENVAS_FEED_LOCK_PATH)
set (OPENVAS_FEED_LOCK_PATH "${OPENVAS_RUN_DIR}/feed-update.lock")
endif (NOT OPENVAS_FEED_LOCK_PATH)
add_definitions (-DOPENVAS_FEED_LOCK_PATH="${OPENVAS_FEED_LOCK_PATH}")

set (OPENVAS_DATA_DIR "${DATADIR}/openvas")
set (OPENVAS_STATE_DIR "${LOCALSTATEDIR}/lib/openvas")
if (NOT GVM_LOG_DIR)
Expand Down
10 changes: 5 additions & 5 deletions tools/greenbone-nvt-sync.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ PORT=24
OPENVAS_SYSCONF_DIR="@OPENVAS_SYSCONF_DIR@"

# Directory where the feed update lock file will be placed.
OPENVAS_RUN_DIR="@OPENVAS_RUN_DIR@"
OPENVAS_FEED_LOCK_PATH="@OPENVAS_FEED_LOCK_PATH@"

# Location of the GSF Access Key
ACCESS_KEY="@GVM_ACCESS_KEY_DIR@/gsf-access-key"
Expand Down Expand Up @@ -503,16 +503,16 @@ do_sync ()
log_write "Feed is already current, skipping synchronization."
else
(
chmod +660 $OPENVAS_RUN_DIR/feed-update.lock
chmod +660 $OPENVAS_FEED_LOCK_PATH
flock -n 9
if [ $? -eq 1 ] ; then
log_warning "Another process related to the feed update is already running"
exit 1
fi
date > $OPENVAS_RUN_DIR/feed-update.lock
date > $OPENVAS_FEED_LOCK_PATH
sync_nvts
echo -n $OPENVAS_RUN_DIR/feed-update.lock
)9>>$OPENVAS_RUN_DIR/feed-update.lock
echo -n $OPENVAS_FEED_LOCK_PATH
)9>>$OPENVAS_FEED_LOCK_PATH
fi
}

Expand Down

0 comments on commit 5dd941c

Please sign in to comment.