svn commit: samba r3125 - in branches/SAMBA_4_0/source: gtk/common librpc/rpc torture/local

jelmer at samba.org jelmer at samba.org
Thu Oct 21 21:57:30 GMT 2004


Author: jelmer
Date: 2004-10-21 21:57:30 +0000 (Thu, 21 Oct 2004)
New Revision: 3125

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=3125&nolog=1

Log:
Store object UUID directly instead of using a pointer (struct dcerpc_binding)
Let test fail if messaging_init() fails instead of generating segfault in the LOCAL-MESSAGING test

Modified:
   branches/SAMBA_4_0/source/gtk/common/gtk-smb.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
   branches/SAMBA_4_0/source/torture/local/messaging.c


Changeset:
Modified: branches/SAMBA_4_0/source/gtk/common/gtk-smb.c
===================================================================
--- branches/SAMBA_4_0/source/gtk/common/gtk-smb.c	2004-10-21 21:02:51 UTC (rev 3124)
+++ branches/SAMBA_4_0/source/gtk/common/gtk-smb.c	2004-10-21 21:57:30 UTC (rev 3125)
@@ -307,7 +307,7 @@
 {
 	struct dcerpc_binding *binding = talloc_p(mem_ctx, struct dcerpc_binding);
 
-	binding->object = NULL;
+	ZERO_STRUCT(binding->object);
 
 	/* Format: TRANSPORT:host[\pipe\foo,foo,foo] */
 

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h	2004-10-21 21:02:51 UTC (rev 3124)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h	2004-10-21 21:57:30 UTC (rev 3125)
@@ -144,7 +144,7 @@
 /* this describes a binding to a particular transport/pipe */
 struct dcerpc_binding {
 	enum dcerpc_transport_t transport;
-	struct GUID *object;
+	struct GUID object;
 	const char *host;
 	const char **options;
 	uint32_t flags;

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c	2004-10-21 21:02:51 UTC (rev 3124)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_util.c	2004-10-21 21:57:30 UTC (rev 3125)
@@ -296,8 +296,8 @@
 		return NULL;
 	}
 
-	if (b->object) { 
-		s = talloc_asprintf(mem_ctx, "%s@", GUID_string(mem_ctx, b->object));
+	if (!uuid_all_zero(&b->object)) { 
+		s = talloc_asprintf(mem_ctx, "%s@", GUID_string(mem_ctx, &b->object));
 	}
 
 	s = talloc_asprintf_append(s, "%s:", t_name);
@@ -347,9 +347,7 @@
 	if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
 		NTSTATUS status;
 
-		b->object = talloc_p(mem_ctx, struct GUID);
-		
-		status = GUID_from_string(s, b->object);
+		status = GUID_from_string(s, &b->object);
 
 		if (NT_STATUS_IS_ERR(status)) {
 			DEBUG(0, ("Failed parsing UUID\n"));
@@ -358,7 +356,7 @@
 
 		s = p + 1;
 	} else {
-		b->object = NULL;
+		ZERO_STRUCT(b->object);
 	}
 
 	p = strchr(s, ':');
@@ -609,7 +607,7 @@
 	int i;
 
 	binding->transport = -1;
-	binding->object = NULL;
+	ZERO_STRUCT(binding->object);
 	binding->options = NULL;
 	binding->host = NULL;
 	binding->flags = 0;
@@ -642,10 +640,7 @@
 	}
 
 	/* Set object uuid */
-	if (!uuid_all_zero(&tower->floors[0].lhs.info.uuid.uuid)) {
-		binding->object = talloc_p(mem_ctx, struct GUID);
-		*binding->object = tower->floors[0].lhs.info.uuid.uuid;
-	}
+	binding->object = tower->floors[0].lhs.info.uuid.uuid;
 
 	/* Ignore floor 1, it contains the NDR version info */
 	
@@ -697,11 +692,7 @@
 
 	/* Floor 0 */
 	(*tower)->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
-	if (binding->object) {
-		(*tower)->floors[0].lhs.info.uuid.uuid = *binding->object;
-	} else {
-		ZERO_STRUCT((*tower)->floors[0].lhs.info.uuid.uuid);
-	}
+	(*tower)->floors[0].lhs.info.uuid.uuid = binding->object;
 	(*tower)->floors[0].lhs.info.uuid.version = 0;
 	
 	/* Floor 1 */

Modified: branches/SAMBA_4_0/source/torture/local/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/messaging.c	2004-10-21 21:02:51 UTC (rev 3124)
+++ branches/SAMBA_4_0/source/torture/local/messaging.c	2004-10-21 21:57:30 UTC (rev 3125)
@@ -61,6 +61,11 @@
 
 	if (fork() == 0) {
 		void *msg_ctx2 = messaging_init(mem_ctx, 1, ev);
+	
+		if (!msg_ctx2) {
+			exit(1);
+		}
+		
 		messaging_register(msg_ctx2, NULL, MY_PING, ping_message);
 		messaging_register(msg_ctx2, mem_ctx, MY_EXIT, exit_message);
 		event_loop_wait(ev);
@@ -71,6 +76,11 @@
 
 	msg_ctx = messaging_init(mem_ctx, 2, ev);
 
+	if (!msg_ctx) {
+		printf("messaging_init() failed\n");
+		return False;
+	}
+
 	messaging_register(msg_ctx, &pong_count, MY_PONG, pong_message);
 
 	start_timer();



More information about the samba-cvs mailing list