2 Unix SMB/CIFS implementation.
5 Copyright (C) Andrew Tridgell 2003-2005
6 Copyright (C) Jelmer Vernooij 2004-2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "system/network.h"
25 #include "lib/tsocket/tsocket.h"
26 #include "lib/util/tevent_ntstatus.h"
27 #include "librpc/rpc/dcerpc.h"
28 #include "librpc/gen_ndr/ndr_dcerpc.h"
29 #include "rpc_common.h"
30 #include "lib/util/bitmap.h"
32 /* we need to be able to get/set the fragment length without doing a full
34 void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v)
36 if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
37 SSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, v);
39 RSSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, v);
43 uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob)
45 if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
46 return SVAL(blob->data, DCERPC_FRAG_LEN_OFFSET);
48 return RSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET);
52 void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v)
54 if (CVAL(blob->data,DCERPC_DREP_OFFSET) & DCERPC_DREP_LE) {
55 SSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET, v);
57 RSSVAL(blob->data, DCERPC_AUTH_LEN_OFFSET, v);
61 uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob)
63 return blob->data[DCERPC_DREP_OFFSET];
67 * @brief Decodes a ncacn_packet
69 * @param mem_ctx The memory context on which to allocate the packet
71 * @param blob The blob of data to decode
72 * @param r An empty ncacn_packet, must not be NULL
74 * @return a NTSTATUS error code
76 NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
77 const DATA_BLOB *blob,
78 struct ncacn_packet *r)
80 enum ndr_err_code ndr_err;
83 ndr = ndr_pull_init_blob(blob, mem_ctx);
85 return NT_STATUS_NO_MEMORY;
88 if (!(CVAL(ndr->data, DCERPC_DREP_OFFSET) & DCERPC_DREP_LE)) {
89 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
92 if (CVAL(ndr->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) {
93 ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
96 ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, r);
98 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
100 return ndr_map_error2ntstatus(ndr_err);
104 if (r->frag_length != blob->length) {
105 return NT_STATUS_RPC_PROTOCOL_ERROR;
112 * @brief Pull a dcerpc_auth structure, taking account of any auth
113 * padding in the blob. For request/response packets we pass
114 * the whole data blob, so auth_data_only must be set to false
115 * as the blob contains data+pad+auth and no just pad+auth.
117 * @param pkt - The ncacn_packet strcuture
118 * @param mem_ctx - The mem_ctx used to allocate dcerpc_auth elements
119 * @param pkt_trailer - The packet trailer data, usually the trailing
120 * auth_info blob, but in the request/response case
121 * this is the stub_and_verifier blob.
122 * @param auth - A preallocated dcerpc_auth *empty* structure
123 * @param auth_length - The length of the auth trail, sum of auth header
124 * lenght and pkt->auth_length
125 * @param auth_data_only - Whether the pkt_trailer includes only the auth_blob
126 * (+ padding) or also other data.
128 * @return - A NTSTATUS error code.
130 NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
132 const DATA_BLOB *pkt_trailer,
133 struct dcerpc_auth *auth,
134 uint32_t *_auth_length,
137 struct ndr_pull *ndr;
138 enum ndr_err_code ndr_err;
139 uint16_t data_and_pad;
140 uint16_t auth_length;
142 uint32_t max_pad_len = 0;
145 if (_auth_length != NULL) {
148 if (auth_data_only) {
149 return NT_STATUS_INTERNAL_ERROR;
152 if (!auth_data_only) {
153 return NT_STATUS_INTERNAL_ERROR;
157 /* Paranoia checks for auth_length. The caller should check this... */
158 if (pkt->auth_length == 0) {
159 return NT_STATUS_INTERNAL_ERROR;
162 /* Paranoia checks for auth_length. The caller should check this... */
163 if (pkt->auth_length > pkt->frag_length) {
164 return NT_STATUS_INTERNAL_ERROR;
166 tmp_length = DCERPC_NCACN_PAYLOAD_OFFSET;
167 tmp_length += DCERPC_AUTH_TRAILER_LENGTH;
168 tmp_length += pkt->auth_length;
169 if (tmp_length > pkt->frag_length) {
170 return NT_STATUS_INTERNAL_ERROR;
172 if (pkt_trailer->length > UINT16_MAX) {
173 return NT_STATUS_INTERNAL_ERROR;
176 auth_length = DCERPC_AUTH_TRAILER_LENGTH + pkt->auth_length;
177 if (pkt_trailer->length < auth_length) {
178 return NT_STATUS_RPC_PROTOCOL_ERROR;
181 data_and_pad = pkt_trailer->length - auth_length;
183 ndr = ndr_pull_init_blob(pkt_trailer, mem_ctx);
185 return NT_STATUS_NO_MEMORY;
188 if (!(pkt->drep[0] & DCERPC_DREP_LE)) {
189 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
192 ndr_err = ndr_pull_advance(ndr, data_and_pad);
193 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
195 return ndr_map_error2ntstatus(ndr_err);
198 ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth);
199 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
202 return ndr_map_error2ntstatus(ndr_err);
206 * Make sure the padding would not exceed
209 * Here we assume at least 24 bytes for the
210 * payload specific header the value of
211 * DCERPC_{REQUEST,RESPONSE}_LENGTH.
213 * We use this also for BIND_*, ALTER_* and AUTH3 pdus.
215 * We need this check before we ignore possible
216 * invalid values. See also bug #11982.
218 * This check is mainly used to generate the correct
219 * error for BIND_*, ALTER_* and AUTH3 pdus.
221 * We always have the 'if (data_and_pad < auth->auth_pad_length)'
222 * protection for REQUEST and RESPONSE pdus, where the
223 * auth_pad_length field is actually used by the caller.
225 tmp_length = DCERPC_REQUEST_LENGTH;
226 tmp_length += DCERPC_AUTH_TRAILER_LENGTH;
227 tmp_length += pkt->auth_length;
228 if (tmp_length < pkt->frag_length) {
229 max_pad_len = pkt->frag_length - tmp_length;
231 if (max_pad_len < auth->auth_pad_length) {
232 DEBUG(1, (__location__ ": ERROR: pad length to large. "
234 (unsigned)max_pad_len,
235 (unsigned)auth->auth_pad_length));
238 return NT_STATUS_RPC_PROTOCOL_ERROR;
242 * This is a workarround for a bug in old
243 * Samba releases. For BIND_ACK <= 3.5.x
244 * and for ALTER_RESP <= 4.2.x (see bug #11061)
246 * See also bug #11982.
248 if (auth_data_only && data_and_pad == 0 &&
249 auth->auth_pad_length > 0) {
251 * we need to ignore invalid auth_pad_length
252 * values for BIND_*, ALTER_* and AUTH3 pdus.
254 auth->auth_pad_length = 0;
257 if (data_and_pad < auth->auth_pad_length) {
258 DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
259 "Calculated %u got %u\n",
260 (unsigned)data_and_pad,
261 (unsigned)auth->auth_pad_length));
264 return NT_STATUS_RPC_PROTOCOL_ERROR;
267 if (auth_data_only && data_and_pad != auth->auth_pad_length) {
268 DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
269 "Calculated %u got %u\n",
270 (unsigned)data_and_pad,
271 (unsigned)auth->auth_pad_length));
274 return NT_STATUS_RPC_PROTOCOL_ERROR;
277 DEBUG(6,(__location__ ": auth_pad_length %u\n",
278 (unsigned)auth->auth_pad_length));
280 talloc_steal(mem_ctx, auth->credentials.data);
283 if (_auth_length != NULL) {
284 *_auth_length = auth_length;
291 * @brief Verify the fields in ncacn_packet header.
293 * @param pkt - The ncacn_packet strcuture
294 * @param ptype - The expected PDU type
295 * @param max_auth_info - The maximum size of a possible auth trailer
296 * @param required_flags - The required flags for the pdu.
297 * @param optional_flags - The possible optional flags for the pdu.
299 * @return - A NTSTATUS error code.
301 NTSTATUS dcerpc_verify_ncacn_packet_header(const struct ncacn_packet *pkt,
302 enum dcerpc_pkt_type ptype,
303 size_t max_auth_info,
304 uint8_t required_flags,
305 uint8_t optional_flags)
307 if (pkt->rpc_vers != 5) {
308 return NT_STATUS_RPC_PROTOCOL_ERROR;
311 if (pkt->rpc_vers_minor != 0) {
312 return NT_STATUS_RPC_PROTOCOL_ERROR;
315 if (pkt->auth_length > pkt->frag_length) {
316 return NT_STATUS_RPC_PROTOCOL_ERROR;
319 if (pkt->ptype != ptype) {
320 return NT_STATUS_RPC_PROTOCOL_ERROR;
323 if (max_auth_info > UINT16_MAX) {
324 return NT_STATUS_INTERNAL_ERROR;
327 if (pkt->auth_length > 0) {
328 size_t max_auth_length;
330 if (max_auth_info <= DCERPC_AUTH_TRAILER_LENGTH) {
331 return NT_STATUS_RPC_PROTOCOL_ERROR;
333 max_auth_length = max_auth_info - DCERPC_AUTH_TRAILER_LENGTH;
335 if (pkt->auth_length > max_auth_length) {
336 return NT_STATUS_RPC_PROTOCOL_ERROR;
340 if ((pkt->pfc_flags & required_flags) != required_flags) {
341 return NT_STATUS_RPC_PROTOCOL_ERROR;
343 if (pkt->pfc_flags & ~(optional_flags|required_flags)) {
344 return NT_STATUS_RPC_PROTOCOL_ERROR;
347 if (pkt->drep[0] & ~DCERPC_DREP_LE) {
348 return NT_STATUS_RPC_PROTOCOL_ERROR;
350 if (pkt->drep[1] != 0) {
351 return NT_STATUS_RPC_PROTOCOL_ERROR;
353 if (pkt->drep[2] != 0) {
354 return NT_STATUS_RPC_PROTOCOL_ERROR;
356 if (pkt->drep[3] != 0) {
357 return NT_STATUS_RPC_PROTOCOL_ERROR;
363 struct dcerpc_read_ncacn_packet_state {
369 struct ncacn_packet *pkt;
372 static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,
375 struct iovec **_vector,
377 static void dcerpc_read_ncacn_packet_done(struct tevent_req *subreq);
379 struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
380 struct tevent_context *ev,
381 struct tstream_context *stream)
383 struct tevent_req *req;
384 struct dcerpc_read_ncacn_packet_state *state;
385 struct tevent_req *subreq;
387 req = tevent_req_create(mem_ctx, &state,
388 struct dcerpc_read_ncacn_packet_state);
393 state->buffer = data_blob_const(NULL, 0);
394 state->pkt = talloc(state, struct ncacn_packet);
395 if (tevent_req_nomem(state->pkt, req)) {
399 subreq = tstream_readv_pdu_send(state, ev,
401 dcerpc_read_ncacn_packet_next_vector,
403 if (tevent_req_nomem(subreq, req)) {
406 tevent_req_set_callback(subreq, dcerpc_read_ncacn_packet_done, req);
410 tevent_req_post(req, ev);
414 static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,
417 struct iovec **_vector,
420 struct dcerpc_read_ncacn_packet_state *state =
421 talloc_get_type_abort(private_data,
422 struct dcerpc_read_ncacn_packet_state);
423 struct iovec *vector;
426 if (state->buffer.length == 0) {
428 * first get enough to read the fragment length
430 * We read the full fixed ncacn_packet header
431 * in order to make wireshark happy with
432 * pcap files from socket_wrapper.
435 state->buffer.length = DCERPC_NCACN_PAYLOAD_OFFSET;
436 state->buffer.data = talloc_array(state, uint8_t,
437 state->buffer.length);
438 if (!state->buffer.data) {
441 } else if (state->buffer.length == DCERPC_NCACN_PAYLOAD_OFFSET) {
442 /* now read the fragment length and allocate the full buffer */
443 size_t frag_len = dcerpc_get_frag_length(&state->buffer);
445 ofs = state->buffer.length;
447 if (frag_len < ofs) {
449 * something is wrong, let the caller deal with it
456 state->buffer.data = talloc_realloc(state,
459 if (!state->buffer.data) {
462 state->buffer.length = frag_len;
464 /* if we reach this we have a full fragment */
470 /* now create the vector that we want to be filled */
471 vector = talloc_array(mem_ctx, struct iovec, 1);
476 vector[0].iov_base = (void *) (state->buffer.data + ofs);
477 vector[0].iov_len = state->buffer.length - ofs;
484 static void dcerpc_read_ncacn_packet_done(struct tevent_req *subreq)
486 struct tevent_req *req = tevent_req_callback_data(subreq,
488 struct dcerpc_read_ncacn_packet_state *state = tevent_req_data(req,
489 struct dcerpc_read_ncacn_packet_state);
492 struct ndr_pull *ndr;
493 enum ndr_err_code ndr_err;
496 ret = tstream_readv_pdu_recv(subreq, &sys_errno);
499 status = map_nt_error_from_unix_common(sys_errno);
500 tevent_req_nterror(req, status);
504 ndr = ndr_pull_init_blob(&state->buffer, state->pkt);
505 if (tevent_req_nomem(ndr, req)) {
509 if (!(CVAL(ndr->data, DCERPC_DREP_OFFSET) & DCERPC_DREP_LE)) {
510 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
513 if (CVAL(ndr->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) {
514 ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
517 ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, state->pkt);
519 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
520 status = ndr_map_error2ntstatus(ndr_err);
521 tevent_req_nterror(req, status);
525 if (state->pkt->frag_length != state->buffer.length) {
526 tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
530 tevent_req_done(req);
533 NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
535 struct ncacn_packet **pkt,
538 struct dcerpc_read_ncacn_packet_state *state = tevent_req_data(req,
539 struct dcerpc_read_ncacn_packet_state);
542 if (tevent_req_is_nterror(req, &status)) {
543 tevent_req_received(req);
547 *pkt = talloc_move(mem_ctx, &state->pkt);
549 buffer->data = talloc_move(mem_ctx, &state->buffer.data);
550 buffer->length = state->buffer.length;
553 tevent_req_received(req);
557 const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx,
558 enum dcerpc_transport_t transport,
559 const struct ndr_interface_table *table)
562 const char *p = NULL;
563 const char *endpoint = NULL;
565 struct dcerpc_binding *default_binding = NULL;
566 TALLOC_CTX *frame = talloc_stackframe();
568 /* Find one of the default pipes for this interface */
570 for (i = 0; i < table->endpoints->count; i++) {
571 enum dcerpc_transport_t dtransport;
572 const char *dendpoint;
574 status = dcerpc_parse_binding(frame, table->endpoints->names[i],
576 if (!NT_STATUS_IS_OK(status)) {
580 dtransport = dcerpc_binding_get_transport(default_binding);
581 dendpoint = dcerpc_binding_get_string_option(default_binding,
583 if (dendpoint == NULL) {
584 TALLOC_FREE(default_binding);
588 if (transport == NCA_UNKNOWN) {
589 transport = dtransport;
592 if (transport != dtransport) {
593 TALLOC_FREE(default_binding);
606 * extract the pipe name without \\pipe from for example
607 * ncacn_np:[\\pipe\\epmapper]
609 if (transport == NCACN_NP) {
610 if (strncasecmp(p, "\\pipe\\", 6) == 0) {
613 if (strncmp(p, "\\", 1) == 0) {
618 endpoint = talloc_strdup(mem_ctx, p);
625 struct dcerpc_sec_vt_header2 dcerpc_sec_vt_header2_from_ncacn_packet(const struct ncacn_packet *pkt)
627 struct dcerpc_sec_vt_header2 ret;
630 ret.ptype = pkt->ptype;
631 memcpy(&ret.drep, pkt->drep, sizeof(ret.drep));
632 ret.call_id = pkt->call_id;
634 switch (pkt->ptype) {
635 case DCERPC_PKT_REQUEST:
636 ret.context_id = pkt->u.request.context_id;
637 ret.opnum = pkt->u.request.opnum;
640 case DCERPC_PKT_RESPONSE:
641 ret.context_id = pkt->u.response.context_id;
644 case DCERPC_PKT_FAULT:
645 ret.context_id = pkt->u.fault.context_id;
655 bool dcerpc_sec_vt_header2_equal(const struct dcerpc_sec_vt_header2 *v1,
656 const struct dcerpc_sec_vt_header2 *v2)
658 if (v1->ptype != v2->ptype) {
662 if (memcmp(v1->drep, v2->drep, sizeof(v1->drep)) != 0) {
666 if (v1->call_id != v2->call_id) {
670 if (v1->context_id != v2->context_id) {
674 if (v1->opnum != v2->opnum) {
681 static bool dcerpc_sec_vt_is_valid(const struct dcerpc_sec_verification_trailer *r)
684 TALLOC_CTX *frame = talloc_stackframe();
685 struct bitmap *commands_seen;
688 if (r->count.count == 0) {
693 if (memcmp(r->magic, DCERPC_SEC_VT_MAGIC, sizeof(r->magic)) != 0) {
697 commands_seen = bitmap_talloc(frame, DCERPC_SEC_VT_COMMAND_ENUM + 1);
698 if (commands_seen == NULL) {
702 for (i=0; i < r->count.count; i++) {
703 enum dcerpc_sec_vt_command_enum cmd =
704 r->commands[i].command & DCERPC_SEC_VT_COMMAND_ENUM;
706 if (bitmap_query(commands_seen, cmd)) {
707 /* Each command must appear at most once. */
710 bitmap_set(commands_seen, cmd);
713 case DCERPC_SEC_VT_COMMAND_BITMASK1:
714 case DCERPC_SEC_VT_COMMAND_PCONTEXT:
715 case DCERPC_SEC_VT_COMMAND_HEADER2:
718 if ((r->commands[i].u._unknown.length % 4) != 0) {
730 static bool dcerpc_sec_vt_bitmask_check(const uint32_t *bitmask1,
731 struct dcerpc_sec_vt *c)
733 if (bitmask1 == NULL) {
734 if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
735 DEBUG(10, ("SEC_VT check Bitmask1 must_process_command "
743 if ((c->u.bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING)
744 && (!(*bitmask1 & DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING))) {
745 DEBUG(10, ("SEC_VT check Bitmask1 client_header_signing "
752 static bool dcerpc_sec_vt_pctx_check(const struct dcerpc_sec_vt_pcontext *pcontext,
753 struct dcerpc_sec_vt *c)
758 if (pcontext == NULL) {
759 if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
760 DEBUG(10, ("SEC_VT check Pcontext must_process_command "
768 mem_ctx = talloc_stackframe();
769 ok = ndr_syntax_id_equal(&pcontext->abstract_syntax,
770 &c->u.pcontext.abstract_syntax);
772 DEBUG(10, ("SEC_VT check pcontext abstract_syntax failed: "
774 ndr_syntax_id_to_string(mem_ctx,
775 &pcontext->abstract_syntax),
776 ndr_syntax_id_to_string(mem_ctx,
777 &c->u.pcontext.abstract_syntax)));
780 ok = ndr_syntax_id_equal(&pcontext->transfer_syntax,
781 &c->u.pcontext.transfer_syntax);
783 DEBUG(10, ("SEC_VT check pcontext transfer_syntax failed: "
785 ndr_syntax_id_to_string(mem_ctx,
786 &pcontext->transfer_syntax),
787 ndr_syntax_id_to_string(mem_ctx,
788 &c->u.pcontext.transfer_syntax)));
794 talloc_free(mem_ctx);
798 static bool dcerpc_sec_vt_hdr2_check(const struct dcerpc_sec_vt_header2 *header2,
799 struct dcerpc_sec_vt *c)
801 if (header2 == NULL) {
802 if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
803 DEBUG(10, ("SEC_VT check Header2 must_process_command failed\n"));
810 if (!dcerpc_sec_vt_header2_equal(header2, &c->u.header2)) {
811 DEBUG(10, ("SEC_VT check Header2 failed\n"));
818 bool dcerpc_sec_verification_trailer_check(
819 const struct dcerpc_sec_verification_trailer *vt,
820 const uint32_t *bitmask1,
821 const struct dcerpc_sec_vt_pcontext *pcontext,
822 const struct dcerpc_sec_vt_header2 *header2)
826 if (!dcerpc_sec_vt_is_valid(vt)) {
830 for (i=0; i < vt->count.count; i++) {
832 struct dcerpc_sec_vt *c = &vt->commands[i];
834 switch (c->command & DCERPC_SEC_VT_COMMAND_ENUM) {
835 case DCERPC_SEC_VT_COMMAND_BITMASK1:
836 ok = dcerpc_sec_vt_bitmask_check(bitmask1, c);
842 case DCERPC_SEC_VT_COMMAND_PCONTEXT:
843 ok = dcerpc_sec_vt_pctx_check(pcontext, c);
849 case DCERPC_SEC_VT_COMMAND_HEADER2: {
850 ok = dcerpc_sec_vt_hdr2_check(header2, c);
858 if (c->command & DCERPC_SEC_VT_MUST_PROCESS) {
859 DEBUG(10, ("SEC_VT check Unknown must_process_command failed\n"));
870 static const struct ndr_syntax_id dcerpc_bind_time_features_prefix = {
872 .time_low = 0x6cb71c2c,
874 .time_hi_and_version = 0x4540,
875 .clock_seq = {0x00, 0x00},
876 .node = {0x00,0x00,0x00,0x00,0x00,0x00}
881 bool dcerpc_extract_bind_time_features(struct ndr_syntax_id s, uint64_t *_features)
884 uint64_t features = 0;
886 values[0] = s.uuid.clock_seq[0];
887 values[1] = s.uuid.clock_seq[1];
888 values[2] = s.uuid.node[0];
889 values[3] = s.uuid.node[1];
890 values[4] = s.uuid.node[2];
891 values[5] = s.uuid.node[3];
892 values[6] = s.uuid.node[4];
893 values[7] = s.uuid.node[5];
895 ZERO_STRUCT(s.uuid.clock_seq);
896 ZERO_STRUCT(s.uuid.node);
898 if (!ndr_syntax_id_equal(&s, &dcerpc_bind_time_features_prefix)) {
899 if (_features != NULL) {
905 features = BVAL(values, 0);
907 if (_features != NULL) {
908 *_features = features;
914 struct ndr_syntax_id dcerpc_construct_bind_time_features(uint64_t features)
916 struct ndr_syntax_id s = dcerpc_bind_time_features_prefix;
919 SBVAL(values, 0, features);
921 s.uuid.clock_seq[0] = values[0];
922 s.uuid.clock_seq[1] = values[1];
923 s.uuid.node[0] = values[2];
924 s.uuid.node[1] = values[3];
925 s.uuid.node[2] = values[4];
926 s.uuid.node[3] = values[5];
927 s.uuid.node[4] = values[6];
928 s.uuid.node[5] = values[7];