use com_err/error_message API
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11314 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "der_locl.h"
|
#include "der_locl.h"
|
||||||
#include <com_right.h>
|
#include <com_err.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <getarg.h>
|
#include <getarg.h>
|
||||||
@@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
static struct et_list *et_list;
|
|
||||||
|
|
||||||
const char *class_names[] = {
|
const char *class_names[] = {
|
||||||
"UNIV", /* 0 */
|
"UNIV", /* 0 */
|
||||||
"APPL", /* 1 */
|
"APPL", /* 1 */
|
||||||
@@ -99,7 +97,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
|
|
||||||
ret = der_get_tag (buf, len, &class, &type, &tag, &sz);
|
ret = der_get_tag (buf, len, &class, &type, &tag, &sz);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_tag: %s", com_right (et_list, ret));
|
errx (1, "der_get_tag: %s", error_message (ret));
|
||||||
if (sz > len)
|
if (sz > len)
|
||||||
errx (1, "unreasonable length (%u) > %u",
|
errx (1, "unreasonable length (%u) > %u",
|
||||||
(unsigned)sz, (unsigned)len);
|
(unsigned)sz, (unsigned)len);
|
||||||
@@ -114,7 +112,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
printf ("tag %d = ", tag);
|
printf ("tag %d = ", tag);
|
||||||
ret = der_get_length (buf, len, &length, &sz);
|
ret = der_get_length (buf, len, &length, &sz);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_tag: %s", com_right (et_list, ret));
|
errx (1, "der_get_tag: %s", error_message (ret));
|
||||||
buf += sz;
|
buf += sz;
|
||||||
len -= sz;
|
len -= sz;
|
||||||
|
|
||||||
@@ -135,7 +133,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
|
|
||||||
ret = der_get_int (buf, length, &val, NULL);
|
ret = der_get_int (buf, length, &val, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_int: %s", com_right (et_list, ret));
|
errx (1, "der_get_int: %s", error_message (ret));
|
||||||
printf ("integer %d\n", val);
|
printf ("integer %d\n", val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -146,8 +144,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
|
|
||||||
ret = der_get_octet_string (buf, length, &str, NULL);
|
ret = der_get_octet_string (buf, length, &str, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_octet_string: %s",
|
errx (1, "der_get_octet_string: %s", error_message (ret));
|
||||||
com_right (et_list, ret));
|
|
||||||
printf ("(length %lu), ", (unsigned long)length);
|
printf ("(length %lu), ", (unsigned long)length);
|
||||||
uc = (unsigned char *)str.data;
|
uc = (unsigned char *)str.data;
|
||||||
for (i = 0; i < 16; ++i)
|
for (i = 0; i < 16; ++i)
|
||||||
@@ -163,7 +160,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
ret = der_get_general_string (buf, length, &str, NULL);
|
ret = der_get_general_string (buf, length, &str, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_general_string: %s",
|
errx (1, "der_get_general_string: %s",
|
||||||
com_right (et_list, ret));
|
error_message (ret));
|
||||||
printf ("\"%s\"\n", str);
|
printf ("\"%s\"\n", str);
|
||||||
free (str);
|
free (str);
|
||||||
break;
|
break;
|
||||||
@@ -174,8 +171,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
|||||||
|
|
||||||
ret = der_get_oid(buf, length, &o, NULL);
|
ret = der_get_oid(buf, length, &o, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx (1, "der_get_oid: %s",
|
errx (1, "der_get_oid: %s", error_message (ret));
|
||||||
com_right (et_list, ret));
|
|
||||||
|
|
||||||
for (i = 0; i < o.length ; i++)
|
for (i = 0; i < o.length ; i++)
|
||||||
printf("%d%s", o.components[i],
|
printf("%d%s", o.components[i],
|
||||||
@@ -242,7 +238,7 @@ main(int argc, char **argv)
|
|||||||
int optind = 0;
|
int optind = 0;
|
||||||
|
|
||||||
setprogname (argv[0]);
|
setprogname (argv[0]);
|
||||||
initialize_asn1_error_table_r (&et_list);
|
initialize_asn1_error_table ();
|
||||||
if(getarg(args, num_args, argc, argv, &optind))
|
if(getarg(args, num_args, argc, argv, &optind))
|
||||||
usage(1);
|
usage(1);
|
||||||
if(help_flag)
|
if(help_flag)
|
||||||
|
Reference in New Issue
Block a user