From b4a7b7a8889737e2891fc1176feabd4ce47f2737 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 14 May 2007 12:16:20 +0000 Subject: [PATCH] r22844: Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL }; and replace all data_blob(NULL, 0) calls. (This used to be commit 3d3d61687ef00181f4f04e001d42181d93ac931e) --- source3/auth/auth.c | 2 +- source3/auth/auth_compat.c | 2 +- source3/auth/auth_sam.c | 4 +- source3/auth/auth_server.c | 8 ++-- source3/auth/auth_util.c | 10 ++--- source3/include/smb.h | 2 + source3/lib/data_blob.c | 2 + source3/libads/cldap.c | 8 ++-- source3/libads/kerberos_verify.c | 4 +- source3/libads/krb5_setpw.c | 2 +- source3/libads/sasl.c | 18 ++++---- source3/libsmb/cliconnect.c | 30 ++++++------- source3/libsmb/clifile.c | 2 +- source3/libsmb/clifsinfo.c | 16 +++---- source3/libsmb/clispnego.c | 2 +- source3/libsmb/ntlmssp.c | 34 +++++++-------- source3/libsmb/ntlmssp_parse.c | 2 +- source3/libsmb/smbencrypt.c | 4 +- source3/nsswitch/winbindd_ccache_access.c | 4 +- source3/nsswitch/winbindd_pam.c | 2 +- source3/passdb/pdb_get_set.c | 4 +- source3/printing/nt_printing.c | 6 +-- source3/rpc_client/cli_pipe.c | 30 ++++++------- source3/rpc_parse/parse_samr.c | 4 +- source3/rpc_server/srv_srvsvc_nt.c | 4 +- source3/smbd/negprot.c | 2 +- source3/smbd/seal.c | 22 +++++----- source3/smbd/service.c | 4 +- source3/smbd/sesssetup.c | 20 ++++----- source3/utils/ntlm_auth.c | 52 +++++++++++------------ source3/utils/ntlm_auth_diagnostics.c | 10 ++--- 31 files changed, 160 insertions(+), 156 deletions(-) diff --git a/source3/auth/auth.c b/source3/auth/auth.c index 91a5ac2ff1c..eb239d3d7df 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -79,7 +79,7 @@ static struct auth_init_function_entry *auth_find_backend_entry(const char *name static const uint8 *get_ntlm_challenge(struct auth_context *auth_context) { - DATA_BLOB challenge = data_blob(NULL, 0); + DATA_BLOB challenge = data_blob_null; const char *challenge_set_by = NULL; auth_methods *auth_method; TALLOC_CTX *mem_ctx; diff --git a/source3/auth/auth_compat.c b/source3/auth/auth_compat.c index 13035eece28..65ece50a508 100644 --- a/source3/auth/auth_compat.c +++ b/source3/auth/auth_compat.c @@ -96,7 +96,7 @@ return True if the password is correct, False otherwise BOOL password_ok(char *smb_name, DATA_BLOB password_blob) { - DATA_BLOB null_password = data_blob(NULL, 0); + DATA_BLOB null_password = data_blob_null; BOOL encrypted = (global_encrypted_passwords_negotiated && (password_blob.length == 24 || password_blob.length > 46)); if (encrypted) { diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 0fa68cbb87a..64556cabd34 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -255,8 +255,8 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context, BOOL ret; NTSTATUS nt_status; NTSTATUS update_login_attempts_status; - DATA_BLOB user_sess_key = data_blob(NULL, 0); - DATA_BLOB lm_sess_key = data_blob(NULL, 0); + DATA_BLOB user_sess_key = data_blob_null; + DATA_BLOB lm_sess_key = data_blob_null; BOOL updated_autolock = False, updated_badpw = False; if (!user_info || !auth_context) { diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index c140ef48f9e..e5331893fda 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -226,24 +226,24 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte to pass that unencrypted password over */ *my_private_data = (void *)make_server_security_state(cli); - return data_blob(NULL, 0); + return data_blob_null; } else if (cli->secblob.length < 8) { /* We can't do much if we don't get a full challenge */ DEBUG(2,("make_auth_info_server: Didn't receive a full challenge from server\n")); cli_shutdown(cli); - return data_blob(NULL, 0); + return data_blob_null; } if (!(*my_private_data = (void *)make_server_security_state(cli))) { - return data_blob(NULL,0); + return data_blob_null; } /* The return must be allocated on the caller's mem_ctx, as our own will be destoyed just after the call. */ return data_blob_talloc(auth_context->mem_ctx, cli->secblob.data,8); } else { - return data_blob(NULL, 0); + return data_blob_null; } } diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 1795322b55a..f66c500943b 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -372,11 +372,11 @@ BOOL make_user_info_for_reply(auth_usersupplied_info **user_info, /* We can't do an NT hash here, as the password needs to be case insensitive */ - local_nt_blob = data_blob(NULL, 0); + local_nt_blob = data_blob_null; } else { - local_lm_blob = data_blob(NULL, 0); - local_nt_blob = data_blob(NULL, 0); + local_lm_blob = data_blob_null; + local_nt_blob = data_blob_null; } ret = make_user_info_map( @@ -1570,7 +1570,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, /* ensure we are never given NULL session keys */ if (memcmp(info3->user_sess_key, zeros, sizeof(zeros)) == 0) { - result->user_session_key = data_blob(NULL, 0); + result->user_session_key = data_blob_null; } else { result->user_session_key = data_blob_talloc( result, info3->user_sess_key, @@ -1578,7 +1578,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, } if (memcmp(info3->lm_sess_key, zeros, 8) == 0) { - result->lm_session_key = data_blob(NULL, 0); + result->lm_session_key = data_blob_null; } else { result->lm_session_key = data_blob_talloc( result, info3->lm_sess_key, diff --git a/source3/include/smb.h b/source3/include/smb.h index f903772254c..1a5b43e564b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -538,6 +538,8 @@ typedef struct data_blob_ { void (*free)(struct data_blob_ *data_blob); } DATA_BLOB; +extern const DATA_BLOB data_blob_null; + /* * Structure used to keep directory state information around. * Used in NT change-notify code. diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index e07247bc49e..6ed48888a88 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -21,6 +21,8 @@ #include "includes.h" +const DATA_BLOB data_blob_null = { NULL, 0, NULL }; + /******************************************************************* Free() a data blob. *******************************************************************/ diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c index 3cb98c59c58..227bbc2a0aa 100644 --- a/source3/libads/cldap.c +++ b/source3/libads/cldap.c @@ -187,10 +187,10 @@ static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply) { int ret; ASN1_DATA data; - DATA_BLOB blob = data_blob(NULL, 0); - DATA_BLOB os1 = data_blob(NULL, 0); - DATA_BLOB os2 = data_blob(NULL, 0); - DATA_BLOB os3 = data_blob(NULL, 0); + DATA_BLOB blob = data_blob_null; + DATA_BLOB os1 = data_blob_null; + DATA_BLOB os2 = data_blob_null; + DATA_BLOB os3 = data_blob_null; int i1; /* half the time of a regular ldap timeout, not less than 3 seconds. */ unsigned int al_secs = MAX(3,lp_ldap_timeout()/2); diff --git a/source3/libads/kerberos_verify.c b/source3/libads/kerberos_verify.c index 0ec03ef4bf2..ca36e6e4254 100644 --- a/source3/libads/kerberos_verify.c +++ b/source3/libads/kerberos_verify.c @@ -333,8 +333,8 @@ NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx, *principal = NULL; *pac_data = NULL; - *ap_rep = data_blob(NULL,0); - *session_key = data_blob(NULL,0); + *ap_rep = data_blob_null; + *session_key = data_blob_null; initialize_krb5_error_table(); ret = krb5_init_context(&context); diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c index c7a4b982db4..4aab09c9f45 100644 --- a/source3/libads/krb5_setpw.c +++ b/source3/libads/krb5_setpw.c @@ -88,7 +88,7 @@ static DATA_BLOB encode_krb5_setpw(const char *principal, const char *password) realm = c; } else { /* We must have a realm component. */ - return data_blob(NULL, 0); + return data_blob_null; } memset(&req, 0, sizeof(req)); diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index 2fc66bd9291..f1f08615355 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -28,10 +28,10 @@ */ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) { - DATA_BLOB msg1 = data_blob(NULL, 0); - DATA_BLOB blob = data_blob(NULL, 0); - DATA_BLOB blob_in = data_blob(NULL, 0); - DATA_BLOB blob_out = data_blob(NULL, 0); + DATA_BLOB msg1 = data_blob_null; + DATA_BLOB blob = data_blob_null; + DATA_BLOB blob_in = data_blob_null; + DATA_BLOB blob_out = data_blob_null; struct berval cred, *scred = NULL; int rc; NTSTATUS nt_status; @@ -54,7 +54,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) return ADS_ERROR_NT(nt_status); } - blob_in = data_blob(NULL, 0); + blob_in = data_blob_null; do { nt_status = ntlmssp_update(ntlmssp_state, @@ -90,7 +90,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) blob = data_blob(scred->bv_val, scred->bv_len); ber_bvfree(scred); } else { - blob = data_blob(NULL, 0); + blob = data_blob_null; } } else { @@ -102,7 +102,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) if ((turn == 1) && (rc == LDAP_SASL_BIND_IN_PROGRESS)) { - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = data_blob_null; /* the server might give us back two challenges */ if (!spnego_parse_challenge(blob, &blob_in, &tmp_blob)) { @@ -142,9 +142,9 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads) */ static ADS_STATUS ads_sasl_spnego_krb5_bind(ADS_STRUCT *ads, const char *principal) { - DATA_BLOB blob = data_blob(NULL, 0); + DATA_BLOB blob = data_blob_null; struct berval cred, *scred = NULL; - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = data_blob_null; int rc; rc = spnego_gen_negTokenTarg(principal, ads->auth.time_offset, &blob, &session_key, 0, diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 6991905c587..86834ad081b 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -61,8 +61,8 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli, const char *pass, size_t passlen, const char *workgroup) { - DATA_BLOB session_key = data_blob(NULL, 0); - DATA_BLOB lm_response = data_blob(NULL, 0); + DATA_BLOB session_key = data_blob_null; + DATA_BLOB lm_response = data_blob_null; fstring pword; char *p; @@ -299,9 +299,9 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user, const char *workgroup) { uint32 capabilities = cli_session_setup_capabilities(cli); - DATA_BLOB lm_response = data_blob(NULL, 0); - DATA_BLOB nt_response = data_blob(NULL, 0); - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB lm_response = data_blob_null; + DATA_BLOB nt_response = data_blob_null; + DATA_BLOB session_key = data_blob_null; NTSTATUS result; char *p; @@ -334,7 +334,7 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user, E_md4hash(pass, nt_hash); #ifdef LANMAN_ONLY - nt_response = data_blob(NULL, 0); + nt_response = data_blob_null; #else nt_response = data_blob(NULL, 24); SMBNTencrypt(pass,cli->secblob.data,nt_response.data); @@ -485,7 +485,7 @@ static BOOL cli_session_setup_blob_send(struct cli_state *cli, DATA_BLOB blob) static DATA_BLOB cli_session_setup_blob_receive(struct cli_state *cli) { - DATA_BLOB blob2 = data_blob(NULL, 0); + DATA_BLOB blob2 = data_blob_null; char *p; size_t len; @@ -534,9 +534,9 @@ static BOOL cli_session_setup_blob(struct cli_state *cli, DATA_BLOB blob, DATA_B { int32 remaining = blob.length; int32 cur = 0; - DATA_BLOB send_blob = data_blob(NULL, 0); + DATA_BLOB send_blob = data_blob_null; int32 max_blob_size = 0; - DATA_BLOB receive_blob = data_blob(NULL, 0); + DATA_BLOB receive_blob = data_blob_null; if (cli->max_xmit < BASE_SESSSETUP_BLOB_PACKET_SIZE + 1) { DEBUG(0,("cli_session_setup_blob: cli->max_xmit too small " @@ -554,7 +554,7 @@ static BOOL cli_session_setup_blob(struct cli_state *cli, DATA_BLOB blob, DATA_B send_blob.length = max_blob_size; remaining -= max_blob_size; } else { - DATA_BLOB null_blob = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; send_blob.length = remaining; remaining = 0; @@ -656,9 +656,9 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use NTSTATUS nt_status; int turn = 1; DATA_BLOB msg1; - DATA_BLOB blob = data_blob(NULL, 0); - DATA_BLOB blob_in = data_blob(NULL, 0); - DATA_BLOB blob_out = data_blob(NULL, 0); + DATA_BLOB blob = data_blob_null; + DATA_BLOB blob_in = data_blob_null; + DATA_BLOB blob_out = data_blob_null; cli_temp_set_signing(cli); @@ -715,7 +715,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use } } else if ((turn == 1) && NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = data_blob_null; /* the server might give us back two challenges */ if (!spnego_parse_challenge(blob, &blob_in, &tmp_blob)) { @@ -743,7 +743,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use DATA_BLOB key = data_blob(ntlmssp_state->session_key.data, ntlmssp_state->session_key.length); - DATA_BLOB null_blob = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; BOOL res; fstrcpy(cli->server_domain, ntlmssp_state->server_domain); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 2e1c156f14a..61c4347b5bc 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1505,7 +1505,7 @@ NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB * return cli_nt_error(cli); } - *blob = data_blob(NULL, 0); + *blob = data_blob_null; return NT_STATUS_OK; } diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 0bc4f7f2f2f..d8ada1a896d 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -395,9 +395,9 @@ NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, const char *pass, const char *domain) { - DATA_BLOB blob_in = data_blob(NULL, 0); - DATA_BLOB blob_out = data_blob(NULL, 0); - DATA_BLOB param_out = data_blob(NULL, 0); + DATA_BLOB blob_in = data_blob_null; + DATA_BLOB blob_out = data_blob_null; + DATA_BLOB param_out = data_blob_null; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; struct smb_trans_enc_state *es = make_cli_enc_state(SMB_TRANS_ENC_NTLM); @@ -477,8 +477,8 @@ static NTSTATUS make_cli_gss_blob(struct smb_trans_enc_state *es, gss_buffer_desc input_name; gss_buffer_desc *p_tok_in; gss_buffer_desc tok_out, tok_in; - DATA_BLOB blob_out = data_blob(NULL, 0); - DATA_BLOB blob_in = data_blob(NULL, 0); + DATA_BLOB blob_out = data_blob_null; + DATA_BLOB blob_in = data_blob_null; char *host_princ_s = NULL; OM_uint32 ret_flags = 0; NTSTATUS status = NT_STATUS_OK; @@ -569,9 +569,9 @@ static NTSTATUS make_cli_gss_blob(struct smb_trans_enc_state *es, NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli) { - DATA_BLOB blob_recv = data_blob(NULL, 0); - DATA_BLOB blob_send = data_blob(NULL, 0); - DATA_BLOB param_out = data_blob(NULL, 0); + DATA_BLOB blob_recv = data_blob_null; + DATA_BLOB blob_send = data_blob_null; + DATA_BLOB param_out = data_blob_null; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; fstring fqdn; const char *servicename; diff --git a/source3/libsmb/clispnego.c b/source3/libsmb/clispnego.c index d2494cac864..5ea5cf3011d 100644 --- a/source3/libsmb/clispnego.c +++ b/source3/libsmb/clispnego.c @@ -542,7 +542,7 @@ BOOL spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status, asn1_check_enumerated(&data, negResult); asn1_end_tag(&data); - *auth = data_blob(NULL,0); + *auth = data_blob_null; if (asn1_tag_remaining(&data)) { asn1_start_tag(&data,ASN1_CONTEXT(1)); diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index 2bc2183adde..73680709859 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -299,13 +299,13 @@ NTSTATUS ntlmssp_update(NTLMSSP_STATE *ntlmssp_state, return NT_STATUS_INVALID_PARAMETER; } - *out = data_blob(NULL, 0); + *out = data_blob_null; if (!in.length && ntlmssp_state->stored_response.length) { input = ntlmssp_state->stored_response; /* we only want to read the stored response once - overwrite it */ - ntlmssp_state->stored_response = data_blob(NULL, 0); + ntlmssp_state->stored_response = data_blob_null; } else { input = in; } @@ -582,7 +582,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state, NTLMSSP_NAME_TYPE_SERVER_DNS, dnsname, 0, ""); } else { - struct_blob = data_blob(NULL, 0); + struct_blob = data_blob_null; } { @@ -623,10 +623,10 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state, static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, const DATA_BLOB request, DATA_BLOB *reply) { - DATA_BLOB encrypted_session_key = data_blob(NULL, 0); - DATA_BLOB user_session_key = data_blob(NULL, 0); - DATA_BLOB lm_session_key = data_blob(NULL, 0); - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB encrypted_session_key = data_blob_null; + DATA_BLOB user_session_key = data_blob_null; + DATA_BLOB lm_session_key = data_blob_null; + DATA_BLOB session_key = data_blob_null; uint32 ntlmssp_command, auth_flags; NTSTATUS nt_status = NT_STATUS_OK; @@ -642,7 +642,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, char *workstation = NULL; /* parse the NTLMSSP packet */ - *reply = data_blob(NULL, 0); + *reply = data_blob_null; #if 0 file_save("ntlmssp_auth.dat", request.data, request.length); @@ -807,7 +807,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, } else { DEBUG(10,("ntlmssp_server_auth: Failed to create NTLM2 session key.\n")); - session_key = data_blob(NULL, 0); + session_key = data_blob_null; } } else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) { if (lm_session_key.data && lm_session_key.length >= 8) { @@ -834,7 +834,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, session_key.length); } else { DEBUG(10,("ntlmssp_server_auth: Failed to create NTLM session key.\n")); - session_key = data_blob(NULL, 0); + session_key = data_blob_null; } } else if (user_session_key.data) { session_key = user_session_key; @@ -846,7 +846,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, dump_data_pw("unmodified session key:\n", session_key.data, session_key.length); } else { DEBUG(10,("ntlmssp_server_auth: Failed to create unmodified session key.\n")); - session_key = data_blob(NULL, 0); + session_key = data_blob_null; } /* With KEY_EXCH, the client supplies the proposed session key, @@ -877,7 +877,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, } if (!NT_STATUS_IS_OK(nt_status)) { - ntlmssp_state->session_key = data_blob(NULL, 0); + ntlmssp_state->session_key = data_blob_null; } else if (ntlmssp_state->session_key.length) { nt_status = ntlmssp_sign_init(ntlmssp_state); } @@ -992,14 +992,14 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state, uint32 chal_flags, ntlmssp_command, unkn1, unkn2; DATA_BLOB server_domain_blob; DATA_BLOB challenge_blob; - DATA_BLOB struct_blob = data_blob(NULL, 0); + DATA_BLOB struct_blob = data_blob_null; char *server_domain; const char *chal_parse_string; const char *auth_gen_string; - DATA_BLOB lm_response = data_blob(NULL, 0); - DATA_BLOB nt_response = data_blob(NULL, 0); - DATA_BLOB session_key = data_blob(NULL, 0); - DATA_BLOB encrypted_session_key = data_blob(NULL, 0); + DATA_BLOB lm_response = data_blob_null; + DATA_BLOB nt_response = data_blob_null; + DATA_BLOB session_key = data_blob_null; + DATA_BLOB encrypted_session_key = data_blob_null; NTSTATUS nt_status = NT_STATUS_OK; if (!msrpc_parse(&reply, "CdBd", diff --git a/source3/libsmb/ntlmssp_parse.c b/source3/libsmb/ntlmssp_parse.c index e71504867e9..3d96fa5f1a7 100644 --- a/source3/libsmb/ntlmssp_parse.c +++ b/source3/libsmb/ntlmssp_parse.c @@ -265,7 +265,7 @@ BOOL msrpc_parse(const DATA_BLOB *blob, b = (DATA_BLOB *)va_arg(ap, void *); if (len1 == 0 && len2 == 0) { - *b = data_blob(NULL, 0); + *b = data_blob_null; } else { /* make sure its in the right format - be strict */ if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) { diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index ad833374f3d..25861289669 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -347,7 +347,7 @@ void SMBsesskeygen_lm_sess_key(const uchar lm_hash[16], DATA_BLOB NTLMv2_generate_names_blob(const char *hostname, const char *domain) { - DATA_BLOB names_blob = data_blob(NULL, 0); + DATA_BLOB names_blob = data_blob_null; msrpc_gen(&names_blob, "aaa", NTLMSSP_NAME_TYPE_DOMAIN, domain, @@ -359,7 +359,7 @@ DATA_BLOB NTLMv2_generate_names_blob(const char *hostname, static DATA_BLOB NTLMv2_generate_client_data(const DATA_BLOB *names_blob) { uchar client_chal[8]; - DATA_BLOB response = data_blob(NULL, 0); + DATA_BLOB response = data_blob_null; char long_date[8]; generate_random_buffer(client_chal, sizeof(client_chal)); diff --git a/source3/nsswitch/winbindd_ccache_access.c b/source3/nsswitch/winbindd_ccache_access.c index f439a0457d7..31f475cb26a 100644 --- a/source3/nsswitch/winbindd_ccache_access.c +++ b/source3/nsswitch/winbindd_ccache_access.c @@ -94,8 +94,8 @@ static NTSTATUS do_ntlm_auth_with_hashes(const char *username, Since we have a copy of the initial message that the client sent, we could resolve any discrepancies if we had to. */ - dummy_msg = data_blob(NULL, 0); - reply = data_blob(NULL, 0); + dummy_msg = data_blob_null; + reply = data_blob_null; status = ntlmssp_update(ntlmssp_state, dummy_msg, &reply); data_blob_free(&dummy_msg); data_blob_free(&reply); diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c index e4acb051b30..bd2f82fb98a 100644 --- a/source3/nsswitch/winbindd_pam.c +++ b/source3/nsswitch/winbindd_pam.c @@ -1155,7 +1155,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain, local_lm_response, sizeof(local_lm_response)); } else { - lm_resp = data_blob(NULL, 0); + lm_resp = data_blob_null; } SMBNTencrypt(state->request.data.auth.pass, chal, diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index 62898f3dac8..309161bf0f4 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -849,7 +849,7 @@ BOOL pdb_set_nt_passwd(struct samu *sampass, const uint8 pwd[NT_HASH_LEN], enum sampass->nt_pw = data_blob_talloc(sampass, pwd, NT_HASH_LEN); } else { - sampass->nt_pw = data_blob(NULL, 0); + sampass->nt_pw = data_blob_null; } return pdb_set_init_flags(sampass, PDB_NTPASSWD, flag); @@ -868,7 +868,7 @@ BOOL pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e if (pwd && lp_lanman_auth() ) { sampass->lm_pw = data_blob_talloc(sampass, pwd, LM_HASH_LEN); } else { - sampass->lm_pw = data_blob(NULL, 0); + sampass->lm_pw = data_blob_null; } return pdb_set_init_flags(sampass, PDB_LMPASSWD, flag); diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index f3d2513c3f6..965793b3cf3 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1429,7 +1429,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_ */ /* Null password is ok - we are already an authenticated user... */ - null_pw = data_blob(NULL, 0); + null_pw = data_blob_null; fstrcpy(res_type, "A:"); become_root(); conn = make_connection_with_chdir("print$", null_pw, res_type, user->vuid, &nt_status); @@ -1766,7 +1766,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract * Note we must be root to do this. */ - null_pw = data_blob(NULL, 0); + null_pw = data_blob_null; fstrcpy(res_type, "A:"); become_root(); conn = make_connection_with_chdir("print$", null_pw, res_type, user->vuid, &nt_status); @@ -4909,7 +4909,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct * do this. */ - null_pw = data_blob( NULL, 0 ); + null_pw = data_blob_null; fstrcpy(res_type, "A:"); become_root(); conn = make_connection_with_chdir( "print$", null_pw, res_type, user->vuid, &nt_status ); diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index ab7f0b9b478..5f21caeccfd 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -915,8 +915,8 @@ static NTSTATUS create_krb5_auth_bind_req( struct rpc_pipe_client *cli, #ifdef HAVE_KRB5 int ret; struct kerberos_auth_struct *a = cli->auth.a_u.kerberos_auth; - DATA_BLOB tkt = data_blob(NULL, 0); - DATA_BLOB tkt_wrapped = data_blob(NULL, 0); + DATA_BLOB tkt = data_blob_null; + DATA_BLOB tkt_wrapped = data_blob_null; /* We may change the pad length before marshalling. */ init_rpc_hdr_auth(pauth_out, RPC_KRB5_AUTH_TYPE, (int)auth_level, 0, 1); @@ -972,9 +972,9 @@ static NTSTATUS create_spnego_ntlmssp_auth_rpc_bind_req( struct rpc_pipe_client prs_struct *auth_data) { NTSTATUS nt_status; - DATA_BLOB null_blob = data_blob(NULL, 0); - DATA_BLOB request = data_blob(NULL, 0); - DATA_BLOB spnego_msg = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; + DATA_BLOB request = data_blob_null; + DATA_BLOB spnego_msg = data_blob_null; /* We may change the pad length before marshalling. */ init_rpc_hdr_auth(pauth_out, RPC_SPNEGO_AUTH_TYPE, (int)auth_level, 0, 1); @@ -1019,8 +1019,8 @@ static NTSTATUS create_ntlmssp_auth_rpc_bind_req( struct rpc_pipe_client *cli, prs_struct *auth_data) { NTSTATUS nt_status; - DATA_BLOB null_blob = data_blob(NULL, 0); - DATA_BLOB request = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; + DATA_BLOB request = data_blob_null; /* We may change the pad length before marshalling. */ init_rpc_hdr_auth(pauth_out, RPC_NTLMSSP_AUTH_TYPE, (int)auth_level, 0, 1); @@ -1250,7 +1250,7 @@ static NTSTATUS add_ntlmssp_auth_footer(struct rpc_pipe_client *cli, { RPC_HDR_AUTH auth_info; NTSTATUS status; - DATA_BLOB auth_blob = data_blob(NULL, 0); + DATA_BLOB auth_blob = data_blob_null; uint16 data_and_pad_len = prs_offset(outgoing_pdu) - RPC_HEADER_LEN - RPC_HDR_RESP_LEN; if (!cli->auth.a_u.ntlmssp_state) { @@ -1775,8 +1775,8 @@ static NTSTATUS rpc_finish_auth3_bind(struct rpc_pipe_client *cli, enum pipe_auth_type auth_type, enum pipe_auth_level auth_level) { - DATA_BLOB server_response = data_blob(NULL,0); - DATA_BLOB client_reply = data_blob(NULL,0); + DATA_BLOB server_response = data_blob_null; + DATA_BLOB client_reply = data_blob_null; RPC_HDR_AUTH hdr_auth; NTSTATUS nt_status; prs_struct rpc_out; @@ -1900,10 +1900,10 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli, enum pipe_auth_type auth_type, enum pipe_auth_level auth_level) { - DATA_BLOB server_spnego_response = data_blob(NULL,0); - DATA_BLOB server_ntlm_response = data_blob(NULL,0); - DATA_BLOB client_reply = data_blob(NULL,0); - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB server_spnego_response = data_blob_null; + DATA_BLOB server_ntlm_response = data_blob_null; + DATA_BLOB client_reply = data_blob_null; + DATA_BLOB tmp_blob = data_blob_null; RPC_HDR_AUTH hdr_auth; NTSTATUS nt_status; prs_struct rpc_out; @@ -1953,7 +1953,7 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli, tmp_blob = spnego_gen_auth(client_reply); data_blob_free(&client_reply); client_reply = tmp_blob; - tmp_blob = data_blob(NULL,0); /* Ensure it's safe to free this just in case. */ + tmp_blob = data_blob_null; /* Ensure it's safe to free this just in case. */ /* Now prepare the alter context pdu. */ prs_init(&rpc_out, 0, prs_get_mem_context(rbuf), MARSHALL); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 529ad319bb8..223ce869774 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6317,7 +6317,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * if (munged_dial) { munged_dial_blob = base64_decode_data_blob(munged_dial); } else { - munged_dial_blob = data_blob(NULL, 0); + munged_dial_blob = data_blob_null; } /* Create NTTIME structs */ @@ -6571,7 +6571,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw) if (munged_dial) { blob = base64_decode_data_blob(munged_dial); } else { - blob = data_blob(NULL, 0); + blob = data_blob_null; } init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 59e86e49123..d0f2aa500fc 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2048,7 +2048,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecur /* Null password is ok - we are already an authenticated user... */ - null_pw = data_blob(NULL, 0); + null_pw = data_blob_null; become_root(); conn = make_connection(r->in.share, null_pw, "A:", p->pipe_user.vuid, &nt_status); @@ -2153,7 +2153,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecur ZERO_STRUCT(st); /* Null password is ok - we are already an authenticated user... */ - null_pw = data_blob(NULL, 0); + null_pw = data_blob_null; become_root(); conn = make_connection(r->in.share, null_pw, "A:", p->pipe_user.vuid, &nt_status); diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 1722c81d2aa..12b1e846004 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -229,7 +229,7 @@ static DATA_BLOB negprot_spnego(void) strlower_m(myname); asprintf(&host_princ_s, "cifs/%s@%s", myname, lp_realm()); if (host_princ_s == NULL) { - blob = data_blob(NULL, 0); + blob = data_blob_null; return blob; } blob = spnego_gen_negTokenInit(guid, OIDs_krb5, host_princ_s); diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c index c4d60b0a60b..5d8ef9b63c8 100644 --- a/source3/smbd/seal.c +++ b/source3/smbd/seal.c @@ -346,8 +346,8 @@ static NTSTATUS srv_enc_spnego_gss_negotiate(unsigned char **ppdata, size_t *p_d OM_uint32 flags = 0; gss_buffer_desc in_buf, out_buf; struct smb_tran_enc_state_gss *gss_state; - DATA_BLOB auth_reply = data_blob(NULL,0); - DATA_BLOB response = data_blob(NULL,0); + DATA_BLOB auth_reply = data_blob_null; + DATA_BLOB response = data_blob_null; NTSTATUS status; if (!partial_srv_trans_enc_ctx) { @@ -419,8 +419,8 @@ static NTSTATUS srv_enc_spnego_gss_negotiate(unsigned char **ppdata, size_t *p_d static NTSTATUS srv_enc_ntlm_negotiate(unsigned char **ppdata, size_t *p_data_size, DATA_BLOB secblob, BOOL spnego_wrap) { NTSTATUS status; - DATA_BLOB chal = data_blob(NULL, 0); - DATA_BLOB response = data_blob(NULL, 0); + DATA_BLOB chal = data_blob_null; + DATA_BLOB response = data_blob_null; status = make_srv_encryption_context(SMB_TRANS_ENC_NTLM, &partial_srv_trans_enc_ctx); if (!NT_STATUS_IS_OK(status)) { @@ -459,8 +459,8 @@ static NTSTATUS srv_enc_spnego_negotiate(connection_struct *conn, size_t *p_param_size) { NTSTATUS status; - DATA_BLOB blob = data_blob(NULL,0); - DATA_BLOB secblob = data_blob(NULL, 0); + DATA_BLOB blob = data_blob_null; + DATA_BLOB secblob = data_blob_null; BOOL got_kerberos_mechanism = False; blob = data_blob_const(*ppdata, *p_data_size); @@ -514,10 +514,10 @@ static NTSTATUS srv_enc_spnego_ntlm_auth(connection_struct *conn, size_t *p_param_size) { NTSTATUS status; - DATA_BLOB blob = data_blob(NULL,0); - DATA_BLOB auth = data_blob(NULL,0); - DATA_BLOB auth_reply = data_blob(NULL,0); - DATA_BLOB response = data_blob(NULL,0); + DATA_BLOB blob = data_blob_null; + DATA_BLOB auth = data_blob_null; + DATA_BLOB auth_reply = data_blob_null; + DATA_BLOB response = data_blob_null; struct smb_srv_trans_enc_ctx *ec = partial_srv_trans_enc_ctx; /* We must have a partial context here. */ @@ -567,7 +567,7 @@ static NTSTATUS srv_enc_raw_ntlm_auth(connection_struct *conn, { NTSTATUS status; DATA_BLOB blob = data_blob_const(*ppdata, *p_data_size); - DATA_BLOB response = data_blob(NULL,0); + DATA_BLOB response = data_blob_null; struct smb_srv_trans_enc_ctx *ec; if (!partial_srv_trans_enc_ctx) { diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 79c618e7b37..6d2cdff5942 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -1230,7 +1230,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password, if (strequal(service_in,HOMES_NAME)) { if(lp_security() != SEC_SHARE) { - DATA_BLOB no_pw = data_blob(NULL, 0); + DATA_BLOB no_pw = data_blob_null; if (vuser->homes_snum == -1) { DEBUG(2, ("[homes] share not available for " "this user because it was not found " @@ -1266,7 +1266,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password, } else if ((lp_security() != SEC_SHARE) && (vuser->homes_snum != -1) && strequal(service_in, lp_servicename(vuser->homes_snum))) { - DATA_BLOB no_pw = data_blob(NULL, 0); + DATA_BLOB no_pw = data_blob_null; DEBUG(5, ("making a connection to 'homes' service [%s] " "created at session setup time\n", service_in)); return make_connection_snum(vuser->homes_snum, diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index d6cdf777d8a..dcff27f70c9 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -177,7 +177,7 @@ static BOOL make_krb5_skew_error(DATA_BLOB *pblob_out) char *host_princ_s = NULL; BOOL ret = False; - *pblob_out = data_blob(NULL,0); + *pblob_out = data_blob_null; initialize_krb5_error_table(); kerr = krb5_init_context(&context); @@ -243,9 +243,9 @@ static int reply_spnego_kerberos(connection_struct *conn, PAC_DATA *pac_data; DATA_BLOB ap_rep, ap_rep_wrapped, response; auth_serversupplied_info *server_info = NULL; - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = data_blob_null; uint8 tok_id[2]; - DATA_BLOB nullblob = data_blob(NULL, 0); + DATA_BLOB nullblob = data_blob_null; fstring real_username; BOOL map_domainuser_to_guest = False; BOOL username_was_mapped; @@ -539,7 +539,7 @@ static int reply_spnego_kerberos(connection_struct *conn, if (NT_STATUS_IS_OK(ret)) { ap_rep_wrapped = spnego_gen_krb5_wrap(ap_rep, TOK_ID_KRB_AP_REP); } else { - ap_rep_wrapped = data_blob(NULL, 0); + ap_rep_wrapped = data_blob_null; } response = spnego_gen_auth_response(&ap_rep_wrapped, ret, OID_KERBEROS5_OLD); reply_sesssetup_blob(conn, inbuf, outbuf, response, ret); @@ -582,7 +582,7 @@ static BOOL reply_spnego_ntlmssp(connection_struct *conn, char *inbuf, char *out if (NT_STATUS_IS_OK(nt_status)) { int sess_vuid; - DATA_BLOB nullblob = data_blob(NULL, 0); + DATA_BLOB nullblob = data_blob_null; DATA_BLOB session_key = data_blob((*auth_ntlmssp_state)->ntlmssp_state->session_key.data, (*auth_ntlmssp_state)->ntlmssp_state->session_key.length); /* register_vuid keeps the server info */ @@ -748,9 +748,9 @@ static int reply_spnego_auth(connection_struct *conn, char *inbuf, char *outbuf, DATA_BLOB blob1, AUTH_NTLMSSP_STATE **auth_ntlmssp_state) { - DATA_BLOB auth = data_blob(NULL,0); - DATA_BLOB auth_reply = data_blob(NULL,0); - DATA_BLOB secblob = data_blob(NULL,0); + DATA_BLOB auth = data_blob_null; + DATA_BLOB auth_reply = data_blob_null; + DATA_BLOB secblob = data_blob_null; NTSTATUS status = NT_STATUS_INVALID_PARAMETER; if (!spnego_parse_auth(blob1, &auth)) { @@ -1089,7 +1089,7 @@ static int reply_sesssetup_and_X_spnego(connection_struct *conn, char *inbuf, } if (!vuser) { - vuid = register_vuid(NULL, data_blob(NULL, 0), data_blob(NULL, 0), NULL); + vuid = register_vuid(NULL, data_blob_null, data_blob_null, NULL); if (vuid == UID_FIELD_INVALID ) { data_blob_free(&blob1); return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER)); @@ -1509,7 +1509,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf, if (server_info->user_session_key.data) { session_key = data_blob(server_info->user_session_key.data, server_info->user_session_key.length); } else { - session_key = data_blob(NULL, 0); + session_key = data_blob_null; } data_blob_clear_free(&plaintext_password); diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 2bdbdc04227..4a74db6b4ab 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -704,7 +704,7 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod } request = base64_decode_data_blob(buf + 3); } else { - request = data_blob(NULL, 0); + request = data_blob_null; } if ((strncmp(buf, "PW ", 3) == 0)) { @@ -832,7 +832,7 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo } request = base64_decode_data_blob(buf + 3); } else { - request = data_blob(NULL, 0); + request = data_blob_null; } if (strncmp(buf, "PW ", 3) == 0) { @@ -854,7 +854,7 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo if (!ntlmssp_state && use_cached_creds) { /* check whether credentials are usable. */ - DATA_BLOB empty_blob = data_blob(NULL, 0); + DATA_BLOB empty_blob = data_blob_null; nt_status = do_ccache_ntlm_auth(empty_blob, empty_blob, NULL); if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { @@ -910,7 +910,7 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo } ntlmssp_want_feature_list(ntlmssp_state, want_feature_list); first = True; - initial_message = data_blob(NULL, 0); + initial_message = data_blob_null; } DEBUG(10, ("got NTLMSSP packet:\n")); @@ -1140,7 +1140,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, response.type = SPNEGO_NEG_TOKEN_TARG; response.negTokenTarg.supportedMech = SMB_STRDUP(OID_NTLMSSP); - response.negTokenTarg.mechListMIC = data_blob(NULL, 0); + response.negTokenTarg.mechListMIC = data_blob_null; status = ntlmssp_update(ntlmssp_state, request.negTokenInit.mechToken, @@ -1163,8 +1163,8 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, response.type = SPNEGO_NEG_TOKEN_TARG; response.negTokenTarg.supportedMech = SMB_STRDUP(OID_KERBEROS5_OLD); - response.negTokenTarg.mechListMIC = data_blob(NULL, 0); - response.negTokenTarg.responseToken = data_blob(NULL, 0); + response.negTokenTarg.mechListMIC = data_blob_null; + response.negTokenTarg.responseToken = data_blob_null; status = ads_verify_ticket(mem_ctx, lp_realm(), 0, &request.negTokenInit.mechToken, @@ -1222,7 +1222,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, response.type = SPNEGO_NEG_TOKEN_TARG; response.negTokenTarg.supportedMech = SMB_STRDUP(OID_NTLMSSP); - response.negTokenTarg.mechListMIC = data_blob(NULL, 0); + response.negTokenTarg.mechListMIC = data_blob_null; if (NT_STATUS_IS_OK(status)) { user = SMB_STRDUP(ntlmssp_state->user); @@ -1276,7 +1276,7 @@ static NTLMSSP_STATE *client_ntlmssp_state = NULL; static BOOL manage_client_ntlmssp_init(SPNEGO_DATA spnego) { NTSTATUS status; - DATA_BLOB null_blob = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; DATA_BLOB to_server; char *to_server_base64; const char *my_mechs[] = {OID_NTLMSSP, NULL}; @@ -1337,7 +1337,7 @@ static BOOL manage_client_ntlmssp_init(SPNEGO_DATA spnego) static void manage_client_ntlmssp_targ(SPNEGO_DATA spnego) { NTSTATUS status; - DATA_BLOB null_blob = data_blob(NULL, 0); + DATA_BLOB null_blob = data_blob_null; DATA_BLOB request; DATA_BLOB to_server; char *to_server_base64; @@ -1398,7 +1398,7 @@ static BOOL manage_client_krb5_init(SPNEGO_DATA spnego) { char *principal; DATA_BLOB tkt, to_server; - DATA_BLOB session_key_krb5 = data_blob(NULL, 0); + DATA_BLOB session_key_krb5 = data_blob_null; SPNEGO_DATA reply; char *reply_base64; int retval; @@ -1462,7 +1462,7 @@ static BOOL manage_client_krb5_init(SPNEGO_DATA spnego) reply.negTokenInit.mechTypes = my_mechs; reply.negTokenInit.reqFlags = 0; reply.negTokenInit.mechToken = tkt; - reply.negTokenInit.mechListMIC = data_blob(NULL, 0); + reply.negTokenInit.mechListMIC = data_blob_null; len = write_spnego_data(&to_server, &reply); data_blob_free(&tkt); @@ -1751,9 +1751,9 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } } /* clear out the state */ - challenge = data_blob(NULL, 0); - nt_response = data_blob(NULL, 0); - lm_response = data_blob(NULL, 0); + challenge = data_blob_null; + nt_response = data_blob_null; + lm_response = data_blob_null; SAFE_FREE(full_username); SAFE_FREE(username); SAFE_FREE(domain); @@ -1800,7 +1800,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n", parameter, (int)challenge.length); - challenge = data_blob(NULL, 0); + challenge = data_blob_null; } } else if (strequal(request, "NT-Response")) { nt_response = strhex_to_data_blob(NULL, parameter); @@ -1808,7 +1808,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod x_fprintf(x_stdout, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n", parameter, (int)nt_response.length); - nt_response = data_blob(NULL, 0); + nt_response = data_blob_null; } } else if (strequal(request, "LANMAN-Response")) { lm_response = strhex_to_data_blob(NULL, parameter); @@ -1816,7 +1816,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n", parameter, (int)lm_response.length); - lm_response = data_blob(NULL, 0); + lm_response = data_blob_null; } } else if (strequal(request, "Password")) { plaintext_password = smb_xstrdup(parameter); @@ -1950,10 +1950,10 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ SAFE_FREE(error_string); } /* clear out the state */ - new_nt_pswd = data_blob(NULL, 0); - old_nt_hash_enc = data_blob(NULL, 0); - new_lm_pswd = data_blob(NULL, 0); - old_nt_hash_enc = data_blob(NULL, 0); + new_nt_pswd = data_blob_null; + old_nt_hash_enc = data_blob_null; + new_lm_pswd = data_blob_null; + old_nt_hash_enc = data_blob_null; SAFE_FREE(full_username); SAFE_FREE(username); SAFE_FREE(domain); @@ -1999,7 +1999,7 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ "(got %d bytes, expected 516)\n.\n", parameter, (int)new_nt_pswd.length); - new_nt_pswd = data_blob(NULL, 0); + new_nt_pswd = data_blob_null; } } else if (strequal(request, "old-nt-hash-blob")) { old_nt_hash_enc = strhex_to_data_blob(NULL, parameter); @@ -2008,7 +2008,7 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ "(got %d bytes, expected 16)\n.\n", parameter, (int)old_nt_hash_enc.length); - old_nt_hash_enc = data_blob(NULL, 0); + old_nt_hash_enc = data_blob_null; } } else if (strequal(request, "new-lm-password-blob")) { new_lm_pswd = strhex_to_data_blob(NULL, parameter); @@ -2017,7 +2017,7 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ "(got %d bytes, expected 516)\n.\n", parameter, (int)new_lm_pswd.length); - new_lm_pswd = data_blob(NULL, 0); + new_lm_pswd = data_blob_null; } } else if (strequal(request, "old-lm-hash-blob")) { @@ -2028,7 +2028,7 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ "(got %d bytes, expected 16)\n.\n", parameter, (int)old_lm_hash_enc.length); - old_lm_hash_enc = data_blob(NULL, 0); + old_lm_hash_enc = data_blob_null; } } else if (strequal(request, "nt-domain")) { domain = smb_xstrdup(parameter); diff --git a/source3/utils/ntlm_auth_diagnostics.c b/source3/utils/ntlm_auth_diagnostics.c index 0ebe77b0d10..a4e0d6b1ba9 100644 --- a/source3/utils/ntlm_auth_diagnostics.c +++ b/source3/utils/ntlm_auth_diagnostics.c @@ -314,9 +314,9 @@ static BOOL test_lmv2_ntlmv2_broken(enum ntlm_break break_which) BOOL pass = True; NTSTATUS nt_status; uint32 flags = 0; - DATA_BLOB ntlmv2_response = data_blob(NULL, 0); - DATA_BLOB lmv2_response = data_blob(NULL, 0); - DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); + DATA_BLOB ntlmv2_response = data_blob_null; + DATA_BLOB lmv2_response = data_blob_null; + DATA_BLOB ntlmv2_session_key = data_blob_null; DATA_BLOB names_blob = NTLMv2_generate_names_blob(get_winbind_netbios_name(), get_winbind_domain()); uchar user_session_key[16]; @@ -442,8 +442,8 @@ static BOOL test_plaintext(enum ntlm_break break_which) { NTSTATUS nt_status; uint32 flags = 0; - DATA_BLOB nt_response = data_blob(NULL, 0); - DATA_BLOB lm_response = data_blob(NULL, 0); + DATA_BLOB nt_response = data_blob_null; + DATA_BLOB lm_response = data_blob_null; char *password; smb_ucs2_t *nt_response_ucs2; -- 2.34.1