summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/krb/rd_error.c
blob: 97e24f90dfd70c62665cee5b19d409a87550daea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * $Source$
 * $Author$
 *
 * Copyright 1990 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <krb5/copyright.h>.
 *
 * krb5_rd_error() routine
 */

#if !defined(lint) && !defined(SABER)
static char rcsid_rd_error_c[] =
"$Id$";
#endif	/* !lint & !SABER */

#include <krb5/copyright.h>

#include <krb5/krb5.h>
#include <krb5/asn1.h>

#include <krb5/ext-proto.h>

/*
 Parses an error message from enc_errbuf and fills in the contents of
 dec_error.

 Upon return dec_error->client,server,text, if non-NULL, point to allocated
 storage which the caller should free when finished.

 returns system errors
 */

krb5_error_code
krb5_rd_error( enc_errbuf, dec_error)
const krb5_data *enc_errbuf;
krb5_error *dec_error;
{
    krb5_error_code retval;
    krb5_error *new_dec_error;

    if (!krb5_is_krb_error(enc_errbuf))
	return KRB5KRB_AP_ERR_MSG_TYPE;
    if (retval = decode_krb5_error(enc_errbuf, &new_dec_error))
	return(retval);
    *dec_error = *new_dec_error;
    (void)free((char *)new_dec_error);
    return 0;
}