In the case of FCC_OPEN_AND_ERASE, unlink the old filename, and then
authorTheodore Tso <tytso@mit.edu>
Thu, 21 Dec 1995 23:39:16 +0000 (23:39 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 21 Dec 1995 23:39:16 +0000 (23:39 +0000)
add the O_EXCL open flag, to prevent O_CREAT from following a symbolic
link.

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

src/lib/krb5/ccache/file/ChangeLog
src/lib/krb5/ccache/file/fcc_maybe.c

index f8b252791881d95d0ae2b30d3d2172ab97f18122..3a2cba83341cb9598ee94f3b66726f8ac110e42c 100644 (file)
@@ -1,3 +1,10 @@
+Thu Dec 21 18:28:09 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * fcc_maybe.c (krb5_fcc_open_file): In the case of
+               FCC_OPEN_AND_ERASE, unlink the old filename, and then add
+               the O_EXCL open flag, to prevent O_CREAT from following a
+               symbolic link.
+
 Fri Oct  6 22:03:16 1995  Theodore Y. Ts'o  <tytso@dcl>
 
        * Makefile.in: Remove ##DOS!include of config/windows.in.
index 30657b29d616c6caf83c9c00d0320a19d0c5fd64..622302a125eeb6b3b0e27238a776afea8e9fcda3 100644 (file)
@@ -229,7 +229,8 @@ krb5_fcc_open_file (context, id, mode)
      data->mode = mode;
      switch(mode) {
      case FCC_OPEN_AND_ERASE:
-        open_flag = O_CREAT|O_TRUNC|O_RDWR;
+        unlink(data->filename);
+        open_flag = O_CREAT|O_EXCL|O_TRUNC|O_RDWR;
         break;
      case FCC_OPEN_RDWR:
         open_flag = O_RDWR;