[28650] in CVS-changelog-for-Kerberos-V5

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

krb5 commit: Don't fdopen() in append mode in cc_file.c

daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Sat Nov 29 16:23:45 2014

Date: Sat, 29 Nov 2014 16:23:40 -0500
From: Benjamin Kaduk <kaduk@mit.edu>
Message-Id: <201411292123.sATLNec2031180@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/d65c504432f01eb1a03703af07356f538f16f8c6
commit d65c504432f01eb1a03703af07356f538f16f8c6
Author: Ben Kaduk <kaduk@mit.edu>
Date:   Mon Nov 24 18:23:32 2014 -0500

    Don't fdopen() in append mode in cc_file.c
    
    Implementations of fdopen() are inconsistent about the state of
    the file offset after fdopen(., "a+") -- some position the stream
    at the end of the file immediately (e.g., Solaris), for both reading
    and writing, but others let reads occur from the beginning of the
    file (e.g., glibc).
    
    As it turns out, we only ever write to the file descriptor, not
    through stdio, so opening the file with O_APPEND and using fdopen()
    with "r+b" should give us sufficient append semantics, while
    more portably letting the stream read from the beginning of the file.
    
    This fixes the test suite on Solaris, a regression introduced
    by commit 6979ead5e5c24ca0ec3569eb4bef48c2e5d8a726.
    
    ticket: 8026

 src/lib/krb5/ccache/cc_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c
index e220971..295f959 100644
--- a/src/lib/krb5/ccache/cc_file.c
+++ b/src/lib/krb5/ccache/cc_file.c
@@ -348,7 +348,7 @@ open_cache_file(krb5_context context, const char *filename,
         return ret;
     }
 
-    fp = fdopen(fd, writable ? "a+b" : "rb");
+    fp = fdopen(fd, writable ? "r+b" : "rb");
     if (fp == NULL) {
         (void)krb5_unlock_file(context, fd);
         (void)close(fd);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

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