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

Drop daemon mode #337

Merged
merged 30 commits into from
Jun 7, 2019
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0b852b0
Remove option --foreground.
janowagner May 31, 2019
1866668
Drop main_loop().
janowagner May 31, 2019
ca6bbe3
Don't create a pidfile anymore.
janowagner May 31, 2019
6f3b053
Remove unneeded includes.
janowagner May 31, 2019
bf126cc
Rename option to update vt info in redis.
janowagner May 31, 2019
30fd2b8
Remove command line options about otp socket.
janowagner May 31, 2019
07c86a5
Move up and comment simple cmd parameters.
janowagner May 31, 2019
3f7dd73
Don't init signal handlers right before exit.
janowagner May 31, 2019
218b83a
Don't open the OTP unix socket anymore.
janowagner May 31, 2019
cc556f9
Remove is_otp_scan() from main module.
janowagner May 31, 2019
95c2058
Drop set_scan_type().
janowagner May 31, 2019
2c451f1
Remove unneeded include.
janowagner May 31, 2019
99a132a
Drop loading handler during vt update.
janowagner May 31, 2019
8b15468
Remove unneeded includes.
janowagner May 31, 2019
7fba00b
Remove module comm.
janowagner May 31, 2019
e1f847b
Remove is_otp_scan() conditionals.
janowagner May 31, 2019
590528d
Remove any unused ntp_ function.
janowagner May 31, 2019
b19eac0
Remove now unused modile otp.
janowagner May 31, 2019
5669fbe
Add generic function host_set_time().
janowagner May 31, 2019
e0cdc58
Drop the now unused module ntp.
janowagner May 31, 2019
cc0f5bc
Drop global_socket handling.
janowagner May 31, 2019
8585952
Improve help text for cmd line option.
janowagner May 31, 2019
148034b
Start renaming openvassd to openvas.
janowagner May 31, 2019
d2b3787
Actually rename the files.
janowagner May 31, 2019
2053945
More renaming from openvassd to openvas.
janowagner May 31, 2019
023a44a
Rename log_conf file.
janowagner May 31, 2019
ff4b6a1
Fixed a start/end confusion.
janowagner Jun 5, 2019
349b4a3
Code formatting improvements.
janowagner Jun 5, 2019
05e6eab
Update man page.
janowagner Jun 5, 2019
c030cd2
A single additional formatting issue.
janowagner Jun 5, 2019
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
24 changes: 21 additions & 3 deletions src/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "hosts.h" /* for hosts_new() */

#include "../misc/network.h" /* for internal_recv */
#include "ntp.h" /* for ntp_parse_input() */
#include "utils.h" /* for data_left() */

#include <errno.h> /* for errno() */
Expand Down Expand Up @@ -63,14 +62,33 @@ static int g_max_hosts = 15;
/*-------------------------------------------------------------------*/
extern int global_scan_stop;

static void
host_set_time (kb_t kb, char *key)
{
char timestr[1024];
char *tmp;
time_t t;
int len;

t = time (NULL);
tmp = ctime (&t);
timestr[sizeof (timestr) - 1] = '\0';
strncpy (timestr, tmp, sizeof (timestr) - 1);
len = strlen (timestr);
if (timestr[len - 1] == '\n')
timestr[len - 1] = '\0';

kb_item_push_str (kb, key, timestr);
}

static void
host_rm (struct host *h)
{
if (h->pid != 0)
waitpid (h->pid, NULL, WNOHANG);

if (!global_scan_stop)
ntp_timestamp_host_scan_ends (h->host_kb);
host_set_time (h->host_kb, "internal/start_time");
Copy link
Member

Choose a reason for hiding this comment

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

The key name here should be "internal/end_time"

Suggested change
host_set_time (h->host_kb, "internal/start_time");
host_set_time (h->host_kb, "internal/end_time");

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

if (h->next != NULL)
h->next->prev = h->prev;

Expand Down Expand Up @@ -206,7 +224,7 @@ hosts_read_data (void)
/* Scan started. */
h->ip = kb_item_get_str (h->host_kb, "internal/ip");
if (h->ip)
ntp_timestamp_host_scan_starts (h->host_kb);
host_set_time (h->host_kb, "internal/start_time");
}
if (h->ip)
{
Expand Down