s4-lib: Use directory_create_or_exist() to create messaging dir.
authorAndreas Schneider <asn@samba.org>
Thu, 13 Dec 2012 15:10:38 +0000 (16:10 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 21 Dec 2012 12:55:59 +0000 (13:55 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source4/lib/messaging/messaging.c

index 66188971f30fe19d93aa121114c69fcd6fb0dd99..2df6f41e4caea6289cbf8aa1a3cce48b98d65a05 100644 (file)
@@ -576,6 +576,7 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
        struct imessaging_context *msg;
        NTSTATUS status;
        struct socket_address *path;
+       bool ok;
 
        if (ev == NULL) {
                return NULL;
@@ -603,7 +604,11 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
 
        msg->base_path     = lpcfg_imessaging_path(msg, lp_ctx);
 
-       mkdir(msg->base_path, 0700);
+       ok = directory_create_or_exist(msg->base_path, geteuid(), 0700);
+       if (!ok) {
+               talloc_free(msg);
+               return NULL;
+       }
 
        msg->path          = imessaging_path(msg, server_id);
        msg->server_id     = server_id;