diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-10-18 18:09:04 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-18 18:09:04 +0200 |
commit | 6a89b59ca6187ef6e06124c2aa729be18b43bb75 (patch) | |
tree | f8187dc0ea92fe32ac4b765516e9153980a65d40 /source4 | |
parent | b3b6d8f3f91824df11b3f1e61c8ad443c8c65458 (diff) | |
download | samba-6a89b59ca6187ef6e06124c2aa729be18b43bb75.tar.gz samba-6a89b59ca6187ef6e06124c2aa729be18b43bb75.tar.bz2 samba-6a89b59ca6187ef6e06124c2aa729be18b43bb75.zip |
Add TALLOC_CTX pointer to strhex_to_data_blob for consistency with Samba
3.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/extended_dn.c | 4 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/password_hash.c | 6 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 6 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_set.c | 3 | ||||
-rw-r--r-- | source4/kdc/hdb-samba4.c | 3 | ||||
-rw-r--r-- | source4/lib/registry/util.c | 3 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_drsuapi.c | 5 | ||||
-rw-r--r-- | source4/torture/auth/ntlmssp.c | 12 | ||||
-rw-r--r-- | source4/torture/ndr/ndr.c | 4 | ||||
-rw-r--r-- | source4/utils/ntlm_auth.c | 6 |
10 files changed, 22 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index 88a8887056..a0602d9281 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -424,7 +424,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) valstr = str; } else { DATA_BLOB binary; - binary = strhex_to_data_blob(str); + binary = strhex_to_data_blob(NULL, str); if (!binary.data) { ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; @@ -471,7 +471,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) valstr = str; } else { DATA_BLOB binary; - binary = strhex_to_data_blob(str); + binary = strhex_to_data_blob(NULL, str); if (!binary.data) { ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index c4451d1355..5ed7f1fbad 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -482,12 +482,11 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io, if (old_scp) { DATA_BLOB blob; - blob = strhex_to_data_blob(old_scp->data); + blob = strhex_to_data_blob(io->ac, old_scp->data); if (!blob.data) { ldb_oom(io->ac->module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(io->ac, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ ndr_err = ndr_pull_struct_blob(&blob, io->ac, lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), &_old_pkb, @@ -596,12 +595,11 @@ static int setup_primary_kerberos_newer(struct setup_password_fields_io *io, if (old_scp) { DATA_BLOB blob; - blob = strhex_to_data_blob(old_scp->data); + blob = strhex_to_data_blob(io->ac, old_scp->data); if (!blob.data) { ldb_oom(io->ac->module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(io->ac, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ ndr_err = ndr_pull_struct_blob(&blob, io->ac, diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 93697a3df0..69d4c2ce80 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -199,9 +199,8 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, return ntstatus_to_werror(nt_status); } - *schemaInfo = strhex_to_data_blob(schema->schema_info); + *schemaInfo = strhex_to_data_blob(mem_ctx, schema->schema_info); W_ERROR_HAVE_NO_MEMORY(schemaInfo->data); - talloc_steal(mem_ctx, schemaInfo->data); return WERR_OK; } @@ -819,12 +818,11 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, } info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo"); if (!info_val) { - info_val_default = strhex_to_data_blob("FF0000000000000000000000000000000000000000"); + info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000"); if (!info_val_default.data) { dsdb_oom(error_string, mem_ctx); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(mem_ctx, info_val_default.data); info_val = &info_val_default; } diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index f8de82e56a..d0aae4e221 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -328,11 +328,10 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf info_val = ldb_msg_find_ldb_val(msg, "schemaInfo"); if (!info_val) { - info_val_default = strhex_to_data_blob("FF0000000000000000000000000000000000000000"); + info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000"); if (!info_val_default.data) { goto nomem; } - talloc_steal(mem_ctx, info_val_default.data); info_val = &info_val_default; } diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c index 3a1379bee4..b6a48e79d0 100644 --- a/source4/kdc/hdb-samba4.c +++ b/source4/kdc/hdb-samba4.c @@ -277,12 +277,11 @@ static krb5_error_code LDB_message2entry_keys(krb5_context context, if (scpk) { DATA_BLOB blob; - blob = strhex_to_data_blob(scpk->data); + blob = strhex_to_data_blob(mem_ctx, scpk->data); if (!blob.data) { ret = ENOMEM; goto out; } - talloc_steal(mem_ctx, blob.data); /* we cannot use ndr_pull_struct_blob_all() here, as w2k and w2k3 add padding bytes */ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, iconv_convenience, &_pkb, diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index 68efd56a86..b3b6e49ea5 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -140,8 +140,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, break; case REG_BINARY: - *data = strhex_to_data_blob(data_str); - talloc_steal(mem_ctx, data->data); + *data = strhex_to_data_blob(mem_ctx, data_str); break; default: diff --git a/source4/librpc/ndr/ndr_drsuapi.c b/source4/librpc/ndr/ndr_drsuapi.c index cb022d2ad3..064b50a9cd 100644 --- a/source4/librpc/ndr/ndr_drsuapi.c +++ b/source4/librpc/ndr/ndr_drsuapi.c @@ -92,7 +92,7 @@ enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_fl DATA_BLOB blob; if (strncasecmp("ff", r->oid, 2) == 0) { - blob = strhex_to_data_blob(r->oid); + blob = strhex_to_data_blob(ndr, r->oid); if (!blob.data) { return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "HEX String Conversion Error: %s\n", @@ -101,7 +101,6 @@ enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_fl } else { _OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid)); } - talloc_steal(ndr, blob.data); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length)); NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length)); @@ -165,7 +164,7 @@ size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags) if (!oid) return 0; if (strncasecmp("ff", oid, 2) == 0) { - _blob = strhex_to_data_blob(oid); + _blob = strhex_to_data_blob(NULL, oid); if (_blob.data) { ret = _blob.length; } diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 739a048d29..1e8b339997 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -48,7 +48,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; - gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f00"); + gensec_ntlmssp_state->session_key = strhex_to_data_blob(tctx, "0102030405060708090a0b0c0d0e0f00"); dump_data_pw("NTLMSSP session key: \n", gensec_ntlmssp_state->session_key.data, gensec_ntlmssp_state->session_key.length); @@ -59,11 +59,11 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) ntlmssp_sign_init(gensec_ntlmssp_state), "Failed to sign_init"); - data = strhex_to_data_blob("6a43494653"); + data = strhex_to_data_blob(tctx, "6a43494653"); gensec_ntlmssp_sign_packet(gensec_security, gensec_security, data.data, data.length, data.data, data.length, &sig); - expected_sig = strhex_to_data_blob("01000000e37f97f2544f4d7e00000000"); + expected_sig = strhex_to_data_blob(tctx, "01000000e37f97f2544f4d7e00000000"); dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length); dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); @@ -103,7 +103,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; - gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405e538b0"); + gensec_ntlmssp_state->session_key = strhex_to_data_blob(tctx, "0102030405e538b0"); dump_data_pw("NTLMSSP session key: \n", gensec_ntlmssp_state->session_key.data, gensec_ntlmssp_state->session_key.length); @@ -114,11 +114,11 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) ntlmssp_sign_init(gensec_ntlmssp_state), "Failed to sign_init"); - data = strhex_to_data_blob("6a43494653"); + data = strhex_to_data_blob(tctx, "6a43494653"); gensec_ntlmssp_sign_packet(gensec_security, gensec_security, data.data, data.length, data.data, data.length, &sig); - expected_sig = strhex_to_data_blob("0100000078010900397420fe0e5a0f89"); + expected_sig = strhex_to_data_blob(tctx, "0100000078010900397420fe0e5a0f89"); dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length); dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c index 8d4d43b2a0..70bd070009 100644 --- a/source4/torture/ndr/ndr.c +++ b/source4/torture/ndr/ndr.c @@ -96,7 +96,7 @@ static bool test_check_string_terminator(struct torture_context *tctx) TALLOC_CTX *mem_ctx = tctx; /* Simple test */ - blob = strhex_to_data_blob("0000"); + blob = strhex_to_data_blob(tctx, "0000"); ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx)); @@ -115,7 +115,7 @@ static bool test_check_string_terminator(struct torture_context *tctx) talloc_free(ndr); - blob = strhex_to_data_blob("11220000"); + blob = strhex_to_data_blob(tctx, "11220000"); ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx)); torture_assert_ndr_success(tctx, diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 6a6302837e..1ec87c6b42 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -869,7 +869,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } if (strequal(request, "LANMAN-Challenge")) { - challenge = strhex_to_data_blob(parameter); + challenge = strhex_to_data_blob(NULL, parameter); if (challenge.length != 8) { mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n", parameter, @@ -877,7 +877,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod challenge = data_blob(NULL, 0); } } else if (strequal(request, "NT-Response")) { - nt_response = strhex_to_data_blob(parameter); + nt_response = strhex_to_data_blob(NULL, parameter); if (nt_response.length < 24) { mux_printf(mux_id, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n", parameter, @@ -885,7 +885,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod nt_response = data_blob(NULL, 0); } } else if (strequal(request, "LANMAN-Response")) { - lm_response = strhex_to_data_blob(parameter); + lm_response = strhex_to_data_blob(NULL, parameter); if (lm_response.length != 24) { mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n", parameter, |