[8518] in Athena Bugs

home help back first fref pref prev next nref lref last post

patch for inter-realm turnin

daemon@ATHENA.MIT.EDU (brlewis@Athena.MIT.EDU)
Thu Oct 31 10:41:50 1991

From: brlewis@Athena.MIT.EDU
Date: Thu, 31 Oct 91 10:41:30 -0500
To: bugs@Athena.MIT.EDU
Cc: haynes@CATS.UCSC.EDU

The turnin/pickup clients incorrectly construct the user's principal
using the realm given by the NEOS server.  This causes pickup not to
find the right graded papers, because they belong to a different
principal.

This patch also uses krb_realmofhost() where the client previously
believed whatever realm the server claimed to be in.

Patch for /source/athena/athena.bin/turnin/lib/fx_init.c

*** fx_init.c.orig	Thu Oct 31 09:18:19 1991
--- fx_init.c	Thu Oct 31 10:11:21 1991
***************
*** 19,24 ****
--- 19,26 ----
  
  #include <netdb.h>
  #include <strings.h>
+ #include <krb.h>
+ #include <des.h>
  #include "fxcl.h"
  
  /*
***************
*** 93,101 ****
    krb_info_res *res;
    int dummy;
    int opened = 0;
  
-   char pname[ANAME_SZ], pinst[INST_SZ];
- 
    res = krb_info_1(&dummy, fxp->cl);
    if (!res) return(_fx_rpc_errno(fxp->cl));
  
--- 95,102 ----
    krb_info_res *res;
    int dummy;
    int opened = 0;
+   char pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ];
  
    res = krb_info_1(&dummy, fxp->cl);
    if (!res) return(_fx_rpc_errno(fxp->cl));
  
***************
*** 104,113 ****
      return(res->errno);
    }
  
    dummy = krb_mk_req(authent,
  		     res->krb_info_res_u.info.service,
  		     res->krb_info_res_u.info.instance,
! 		     res->krb_info_res_u.info.realm, 0);
    if (dummy) goto _FX_GET_AUTH_CLEANUP;
  
    /* fill in owner */
--- 105,123 ----
      return(res->errno);
    }
  
+   /*
+    * We must find the realm of the ticket file here before calling
+    * tf_init because since the realm of the ticket file is not
+    * really stored in the principal section of the file, the
+    * routine we use must itself call tf_init and tf_close.
+    */
+   if ((dummy = krb_get_tf_realm((char *)TKT_FILE, prealm)) != KSUCCESS)
+     goto _FX_GET_AUTH_CLEANUP;
+ 
    dummy = krb_mk_req(authent,
  		     res->krb_info_res_u.info.service,
  		     res->krb_info_res_u.info.instance,
! 		     krb_realmofhost(fxp->host), 0);
    if (dummy) goto _FX_GET_AUTH_CLEANUP;
  
    /* fill in owner */
***************
*** 119,125 ****
    dummy = tf_get_pinst(pinst);
    if (dummy) goto _FX_GET_AUTH_CLEANUP;
    (void) sprintf(fxp->owner, "%s%s%s@%s", pname, (pinst[0]?".":""),
! 		 pinst, res->krb_info_res_u.info.realm);
    fxp->extension = index(fxp->owner, '@');
  
   _FX_GET_AUTH_CLEANUP:
--- 129,135 ----
    dummy = tf_get_pinst(pinst);
    if (dummy) goto _FX_GET_AUTH_CLEANUP;
    (void) sprintf(fxp->owner, "%s%s%s@%s", pname, (pinst[0]?".":""),
! 		 pinst, prealm);
    fxp->extension = index(fxp->owner, '@');
  
   _FX_GET_AUTH_CLEANUP:

home help back first fref pref prev next nref lref last post