[786] in Kerberos-V5-bugs

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

Default ccache and keytab types

daemon@ATHENA.MIT.EDU (Barry Jaspan)
Wed Sep 28 16:04:21 1994

Date: Wed, 28 Sep 94 16:06:05 EDT
From: "Barry Jaspan" <bjaspan@cam.ov.com>
To: krb5-bugs@MIT.EDU


Everyone has their pet peeves.

It has always infuriated me to have to type FILE: at the beginning of
all ccache and keytab names.  That is the default and I shouldn't have
to type it.

The following patches enable this behavior.  They are against beta 2
but I doubt the code has changed much in beta 4.

Barry

*** 1.1	1993/09/20 20:20:08
--- ccbase.c	1994/09/28 19:55:47
***************
*** 73,83 ****
  /*
   * Resolve a credential cache name into a cred. cache object.
   *
!  * The name is currently constrained to be of the form "type:residual";
!  *
!  * The "type" portion corresponds to one of the predefined credential
   * cache types, while the "residual" portion is specific to the
!  * particular cache type.
   */
  
  krb5_error_code krb5_cc_resolve (name, cache)
--- 73,84 ----
  /*
   * Resolve a credential cache name into a cred. cache object.
   *
!  * The name is of the form "[type:]residual".
!  * 
!  * The "type" portion corresponds to one of the registered credential
   * cache types, while the "residual" portion is specific to the
!  * particular ccache type.  The "type" is not specified, the type of
!  * krb5_cc_dfl_ops is used.
   */
  
  krb5_error_code krb5_cc_resolve (name, cache)
***************
*** 89,106 ****
      int pfxlen;
      
      cp = strchr (name, ':');
!     if (!cp)
! 	return KRB5_CC_BADNAME;
! 
!     pfxlen = cp - name;
!     resid = name + pfxlen + 1;
! 	
!     pfx = malloc (pfxlen+1);
!     if (!pfx)
  	return ENOMEM;
! 
!     memcpy (pfx, name, pfxlen);
!     pfx[pfxlen] = '\0';
  
      *cache = (krb5_ccache) 0;
  
--- 90,111 ----
      int pfxlen;
      
      cp = strchr (name, ':');
!     if (!cp) {
! 	 resid = name;
! 	 pfx = strdup(krb5_cc_dfl_ops->prefix);
! 	 if (!pfx)
! 	      return ENOMEM;
!     } else {
! 	 pfxlen = cp - name;
! 	 resid = name + pfxlen + 1;
! 	 
! 	 pfx = malloc (pfxlen+1);
! 	 if (!pfx)
  	return ENOMEM;
! 	 
! 	 memcpy (pfx, name, pfxlen);
! 	 pfx[pfxlen] = '\0';
!     }
  
      *cache = (krb5_ccache) 0;
  
*** 1.1	1993/09/20 20:21:31
--- ktbase.c	1994/09/28 19:47:45
***************
*** 67,77 ****
  /*
   * Resolve a key table name into a keytab object.
   *
!  * The name is currently constrained to be of the form "type:residual";
!  *
   * The "type" portion corresponds to one of the registered key table
   * types, while the "residual" portion is specific to the
!  * particular keytab type.
   */
  
  krb5_error_code krb5_kt_resolve (name, ktid)
--- 67,79 ----
  /*
   * Resolve a key table name into a keytab object.
   *
!  * The name is of the form "[type:]residual".
!  * 
   * The "type" portion corresponds to one of the registered key table
   * types, while the "residual" portion is specific to the
!  * particular keytab type.  The "type" is not specified, the type of
!  * krb5_defkeyname is used; if krb5_defkeyname also doesn't have a
!  * type, the type of krb5_kt_dfl_ops is used.
   */
  
  krb5_error_code krb5_kt_resolve (name, ktid)
***************
*** 78,101 ****
      const char *name;
      krb5_keytab *ktid;
  {
      struct krb5_kt_typelist *tlist;
      char *pfx, *resid, *cp;
      int pfxlen;
      
      cp = strchr (name, ':');
!     if (!cp)
! 	return KRB5_KT_BADNAME;
  
!     pfxlen = cp - (char *)name;
!     resid = (char *)name + pfxlen + 1;
! 	
!     pfx = malloc (pfxlen+1);
!     if (!pfx)
! 	return ENOMEM;
  
!     memcpy (pfx, name, pfxlen);
!     pfx[pfxlen] = '\0';
  
      *ktid = (krb5_keytab) 0;
  
      for (tlist = kt_typehead; tlist; tlist = tlist->next) {
--- 80,120 ----
      const char *name;
      krb5_keytab *ktid;
  {
+     extern char *krb5_defkeyname;
      struct krb5_kt_typelist *tlist;
      char *pfx, *resid, *cp;
      int pfxlen;
      
      cp = strchr (name, ':');
!     if (!cp) {
! 	 resid = (char *) name;
  
! 	 cp = strchr(krb5_defkeyname, ':');
! 	 if (!cp) {
! 	      pfx = strdup(krb5_kt_dfl_ops.prefix);
! 	      if (!pfx)
! 		   return ENOMEM;
! 	 } else {
! 	      pfxlen = cp - krb5_defkeyname;
! 	      pfx = malloc(pfxlen+1);
! 	      if (!pfx)
! 		   return ENOMEM;
  
! 	      memcpy(pfx, krb5_defkeyname, pfxlen);
! 	      pfx[pfxlen] = '\0';
! 	 }
!     } else {
! 	 pfxlen = cp - (char *)name;
! 	 resid = (char *)name + pfxlen + 1;
! 	
! 	 pfx = malloc (pfxlen+1);
! 	 if (!pfx)
! 	      return ENOMEM;
  
+ 	 memcpy (pfx, name, pfxlen);
+ 	 pfx[pfxlen] = '\0';
+     }
+     
      *ktid = (krb5_keytab) 0;
  
      for (tlist = kt_typehead; tlist; tlist = tlist->next) {

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