From 14e6b9204deb0a31e8e3d45840f5186329946c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 22 Jun 2006 03:49:20 +0000 Subject: [PATCH] (der_print_heim_oid): new function git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17677 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/asn1/der.h | 3 +++ lib/asn1/der_format.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/asn1/der.h b/lib/asn1/der.h index 0ce875778..7ca7ee6f7 100644 --- a/lib/asn1/der.h +++ b/lib/asn1/der.h @@ -243,4 +243,7 @@ int der_get_tag_num(const char *); int der_parse_hex_heim_integer(const char *, heim_integer *); int der_print_hex_heim_integer(const heim_integer *, char **); +int der_print_heim_oid (const heim_oid *data, char **); + + #endif /* __DER_H__ */ diff --git a/lib/asn1/der_format.c b/lib/asn1/der_format.c index 97ee7c6a1..32bbc1e93 100644 --- a/lib/asn1/der_format.c +++ b/lib/asn1/der_format.c @@ -103,3 +103,25 @@ der_print_hex_heim_integer (const heim_integer *data, char **p) } return 0; } + +int +der_print_heim_oid (const heim_oid *oid, char **str) +{ + struct rk_strpool *p = NULL; + int i; + + for (i = 0; i < oid->length ; i++) { + p = rk_strpoolprintf(p, "%d%s", + oid->components[i], + i < oid->length - 1 ? " " : ""); + if (p == NULL) { + *str = NULL; + return ENOMEM; + } + } + + *str = rk_strpoolcollect(p); + if (*str == NULL) + return ENOMEM; + return 0; +}