]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Don't call a function to initialize an empty DATA_BLOB
authorVolker Lendecke <vl@samba.org>
Wed, 24 Dec 2025 08:41:02 +0000 (09:41 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 7 Jan 2026 09:57:40 +0000 (09:57 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
18 files changed:
auth/ntlmssp/ntlmssp_client.c
auth/ntlmssp/ntlmssp_server.c
libcli/auth/smbencrypt.c
libcli/drsuapi/repl_decrypt.c
libcli/ldap/ldap_message.c
source3/utils/ntlm_auth.c
source4/auth/gensec/gensec_krb5.c
source4/auth/kerberos/kerberos_pac.c
source4/auth/sam.c
source4/libcli/ldap/ldap_bind.c
source4/libcli/smb_composite/sesssetup.c
source4/ntvfs/posix/pvfs_xattr.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/rpc_server/samr/samr_password.c
source4/smb_server/smb/negprot.c
source4/smb_server/smb2/fileio.c
source4/smb_server/smb2/negprot.c
source4/torture/rpc/samlogon.c

index 8c2a1f9c0aaac89cebbe36aa2dcb5a92da2d6b08..f8b3f9c0b3aaca5de59949af3c5ee27a00de02b6 100644 (file)
@@ -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;
index 2e25c4efab57a5551749a79e8b636cb05feda084..a51bcf115eee40ecd1fc2a077b71e2cb2726f0e5 100644 (file)
@@ -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);
index b130c0abe347283981297ea3f555bc58f7835589..f2bcda7fc0567ed30f0bb0c3f4c102a43a8be10e 100644 (file)
@@ -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));
index d28924603abab04217a55cb219b882e5e146004c..194e024f643d984423e1865e346bc6539a1ad397 100644 (file)
@@ -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;
index eb2d77c84aecc48543ff53c83e6126ab24a487a7..3efae311026d8cbc3e9ccba325dbefff5ba0afb4 100644 (file)
@@ -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;
index 0538210b5a864ff0be322f7a236e78dca600ed09..ced45fe61c92aa319fb30bfa4a0144f5ca2a8407 100644 (file)
@@ -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 {
index 5b4fd0901e58b1c3745f842b9b6bf9605a7ebcbc..d3372d2ea8617b4add155097430f6fdfc8d36df6 100644 (file)
@@ -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;
index c33dc2f9217d61b0c9db63d4c0b27d5309f78704..962a87448059512e6d17230192917a7d27d49053 100644 (file)
@@ -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;
index 55bcd746b7c9b140e07c65f3e7b00c948e7e442d..41c538b618cf0753fab0f4a327b7c02c44ed84a6 100644 (file)
@@ -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;
index b00329c9fa43fb6e5037f1b1a2b593740f4ffd39..949c015544e60281e3a7f74c5b6f62b0da2dd003 100644 (file)
@@ -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;
index c1c4c3dc85a6f18f103717c5c7bba4a7e0655152..65c04a20abfb52e70f5cf860e47b950b96332968 100644 (file)
@@ -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) {
index ab88d89d10bddab2ffcd244b80aca0518079c20c..400c0ec02d34c6bd6ea487766f3dd2c258bfd701 100644 (file)
@@ -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;
index 0440d8740103a4fae7743458d8aa0f7e751375fd..cc0a94a14cb86dc8cee0f953eb8a392cebfb2bdc 100644 (file)
@@ -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;
index 3c1bb26cce016bccc67b54c68678657043d3e161..b5aa52620073bcfa8ffdda1c443b37474434ffed 100644 (file)
@@ -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;
index ad400a076c00db1fd4af16e7813c9a905e453888..6beb3b98747a89748095518f4fe7f9c737e6bfa4 100644 (file)
@@ -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;
 
index 4153a42df0d7f60e282beaf4041f2e801d1b7185..3d10fdc5de16443c9e37447bc0f1a1ae9881adb6 100644 (file)
@@ -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));
index 048d7b46837fb1296892fa223bbc0d5722e07605..117c2031df8f12ce99ad906cbf33f871f64ce17b 100644 (file)
@@ -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;
index ebf00bc4cf5737a8a8968f72a1202cf97547976b..baa06623797cfc3649166a2aea2254c711347c09 100644 (file)
@@ -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;