]> git.ipfire.org Git - thirdparty/krb5.git/commit
Use stdio reads, O_APPEND writes in FILE ccache 218/head
authorGreg Hudson <ghudson@mit.edu>
Sun, 12 Oct 2014 22:46:17 +0000 (18:46 -0400)
committerGreg Hudson <ghudson@mit.edu>
Mon, 3 Nov 2014 17:51:44 +0000 (12:51 -0500)
commit6979ead5e5c24ca0ec3569eb4bef48c2e5d8a726
tree3ee346b4022bc21ce8fcdd292e33161b2c7bac3d
parent21c6d59c9b5b08cbd2c87a96a719b0ac511cce51
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.

ticket: 8026 (new)
src/lib/krb5/ccache/cc_file.c