Skip Menu |
 

From: ghudson@mit.edu
Subject: git commit
Download (untitled) / with headers
text/plain 1.3KiB

Use stdio reads, O_APPEND writes in FILE ccache

Remove open file state from the cache handle, use stdio for reading,
use single O_APPEND writes for writing, and use O_CLOEXEC when
opening. Keep the file handle open during iteration. These changes
simplify the code, fix some concurrency issues, and reduce the
dependency on POSIX file locks. We still acquire file locks for
compatibility with older code, and in case O_APPEND writes aren't
concurrency-atomic.

Helper functions change as follows:
* open_cache_file yields a stdio handle, and only opens and locks.
* close_cache_file takes a stdio handle.
* read_header (new) reads the file header and yields a version.
* invalidate_cache and fcc_lseek are no longer needed.
* get_size, read_bytes, and load_bytes operate on a stdio handle.
* read32, read16, load_data, load_principal, and load_cred operate on
a stdio handle and version.
* write_bytes, store32, store16, and store_principal are no longer
needed.

fcc_initialize now takes responsibility for writing the header and
default client principal, using a single write.

https://github.com/krb5/krb5/commit/6979ead5e5c24ca0ec3569eb4bef48c2e5d8a726
Author: Greg Hudson <ghudson@mit.edu>
Commit: 6979ead5e5c24ca0ec3569eb4bef48c2e5d8a726
Branch: master
src/lib/krb5/ccache/cc_file.c | 875 +++++++++++++++--------------------------
1 files changed, 313 insertions(+), 562 deletions(-)
From: ghudson@mit.edu
Subject: git commit

Fix spurious gcc warning in cc_file.c

gcc 4.6.3 (present in Ubuntu 12.04) is smart enough to look at
get_size and see that it does not always assign to *size_out, but not
smart enough to figure out that it always assigns to *size_out when it
returns 0. As a result, it outputs two warnings which we treat as
errors. Add an initial assignment to *size_out at the beginning of
get_size to work around this.

https://github.com/krb5/krb5/commit/35ab0d013f35a9840d0fbcb8de3b194eb501199d
Author: Greg Hudson <ghudson@mit.edu>
Commit: 35ab0d013f35a9840d0fbcb8de3b194eb501199d
Branch: master
src/lib/krb5/ccache/cc_file.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: ghudson@mit.edu
Subject: git commit

Fix minor cleanup issue in file ccache

If we fail to open the cache file in fcc_initialize, we could wind up
calling close(-1) which is harmless but incorrect. Avoid this by
initializing fd and conditionalizing its cleanup.

https://github.com/krb5/krb5/commit/16989828e9b9137b4f3c701962d838360f895636
Author: Greg Hudson <ghudson@mit.edu>
Commit: 16989828e9b9137b4f3c701962d838360f895636
Branch: master
src/lib/krb5/ccache/cc_file.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
From: kaduk@MIT.EDU
Subject: git commit

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.

https://github.com/krb5/krb5/commit/d65c504432f01eb1a03703af07356f538f16f8c6
Author: Ben Kaduk <kaduk@mit.edu>
Commit: d65c504432f01eb1a03703af07356f538f16f8c6
Branch: master
src/lib/krb5/ccache/cc_file.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)