1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

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)
This commit is contained in:
Jelmer Vernooij 2004-10-21 21:57:30 +00:00 committed by Gerald (Jerry) Carter
parent 77b691e670
commit 27129573ff
4 changed files with 19 additions and 18 deletions

View File

@ -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] */

View File

@ -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;

View File

@ -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 */

View File

@ -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();