2 Copyright (C) 1989 by the Massachusetts Institute of Technology
4 Export of this software from the United States of America is assumed
5 to require a specific license from the United States Government.
6 It is the responsibility of any person or organization contemplating
7 export to obtain such a license before exporting.
9 WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
10 distribute this software and its documentation for any purpose and
11 without fee is hereby granted, provided that the above copyright
12 notice appear in all copies and that both that copyright notice and
13 this permission notice appear in supporting documentation, and that
14 the name of M.I.T. not be used in advertising or publicity pertaining
15 to distribution of the software without specific, written prior
16 permission. M.I.T. makes no representations about the suitability of
17 this software for any purpose. It is provided "as is" without express
24 RCSID("$Id: mk_err.c,v 1.7 1998/06/09 19:25:22 joda Exp $");
27 * This routine creates a general purpose error reply message. It
28 * doesn't use KTEXT because application protocol may have long
29 * messages, and may want this part of buffer contiguous to other
32 * The error reply is built in "p", using the error code "e" and
33 * error text "e_string" given. The length of the error reply is
36 * The error reply is in the following format:
38 * unsigned char KRB_PROT_VERSION protocol version no.
39 * unsigned char AUTH_MSG_APPL_ERR message type
41 * bit of above) HOST_BYTE_ORDER local byte order
42 * 4 bytes e given error code
43 * string e_string given error text
47 krb_mk_err(u_char *p, int32_t e, char *e_string)
49 unsigned char *start = p;
51 p += krb_put_int(KRB_PROT_VERSION, p, 1, 1);
52 p += krb_put_int(AUTH_MSG_APPL_ERR, p, 1, 1);
54 p += krb_put_int(e, p, 4, 4);
55 p += krb_put_string(e_string, p, strlen(e_string) + 1);