From: Volker Lendecke Date: Wed, 24 Dec 2025 08:41:02 +0000 (+0100) Subject: lib: Don't call a function to initialize an empty DATA_BLOB X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff627b2b41eba26a0dbe7744b6a027e001583828;p=thirdparty%2Fsamba.git lib: Don't call a function to initialize an empty DATA_BLOB Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c index 8c2a1f9c0aa..f8b3f9c0b3a 100644 --- a/auth/ntlmssp/ntlmssp_client.c +++ b/auth/ntlmssp/ntlmssp_client.c @@ -227,16 +227,16 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, uint32_t chal_flags, ntlmssp_command, unkn1 = 0, unkn2 = 0; DATA_BLOB server_domain_blob; DATA_BLOB challenge_blob; - DATA_BLOB target_info = data_blob(NULL, 0); + DATA_BLOB target_info = {}; char *server_domain; const char *chal_parse_string; const char *chal_parse_string_short = NULL; 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 lm_session_key = data_blob(NULL, 0); - DATA_BLOB encrypted_session_key = data_blob(NULL, 0); + DATA_BLOB lm_response = {}; + DATA_BLOB nt_response = {}; + DATA_BLOB session_key = {}; + DATA_BLOB lm_session_key = {}; + DATA_BLOB encrypted_session_key = {}; NTSTATUS nt_status; int flags = 0; const char *user = NULL, *domain = NULL, *workstation = NULL; diff --git a/auth/ntlmssp/ntlmssp_server.c b/auth/ntlmssp/ntlmssp_server.c index 2e25c4efab5..a51bcf115ee 100644 --- a/auth/ntlmssp/ntlmssp_server.c +++ b/auth/ntlmssp/ntlmssp_server.c @@ -897,7 +897,7 @@ static NTSTATUS ntlmssp_server_postauth(struct gensec_security *gensec_security, DATA_BLOB user_session_key = state->user_session_key; DATA_BLOB lm_session_key = state->lm_session_key; NTSTATUS nt_status = NT_STATUS_OK; - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; struct auth_session_info *session_info = NULL; TALLOC_FREE(state->user_info); diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c index b130c0abe34..f2bcda7fc05 100644 --- a/libcli/auth/smbencrypt.c +++ b/libcli/auth/smbencrypt.c @@ -455,7 +455,7 @@ static DATA_BLOB NTLMv2_generate_client_data(TALLOC_CTX *mem_ctx, const DATA_BLOB *names_blob) { uint8_t client_chal[8]; - DATA_BLOB response = data_blob(NULL, 0); + DATA_BLOB response = {}; uint8_t long_date[8]; generate_random_buffer(client_chal, sizeof(client_chal)); diff --git a/libcli/drsuapi/repl_decrypt.c b/libcli/drsuapi/repl_decrypt.c index d28924603ab..194e024f643 100644 --- a/libcli/drsuapi/repl_decrypt.c +++ b/libcli/drsuapi/repl_decrypt.c @@ -220,7 +220,7 @@ static WERROR drsuapi_encrypt_attribute_value(TALLOC_CTX *mem_ctx, const DATA_BLOB *in, DATA_BLOB *out) { - DATA_BLOB rid_crypt_out = data_blob(NULL, 0); + DATA_BLOB rid_crypt_out = {}; DATA_BLOB confounder; DATA_BLOB enc_buffer; diff --git a/libcli/ldap/ldap_message.c b/libcli/ldap/ldap_message.c index eb2d77c84ae..3efae311026 100644 --- a/libcli/ldap/ldap_message.c +++ b/libcli/ldap/ldap_message.c @@ -1208,7 +1208,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, r->mechanism = LDAP_AUTH_MECH_SASL; if (!asn1_read_OctetString_talloc(msg, data, &r->creds.SASL.mechanism)) goto prot_err; if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { /* optional */ - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = {}; if (!asn1_read_OctetString(data, msg, &tmp_blob)) goto prot_err; r->creds.SASL.secblob = talloc(msg, DATA_BLOB); if (!r->creds.SASL.secblob) { @@ -1242,7 +1242,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, if (!asn1_start_tag(data, tag)) goto prot_err; if (!ldap_decode_response(msg, data, &r->response)) goto prot_err; if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(7))) { - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = {}; if (!asn1_read_ContextSimple(data, msg, 7, &tmp_blob)) goto prot_err; r->SASL.secblob = talloc(msg, DATA_BLOB); if (!r->SASL.secblob) { @@ -1518,7 +1518,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, case ASN1_APPLICATION(LDAP_TAG_ExtendedRequest): { struct ldap_ExtendedRequest *r = &msg->r.ExtendedRequest; - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = {}; msg->type = LDAP_TAG_ExtendedRequest; if (!asn1_start_tag(data,tag)) goto prot_err; @@ -1549,7 +1549,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, case ASN1_APPLICATION(LDAP_TAG_ExtendedResponse): { struct ldap_ExtendedResponse *r = &msg->r.ExtendedResponse; - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB tmp_blob = {}; msg->type = LDAP_TAG_ExtendedResponse; if (!asn1_start_tag(data, tag)) goto prot_err; diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 0538210b5a8..ced45fe61c9 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1456,7 +1456,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, char *buf, int length, void **private1) { DATA_BLOB in; - DATA_BLOB out = data_blob(NULL, 0); + DATA_BLOB out = {}; char *out_base64 = NULL; const char *reply_arg = NULL; struct gensec_ntlm_state { diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index 5b4fd0901e5..d3372d2ea86 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -570,7 +570,7 @@ static NTSTATUS gensec_krb5_update_internal(struct gensec_security *gensec_secur case GENSEC_KRB5_SERVER_START: { DATA_BLOB unwrapped_in; - DATA_BLOB unwrapped_out = data_blob(NULL, 0); + DATA_BLOB unwrapped_out = {}; krb5_data inbuf, outbuf; uint8_t tok_id[2]; struct keytab_container *keytab; diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c index c33dc2f9217..962a8744805 100644 --- a/source4/auth/kerberos/kerberos_pac.c +++ b/source4/auth/kerberos/kerberos_pac.c @@ -44,8 +44,8 @@ NTSTATUS nt_status; krb5_error_code ret; enum ndr_err_code ndr_err; - DATA_BLOB zero_blob = data_blob(NULL, 0); - DATA_BLOB tmp_blob = data_blob(NULL, 0); + DATA_BLOB zero_blob = {}; + DATA_BLOB tmp_blob = {}; struct PAC_SIGNATURE_DATA *kdc_checksum = NULL; struct PAC_SIGNATURE_DATA *srv_checksum = NULL; uint32_t i; diff --git a/source4/auth/sam.c b/source4/auth/sam.c index 55bcd746b7c..41c538b618c 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -902,8 +902,8 @@ NTSTATUS authsam_get_user_info_dc_principal(TALLOC_CTX *mem_ctx, struct auth_user_info_dc **user_info_dc) { NTSTATUS nt_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 lm_sess_key = {}; struct ldb_message *msg; struct ldb_dn *domain_dn; diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c index b00329c9fa4..949c015544e 100644 --- a/source4/libcli/ldap/ldap_bind.c +++ b/source4/libcli/ldap/ldap_bind.c @@ -210,8 +210,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, const char *sasl_mech = "GSS-SPNEGO"; NTSTATUS status; TALLOC_CTX *tmp_ctx = NULL; - DATA_BLOB input = data_blob(NULL, 0); - DATA_BLOB output = data_blob(NULL, 0); + DATA_BLOB input = {}; + DATA_BLOB output = {}; bool first = true; int wrap_flags = 0; uint32_t old_gensec_features; diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c index c1c4c3dc85a..65c04a20abf 100644 --- a/source4/libcli/smb_composite/sesssetup.c +++ b/source4/libcli/smb_composite/sesssetup.c @@ -83,7 +83,7 @@ static void request_handler(struct smbcli_request *req) struct composite_context *c = (struct composite_context *)req->async.private_data; struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state); struct smbcli_session *session = req->session; - DATA_BLOB null_data_blob = data_blob(NULL, 0); + DATA_BLOB null_data_blob = {}; NTSTATUS session_key_err, nt_status; struct smbcli_request *check_req = NULL; const char *os = NULL; @@ -329,7 +329,7 @@ static NTSTATUS session_setup_nt1(struct composite_context *c, */ DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, NULL, domain); - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; int flags = CLI_CRED_NTLM_AUTH; if (session->options.lanman_auth) { diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index ab88d89d10b..400c0ec02d3 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -403,7 +403,7 @@ NTSTATUS pvfs_xattr_create(struct pvfs_state *pvfs, const char *attr_name) { NTSTATUS status; - DATA_BLOB blob = data_blob(NULL, 0); + DATA_BLOB blob = {}; char *aname = talloc_asprintf(NULL, "%s%s", attr_prefix, attr_name); if (aname == NULL) { return NT_STATUS_NO_MEMORY; diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 0440d874010..cc0a94a14cb 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -933,7 +933,7 @@ static NTSTATUS get_trustdom_auth_blob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, DATA_BLOB *auth_blob, struct trustDomainPasswords *auth_struct) { - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; enum ndr_err_code ndr_err; NTSTATUS nt_status; gnutls_cipher_hd_t cipher_hnd = NULL; diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index 3c1bb26cce0..b5aa5262007 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -580,7 +580,7 @@ NTSTATUS samr_set_password(struct dcesrv_call_state *dce_call, { NTSTATUS nt_status; DATA_BLOB new_password; - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; gnutls_cipher_hd_t cipher_hnd = NULL; gnutls_datum_t _session_key; struct auth_session_info *session_info = @@ -670,7 +670,7 @@ NTSTATUS samr_set_password_ex(struct dcesrv_call_state *dce_call, /* The confounder is in the last 16 bytes of the buffer */ DATA_BLOB confounder = data_blob_const(&pwbuf->data[516], 16); DATA_BLOB pw_data = data_blob_const(pwbuf->data, 516); - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; int rc; bool encrypted; @@ -734,7 +734,7 @@ NTSTATUS samr_set_password_buffers(struct dcesrv_call_state *dce_call, { struct samr_Password *d_lm_pwd_hash = NULL, *d_nt_pwd_hash = NULL; uint8_t random_session_key[16] = { 0, }; - DATA_BLOB session_key = data_blob(NULL, 0); + DATA_BLOB session_key = {}; DATA_BLOB in, out; NTSTATUS nt_status = NT_STATUS_OK; int rc; diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index ad400a076c0..6beb3b98747 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -370,8 +370,8 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) } else { struct cli_credentials *server_credentials; struct gensec_security *gensec_security; - DATA_BLOB null_data_blob = data_blob(NULL, 0); - DATA_BLOB blob = data_blob_null; + DATA_BLOB null_data_blob = {}; + DATA_BLOB blob = {}; const char *oid; NTSTATUS nt_status; diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index 4153a42df0d..3d10fdc5de1 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -440,7 +440,7 @@ static void smb2srv_notify_send(struct ntvfs_request *ntvfs) size_t size = 0; int i; uint8_t *p; - DATA_BLOB blob = data_blob(NULL, 0); + DATA_BLOB blob = {}; SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_notify); SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, 0)); diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index 048d7b46837..117c2031df8 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -34,7 +34,7 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB *_blob) { struct gensec_security *gensec_security; - DATA_BLOB null_data_blob = data_blob(NULL, 0); + DATA_BLOB null_data_blob = {}; DATA_BLOB blob; NTSTATUS nt_status; struct cli_credentials *server_credentials; diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index ebf00bc4cf5..baa06623797 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -717,10 +717,10 @@ static bool test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, { bool pass = true; NTSTATUS nt_status; - DATA_BLOB ntlmv2_response = data_blob(NULL, 0); - DATA_BLOB lmv2_response = data_blob(NULL, 0); - DATA_BLOB lmv2_session_key = data_blob(NULL, 0); - DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); + DATA_BLOB ntlmv2_response = {}; + DATA_BLOB lmv2_response = {}; + DATA_BLOB lmv2_session_key = {}; + DATA_BLOB ntlmv2_session_key = {}; DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, TEST_MACHINE_NAME, samlogon_state->workgroup); uint8_t lm_session_key[8]; @@ -870,10 +870,10 @@ static bool test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, { bool pass = true; NTSTATUS nt_status; - DATA_BLOB ntlmv2_response = data_blob(NULL, 0); - DATA_BLOB lmv2_response = data_blob(NULL, 0); - DATA_BLOB lmv2_session_key = data_blob(NULL, 0); - DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); + DATA_BLOB ntlmv2_response = {}; + DATA_BLOB lmv2_response = {}; + DATA_BLOB lmv2_session_key = {}; + DATA_BLOB ntlmv2_session_key = {}; DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->netbios_name, samlogon_state->workgroup); DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); @@ -1258,8 +1258,8 @@ static bool test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) { NTSTATUS nt_status; - DATA_BLOB nt_response = data_blob(NULL, 0); - DATA_BLOB lm_response = data_blob(NULL, 0); + DATA_BLOB nt_response = {}; + DATA_BLOB lm_response = {}; char *password; char *dospw; smb_ucs2_t *unicodepw;