summaryrefslogtreecommitdiffstats
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-02-04 13:52:26 +0100
committerAndrew Bartlett <abartlet@samba.org>2014-03-25 00:45:29 +0100
commit5f402dcdf7a652378a7d4e08ab1e12fd929d3d5b (patch)
treef0333abbb2eb7e8da234f8b7b18987a9efa30ef0 /librpc
parenta2ec73050cdb43532692e3548d9c9338e4697e8b (diff)
downloadsamba-5f402dcdf7a652378a7d4e08ab1e12fd929d3d5b.tar.gz
samba-5f402dcdf7a652378a7d4e08ab1e12fd929d3d5b.tar.xz
samba-5f402dcdf7a652378a7d4e08ab1e12fd929d3d5b.zip
librpc/rpc: maintain "abstract_syntax" as string option of dcerpc_binding
This should not be mixed with the object guid! They are different things! Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/binding.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index ea00a3d798c..27ea4c62029 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -620,42 +620,55 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_assoc_group_id(struct dcerpc_binding *b,
_PUBLIC_ struct ndr_syntax_id dcerpc_binding_get_abstract_syntax(const struct dcerpc_binding *b)
{
- /*
- * For now we just use object, until all callers are fixed.
- */
- return b->object;
+ const char *s = dcerpc_binding_get_string_option(b, "abstract_syntax");
+ bool ok;
+ struct ndr_syntax_id id;
+
+ if (s == NULL) {
+ return ndr_syntax_id_null;
+ }
+
+ ok = ndr_syntax_id_from_string(s, &id);
+ if (!ok) {
+ return ndr_syntax_id_null;
+ }
+
+ return id;
}
_PUBLIC_ NTSTATUS dcerpc_binding_set_abstract_syntax(struct dcerpc_binding *b,
const struct ndr_syntax_id *syntax)
{
NTSTATUS status;
- struct GUID object;
+ char *s = NULL;
- /*
- * For now we just use object, until all callers are fixed.
- */
+ if (syntax == NULL) {
+ status = dcerpc_binding_set_string_option(b, "abstract_syntax", NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
- if (syntax != NULL) {
- object = syntax->uuid;
- } else {
- object = GUID_zero();
+ return NT_STATUS_OK;
}
- /*
- * This sets also the string
- */
- status = dcerpc_binding_set_object(b, object);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ if (ndr_syntax_id_equal(&ndr_syntax_id_null, syntax)) {
+ status = dcerpc_binding_set_string_option(b, "abstract_syntax", NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ return NT_STATUS_OK;
}
- if (syntax != NULL) {
- /*
- * Here we need to reset the whole ndr_syntax_id
- * structure including the .if_version
- */
- b->object = *syntax;
+ s = ndr_syntax_id_to_string(b, syntax);
+ if (s == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = dcerpc_binding_set_string_option(b, "abstract_syntax", s);
+ TALLOC_FREE(s);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
return NT_STATUS_OK;