[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Jul 28 16:31:04 MDT 2014


The branch, master has been updated
       via  d697c9f messaging4: Simplify imessaging_path
       via  d7b4f86 messaging3: messaging_array is no longer used
       via  f4e7a49 unix_msg: simplify unix_msg_send
       via  f1f4388 unix_msg: Use struct initializers
       via  8621870 unix_msg: Use empty arrays in structs
       via  f5efddb lib: directory_create_or_exist() does not use "uid" parameter
       via  2b9c35d lib: Simplify directory_create_or_exist with an early return
      from  f481009 winbind/i18n: update Japanese pam winbind translation

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d697c9fdcb9d1d08fa80fc78a299690c8114917c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 20 16:07:44 2014 +0200

    messaging4: Simplify imessaging_path
    
    Use server_id_str_buf
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Jul 29 00:30:55 CEST 2014 on sn-devel-104

commit d7b4f863e488cd8e088ec77c35718cfdcc19c743
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 9 14:40:12 2014 +0000

    messaging3: messaging_array is no longer used
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f4e7a49cd755532a4201311655f3474228fd7b81
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 24 14:59:33 2014 +0000

    unix_msg: simplify unix_msg_send
    
    We have a variable array inside one-fragment fast path anyway. Moving
    that to the toplevel of the function saves us a malloc/free pair.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f1f43886f02966e3fe759d7406b84e46b38867fe
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jul 28 11:54:16 2014 +0000

    unix_msg: Use struct initializers
    
    Saves a few lines and bytes of .text
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8621870559c6274eaa645aa47109c75ebc190278
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jul 28 12:02:12 2014 +0000

    unix_msg: Use empty arrays in structs
    
    Just a simple style update
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f5efddb9aebd896df014a011d68aefb314beee22
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 27 19:18:09 2014 +0200

    lib: directory_create_or_exist() does not use "uid" parameter
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2b9c35da12f6892e22253e8beb6a7ec95ba17c58
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 27 19:08:52 2014 +0200

    lib: Simplify directory_create_or_exist with an early return
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/param/util.c                  |    4 +-
 lib/util/samba_util.h             |    3 +-
 lib/util/util.c                   |   54 +++++++++++-----------
 source3/lib/dumpcore.c            |    2 +-
 source3/lib/eventlog/eventlog.c   |    2 +-
 source3/lib/unix_msg/unix_msg.c   |   87 +++++++++++++++++--------------------
 source3/librpc/idl/messaging.idl  |    5 --
 source3/nmbd/nmbd.c               |    4 +-
 source3/printing/nt_printing.c    |    6 +--
 source3/printing/printing.c       |    2 +-
 source3/registry/reg_perfcount.c  |    2 +-
 source3/rpc_server/rpc_server.c   |    4 +-
 source3/smbd/server.c             |    2 +-
 source3/winbindd/winbindd.c       |    4 +-
 source4/ldap_server/ldap_server.c |    2 +-
 source4/lib/messaging/messaging.c |   13 ++----
 source4/smbd/service_named_pipe.c |    2 +-
 17 files changed, 89 insertions(+), 109 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/util.c b/lib/param/util.c
index 232e85b..faf161d 100644
--- a/lib/param/util.c
+++ b/lib/param/util.c
@@ -91,7 +91,7 @@ static char *lpcfg_common_path(TALLOC_CTX* mem_ctx,
 	}
 	trim_string(dname,"","/");
 
-	ok = directory_create_or_exist(dname, geteuid(), 0755);
+	ok = directory_create_or_exist(dname, 0755);
 	if (!ok) {
 		DEBUG(1, ("Unable to create directory %s for file %s. "
 			  "Error was %s\n", dname, name, strerror(errno)));
@@ -231,7 +231,7 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
-	ok = directory_create_or_exist(dname, geteuid(), 0755);
+	ok = directory_create_or_exist(dname, 0755);
 	if (!ok) {
 		return NULL;
 	}
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 251ddc2..2ffe028 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -649,8 +649,7 @@ _PUBLIC_ bool file_check_permissions(const char *fname,
  * @retval true if the directory already existed and has the right permissions 
  * or was successfully created.
  */
-_PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid, 
-			       mode_t dir_perms);
+_PUBLIC_ bool directory_create_or_exist(const char *dname, mode_t dir_perms);
 
 _PUBLIC_ bool directory_create_or_exist_strict(const char *dname,
 					       uid_t uid,
diff --git a/lib/util/util.c b/lib/util/util.c
index b6f60c4..1f75266 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -191,40 +191,40 @@ _PUBLIC_ bool directory_exist(const char *dname)
  * or was successfully created.
  */
 _PUBLIC_ bool directory_create_or_exist(const char *dname,
-					uid_t uid,
 					mode_t dir_perms)
 {
 	int ret;
 	struct stat st;
+	mode_t old_umask;
 
 	ret = lstat(dname, &st);
-	if (ret == -1) {
-		mode_t old_umask;
+	if (ret == 0) {
+		return true;
+	}
 
-		if (errno != ENOENT) {
-			DEBUG(0, ("lstat failed on directory %s: %s\n",
-				  dname, strerror(errno)));
-			return false;
-		}
+	if (errno != ENOENT) {
+		DEBUG(0, ("lstat failed on directory %s: %s\n",
+			  dname, strerror(errno)));
+		return false;
+	}
 
-		/* Create directory */
-		old_umask = umask(0);
-		ret = mkdir(dname, dir_perms);
-		if (ret == -1 && errno != EEXIST) {
-			DEBUG(0, ("mkdir failed on directory "
-				  "%s: %s\n", dname,
-				  strerror(errno)));
-			umask(old_umask);
-			return false;
-		}
+	/* Create directory */
+	old_umask = umask(0);
+	ret = mkdir(dname, dir_perms);
+	if (ret == -1 && errno != EEXIST) {
+		DEBUG(0, ("mkdir failed on directory "
+			  "%s: %s\n", dname,
+			  strerror(errno)));
 		umask(old_umask);
+		return false;
+	}
+	umask(old_umask);
 
-		ret = lstat(dname, &st);
-		if (ret == -1) {
-			DEBUG(0, ("lstat failed on created directory %s: %s\n",
-				  dname, strerror(errno)));
-			return false;
-		}
+	ret = lstat(dname, &st);
+	if (ret == -1) {
+		DEBUG(0, ("lstat failed on created directory %s: %s\n",
+			  dname, strerror(errno)));
+		return false;
 	}
 
 	return true;
@@ -253,7 +253,7 @@ _PUBLIC_ bool directory_create_or_exist_strict(const char *dname,
 	bool ok;
 	int rc;
 
-	ok = directory_create_or_exist(dname, uid, dir_perms);
+	ok = directory_create_or_exist(dname, dir_perms);
 	if (!ok) {
 		return false;
 	}
diff --git a/source3/lib/dumpcore.c b/source3/lib/dumpcore.c
index f284ea4..487ccec 100644
--- a/source3/lib/dumpcore.c
+++ b/source3/lib/dumpcore.c
@@ -67,7 +67,7 @@ static char *get_default_corepath(const char *logbase, const char *progname)
 		goto err_out;
 	}
 
-	if (!directory_create_or_exist(tmp_corepath, uid, mode)) {
+	if (!directory_create_or_exist(tmp_corepath, mode)) {
 		DEBUG(0, ("Failed to create %s for user %d with mode 0%o\n",
 			  tmp_corepath, (int)uid, (int)mode));
 		goto err_out;
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 0cc0240..4c6767d 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -373,7 +373,7 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only )
 	/* make sure that the eventlog dir exists */
 
 	eventlogdir = state_path( "eventlog" );
-	ok = directory_create_or_exist(eventlogdir, geteuid(), 0755);
+	ok = directory_create_or_exist(eventlogdir, 0755);
 	if (!ok) {
 		return NULL;
 	}
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index f3185a3..00438ce 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -43,7 +43,7 @@ struct unix_dgram_msg {
 	ssize_t sent;
 	int sys_errno;
 	size_t buflen;
-	uint8_t buf[1];
+	uint8_t buf[];
 };
 
 struct unix_dgram_send_queue {
@@ -51,7 +51,7 @@ struct unix_dgram_send_queue {
 	struct unix_dgram_ctx *ctx;
 	int sock;
 	struct unix_dgram_msg *msgs;
-	char path[1];
+	char path[];
 };
 
 struct unix_dgram_ctx {
@@ -72,7 +72,7 @@ struct unix_dgram_ctx {
 	struct poll_watch *pool_read_watch;
 
 	uint8_t *recv_buf;
-	char path[1];
+	char path[];
 };
 
 static ssize_t iov_buflen(const struct iovec *iov, int iovlen);
@@ -163,20 +163,19 @@ static int unix_dgram_init(const struct sockaddr_un *addr, size_t max_msg,
 		ctx->path[0] = '\0';
 	}
 
+	*ctx = (struct unix_dgram_ctx) {
+		.max_msg = max_msg,
+		.ev_funcs = ev_funcs,
+		.recv_callback = recv_callback,
+		.private_data = private_data,
+		.created_pid = (pid_t)-1
+	};
+
 	ctx->recv_buf = malloc(max_msg);
 	if (ctx->recv_buf == NULL) {
 		free(ctx);
 		return ENOMEM;
 	}
-	ctx->max_msg = max_msg;
-	ctx->ev_funcs = ev_funcs;
-	ctx->recv_callback = recv_callback;
-	ctx->private_data = private_data;
-	ctx->sock_read_watch = NULL;
-	ctx->send_pool = NULL;
-	ctx->pool_read_watch = NULL;
-	ctx->send_queues = NULL;
-	ctx->created_pid = (pid_t)-1;
 
 	ctx->sock = socket(AF_UNIX, SOCK_DGRAM, 0);
 	if (ctx->sock == -1) {
@@ -486,15 +485,12 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
 	 * Try a cheap nonblocking send
 	 */
 
-	msg.msg_name = discard_const_p(struct sockaddr_un, dst);
-	msg.msg_namelen = sizeof(*dst);
-	msg.msg_iov = discard_const_p(struct iovec, iov);
-	msg.msg_iovlen = iovlen;
-#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
-	msg.msg_control = NULL;
-	msg.msg_controllen = 0;
-#endif
-	msg.msg_flags = 0;
+	msg = (struct msghdr) {
+		.msg_name = discard_const_p(struct sockaddr_un, dst),
+		.msg_namelen = sizeof(*dst),
+		.msg_iov = discard_const_p(struct iovec, iov),
+		.msg_iovlen = iovlen
+	};
 
 	ret = sendmsg(ctx->sock, &msg, 0);
 	if (ret >= 0) {
@@ -620,6 +616,13 @@ int unix_msg_init(const struct sockaddr_un *addr,
 		return ENOMEM;
 	}
 
+	*ctx = (struct unix_msg_ctx) {
+		.fragment_len = fragment_len,
+		.cookie = cookie,
+		.recv_callback = recv_callback,
+		.private_data = private_data
+	};
+
 	ret = unix_dgram_init(addr, fragment_len, ev_funcs,
 			      unix_msg_recv, ctx, &ctx->dgram);
 	if (ret != 0) {
@@ -627,12 +630,6 @@ int unix_msg_init(const struct sockaddr_un *addr,
 		return ret;
 	}
 
-	ctx->fragment_len = fragment_len;
-	ctx->cookie = cookie;
-	ctx->recv_callback = recv_callback;
-	ctx->private_data = private_data;
-	ctx->msgs = NULL;
-
 	*result = ctx;
 	return 0;
 }
@@ -643,7 +640,7 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct sockaddr_un *dst,
 	ssize_t msglen;
 	size_t sent;
 	int ret = 0;
-	struct iovec *iov_copy;
+	struct iovec iov_copy[iovlen+2];
 	struct unix_msg_hdr hdr;
 	struct iovec src_iov;
 
@@ -657,27 +654,24 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct sockaddr_un *dst,
 	}
 
 	if (msglen <= (ctx->fragment_len - sizeof(uint64_t))) {
-		struct iovec tmp_iov[iovlen+1];
 		uint64_t cookie = 0;
 
-		tmp_iov[0].iov_base = &cookie;
-		tmp_iov[0].iov_len = sizeof(cookie);
+		iov_copy[0].iov_base = &cookie;
+		iov_copy[0].iov_len = sizeof(cookie);
 		if (iovlen > 0) {
-			memcpy(&tmp_iov[1], iov,
+			memcpy(&iov_copy[1], iov,
 			       sizeof(struct iovec) * iovlen);
 		}
 
-		return unix_dgram_send(ctx->dgram, dst, tmp_iov, iovlen+1);
+		return unix_dgram_send(ctx->dgram, dst, iov_copy, iovlen+1);
 	}
 
-	hdr.msglen = msglen;
-	hdr.pid = getpid();
-	hdr.sock = unix_dgram_sock(ctx->dgram);
+	hdr = (struct unix_msg_hdr) {
+		.msglen = msglen,
+		.pid = getpid(),
+		.sock = unix_dgram_sock(ctx->dgram)
+	};
 
-	iov_copy = malloc(sizeof(struct iovec) * (iovlen + 2));
-	if (iov_copy == NULL) {
-		return ENOMEM;
-	}
 	iov_copy[0].iov_base = &ctx->cookie;
 	iov_copy[0].iov_len = sizeof(ctx->cookie);
 	iov_copy[1].iov_base = &hdr;
@@ -731,8 +725,6 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct sockaddr_un *dst,
 		}
 	}
 
-	free(iov_copy);
-
 	ctx->cookie += 1;
 	if (ctx->cookie == 0) {
 		ctx->cookie += 1;
@@ -790,11 +782,12 @@ static void unix_msg_recv(struct unix_dgram_ctx *dgram_ctx,
 		if (msg == NULL) {
 			return;
 		}
-		msg->msglen = hdr.msglen;
-		msg->received = 0;
-		msg->sender_pid = hdr.pid;
-		msg->sender_sock = hdr.sock;
-		msg->cookie = cookie;
+		*msg = (struct unix_msg) {
+			.msglen = hdr.msglen,
+			.sender_pid = hdr.pid,
+			.sender_sock = hdr.sock,
+			.cookie = cookie
+		};
 		DLIST_ADD(ctx->msgs, msg);
 	}
 
diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index a396b5b..66d4ae5 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -131,9 +131,4 @@ interface messaging
 		server_id src;
 		DATA_BLOB buf;
 	} messaging_rec;
-
-	typedef [public] struct {
-		uint32 num_messages;
-		messaging_rec messages[num_messages];
-	} messaging_array;
 }
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 8c66d75..50b18e5 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -973,12 +973,12 @@ static bool open_sockets(bool isdaemon, int port)
 	}
 #endif
 
-	ok = directory_create_or_exist(lp_lock_directory(), geteuid(), 0755);
+	ok = directory_create_or_exist(lp_lock_directory(), 0755);
 	if (!ok) {
 		exit_daemon("Failed to create directory for lock files, check 'lock directory'", errno);
 	}
 
-	ok = directory_create_or_exist(lp_pid_directory(), geteuid(), 0755);
+	ok = directory_create_or_exist(lp_pid_directory(), 0755);
 	if (!ok) {
 		exit_daemon("Failed to create directory for pid files, check 'pid directory'", errno);
 	}
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 6a5f2d7..b76badf 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -95,7 +95,7 @@ static bool print_driver_directories_init(void)
 		return false;
 	}
 
-	ok = directory_create_or_exist(driver_path, sec_initial_uid(), 0755);
+	ok = directory_create_or_exist(driver_path, 0755);
 	if (!ok) {
 		DEBUG(1, ("Failed to create printer driver directory %s\n",
 			  driver_path));
@@ -115,9 +115,7 @@ static bool print_driver_directories_init(void)
 			return false;
 		}
 
-		ok = directory_create_or_exist(arch_path,
-					       sec_initial_uid(),
-					       0755);
+		ok = directory_create_or_exist(arch_path, 0755);
 		if (!ok) {
 			DEBUG(1, ("Failed to create printer driver "
 				  "architecture directory %s\n",
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index fa4a2fc..dcfd2a2 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -203,7 +203,7 @@ bool print_backend_init(struct messaging_context *msg_ctx)
 		return false;
 	}
 
-	ok = directory_create_or_exist(cache_path("printing"), geteuid(), 0755);
+	ok = directory_create_or_exist(cache_path("printing"), 0755);
 	if (!ok) {
 		return false;
 	}
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index 82e5624..b875067 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -48,7 +48,7 @@ static char *counters_directory(const char *dbname)
 	TALLOC_CTX *ctx = talloc_tos();
 
 	path = state_path(PERFCOUNTDIR);
-	if (!directory_create_or_exist(path, geteuid(), 0755)) {
+	if (!directory_create_or_exist(path, 0755)) {
 		return NULL;
 	}
 
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 2ac29e1..01a854c 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -106,7 +106,7 @@ int create_named_pipe_socket(const char *pipe_name)
 	 * lp_ncalrpc_dir()/np should have 0700, we need to
 	 * create lp_ncalrpc_dir() first.
 	 */
-	if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+	if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
 		DEBUG(0, ("Failed to create pipe directory %s - %s\n",
 			  lp_ncalrpc_dir(), strerror(errno)));
 		goto out;
@@ -773,7 +773,7 @@ int create_dcerpc_ncalrpc_socket(const char *name)
 		name = "DEFAULT";
 	}
 
-	if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+	if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
 		DEBUG(0, ("Failed to create ncalrpc directory %s - %s\n",
 			  lp_ncalrpc_dir(), strerror(errno)));
 		return -1;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index dd1e20a..ec9348c 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1488,7 +1488,7 @@ extern void build_options(bool screen);
 	/* This MUST be done before start_epmd() because otherwise
 	 * start_epmd() forks and races against dcesrv_ep_setup() to
 	 * call directory_create_or_exist() */
-	if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+	if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
 		DEBUG(0, ("Failed to create pipe directory %s - %s\n",
 			  lp_ncalrpc_dir(), strerror(errno)));
 		return -1;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index cb61646..a51a172 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1519,14 +1519,14 @@ int main(int argc, const char **argv)
 		exit(1);
 	}
 
-	ok = directory_create_or_exist(lp_lock_directory(), geteuid(), 0755);
+	ok = directory_create_or_exist(lp_lock_directory(), 0755);
 	if (!ok) {
 		DEBUG(0, ("Failed to create directory %s for lock files - %s\n",
 			  lp_lock_directory(), strerror(errno)));
 		exit(1);
 	}
 
-	ok = directory_create_or_exist(lp_pid_directory(), geteuid(), 0755);
+	ok = directory_create_or_exist(lp_pid_directory(), 0755);
 	if (!ok) {
 		DEBUG(0, ("Failed to create directory %s for pid files - %s\n",
 			  lp_pid_directory(), strerror(errno)));
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index d59668b..691266c 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -1007,7 +1007,7 @@ static void ldapsrv_task_init(struct task_server *task)
 	 * Make sure the directory for the privileged ldapi socket exists, and
 	 * is of the correct permissions
 	 */
-	if (!directory_create_or_exist(priv_dir, geteuid(), 0750)) {
+	if (!directory_create_or_exist(priv_dir, 0750)) {
 		task_server_terminate(task, "Cannot create ldap "
 				      "privileged ldapi directory", true);
 		return;
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index ffa668a..a67a58a 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -136,15 +136,10 @@ static NTSTATUS irpc_uptime(struct irpc_message *msg,
 */
 static char *imessaging_path(struct imessaging_context *msg, struct server_id server_id)
 {
-	TALLOC_CTX *tmp_ctx = talloc_new(msg);
-	const char *id = server_id_str(tmp_ctx, &server_id);
-	char *s;
-	if (id == NULL) {
-		return NULL;
-	}
-	s = talloc_asprintf(msg, "%s/msg.%s", msg->base_path, id);
-	talloc_steal(s, tmp_ctx);
-	return s;
+	struct server_id_buf buf;
+
+	return talloc_asprintf(msg, "%s/msg.%s", msg->base_path,
+			       server_id_str_buf(server_id, &buf));
 }
 
 /*
diff --git a/source4/smbd/service_named_pipe.c b/source4/smbd/service_named_pipe.c
index 6aa984d..f9907b2 100644


-- 
Samba Shared Repository


More information about the samba-cvs mailing list