diff options
author | Theodore Tso <tytso@mit.edu> | 1991-05-06 15:14:31 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1991-05-06 15:14:31 +0000 |
commit | de8c3b49f993fa7583c710451cac8f7407f8859c (patch) | |
tree | fed1419e5656ababa393248d50b69707dc210a61 /src/lib/gssapi/check_tok.c | |
parent | eab25e18ca94480e73d70f57b5cbc5cc04b87d45 (diff) | |
download | krb5-de8c3b49f993fa7583c710451cac8f7407f8859c.tar.gz krb5-de8c3b49f993fa7583c710451cac8f7407f8859c.tar.xz krb5-de8c3b49f993fa7583c710451cac8f7407f8859c.zip |
Initial Revision
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2099 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi/check_tok.c')
-rw-r--r-- | src/lib/gssapi/check_tok.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/gssapi/check_tok.c b/src/lib/gssapi/check_tok.c new file mode 100644 index 000000000..24073490a --- /dev/null +++ b/src/lib/gssapi/check_tok.c @@ -0,0 +1,47 @@ +/* + * check_tok.c --- Read a GSS API token and do error checking + * checking on it. + * + * $Source$ + * $Author$ + * $Header$ + * + * Copyright 1991 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * For copying and distribution information, please see the file + * <krb5/copyright.h>. + * + */ + +#include <gssapi.h> + +OM_uint32 gss_check_token(minor_status, input_token, mechanism, type) + OM_uint32 *minor_status; + gss_buffer_t input_token; + unsigned char mechanism; + unsigned char type; +{ + char *buf; + + *minor_status = 0; + + if (!input_token) + return(gss_make_ce(GSS_CE_CALL_INACCESSIBLE_READ)); + + if (input_token->length < 4) + return(gss_make_re(GSS_RE_DEFECTIVE_TOKEN)); + + buf = input_token->value; + + if (buf[0] != GSS_API_IMPL_VERSION) + return(gss_make_re(GSS_RE_DEFECTIVE_TOKEN)); + + if (mechanism && (mechanism != buf[1])) + return(gss_make_re(GSS_RE_BAD_MECH)); + + if (type && (type != buf[2])) + return(gss_make_re(GSS_RE_FAILURE) | GSS_SS_UNSEQ_TOKEN); + + return(GSS_S_COMPLETE); +} |