mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ASN1: use a talloc context in read_contextSimple
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
parent
8b650a5ab3
commit
8ca1e349eb
@ -927,7 +927,8 @@ bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLO
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
|
bool asn1_read_ContextSimple(struct asn1_data *data, TALLOC_CTX *mem_ctx, uint8_t num,
|
||||||
|
DATA_BLOB *blob)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
ZERO_STRUCTP(blob);
|
ZERO_STRUCTP(blob);
|
||||||
@ -937,7 +938,7 @@ bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blo
|
|||||||
data->has_error = true;
|
data->has_error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*blob = data_blob(NULL, len);
|
*blob = data_blob_talloc(mem_ctx, NULL, len);
|
||||||
if ((len != 0) && (!blob->data)) {
|
if ((len != 0) && (!blob->data)) {
|
||||||
data->has_error = true;
|
data->has_error = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,7 +87,7 @@ bool asn1_check_OID(struct asn1_data *data, const char *OID);
|
|||||||
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
|
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
|
||||||
bool asn1_read_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
|
bool asn1_read_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
|
||||||
bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob);
|
bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob);
|
||||||
bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob);
|
bool asn1_read_ContextSimple(struct asn1_data *data, TALLOC_CTX *mem_ctx, uint8_t num, DATA_BLOB *blob);
|
||||||
bool asn1_read_implicit_Integer(struct asn1_data *data, int *i);
|
bool asn1_read_implicit_Integer(struct asn1_data *data, int *i);
|
||||||
bool asn1_read_Integer(struct asn1_data *data, int *i);
|
bool asn1_read_Integer(struct asn1_data *data, int *i);
|
||||||
bool asn1_read_BitString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob, uint8_t *padding);
|
bool asn1_read_BitString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob, uint8_t *padding);
|
||||||
|
@ -1232,7 +1232,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
|
|||||||
if (!ldap_decode_response(msg, data, &r->response)) goto prot_err;
|
if (!ldap_decode_response(msg, data, &r->response)) goto prot_err;
|
||||||
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(7))) {
|
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(7))) {
|
||||||
DATA_BLOB tmp_blob = data_blob(NULL, 0);
|
DATA_BLOB tmp_blob = data_blob(NULL, 0);
|
||||||
if (!asn1_read_ContextSimple(data, 7, &tmp_blob)) goto prot_err;
|
if (!asn1_read_ContextSimple(data, msg, 7, &tmp_blob)) goto prot_err;
|
||||||
r->SASL.secblob = talloc(msg, DATA_BLOB);
|
r->SASL.secblob = talloc(msg, DATA_BLOB);
|
||||||
if (!r->SASL.secblob) {
|
if (!r->SASL.secblob) {
|
||||||
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
||||||
@ -1501,7 +1501,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
|
|||||||
|
|
||||||
msg->type = LDAP_TAG_ExtendedRequest;
|
msg->type = LDAP_TAG_ExtendedRequest;
|
||||||
if (!asn1_start_tag(data,tag)) goto prot_err;
|
if (!asn1_start_tag(data,tag)) goto prot_err;
|
||||||
if (!asn1_read_ContextSimple(data, 0, &tmp_blob)) {
|
if (!asn1_read_ContextSimple(data, msg, 0, &tmp_blob)) {
|
||||||
goto prot_err;
|
goto prot_err;
|
||||||
}
|
}
|
||||||
r->oid = blob2string_talloc(msg, tmp_blob);
|
r->oid = blob2string_talloc(msg, tmp_blob);
|
||||||
@ -1511,7 +1511,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) {
|
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) {
|
||||||
if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err;
|
if (!asn1_read_ContextSimple(data, msg, 1, &tmp_blob)) goto prot_err;
|
||||||
r->value = talloc(msg, DATA_BLOB);
|
r->value = talloc(msg, DATA_BLOB);
|
||||||
if (!r->value) {
|
if (!r->value) {
|
||||||
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
||||||
@ -1535,7 +1535,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
|
|||||||
if (!ldap_decode_response(msg, data, &r->response)) goto prot_err;
|
if (!ldap_decode_response(msg, data, &r->response)) goto prot_err;
|
||||||
|
|
||||||
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(10))) {
|
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(10))) {
|
||||||
if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err;
|
if (!asn1_read_ContextSimple(data, msg, 1, &tmp_blob)) goto prot_err;
|
||||||
r->oid = blob2string_talloc(msg, tmp_blob);
|
r->oid = blob2string_talloc(msg, tmp_blob);
|
||||||
data_blob_free(&tmp_blob);
|
data_blob_free(&tmp_blob);
|
||||||
if (!r->oid) {
|
if (!r->oid) {
|
||||||
@ -1546,7 +1546,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(11))) {
|
if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(11))) {
|
||||||
if (!asn1_read_ContextSimple(data, 1, &tmp_blob)) goto prot_err;
|
if (!asn1_read_ContextSimple(data, msg, 1, &tmp_blob)) goto prot_err;
|
||||||
r->value = talloc(msg, DATA_BLOB);
|
r->value = talloc(msg, DATA_BLOB);
|
||||||
if (!r->value) {
|
if (!r->value) {
|
||||||
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
|
||||||
|
Loading…
Reference in New Issue
Block a user