diff --git a/CHANGELOG.md b/CHANGELOG.md index bd198487f..40f306ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/gvmd.c b/src/gvmd.c index 16f9073cb..71f420801 100644 --- a/src/gvmd.c +++ b/src/gvmd.c @@ -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. */ @@ -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) {