diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-10-21 21:57:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:02:23 -0500 |
commit | 27129573ff5b87ac8b107d267cde87b516d9e6b9 (patch) | |
tree | db84db6b5e2c7aa986af63b31985d7c5b56c082d /source4 | |
parent | 77b691e670b6372f74451f1cf87ccf8a6d7804e2 (diff) | |
download | samba-27129573ff5b87ac8b107d267cde87b516d9e6b9.tar.gz samba-27129573ff5b87ac8b107d267cde87b516d9e6b9.tar.bz2 samba-27129573ff5b87ac8b107d267cde87b516d9e6b9.zip |
r3125: 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
(This used to be commit 0609f410ef756501d50c04b544387ae547fcd63c)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/gtk/common/gtk-smb.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 23 | ||||
-rw-r--r-- | source4/torture/local/messaging.c | 10 |
4 files changed, 19 insertions, 18 deletions
diff --git a/source4/gtk/common/gtk-smb.c b/source4/gtk/common/gtk-smb.c index 70c05350e8..e5121a21ce 100644 --- a/source4/gtk/common/gtk-smb.c +++ b/source4/gtk/common/gtk-smb.c @@ -307,7 +307,7 @@ struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d { 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] */ diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 903759f19b..e7b520d0ad 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -144,7 +144,7 @@ struct dcerpc_interface_table { /* 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; diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index f1b120894e..a951f782c3 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -296,8 +296,8 @@ const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bindi 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 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ 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 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ s = p + 1; } else { - b->object = NULL; + ZERO_STRUCT(b->object); } p = strchr(s, ':'); @@ -609,7 +607,7 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, 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 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, } /* 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 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding * /* 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 */ diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c index 6177bc82a8..38cebb4d39 100644 --- a/source4/torture/local/messaging.c +++ b/source4/torture/local/messaging.c @@ -61,6 +61,11 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) 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 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) 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(); |