#include "libsmb/libsmb.h"
#include "ntlmssp_wrap.h"
#include "libcli/auth/krb5_wrap.h"
+#include "auth/gensec/gensec.h"
+#undef malloc
/******************************************************************************
Pull out the encryption context for this packet. 0 means global context.
/* Point at the signature. */
sig = data_blob_const(inbuf+8, NTLMSSP_SIG_SIZE);
- status = auth_ntlmssp_unseal_packet(auth_ntlmssp_state,
+ status = gensec_unseal_packet(auth_ntlmssp_state->gensec_security,
(unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'E' <enc> <ctx> */
data_len,
(unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE,
* check needed.
*/
- buf_out = SMB_XMALLOC_ARRAY(char, 8 + NTLMSSP_SIG_SIZE + data_len);
+ buf_out = (char *)malloc(8 + NTLMSSP_SIG_SIZE + data_len);
+ if (buf_out == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
/* Copy the data from the original buffer. */
ZERO_STRUCT(sig);
- status = auth_ntlmssp_seal_packet(auth_ntlmssp_state,
- frame,
+ status = gensec_seal_packet(auth_ntlmssp_state->gensec_security,
+ frame,
(unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'S' <enc> <ctx> */
data_len,
(unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE,
* bother :-*(. JRA.
*/
- *ppbuf_out = (char *)SMB_MALLOC(out_buf.length + 8); /* We know this can't wrap. */
+ *ppbuf_out = (char *)malloc(out_buf.length + 8); /* We know this can't wrap. */
if (!*ppbuf_out) {
gss_release_buffer(&minor, &out_buf);
return NT_STATUS_NO_MEMORY;
return;
}
- if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
- SAFE_FREE(buf);
- return;
- }
-
-#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
- if (es->smb_enc_type == SMB_TRANS_ENC_GSS) {
- OM_uint32 min;
- gss_buffer_desc rel_buf;
- rel_buf.value = buf;
- rel_buf.length = smb_len_nbt(buf) + 4;
- gss_release_buffer(&min, &rel_buf);
- }
-#endif
+ SAFE_FREE(buf);
}