rd_req_sim was using the wrong component of the server name to generate
authorTheodore Tso <tytso@mit.edu>
Thu, 2 Jun 1994 16:41:50 +0000 (16:41 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 2 Jun 1994 16:41:50 +0000 (16:41 +0000)
the replay cache name.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3672 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/rd_req_sim.c

index ff3c779415cfa688da50c81f1d8d8151f0b40087..0e77cdf48b15de29fc7f9f72fec0835be95d2d3e 100644 (file)
@@ -62,7 +62,7 @@ krb5_tkt_authent **authdat;
 {
     krb5_error_code retval;
     krb5_ap_req *request;
-    krb5_rcache rcache;
+    krb5_rcache rcache = 0;
 
     if (!krb5_is_ap_req(inbuf))
        return KRB5KRB_AP_ERR_MSG_TYPE;
@@ -74,15 +74,20 @@ krb5_tkt_authent **authdat;
            return(retval);
        }
     }
-    if (!(retval = krb5_get_server_rcache(krb5_princ_component(server, 1),
-                                         &rcache))) {
-       retval = krb5_rd_req_decoded(request, server,
-                                    sender_addr, 0,
-                                    0, 0, rcache, authdat);
-       krb5_rc_close(rcache);
+
+    if (server) {
+       retval = krb5_get_server_rcache(krb5_princ_component(server, 0),
+                                       &rcache);
+       if (retval)
+           goto cleanup;
     }
-    krb5_free_ap_req(request);
 
+    retval = krb5_rd_req_decoded(request, server, sender_addr, 0, 0, 0,
+                                rcache, authdat);
+cleanup:
+    if (rcache)
+       krb5_rc_close(rcache);
+    krb5_free_ap_req(request);
     return retval;
 }