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/librpc/rpc | |
parent | 77b691e670b6372f74451f1cf87ccf8a6d7804e2 (diff) | |
download | samba-27129573ff5b87ac8b107d267cde87b516d9e6b9.tar.gz samba-27129573ff5b87ac8b107d267cde87b516d9e6b9.tar.xz 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/librpc/rpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 23 |
2 files changed, 8 insertions, 17 deletions
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 903759f19b2..e7b520d0ad8 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 f1b120894ed..a951f782c38 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 */ |