diff options
author | Kamen Mazdrashki <kamen.mazdrashki@postpath.com> | 2009-09-26 01:41:18 +0300 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-10-01 23:13:00 +0200 |
commit | a58bc2c9a93597f3625dc8b64221c601b6f59833 (patch) | |
tree | cacc83c3616e0d5345523b4d3de30da84f893e5d /lib | |
parent | a96c8c23553489ff86be1257bd2cce81b78e1d5b (diff) | |
download | samba-a58bc2c9a93597f3625dc8b64221c601b6f59833.tar.gz samba-a58bc2c9a93597f3625dc8b64221c601b6f59833.tar.bz2 samba-a58bc2c9a93597f3625dc8b64221c601b6f59833.zip |
s4/asn1: ber_read_OID_String() to be based on _ber_read_OID_String_impl()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/asn1.c | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/lib/util/asn1.c b/lib/util/asn1.c index 93d96c2bdf..ec8ef3f28f 100644 --- a/lib/util/asn1.c +++ b/lib/util/asn1.c @@ -621,39 +621,12 @@ nomem: /* read an object ID from a data blob */ bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID) { - int i; - uint8_t *b; - uint_t v; - char *tmp_oid = NULL; - - if (blob.length < 2) return false; - - b = blob.data; - - tmp_oid = talloc_asprintf(mem_ctx, "%u", b[0]/40); - if (!tmp_oid) goto nomem; - tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", b[0]%40); - if (!tmp_oid) goto nomem; - - for(i = 1, v = 0; i < blob.length; i++) { - v = (v<<7) | (b[i]&0x7f); - if ( ! (b[i] & 0x80)) { - tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", v); - v = 0; - } - if (!tmp_oid) goto nomem; - } + size_t bytes_eaten; - if (v != 0) { - talloc_free(tmp_oid); + if (!_ber_read_OID_String_impl(mem_ctx, blob, OID, &bytes_eaten)) return false; - } - *OID = tmp_oid; - return true; - -nomem: - return false; + return (bytes_eaten == blob.length); } /** |