From: Theodore Tso Date: Thu, 3 Jun 1993 00:14:04 +0000 (+0000) Subject: Fix so that recvauth will work even if a null cachename is passed in X-Git-Tag: krb5-1.0-beta3~283 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=55a7cbc5a5d3e97802a959b6ef73cd916da48688;p=krb5.git Fix so that recvauth will work even if a null cachename is passed in git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2555 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c index 0eeb5be06..559e0aa16 100644 --- a/src/lib/krb5/krb/recvauth.c +++ b/src/lib/krb5/krb/recvauth.c @@ -68,14 +68,14 @@ krb5_recvauth(/* IN */ krb5_ticket **ticket; krb5_authenticator **authent; { - krb5_error_code retval, problem; - krb5_data inbuf; + krb5_error_code retval, problem; + krb5_data inbuf; krb5_tkt_authent *authdat; krb5_data outbuf; - krb5_rcache rcache; + krb5_rcache rcache; krb5_octet response; - krb5_data *server_name; - char *cachename; + krb5_data *server_name, null_server; + char *cachename; extern krb5_deltat krb5_clockskew; static char *rc_base = "rc_"; @@ -154,14 +154,21 @@ krb5_recvauth(/* IN */ problem = krb5_rc_resolve_type(&rcache, rc_type ? rc_type : "dfl"); cachename = NULL; - server_name = krb5_princ_component(server, 0); + if (server) { + server_name = krb5_princ_component(server, 0); + } else { + null_server.data = "default"; + null_server.length = 7; + server_name = &null_server; + } + if (!problem && !(cachename = malloc(server_name->length+1+strlen(rc_base)))) - problem = ENOMEM; + problem = ENOMEM; if (!problem) { - strcpy(cachename, rc_base ? rc_base : "rc_"); - strncat(cachename, server_name->data, server_name->length); - cachename[server_name->length+strlen(rc_base)] = '\0'; - problem = krb5_rc_resolve(rcache, cachename); + strcpy(cachename, rc_base ? rc_base : "rc_"); + strncat(cachename, server_name->data, server_name->length); + cachename[server_name->length+strlen(rc_base)] = '\0'; + problem = krb5_rc_resolve(rcache, cachename); } if (!problem) { if (krb5_rc_recover(rcache))