summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-27 16:47:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:49 -0500
commite748b53e4343fbac00a19e8fc76b42624eb5af02 (patch)
treebd19a3baa052d404af9452f53ab90ba26244fad2 /source4/librpc/rpc
parentd658de65d32e6746ac51aeb4da7aa74b3da40c2b (diff)
downloadsamba-e748b53e4343fbac00a19e8fc76b42624eb5af02.tar.gz
samba-e748b53e4343fbac00a19e8fc76b42624eb5af02.tar.bz2
samba-e748b53e4343fbac00a19e8fc76b42624eb5af02.zip
r12513: Similar change as my previous commit, but now for transfer syntaxes.
Avoids converting a static string to GUID every time we check whether a transfer syntax is equal to that of NDR. (This used to be commit 8dcfcaf75ab8cf4a54cf5e56f6be25acc68e3989)
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc.c7
-rw-r--r--source4/librpc/rpc/dcerpc_util.c29
2 files changed, 13 insertions, 23 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 10093cfcbb..14305c3449 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -794,15 +794,10 @@ NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
struct dcerpc_syntax_id *syntax,
struct dcerpc_syntax_id *transfer_syntax)
{
- NTSTATUS status;
-
syntax->uuid = table->uuid;
syntax->if_version = table->if_version;
- status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid);
- if (!NT_STATUS_IS_OK(status)) return status;
-
- transfer_syntax->if_version = NDR_GUID_VERSION;
+ *transfer_syntax = ndr_transfer_syntax;
return NT_STATUS_OK;
}
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 3a1e3c6cff..4e7550c701 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -221,12 +221,16 @@ const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
/* lhs is used: UUID */
char *uuidstr;
- uuidstr = GUID_string(mem_ctx, &uuid);
-
- if (strcasecmp(uuidstr, NDR_GUID) == 0) {
+ if (GUID_equal(&uuid, &ndr_transfer_syntax.uuid)) {
return "NDR";
}
+ if (GUID_equal(&uuid, &ndr64_transfer_syntax.uuid)) {
+ return "NDR64";
+ }
+
+ uuidstr = GUID_string(mem_ctx, &uuid);
+
return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, if_version);
} else { /* IPX */
return talloc_asprintf(mem_ctx, "IPX:%s",
@@ -497,7 +501,7 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct GUID *uui
return status;
}
-static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, struct GUID *uuid, uint32_t if_version)
+static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct GUID *uuid, uint32_t if_version)
{
struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
@@ -743,7 +747,6 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
{
const enum epm_protocol *protseq = NULL;
int num_protocols = -1, i;
- struct GUID ndr_guid;
NTSTATUS status;
/* Find transport */
@@ -773,12 +776,9 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
/* Floor 1 */
tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
- status = GUID_from_string(NDR_GUID, &ndr_guid);
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
-
- tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &ndr_guid, NDR_GUID_VERSION);
+ tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
+ &ndr_transfer_syntax.uuid,
+ ndr_transfer_syntax.if_version);
tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
@@ -1340,12 +1340,7 @@ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
p2->syntax.uuid = table->uuid;
p2->syntax.if_version = table->if_version;
- status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(p2);
- return status;
- }
- p2->transfer_syntax.if_version = NDR_GUID_VERSION;
+ p2->transfer_syntax = ndr_transfer_syntax;
status = dcerpc_alter_context(p2, p2, &p2->syntax, &p2->transfer_syntax);
if (!NT_STATUS_IS_OK(status)) {