[krbdev.mit.edu #8026] git commit

Greg Hudson via RT rt-comment at krbdev.mit.edu
Mon Nov 3 13:25:40 EST 2014


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 at mit.edu>
Commit: 6979ead5e5c24ca0ec3569eb4bef48c2e5d8a726
Branch: master
 src/lib/krb5/ccache/cc_file.c |  875 +++++++++++++++--------------------------
 1 files changed, 313 insertions(+), 562 deletions(-)



More information about the krb5-bugs mailing list