From: Theodore Tso Date: Thu, 21 Dec 1995 23:39:45 +0000 (+0000) Subject: In the case of SCC_OPEN_AND_ERASE, unlink the filename first, in case X-Git-Tag: krb5-1.0-beta6~675 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be92d20ddd4a55d63dd68592e8206bb8f7004ab2;p=krb5.git In the case of SCC_OPEN_AND_ERASE, unlink the filename first, in case there's a symbolic link lurking about. (We should do an exclusive open then, but there's no such thing in stdio.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7244 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/stdio/ChangeLog b/src/lib/krb5/ccache/stdio/ChangeLog index f36b324bf..e7059f7b3 100644 --- a/src/lib/krb5/ccache/stdio/ChangeLog +++ b/src/lib/krb5/ccache/stdio/ChangeLog @@ -1,3 +1,10 @@ +Thu Dec 21 18:33:39 1995 Theodore Y. Ts'o + + * scc_maybe.c (krb5_scc_open_file): In the case of + SCC_OPEN_AND_ERASE, unlink the filename first, in case + there's a symbolic link lurking about. (We should do an + exclusive open then, but there's no such thing in stdio.) + Mon Sep 25 16:56:51 1995 Theodore Y. Ts'o * Makefile.in: Removed "foo:: foo-$(WHAT)" lines from the diff --git a/src/lib/krb5/ccache/stdio/scc_maybe.c b/src/lib/krb5/ccache/stdio/scc_maybe.c index 706b10bf9..5a535e16c 100644 --- a/src/lib/krb5/ccache/stdio/scc_maybe.c +++ b/src/lib/krb5/ccache/stdio/scc_maybe.c @@ -92,6 +92,9 @@ krb5_scc_open_file (context, id, mode) #ifdef ANSI_STDIO switch(mode) { case SCC_OPEN_AND_ERASE: + unlink(data->filename); + /* XXX should do an exclusive open here, but no way to do */ + /* this under stdio */ open_flag = "wb+"; break; case SCC_OPEN_RDWR: @@ -105,6 +108,9 @@ krb5_scc_open_file (context, id, mode) #else switch(mode) { case SCC_OPEN_AND_ERASE: + unlink(data->filename); + /* XXX should do an exclusive open here, but no way to do */ + /* this under stdio */ open_flag = "w+"; break; case SCC_OPEN_RDWR: