]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbind:varlink: Create varlink socket directory
authorSamuel Cabrero <scabrero@samba.org>
Thu, 2 Feb 2023 08:56:05 +0000 (09:56 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 20 Feb 2025 08:07:32 +0000 (08:07 +0000)
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_varlink.c

index ccde59e953fda3cb7b9e75d0679f7480e6d637e1..edc55143fd8314abe5d297aec98762af18d01db2 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "includes.h"
+#include "lib/util/mkdir_p.h"
 #include "winbindd_varlink.h"
 
 #define WB_VL_SOCKET_DIR  "/run/systemd/userdb"
@@ -85,6 +86,15 @@ bool winbind_setup_varlink(TALLOC_CTX *mem_ctx,
                                           "service name",
                                           WB_VL_SERVICE_NAME);
 
+       /* Create socket directory, useful in containers */
+       rc = mkdir_p(socket_dir,
+                    S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+       if (rc && errno != EEXIST) {
+               DBG_ERR("Could not create socket directory %s: %s\n",
+                       socket_dir, strerror(errno));
+               goto fail;
+       }
+
        uri = talloc_asprintf(state, "unix:%s/%s", socket_dir, socket_name);
 
        rc = varlink_service_new(&state->service,