[6797] in Athena Bugs

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

patches for s_chkaf

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Fri Jan 4 15:31:01 1991

Date: Fri, 4 Jan 91 15:31:12 -0500
From: "Barr3y Jaspan" <bjaspan@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU


o s_chkaf was using KRB_REALM explicitly, and was not checking that
the host name for krb functions was only the first component.

*** /tmp/,RCSt1a06801	Fri Jan  4 15:28:28 1991
--- /tmp/,RCSt2a06801	Fri Jan  4 15:28:29 1991
***************
*** 4,10 ****
   * This set of routines periodically checks the accounting files and reports
   * any changes to the quota server.
   *
!  * $Header: /source/lpr/quota/RCS/s_chkaf.c,v 1.8 90/11/15 13:54:59 epeisach Audited $
   */
  
  /*
--- 4,10 ----
   * This set of routines periodically checks the accounting files and reports
   * any changes to the quota server.
   *
!  * $Header: /source/lpr/quota/RCS/s_chkaf.c,v 1.9 90/12/14 18:27:24 bjaspan Exp $
   */
  
  /*
***************
*** 20,26 ****
   */
  
  #ifndef lint
! static char rcsid[] = "$Header: /source/lpr/quota/RCS/s_chkaf.c,v 1.8 90/11/15 13:54:59 epeisach Audited $";
  #endif
  
  /* We define this so it will be undefined later.. sys/dir.h has an error (sigh)*/
--- 20,26 ----
   */
  
  #ifndef lint
! static char rcsid[] = "$Header: /source/lpr/quota/RCS/s_chkaf.c,v 1.9 90/12/14 18:27:24 bjaspan Exp $";
  #endif
  
  /* We define this so it will be undefined later.. sys/dir.h has an error (sigh)*/
***************
*** 33,38 ****
--- 33,39 ----
  #include "quota_limits.h"
  #include "quota_ncs.h"
  #include "pfm.h"
+ #include <strings.h>
  #include <signal.h>
  #include <sys/types.h>
  #include <netinet/in.h>
***************
*** 123,132 ****
--- 124,136 ----
         exit(1);
     }
  
+     /* Get the host name, and make sure it's only the first comp. */
      if(gethostname(myhostname, MAXHOSTNAMELEN)) {
  	syslog(LOG_ERR, "Unable to determine own hostname");	
  	exit(1);
      }
+     if (index(myhostname, '.') != NULL)
+       *index(myhostname, '.') = '\0';
      
      if(access(CACHEDIR, R_OK)) {
  	syslog(LOG_ERR, "s_chkaf: Cannot access %s - exiting\n", CACHEDIR);
***************
*** 652,669 ****
  	}
      }
  
!     /* We need a krb_mk_req - first check for new tgt */
!     if(((ret = 
! 	 krb_get_cred("krbtgt", KRB_REALM, my_realm, &cred)) != KSUCCESS) ||
!        ((cred.issue_date + (cred.lifetime * 5 * 60)) < time((long *) 0) + 120))
! 	    {
! 		if ((ret = krb_get_svc_in_tkt("rcmd", myhostname, my_realm,
! 					      "krbtgt", KRB_REALM,
! 					      96, NULL)) != KSUCCESS) {
! 		    syslog(LOG_ERR, "Could not get new tgt %s",krb_err_txt[ret]);
! 		    return 1;
! 		}
! 	    }
  mkreq:
      if((ret = krb_mk_req(auth, KLPQUOTA_SERVICE, hostname,
  			 rpqauth[ent].realm, 0)) != KSUCCESS) {
--- 655,676 ----
  	}
      }
  
!     /* Make sure we have an up-to-date tgt */
!     ret = krb_get_cred("krbtgt", my_realm, my_realm, &cred);
!     if (ret != KSUCCESS || (cred.issue_date + cred.lifetime * 5 * 60) < 
! 			    (time((long *) 0) + 120)) {
!       /* If not, get one. */
! #ifdef DEBUG
!       syslog(LOG_DEBUG, "Requesting krbtgt.%s for rcmd.%s@%s",
! 	     my_realm, myhostname, my_realm);
! #endif
!       ret = krb_get_svc_in_tkt("rcmd", myhostname, my_realm, "krbtgt",
! 			       my_realm, 96, NULL);
!       if (ret != KSUCCESS) {
! 	syslog(LOG_ERR, "Could not get new tgt: %s",krb_err_txt[ret]);
! 	return 1;
!       }
!     }
  mkreq:
      if((ret = krb_mk_req(auth, KLPQUOTA_SERVICE, hostname,
  			 rpqauth[ent].realm, 0)) != KSUCCESS) {

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