aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/krb/mk_error.c
blob: c985f3fed36074fa4b808c8b41585449d109cb7d (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
/*
 * $Source$
 * $Author$
 *
 * Copyright 1990 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <krb5/mit-copyright.h>.
 *
 * krb5_mk_error() routine.
 */

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

#include <krb5/copyright.h>

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

#include <krb5/ext-proto.h>

/*
 formats the error structure *dec_err into an error buffer *enc_err.

 The error buffer storage is allocated, and should be freed by the
 caller when finished.

 returns system errors
 */
krb5_error_code
krb5_mk_error(dec_err, enc_err)
krb5_error *dec_err;
krb5_data *enc_err;
{
    krb5_error_code retval;
    krb5_data *new_enc_err;

    if (retval = encode_krb5_error(dec_err, &new_enc_err))
	return(retval);
    *enc_err = *new_enc_err;
    (void)free((char *)new_enc_err);
    return 0;
}