Skip to content

Commit

Permalink
Merge pull request #1040 from mattmundell/socket-path
Browse files Browse the repository at this point in the history
Ensure path of listening UNIX socket exists
  • Loading branch information
mattmundell authored Apr 9, 2020
2 parents a2e91c8 + 0c52822 commit 85f1235
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add a delay for re-requesting scan information via osp [#1012](https://github.com/greenbone/gvmd/pull/1012)
- Add --optimize option cleanup-result-encoding [#1013](https://github.com/greenbone/gvmd/pull/1013)
- Perform integrity check of VTs after updates [#1024](https://github.com/greenbone/gvmd/pull/1024) [#1035](https://github.com/greenbone/gvmd/pull/1035)
- Ensure path of listening UNIX socket exists [#1040](https://github.com/greenbone/gvmd/pull/1040)

### Changed
- Update SCAP and CERT feed info in sync scripts [#810](https://github.com/greenbone/gvmd/pull/810)
Expand Down
13 changes: 13 additions & 0 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ manager_listen (const char *address_str_unix, const char *address_str_tls,
if (address_str_unix)
{
struct stat state;
gchar *address_parent;

/* UNIX file socket. */

Expand Down Expand Up @@ -1398,6 +1399,18 @@ manager_listen (const char *address_str_unix, const char *address_str_tls,

address = (struct sockaddr *) &address_unix;
address_size = sizeof (address_unix);

/* Ensure the path of the socket exists. */

address_parent = g_path_get_dirname (address_str_unix);
if (g_mkdir_with_parents (address_parent, 0755 /* "rwxr-xr-x" */))
{
g_warning ("%s: failed to create socket dir %s", __func__,
address_parent);
g_free (address_parent);
return -1;
}
g_free (address_parent);
}
else if (address_str_tls)
{
Expand Down

0 comments on commit 85f1235

Please sign in to comment.