This allows auth_ntlmssp_get_ntlmssp_state() to be removed.
Andrew Bartlett
Signed-off-by: Andrew Tridgell <tridge@samba.org>
const DATA_BLOB *sig);
bool auth_ntlmssp_negotiated_sign(struct auth_ntlmssp_state *ans);
bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *ans);
-struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(
- struct auth_ntlmssp_state *ans);
const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *ans);
const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *ans);
const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *ans);
const char *password);
void auth_ntlmssp_and_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
void auth_ntlmssp_or_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
+void auth_ntlmssp_want_feature(struct auth_ntlmssp_state *ans, uint32_t feature);
DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans);
NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *ans,
uint16 enc_ctx_num;
bool enc_on;
union {
- struct ntlmssp_state *ntlmssp_state;
+ struct auth_ntlmssp_state *auth_ntlmssp_state;
#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
struct smb_tran_enc_state_gss *gss_state;
#endif
#include "async_smb.h"
#include "smb_crypt.h"
#include "trans2.h"
+#include "ntlmssp_wrap.h"
/****************************************************************************
Get UNIX extensions version info.
if (!es) {
return NT_STATUS_NO_MEMORY;
}
- status = ntlmssp_client_start(NULL,
+ status = auth_ntlmssp_client_start(NULL,
lp_netbios_name(),
lp_workgroup(),
lp_client_ntlmv2_auth(),
- &es->s.ntlmssp_state);
+ &es->s.auth_ntlmssp_state);
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
- ntlmssp_want_feature(es->s.ntlmssp_state, NTLMSSP_FEATURE_SESSION_KEY);
- es->s.ntlmssp_state->neg_flags |= (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL);
+ auth_ntlmssp_want_feature(es->s.auth_ntlmssp_state, NTLMSSP_FEATURE_SESSION_KEY);
+ auth_ntlmssp_or_flags(es->s.auth_ntlmssp_state, NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL);
- if (!NT_STATUS_IS_OK(status = ntlmssp_set_username(es->s.ntlmssp_state, user))) {
+ if (!NT_STATUS_IS_OK(status = auth_ntlmssp_set_username(es->s.auth_ntlmssp_state, user))) {
goto fail;
}
- if (!NT_STATUS_IS_OK(status = ntlmssp_set_domain(es->s.ntlmssp_state, domain))) {
+ if (!NT_STATUS_IS_OK(status = auth_ntlmssp_set_domain(es->s.auth_ntlmssp_state, domain))) {
goto fail;
}
- if (!NT_STATUS_IS_OK(status = ntlmssp_set_password(es->s.ntlmssp_state, pass))) {
+ if (!NT_STATUS_IS_OK(status = auth_ntlmssp_set_password(es->s.auth_ntlmssp_state, pass))) {
goto fail;
}
do {
- status = ntlmssp_update(es->s.ntlmssp_state, blob_in, &blob_out);
+ status = auth_ntlmssp_update(es->s.auth_ntlmssp_state, blob_in, &blob_out);
data_blob_free(&blob_in);
data_blob_free(¶m_out);
if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) || NT_STATUS_IS_OK(status)) {
return ans->ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL;
}
-struct ntlmssp_state *auth_ntlmssp_get_ntlmssp_state(
- struct auth_ntlmssp_state *ans)
-{
- return ans->ntlmssp_state;
-}
-
/* Needed for 'smb username' processing */
const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *ans)
{
ans->ntlmssp_state->neg_flags |= flags;
}
+void auth_ntlmssp_want_feature(struct auth_ntlmssp_state *ans, uint32_t feature)
+{
+ ntlmssp_want_feature(ans->ntlmssp_state, feature);
+}
+
DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans)
{
return ans->ntlmssp_state->session_key;
NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
bool common_encryption_on(struct smb_trans_enc_state *es);
-NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
-NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
+NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf);
+NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
uint16 enc_ctx_num,
char *buf,
char **ppbuf_out);
#include "../libcli/auth/ntlmssp.h"
#include "smb_crypt.h"
#include "libsmb/libsmb.h"
+#include "ntlmssp_wrap.h"
+
/******************************************************************************
Pull out the encryption context for this packet. 0 means global context.
output, so cope with the same for compatibility.
******************************************************************************/
-NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf)
+NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf)
{
NTSTATUS status;
size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */
/* Point at the signature. */
sig = data_blob_const(inbuf+8, NTLMSSP_SIG_SIZE);
- status = ntlmssp_unseal_packet(ntlmssp_state,
+ status = auth_ntlmssp_unseal_packet(auth_ntlmssp_state,
(unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'E' <enc> <ctx> */
data_len,
(unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE,
output, so do the same for compatibility.
******************************************************************************/
-NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
+NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
uint16 enc_ctx_num,
char *buf,
char **ppbuf_out)
ZERO_STRUCT(sig);
- status = ntlmssp_seal_packet(ntlmssp_state,
+ status = auth_ntlmssp_seal_packet(auth_ntlmssp_state,
frame,
(unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'S' <enc> <ctx> */
data_len,
switch (es->smb_enc_type) {
case SMB_TRANS_ENC_NTLM:
- return common_ntlm_encrypt_buffer(es->s.ntlmssp_state, es->enc_ctx_num, buffer, buf_out);
+ return common_ntlm_encrypt_buffer(es->s.auth_ntlmssp_state, es->enc_ctx_num, buffer, buf_out);
#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
case SMB_TRANS_ENC_GSS:
return common_gss_encrypt_buffer(es->s.gss_state, es->enc_ctx_num, buffer, buf_out);
switch (es->smb_enc_type) {
case SMB_TRANS_ENC_NTLM:
- return common_ntlm_decrypt_buffer(es->s.ntlmssp_state, buf);
+ return common_ntlm_decrypt_buffer(es->s.auth_ntlmssp_state, buf);
#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
case SMB_TRANS_ENC_GSS:
return common_gss_decrypt_buffer(es->s.gss_state, buf);
}
if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
- if (es->s.ntlmssp_state) {
- TALLOC_FREE(es->s.ntlmssp_state);
+ if (es->s.auth_ntlmssp_state) {
+ TALLOC_FREE(es->s.auth_ntlmssp_state);
}
}
#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
* We must remember to update the pointer copy for the common
* functions after any auth_ntlmssp_start/auth_ntlmssp_end.
*/
- ec->es->s.ntlmssp_state = auth_ntlmssp_get_ntlmssp_state(ec->auth_ntlmssp_state);
+ ec->es->s.auth_ntlmssp_state = ec->auth_ntlmssp_state;
return status;
}
if (ec->auth_ntlmssp_state) {
TALLOC_FREE(ec->auth_ntlmssp_state);
/* The auth_ntlmssp_end killed this already. */
- ec->es->s.ntlmssp_state = NULL;
+ ec->es->s.auth_ntlmssp_state = NULL;
}
}