summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/krb/recvauth.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2009-04-10 20:17:38 +0000
committerGreg Hudson <ghudson@mit.edu>2009-04-10 20:17:38 +0000
commite8ff0dc9d86ca03de5b4bce1bcdfa9e4add93a95 (patch)
tree0e460a9d178d65dfb08d9c9a56f20ef620c4c370 /src/lib/krb5/krb/recvauth.c
parentbcf8a9ba3a238cc83e432bdb66d0fdd3036860ec (diff)
downloadkrb5-e8ff0dc9d86ca03de5b4bce1bcdfa9e4add93a95.tar.gz
krb5-e8ff0dc9d86ca03de5b4bce1bcdfa9e4add93a95.tar.xz
krb5-e8ff0dc9d86ca03de5b4bce1bcdfa9e4add93a95.zip
Simplify the coupling of problem to response code in recvauth_common,
eliminating a big switch statement with a dead-code default block. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22192 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/recvauth.c')
-rw-r--r--src/lib/krb5/krb/recvauth.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c
index 0db05f5a1..2f56e567d 100644
--- a/src/lib/krb5/krb/recvauth.c
+++ b/src/lib/krb5/krb/recvauth.c
@@ -67,6 +67,7 @@ recvauth_common(krb5_context context,
* and exit.
*/
problem = 0;
+ response = 0;
if (!(flags & KRB5_RECVAUTH_SKIP_VERSION)) {
/*
@@ -76,11 +77,14 @@ recvauth_common(krb5_context context,
return(retval);
if (strcmp(inbuf.data, sendauth_version)) {
problem = KRB5_SENDAUTH_BADAUTHVERS;
+ response = 1;
}
free(inbuf.data);
}
- if (flags & KRB5_RECVAUTH_BADAUTHVERS)
+ if (flags & KRB5_RECVAUTH_BADAUTHVERS) {
problem = KRB5_SENDAUTH_BADAUTHVERS;
+ response = 1;
+ }
/*
* Do the same thing for the application version string.
@@ -88,40 +92,16 @@ recvauth_common(krb5_context context,
if ((retval = krb5_read_message(context, fd, &inbuf)))
return(retval);
if (appl_version && strcmp(inbuf.data, appl_version)) {
- if (!problem)
+ if (!problem) {
problem = KRB5_SENDAUTH_BADAPPLVERS;
+ response = 2;
+ }
}
if (version && !problem)
*version = inbuf;
else
free(inbuf.data);
- /*
- * OK, now check the problem variable. If it's zero, we're
- * fine and we can continue. Otherwise, we have to signal an
- * error to the client side and bail out.
- */
- switch (problem) {
- case 0:
- response = 0;
- break;
- case KRB5_SENDAUTH_BADAUTHVERS:
- response = 1;
- break;
- case KRB5_SENDAUTH_BADAPPLVERS:
- response = 2;
- break;
- default:
- /*
- * Should never happen!
- */
- response = 255;
-#ifdef SENDAUTH_DEBUG
- fprintf(stderr, "Programming botch in recvauth! problem = %d",
- problem);
- abort();
-#endif
- break;
- }
+
/*
* Now we actually write the response. If the response is non-zero,
* exit with a return value of problem