diff options
Diffstat (limited to 'src/lib/krb4/rd_err.c')
-rw-r--r-- | src/lib/krb4/rd_err.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/src/lib/krb4/rd_err.c b/src/lib/krb4/rd_err.c index 80f0d3abdb..6ba9a646c7 100644 --- a/src/lib/krb4/rd_err.c +++ b/src/lib/krb4/rd_err.c @@ -1,17 +1,31 @@ /* - * rd_err.c + * lib/krb4/rd_err.c * - * Copyright 1986, 1987, 1988 by the Massachusetts Institute - * of Technology. + * Copyright 1986, 1987, 1988, 2000 by the Massachusetts Institute of + * Technology. All Rights Reserved. * - * For copying and distribution information, please see the file - * <mit-copyright.h>. + * Export of this software from the United States of America may + * require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. Furthermore if you modify this software you must label + * your software as modified software and not distribute it in such a + * fashion that it might be confused with the original M.I.T. software. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. * * Steve Miller Project Athena MIT/DEC */ -#include "mit-copyright.h" - #include <string.h> #include "krb.h" @@ -33,37 +47,32 @@ */ KRB5_DLLIMP int KRB5_CALLCONV -krb_rd_err(in,in_length,code,m_data) +krb_rd_err(in, in_length, code, m_data) u_char FAR *in; /* pointer to the msg received */ u_long in_length; /* of in msg */ long FAR *code; /* received error code */ MSG_DAT FAR *m_data; { register u_char *p; - int swap_bytes = 0; + int le; + unsigned KRB4_32 raw_code; + p = in; /* beginning of message */ + if (in_length < 1 + 1 + 4) + return RD_AP_MODIFIED; /* XXX should have better error code */ if (*p++ != KRB_PROT_VERSION) - return(RD_AP_VERSION); + return RD_AP_VERSION; if (((*p) & ~1) != AUTH_MSG_APPL_ERR) - return(RD_AP_MSG_TYPE); - if ((*p++ & 1) != HOST_BYTE_ORDER) - swap_bytes++; + return RD_AP_MSG_TYPE; + le = *p++ & 1; - /* safely get code */ - { - unsigned KRB4_32 raw_code; - - memcpy((char *)&raw_code, (char *)p, sizeof(raw_code)); - if (swap_bytes) - raw_code = krb4_swab32(raw_code); - p += sizeof(raw_code); /* skip over */ - *code = raw_code; - } + KRB4_GET32(raw_code, p, le); + *code = raw_code; /* XXX unsigned->signed conversion! */ m_data->app_data = p; /* we're now at the error text * message */ - m_data->app_length = in_length; + m_data->app_length = p - in; - return(RD_AP_OK); /* OK == 0 */ + return RD_AP_OK; /* OK == 0 */ } |