2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * This modules includes all the necessary functions that create and 2N/A * modify the Kerberos principal update and header logs. 2N/A#
if 0
/* Solaris Kerberos */ 2N/A * Sync update entry to disk. 2N/A * Sync memory to disk for the update log header. 2N/A * Couldn't sync to disk, let's panic 2N/A * Resizes the array elements. We reinitialize the update log rather than 2N/A * unrolling the the log and copying it over to a temporary log for obvious 2N/A * performance reasons. Slaves will subsequently do a full resync, but 2N/A * the need for resizing should be very small. 2N/A * Reinit log with new block size 2N/A * Time to expand log considering new block size 2N/A * Can't map into file larger than MAXLOGLEN 2N/A * Adds an entry to the update log. 2N/A * The layout of the update log looks like: 2N/A * header log -> [ update header -> xdr(kdb_incr_update_t) ], ... 2N/A /* Resize element array failed */ 2N/A * We need to overflow our sno, replicas will do full 2N/A * resyncs once they see their sno > than the masters. 2N/A * We squirrel this away for finish_update() to index 2N/A * Since this is a circular array, once we circled, kdb_first_sno is 2N/A * always kdb_entry_sno + 1. 2N/A * Mark the log entry as committed and sync the memory mapped log 2N/A * Set the header log details on the slave and sync it to file. 2N/A * Delete an entry to the update log. 2N/A * Used by the slave or master (during ulog_check) to update it's hash db from 2N/A * the incr update log. 2N/A * Must be called with lock held. 2N/A * We reset last_sno and last_time to 0, if krb5_db2_db_put_principal 2N/A * or krb5_db2_db_delete_principal fail. 2N/A +
1) *
sizeof (
char));
2N/A * Validate the log file and resync any uncommitted update entries 2N/A * to the principal database. 2N/A * Must be called with lock held. 2N/A * Update entry corrupted we should scream and die 2N/A * We don't want to readd this update and just use the 2N/A * existing update to be propagated later on 2N/A * upd was freed by ulog_replay, we NULL 2N/A * the pointer in case we subsequently break from loop. 2N/A * We flag this as committed since this was 2N/A * the last entry before kadmind crashed, ergo 2N/A * the slaves have not seen this update before 2N/A * Map the log file to memory for performance and simplicity. 2N/A * Called by: if iprop_enabled then ulog_map(); 2N/A * Assumes that the caller will terminate on ulog_map, hence munmap and 2N/A * closing of the fd are implicitly performed by the caller. 2N/A * Returns 0 on success else failure. 2N/A * File doesn't exist so we exit with kproplog 2N/A * Can't open existing log file 2N/A * else kadmind, kpropd, & kcommands should udpate stores 2N/A * Can't map update log file to memory 2N/A * kproplog and kpropd don't need to do anything else 2N/A * Reinit ulog if the log is being truncated or expanded after 2N/A * Expand ulog if we have specified a greater size 2N/A * Get the last set of updates seen, (last+1) to n is returned. 2N/A * Check to make sure we don't have a corrupt ulog first. 2N/A * We need to lock out other processes here, such as kadmin.local, 2N/A * since we are looking at the last_sno and looking up updates. So 2N/A * we can share with other readers. 2N/A * We may have overflowed the update log or we shrunk the log, or 2N/A * the client's ulog has just been created. 2N/A * Validate the time stamp just to make sure it was the same sno 2N/A * If we have the same sno we return success 2N/A * Mark commitment since we didn't 2N/A * want to decode and encode the 2N/A * incr update record the first time. 2N/A * We have time stamp mismatch or we no longer have 2N/A * the slave's last sno, so we brute force it 2N/A * Should never get here, return error 2N/A * Extend update log file. 2N/A static const char zero[
512] = { 0, };