2 * DCERPC Helper routines
3 * Günther Deschner <gd@samba.org> 2010.
4 * Simo Sorce <idra@samba.org> 2010.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "librpc/rpc/dcerpc.h"
23 #include "librpc/gen_ndr/ndr_dcerpc.h"
24 #include "librpc/gen_ndr/ndr_schannel.h"
25 #include "../libcli/auth/schannel.h"
26 #include "../libcli/auth/spnego.h"
27 #include "librpc/crypto/gse.h"
28 #include "librpc/crypto/spnego.h"
29 #include "auth/gensec/gensec.h"
32 #define DBGC_CLASS DBGC_RPC_PARSE
35 * @brief NDR Encodes a ncacn_packet
37 * @param mem_ctx The memory context the blob will be allocated on
38 * @param ptype The DCERPC packet type
39 * @param pfc_flags The DCERPC PFC Falgs
40 * @param auth_length The length of the trailing auth blob
41 * @param call_id The call ID
42 * @param u The payload of the packet
43 * @param blob [out] The encoded blob if successful
45 * @return an NTSTATUS error code
47 NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
48 enum dcerpc_pkt_type ptype,
52 union dcerpc_payload *u,
55 struct ncacn_packet r;
56 enum ndr_err_code ndr_err;
61 r.pfc_flags = pfc_flags;
62 r.drep[0] = DCERPC_DREP_LE;
66 r.auth_length = auth_length;
70 ndr_err = ndr_push_struct_blob(blob, mem_ctx, &r,
71 (ndr_push_flags_fn_t)ndr_push_ncacn_packet);
72 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
73 return ndr_map_error2ntstatus(ndr_err);
76 dcerpc_set_frag_length(blob, blob->length);
79 if (DEBUGLEVEL >= 10) {
80 /* set frag len for print function */
81 r.frag_length = blob->length;
82 NDR_PRINT_DEBUG(ncacn_packet, &r);
89 * @brief Decodes a ncacn_packet
91 * @param mem_ctx The memory context on which to allocate the packet
93 * @param blob The blob of data to decode
94 * @param r An empty ncacn_packet, must not be NULL
95 * @param bigendian Whether the packet is bignedian encoded
97 * @return a NTSTATUS error code
99 NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
100 const DATA_BLOB *blob,
101 struct ncacn_packet *r,
104 enum ndr_err_code ndr_err;
105 struct ndr_pull *ndr;
107 ndr = ndr_pull_init_blob(blob, mem_ctx);
109 return NT_STATUS_NO_MEMORY;
112 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
115 ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, r);
117 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
119 return ndr_map_error2ntstatus(ndr_err);
123 if (DEBUGLEVEL >= 10) {
124 NDR_PRINT_DEBUG(ncacn_packet, r);
131 * @brief NDR Encodes a NL_AUTH_MESSAGE
133 * @param mem_ctx The memory context the blob will be allocated on
134 * @param r The NL_AUTH_MESSAGE to encode
135 * @param blob [out] The encoded blob if successful
137 * @return a NTSTATUS error code
139 NTSTATUS dcerpc_push_schannel_bind(TALLOC_CTX *mem_ctx,
140 struct NL_AUTH_MESSAGE *r,
143 enum ndr_err_code ndr_err;
145 ndr_err = ndr_push_struct_blob(blob, mem_ctx, r,
146 (ndr_push_flags_fn_t)ndr_push_NL_AUTH_MESSAGE);
147 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
148 return ndr_map_error2ntstatus(ndr_err);
151 if (DEBUGLEVEL >= 10) {
152 NDR_PRINT_DEBUG(NL_AUTH_MESSAGE, r);
159 * @brief NDR Encodes a dcerpc_auth structure
161 * @param mem_ctx The memory context the blob will be allocated on
162 * @param auth_type The DCERPC Authentication Type
163 * @param auth_level The DCERPC Authentication Level
164 * @param auth_pad_length The padding added to the packet this blob will be
166 * @param auth_context_id The context id
167 * @param credentials The authentication credentials blob (signature)
168 * @param blob [out] The encoded blob if successful
170 * @return a NTSTATUS error code
172 NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
173 enum dcerpc_AuthType auth_type,
174 enum dcerpc_AuthLevel auth_level,
175 uint8_t auth_pad_length,
176 uint32_t auth_context_id,
177 const DATA_BLOB *credentials,
180 struct dcerpc_auth r;
181 enum ndr_err_code ndr_err;
183 r.auth_type = auth_type;
184 r.auth_level = auth_level;
185 r.auth_pad_length = auth_pad_length;
187 r.auth_context_id = auth_context_id;
188 r.credentials = *credentials;
190 ndr_err = ndr_push_struct_blob(blob, mem_ctx, &r,
191 (ndr_push_flags_fn_t)ndr_push_dcerpc_auth);
192 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
193 return ndr_map_error2ntstatus(ndr_err);
196 if (DEBUGLEVEL >= 10) {
197 NDR_PRINT_DEBUG(dcerpc_auth, &r);
204 * @brief Decodes a dcerpc_auth blob
206 * @param mem_ctx The memory context on which to allocate the packet
208 * @param blob The blob of data to decode
209 * @param r An empty dcerpc_auth structure, must not be NULL
211 * @return a NTSTATUS error code
213 NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
214 const DATA_BLOB *blob,
215 struct dcerpc_auth *r,
218 enum ndr_err_code ndr_err;
219 struct ndr_pull *ndr;
221 ndr = ndr_pull_init_blob(blob, mem_ctx);
223 return NT_STATUS_NO_MEMORY;
226 ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
229 ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, r);
231 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
233 return ndr_map_error2ntstatus(ndr_err);
237 if (DEBUGLEVEL >= 10) {
238 NDR_PRINT_DEBUG(dcerpc_auth, r);
245 * @brief Calculate how much data we can in a packet, including calculating
246 * auth token and pad lengths.
248 * @param auth The pipe_auth_data structure for this pipe.
249 * @param header_len The length of the packet header
250 * @param data_left The data left in the send buffer
251 * @param max_xmit_frag The max fragment size.
252 * @param pad_alignment The NDR padding size.
253 * @param data_to_send [out] The max data we will send in the pdu
254 * @param frag_len [out] The total length of the fragment
255 * @param auth_len [out] The length of the auth trailer
256 * @param pad_len [out] The padding to be applied
258 * @return A NT Error status code.
260 NTSTATUS dcerpc_guess_sizes(struct pipe_auth_data *auth,
261 size_t header_len, size_t data_left,
262 size_t max_xmit_frag, size_t pad_alignment,
263 size_t *data_to_send, size_t *frag_len,
264 size_t *auth_len, size_t *pad_len)
268 struct gensec_security *gensec_security;
269 struct schannel_state *schannel_auth;
270 struct spnego_context *spnego_ctx;
271 struct gse_context *gse_ctx;
272 enum spnego_mech auth_type;
277 /* no auth token cases first */
278 switch (auth->auth_level) {
279 case DCERPC_AUTH_LEVEL_NONE:
280 case DCERPC_AUTH_LEVEL_CONNECT:
281 case DCERPC_AUTH_LEVEL_PACKET:
282 max_len = max_xmit_frag - header_len;
283 *data_to_send = MIN(max_len, data_left);
286 *frag_len = header_len + *data_to_send;
289 case DCERPC_AUTH_LEVEL_PRIVACY:
293 case DCERPC_AUTH_LEVEL_INTEGRITY:
297 return NT_STATUS_INVALID_PARAMETER;
301 /* Sign/seal case, calculate auth and pad lengths */
303 max_len = max_xmit_frag - header_len - DCERPC_AUTH_TRAILER_LENGTH;
305 /* Treat the same for all authenticated rpc requests. */
306 switch (auth->auth_type) {
307 case DCERPC_AUTH_TYPE_SPNEGO:
308 spnego_ctx = talloc_get_type_abort(auth->auth_ctx,
309 struct spnego_context);
310 status = spnego_get_negotiated_mech(spnego_ctx,
311 &auth_type, &auth_ctx);
312 if (!NT_STATUS_IS_OK(status)) {
317 gensec_security = talloc_get_type_abort(auth_ctx,
318 struct gensec_security);
319 *auth_len = gensec_sig_size(gensec_security, max_len);
323 gse_ctx = talloc_get_type_abort(auth_ctx,
326 return NT_STATUS_INVALID_PARAMETER;
328 *auth_len = gse_get_signature_length(gse_ctx,
333 return NT_STATUS_INVALID_PARAMETER;
337 case DCERPC_AUTH_TYPE_NTLMSSP:
338 case DCERPC_AUTH_TYPE_KRB5:
339 gensec_security = talloc_get_type_abort(auth->auth_ctx,
340 struct gensec_security);
341 *auth_len = gensec_sig_size(gensec_security, max_len);
344 case DCERPC_AUTH_TYPE_SCHANNEL:
345 schannel_auth = talloc_get_type_abort(auth->auth_ctx,
346 struct schannel_state);
347 *auth_len = netsec_outgoing_sig_size(schannel_auth);
350 return NT_STATUS_INVALID_PARAMETER;
353 max_len -= *auth_len;
355 *data_to_send = MIN(max_len, data_left);
357 mod_len = (header_len + *data_to_send) % pad_alignment;
359 *pad_len = pad_alignment - mod_len;
364 if (*data_to_send + *pad_len > max_len) {
365 *data_to_send -= pad_alignment;
368 *frag_len = header_len + *data_to_send + *pad_len
369 + DCERPC_AUTH_TRAILER_LENGTH + *auth_len;
374 /*******************************************************************
375 Create and add the NTLMSSP sign/seal auth data.
376 ********************************************************************/
378 static NTSTATUS add_generic_auth_footer(struct gensec_security *gensec_security,
379 enum dcerpc_AuthLevel auth_level,
382 uint16_t data_and_pad_len = rpc_out->length
383 - DCERPC_RESPONSE_LENGTH
384 - DCERPC_AUTH_TRAILER_LENGTH;
388 if (!gensec_security) {
389 return NT_STATUS_INVALID_PARAMETER;
392 switch (auth_level) {
393 case DCERPC_AUTH_LEVEL_PRIVACY:
394 /* Data portion is encrypted. */
395 status = gensec_seal_packet(gensec_security,
398 + DCERPC_RESPONSE_LENGTH,
403 if (!NT_STATUS_IS_OK(status)) {
408 case DCERPC_AUTH_LEVEL_INTEGRITY:
409 /* Data is signed. */
410 status = gensec_sign_packet(gensec_security,
413 + DCERPC_RESPONSE_LENGTH,
418 if (!NT_STATUS_IS_OK(status)) {
425 smb_panic("bad auth level");
427 return NT_STATUS_INVALID_PARAMETER;
430 /* Finally attach the blob. */
431 if (!data_blob_append(NULL, rpc_out,
432 auth_blob.data, auth_blob.length)) {
433 DEBUG(0, ("Failed to add %u bytes auth blob.\n",
434 (unsigned int)auth_blob.length));
435 return NT_STATUS_NO_MEMORY;
437 data_blob_free(&auth_blob);
442 /*******************************************************************
443 Check/unseal the NTLMSSP auth data. (Unseal in place).
444 ********************************************************************/
446 static NTSTATUS get_generic_auth_footer(struct gensec_security *gensec_security,
447 enum dcerpc_AuthLevel auth_level,
448 DATA_BLOB *data, DATA_BLOB *full_pkt,
449 DATA_BLOB *auth_token)
451 switch (auth_level) {
452 case DCERPC_AUTH_LEVEL_PRIVACY:
453 /* Data portion is encrypted. */
454 return gensec_unseal_packet(gensec_security,
461 case DCERPC_AUTH_LEVEL_INTEGRITY:
462 /* Data is signed. */
463 return gensec_check_packet(gensec_security,
471 return NT_STATUS_INVALID_PARAMETER;
475 /*******************************************************************
476 Create and add the schannel sign/seal auth data.
477 ********************************************************************/
479 static NTSTATUS add_schannel_auth_footer(struct schannel_state *sas,
480 enum dcerpc_AuthLevel auth_level,
483 uint8_t *data_p = rpc_out->data + DCERPC_RESPONSE_LENGTH;
484 size_t data_and_pad_len = rpc_out->length
485 - DCERPC_RESPONSE_LENGTH
486 - DCERPC_AUTH_TRAILER_LENGTH;
491 return NT_STATUS_INVALID_PARAMETER;
494 DEBUG(10,("add_schannel_auth_footer: SCHANNEL seq_num=%d\n",
497 switch (auth_level) {
498 case DCERPC_AUTH_LEVEL_PRIVACY:
499 status = netsec_outgoing_packet(sas,
506 case DCERPC_AUTH_LEVEL_INTEGRITY:
507 status = netsec_outgoing_packet(sas,
515 status = NT_STATUS_INTERNAL_ERROR;
519 if (!NT_STATUS_IS_OK(status)) {
520 DEBUG(1,("add_schannel_auth_footer: failed to process packet: %s\n",
525 if (DEBUGLEVEL >= 10) {
526 dump_NL_AUTH_SIGNATURE(talloc_tos(), &auth_blob);
529 /* Finally attach the blob. */
530 if (!data_blob_append(NULL, rpc_out,
531 auth_blob.data, auth_blob.length)) {
532 return NT_STATUS_NO_MEMORY;
534 data_blob_free(&auth_blob);
539 /*******************************************************************
540 Check/unseal the Schannel auth data. (Unseal in place).
541 ********************************************************************/
543 static NTSTATUS get_schannel_auth_footer(TALLOC_CTX *mem_ctx,
544 struct schannel_state *auth_state,
545 enum dcerpc_AuthLevel auth_level,
546 DATA_BLOB *data, DATA_BLOB *full_pkt,
547 DATA_BLOB *auth_token)
549 switch (auth_level) {
550 case DCERPC_AUTH_LEVEL_PRIVACY:
551 /* Data portion is encrypted. */
552 return netsec_incoming_packet(auth_state,
558 case DCERPC_AUTH_LEVEL_INTEGRITY:
559 /* Data is signed. */
560 return netsec_incoming_packet(auth_state,
567 return NT_STATUS_INVALID_PARAMETER;
571 /*******************************************************************
572 Create and add the spnego-negotiated sign/seal auth data.
573 ********************************************************************/
575 static NTSTATUS add_spnego_auth_footer(struct spnego_context *spnego_ctx,
576 enum dcerpc_AuthLevel auth_level,
584 return NT_STATUS_INVALID_PARAMETER;
587 rpc_data = data_blob_const(rpc_out->data
588 + DCERPC_RESPONSE_LENGTH,
590 - DCERPC_RESPONSE_LENGTH
591 - DCERPC_AUTH_TRAILER_LENGTH);
593 switch (auth_level) {
594 case DCERPC_AUTH_LEVEL_PRIVACY:
595 /* Data portion is encrypted. */
596 status = spnego_seal(rpc_out->data, spnego_ctx,
597 &rpc_data, rpc_out, &auth_blob);
600 if (!NT_STATUS_IS_OK(status)) {
605 case DCERPC_AUTH_LEVEL_INTEGRITY:
606 /* Data is signed. */
607 status = spnego_sign(rpc_out->data, spnego_ctx,
608 &rpc_data, rpc_out, &auth_blob);
611 if (!NT_STATUS_IS_OK(status)) {
618 smb_panic("bad auth level");
620 return NT_STATUS_INVALID_PARAMETER;
623 /* Finally attach the blob. */
624 if (!data_blob_append(NULL, rpc_out,
625 auth_blob.data, auth_blob.length)) {
626 DEBUG(0, ("Failed to add %u bytes auth blob.\n",
627 (unsigned int)auth_blob.length));
628 return NT_STATUS_NO_MEMORY;
630 data_blob_free(&auth_blob);
635 static NTSTATUS get_spnego_auth_footer(TALLOC_CTX *mem_ctx,
636 struct spnego_context *sp_ctx,
637 enum dcerpc_AuthLevel auth_level,
638 DATA_BLOB *data, DATA_BLOB *full_pkt,
639 DATA_BLOB *auth_token)
641 switch (auth_level) {
642 case DCERPC_AUTH_LEVEL_PRIVACY:
643 /* Data portion is encrypted. */
644 return spnego_unseal(mem_ctx, sp_ctx,
645 data, full_pkt, auth_token);
647 case DCERPC_AUTH_LEVEL_INTEGRITY:
648 /* Data is signed. */
649 return spnego_sigcheck(mem_ctx, sp_ctx,
650 data, full_pkt, auth_token);
653 return NT_STATUS_INVALID_PARAMETER;
658 * @brief Append an auth footer according to what is the current mechanism
660 * @param auth The pipe_auth_data associated with the connection
661 * @param pad_len The padding used in the packet
662 * @param rpc_out Packet blob up to and including the auth header
664 * @return A NTSTATUS error code.
666 NTSTATUS dcerpc_add_auth_footer(struct pipe_auth_data *auth,
667 size_t pad_len, DATA_BLOB *rpc_out)
669 struct schannel_state *schannel_auth;
670 struct gensec_security *gensec_security;
671 struct spnego_context *spnego_ctx;
672 char pad[CLIENT_NDR_PADDING_SIZE] = { 0, };
677 if (auth->auth_type == DCERPC_AUTH_TYPE_NONE ||
678 auth->auth_type == DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM) {
683 /* Copy the sign/seal padding data. */
684 if (!data_blob_append(NULL, rpc_out, pad, pad_len)) {
685 return NT_STATUS_NO_MEMORY;
689 /* marshall the dcerpc_auth with an actually empty auth_blob.
690 * This is needed because the ntmlssp signature includes the
691 * auth header. We will append the actual blob later. */
692 auth_blob = data_blob_null;
693 status = dcerpc_push_dcerpc_auth(rpc_out->data,
700 if (!NT_STATUS_IS_OK(status)) {
704 /* append the header */
705 if (!data_blob_append(NULL, rpc_out,
706 auth_info.data, auth_info.length)) {
707 DEBUG(0, ("Failed to add %u bytes auth blob.\n",
708 (unsigned int)auth_info.length));
709 return NT_STATUS_NO_MEMORY;
711 data_blob_free(&auth_info);
713 /* Generate any auth sign/seal and add the auth footer. */
714 switch (auth->auth_type) {
715 case DCERPC_AUTH_TYPE_NONE:
716 case DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM:
717 status = NT_STATUS_OK;
719 case DCERPC_AUTH_TYPE_SPNEGO:
720 spnego_ctx = talloc_get_type_abort(auth->auth_ctx,
721 struct spnego_context);
722 status = add_spnego_auth_footer(spnego_ctx,
723 auth->auth_level, rpc_out);
725 case DCERPC_AUTH_TYPE_KRB5:
726 case DCERPC_AUTH_TYPE_NTLMSSP:
727 gensec_security = talloc_get_type_abort(auth->auth_ctx,
728 struct gensec_security);
729 status = add_generic_auth_footer(gensec_security,
733 case DCERPC_AUTH_TYPE_SCHANNEL:
734 schannel_auth = talloc_get_type_abort(auth->auth_ctx,
735 struct schannel_state);
736 status = add_schannel_auth_footer(schannel_auth,
741 status = NT_STATUS_INVALID_PARAMETER;
749 * @brief Check authentication for request/response packets
751 * @param auth The auth data for the connection
752 * @param pkt The actual ncacn_packet
753 * @param pkt_trailer The stub_and_verifier part of the packet
754 * @param header_size The header size
755 * @param raw_pkt The whole raw packet data blob
756 * @param pad_len [out] The padding length used in the packet
758 * @return A NTSTATUS error code
760 NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
761 struct ncacn_packet *pkt,
762 DATA_BLOB *pkt_trailer,
767 struct schannel_state *schannel_auth;
768 struct gensec_security *gensec_security;
769 struct spnego_context *spnego_ctx;
771 struct dcerpc_auth auth_info;
772 uint32_t auth_length;
776 switch (auth->auth_level) {
777 case DCERPC_AUTH_LEVEL_PRIVACY:
778 DEBUG(10, ("Requested Privacy.\n"));
781 case DCERPC_AUTH_LEVEL_INTEGRITY:
782 DEBUG(10, ("Requested Integrity.\n"));
785 case DCERPC_AUTH_LEVEL_CONNECT:
786 if (pkt->auth_length != 0) {
792 case DCERPC_AUTH_LEVEL_NONE:
793 if (pkt->auth_length != 0) {
794 DEBUG(3, ("Got non-zero auth len on non "
795 "authenticated connection!\n"));
796 return NT_STATUS_INVALID_PARAMETER;
802 DEBUG(3, ("Unimplemented Auth Level %d",
804 return NT_STATUS_INVALID_PARAMETER;
807 /* Paranioa checks for auth_length. */
808 if (pkt->auth_length > pkt->frag_length) {
809 return NT_STATUS_INFO_LENGTH_MISMATCH;
811 if (((unsigned int)pkt->auth_length
812 + DCERPC_AUTH_TRAILER_LENGTH < (unsigned int)pkt->auth_length) ||
813 ((unsigned int)pkt->auth_length
814 + DCERPC_AUTH_TRAILER_LENGTH < DCERPC_AUTH_TRAILER_LENGTH)) {
815 /* Integer wrap attempt. */
816 return NT_STATUS_INFO_LENGTH_MISMATCH;
819 status = dcerpc_pull_auth_trailer(pkt, pkt, pkt_trailer,
820 &auth_info, &auth_length, false);
821 if (!NT_STATUS_IS_OK(status)) {
825 data = data_blob_const(raw_pkt->data + header_size,
826 pkt_trailer->length - auth_length);
827 full_pkt = data_blob_const(raw_pkt->data,
828 raw_pkt->length - auth_info.credentials.length);
830 switch (auth->auth_type) {
831 case DCERPC_AUTH_TYPE_NONE:
832 case DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM:
835 case DCERPC_AUTH_TYPE_SPNEGO:
836 spnego_ctx = talloc_get_type_abort(auth->auth_ctx,
837 struct spnego_context);
838 status = get_spnego_auth_footer(pkt, spnego_ctx,
841 &auth_info.credentials);
842 if (!NT_STATUS_IS_OK(status)) {
847 case DCERPC_AUTH_TYPE_KRB5:
848 case DCERPC_AUTH_TYPE_NTLMSSP:
850 DEBUG(10, ("GENSEC auth\n"));
852 gensec_security = talloc_get_type_abort(auth->auth_ctx,
853 struct gensec_security);
854 status = get_generic_auth_footer(gensec_security,
857 &auth_info.credentials);
858 if (!NT_STATUS_IS_OK(status)) {
863 case DCERPC_AUTH_TYPE_SCHANNEL:
865 DEBUG(10, ("SCHANNEL auth\n"));
867 schannel_auth = talloc_get_type_abort(auth->auth_ctx,
868 struct schannel_state);
869 status = get_schannel_auth_footer(pkt, schannel_auth,
872 &auth_info.credentials);
873 if (!NT_STATUS_IS_OK(status)) {
879 DEBUG(0, ("process_request_pdu: "
880 "unknown auth type %u set.\n",
881 (unsigned int)auth->auth_type));
882 return NT_STATUS_INVALID_PARAMETER;
885 /* TODO: remove later
886 * this is still needed because in the server code the
887 * pkt_trailer actually has a copy of the raw data, and they
888 * are still both used in later calls */
889 if (auth->auth_level == DCERPC_AUTH_LEVEL_PRIVACY) {
890 memcpy(pkt_trailer->data, data.data, data.length);
893 *pad_len = auth_info.auth_pad_length;
894 data_blob_free(&auth_info.credentials);