From: Theodore Tso Date: Wed, 1 Dec 1993 22:26:22 +0000 (+0000) Subject: Added flags argument to krb5_recvauth(), and added support for flags which X-Git-Tag: krb5-1.0-beta3~118 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e75893ae197bd45bfb0167c48d35d2968e9f1fa8;p=krb5.git Added flags argument to krb5_recvauth(), and added support for flags which ignore the version string (for use with an automatically selected V4/V5 mechanism.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3060 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c index 3e8775a84..f8b106beb 100644 --- a/src/lib/krb5/krb/recvauth.c +++ b/src/lib/krb5/krb/recvauth.c @@ -43,8 +43,6 @@ static char rcsid_recvauth_c [] = #include #include -#define WORKING_RCACHE - extern krb5_flags krb5_kdc_default_options; static char *sendauth_version = "KRB5_SENDAUTH_V1.0"; @@ -52,7 +50,7 @@ static char *sendauth_version = "KRB5_SENDAUTH_V1.0"; krb5_error_code krb5_recvauth(/* IN */ fd, appl_version, server, sender_addr, fetch_from, - keyproc, keyprocarg, rc_type, + keyproc, keyprocarg, rc_type, flags, /* OUT */ seq_number, client, ticket, authent) krb5_pointer fd; @@ -62,6 +60,7 @@ krb5_recvauth(/* IN */ krb5_pointer fetch_from; krb5_int32 *seq_number; char *rc_type; + krb5_int32 flags; krb5_rdreq_key_proc keyproc; krb5_pointer keyprocarg; krb5_principal *client; @@ -86,16 +85,22 @@ krb5_recvauth(/* IN */ * and exit. */ problem = 0; - /* - * First read the sendauth version string and check it. - */ - if (retval = krb5_read_message(fd, &inbuf)) + + if (!(flags & KRB5_RECVAUTH_SKIP_VERSION)) { + /* + * First read the sendauth version string and check it. + */ + if (retval = krb5_read_message(fd, &inbuf)) return(retval); - if (strcmp(inbuf.data, sendauth_version)) { + if (strcmp(inbuf.data, sendauth_version)) { krb5_xfree(inbuf.data); problem = KRB5_SENDAUTH_BADAUTHVERS; + } + krb5_xfree(inbuf.data); } - krb5_xfree(inbuf.data); + if (flags & KRB5_RECVAUTH_BADAUTHVERS) + problem = KRB5_SENDAUTH_BADAUTHVERS; + /* * Do the same thing for the application version string. */ @@ -144,7 +149,6 @@ krb5_recvauth(/* IN */ if (problem) return(problem); rcache = NULL; -#ifdef WORKING_RCACHE /* * Setup the replay cache. */ @@ -182,16 +186,14 @@ krb5_recvauth(/* IN */ rcache = NULL; } } -#endif + /* * Now, let's read the AP_REQ message and decode it */ if (retval = krb5_read_message(fd, &inbuf)) { -#ifdef WORKING_RCACHE (void) krb5_rc_close(rcache); if (cachename) free(cachename); -#endif return(retval); } authdat = 0; /* so we can tell if we need to @@ -200,16 +202,12 @@ krb5_recvauth(/* IN */ problem = krb5_rd_req(&inbuf, server, sender_addr, fetch_from, keyproc, keyprocarg, rcache, &authdat); krb5_xfree(inbuf.data); -#ifdef WORKING_RCACHE if (rcache) retval = krb5_rc_close(rcache); -#endif if (!problem && retval) problem = retval; -#ifdef WORKING_RCACHE if (cachename) free(cachename); -#endif /* * If there was a problem, send back a krb5_error message,