summaryrefslogtreecommitdiffstats
path: root/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-02 11:18:38 +0100
committerStefan Metzmacher <metze@samba.org>2014-01-07 00:27:12 +0100
commitc0dc2fb7e1dadcef35a132040448cb27ff1d5bfa (patch)
tree9908f7a9f1e96c44cfdc330da15b64f230b7fa87 /librpc/ndr
parent66c39420e29e7c257d9cdc5d04c061472bbefd19 (diff)
downloadsamba-c0dc2fb7e1dadcef35a132040448cb27ff1d5bfa.tar.gz
samba-c0dc2fb7e1dadcef35a132040448cb27ff1d5bfa.tar.xz
samba-c0dc2fb7e1dadcef35a132040448cb27ff1d5bfa.zip
dcerpc.idl: add dcerpc_sec_verification_trailer
See [MS-RPCE] 2.2.2.13 Verification Trailer for details. Pair-Programmed-With: Gregor Beck <gbeck@sernet.de> Signed-off-by: Gregor Beck <gbeck@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/ndr_dcerpc.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_dcerpc.c b/librpc/ndr/ndr_dcerpc.c
new file mode 100644
index 00000000000..88a7f38fdbf
--- /dev/null
+++ b/librpc/ndr/ndr_dcerpc.c
@@ -0,0 +1,66 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Manually parsed structures found in the DCERPC protocol
+
+ Copyright (C) Stefan Metzmacher 2014
+ Copyright (C) Gregor Beck 2014
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "bin/default/librpc/gen_ndr/ndr_dcerpc.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+
+const uint8_t DCERPC_SEC_VT_MAGIC[] = {0x8a,0xe3,0x13,0x71,0x02,0xf4,0x36,0x71};
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_sec_vt_count(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_sec_vt_count *r)
+{
+ NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+ /* nothing */
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_sec_vt_count(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_sec_vt_count *r)
+{
+ uint32_t _saved_ofs = ndr->offset;
+
+ NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ r->count = 0;
+
+ while (true) {
+ uint16_t command;
+ uint16_t length;
+
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &command));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &length));
+ NDR_CHECK(ndr_pull_advance(ndr, length));
+
+ r->count += 1;
+
+ if (command & DCERPC_SEC_VT_COMMAND_END) {
+ break;
+ }
+ }
+
+ ndr->offset = _saved_ofs;
+ return NDR_ERR_SUCCESS;
+}