[4] in Kerberos-V5-bugs

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

Trivial patch to fcc_gennew.c

daemon@ATHENA.MIT.EDU (Barr3y Jaspan)
Sat Jun 30 14:30:20 1990

Date: Sat, 30 Jun 90 14:30:11 -0400
From: "Barr3y Jaspan" <bjaspan@ATHENA.MIT.EDU>
To: krb5-bugs@ATHENA.MIT.EDU


I just happened to be looking through the file credential cache
routines (which I wrote.. sigh) and found two small bugs.  Here's a
patch.

*** fcc_gennew.c	Fri May 25 09:36:19 1990
--- /tmp/fcc_gennew.c	Sat Jun 30 14:27:26 1990
***************
*** 32,37 ****
--- 32,38 ----
   * Errors:
   * KRB5_NOMEM - there was insufficient memory to allocate the
   * 		krb5_ccache.  id is undefined.
+  * system errors (from open)
   */
  krb5_error_code
  krb5_fcc_generate_new (id)
***************
*** 71,80 ****
       strcpy(((krb5_fcc_data *) lid->data)->filename, scratch);
  
       /* Make sure the file name is reserved */
!      ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT| O_EXCL,0600);
       if (ret == -1)
! 	  return ret;
       else {
  	  close(ret);
  	  *id = lid;
  	  return KRB5_OK;
--- 72,83 ----
       strcpy(((krb5_fcc_data *) lid->data)->filename, scratch);
  
       /* Make sure the file name is reserved */
!      ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT | O_EXCL, 0);
       if (ret == -1)
! 	  return errno;
       else {
+ 	  /* Ignore user's umask, set mode = 0600 */
+ 	  fchmod(ret, S_IREAD | S_IWRITE);
  	  close(ret);
  	  *id = lid;
  	  return KRB5_OK;

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