summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/asn1.c17
-rw-r--r--lib/util/asn1.h6
-rw-r--r--lib/util/tests/asn1_tests.c4
3 files changed, 14 insertions, 13 deletions
diff --git a/lib/util/asn1.c b/lib/util/asn1.c
index 21d4bd4308..f4a6bc5933 100644
--- a/lib/util/asn1.c
+++ b/lib/util/asn1.c
@@ -660,7 +660,7 @@ int asn1_tag_remaining(struct asn1_data *data)
* till buffer ends or not valid sub-identifier is found.
*/
static bool _ber_read_OID_String_impl(TALLOC_CTX *mem_ctx, DATA_BLOB blob,
- const char **OID, size_t *bytes_eaten)
+ char **OID, size_t *bytes_eaten)
{
int i;
uint8_t *b;
@@ -699,7 +699,7 @@ nomem:
}
/* read an object ID from a data blob */
-bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
+bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, char **OID)
{
size_t bytes_eaten;
@@ -715,14 +715,15 @@ bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
* 1:2.5.6:0x81
* 1:2.5.6:0x8182
*/
-bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **partial_oid)
+bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob,
+ char **partial_oid)
{
size_t bytes_left;
size_t bytes_eaten;
char *identifier = NULL;
char *tmp_oid = NULL;
- if (!_ber_read_OID_String_impl(mem_ctx, blob, (const char **)&tmp_oid, &bytes_eaten))
+ if (!_ber_read_OID_String_impl(mem_ctx, blob, &tmp_oid, &bytes_eaten))
return false;
if (bytes_eaten < blob.length) {
@@ -746,7 +747,7 @@ nomem:
}
/* read an object ID from a ASN1 buffer */
-bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID)
+bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **OID)
{
DATA_BLOB blob;
int len;
@@ -785,16 +786,16 @@ bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID
/* check that the next object ID is correct */
bool asn1_check_OID(struct asn1_data *data, const char *OID)
{
- const char *id;
+ char *id;
if (!asn1_read_OID(data, data, &id)) return false;
if (strcmp(id, OID) != 0) {
- talloc_free(discard_const(id));
+ talloc_free(id);
data->has_error = true;
return false;
}
- talloc_free(discard_const(id));
+ talloc_free(id);
return true;
}
diff --git a/lib/util/asn1.h b/lib/util/asn1.h
index 266a9a386b..568b4e4cc8 100644
--- a/lib/util/asn1.h
+++ b/lib/util/asn1.h
@@ -84,9 +84,9 @@ bool asn1_peek_tag(struct asn1_data *data, uint8_t tag);
bool asn1_start_tag(struct asn1_data *data, uint8_t tag);
bool asn1_end_tag(struct asn1_data *data);
int asn1_tag_remaining(struct asn1_data *data);
-bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID);
-bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **partial_oid);
-bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID);
+bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, char **OID);
+bool ber_read_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, char **partial_oid);
+bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **OID);
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_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s);
diff --git a/lib/util/tests/asn1_tests.c b/lib/util/tests/asn1_tests.c
index 5cc514616b..ac8ca538f8 100644
--- a/lib/util/tests/asn1_tests.c
+++ b/lib/util/tests/asn1_tests.c
@@ -148,7 +148,7 @@ static bool test_ber_write_OID_String(struct torture_context *tctx)
static bool test_ber_read_OID_String(struct torture_context *tctx)
{
int i;
- const char *oid;
+ char *oid;
DATA_BLOB oid_blob;
TALLOC_CTX *mem_ctx;
const struct oid_data *data = oid_data_ok;
@@ -221,7 +221,7 @@ static bool test_ber_write_partial_OID_String(struct torture_context *tctx)
static bool test_ber_read_partial_OID_String(struct torture_context *tctx)
{
int i;
- const char *oid;
+ char *oid;
DATA_BLOB oid_blob;
TALLOC_CTX *mem_ctx;
const struct oid_data *data = oid_data_ok;