74 Commits

Author SHA1 Message Date
0e8c4ccc6e hdb: eliminate hdb_entry_ex
Remove hdb_entry_ex and revert to the original design of hdb_entry (except with
an additional context member in hdb_entry which is managed by the free_entry
method in HDB).
2022-01-15 18:54:57 +11:00
c5551775e2 hdb: decorate HDB_entry with context member
Decorate HDB_entry with context and move free_entry callback into HDB structure
itself. Requires updating hdb_free_entry() signature to include HDB parameter.
A follow-up commit will consolidate hdb_entry_ex (which has a single hdb_entry
member) into hdb_entry.
2022-01-15 18:54:57 +11:00
b7bf5ca6e8 kadmin: Fix warnings 2022-01-14 14:59:02 -06:00
bac9c1fe94 Use correct ret value in load error messages 2017-12-06 21:18:47 -05:00
d2130e3312 Handle long lines in dump files 2017-10-11 17:13:07 -05:00
7d5f8bb051 Disable sync during kadmin load 2017-10-10 14:29:09 -05:00
ffd0dda237 Fix iprop against legacy master with full log
When the master's log has all entries from version 1 to now, and no
uber entry (legacy master), then new slaves will not pull version 1,
because their uber record has version 1.

The fix is to force the uber version to 0 always, and avoid adding a
truncate nop when doing a full prop.  The uber record now records the
database version even in the absence of any other log entries so that
we know what to pull going forward.
2016-06-09 01:03:10 -04:00
20df2c8706 Two-phase HDB commit via iprop log, + GC for log
We used to update the iprop log and HDB in different orders depending on
the kadm5 operation, which then led to various race conditions.

The iprop log now functions as a two-phase commit (with roll forward)
log for HDB changes.  The log is auto-truncated, keeping the latest
entries that fit in a configurable maximum number of bytes (defaults to
50MB).  See the log-max-size parameter description in krb5.conf(5).

The iprop log format and the protocol remain backwards-compatible with
earlier versions of Heimdal.  This is NOT a flag-day; there is NO need
to update all the slaves at once with the master, though it is advisable
in general.  Rolling upgrades and downgrades should work.

The sequence of updates is now (with HDB and log open and locked):

a) check that the HDB operation will succeed if attempted,
b) append to iprop log and fsync() it,
c) write to HDB (which should fsync()),
d) mark last log record committed (no fsync in this case).

Every kadm5 write operation recover transactions not yet confirmed as
committed, thus there can be at most one unconfirmed commit on a master
KDC.

Reads via kadm5_get_principal() also attempt to lock the log, and if
successful, recover unconfirmed transactions; readers must have write
access and must win any race to lock the iprop log.

The ipropd-master daemon also attempts to recover unconfirmed
transactions when idle.

The log now starts with a nop record whose payload records the offset of
the logical end of the log: the end of the last confirmed committed
transaction.  This is kown as the "uber record".  Its purpose is
two-fold: act as the confirmation of committed transactions, and provide
an O(1) method of finding the end of the log (i.e., without having to
traverse the entire log front to back).

Two-phase commit makes all kadm5 writes single-operation atomic
transactions (though some kadm5 operations, such as renames of
principals, and changes to principals' aliases, use multiple low-level
HDB write operations, but still all in one transaction).  One can still
hold a lock on the HDB across many operations (e.g., by using the lock
command in a kadmin -l or calling kadm5_lock()) in order to push
multiple transactions in sequence, but this sequence will not be atomic
if the process or host crashes in the middle.

As before, HDB writes which do not go through the kadm5 API are excluded
from all of this, but there should be no such writes.

Lastly, the iprop-log(1) command is enhanced as follows:

 - The dump, last-version, truncate, and replay sub-commands now have an
   option to not lock the log.  This is useful for inspecting a running
   system's log file, especially on slave KDCs.

 - The dump, last-version, truncate, and replay sub-commands now take an
   optional iprop log file positional argument, so that they may be used
   to inspect log files other than the running system's
   configured/default log file.

Extensive code review and some re-writing for clarity by Viktor Dukhovni.
2016-02-26 00:55:33 -06:00
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
433b1d5073 drop RCSID 2010-03-16 12:52:58 -07:00
d83aacd2c5 drop krb5_get_err_text 2009-11-04 22:27:55 -08:00
20d4cca179 Make skip-ing work again, so that tests passes again 2009-07-30 18:55:45 +02:00
e395b3a9ea Free d on failure [CID-103] 2009-07-30 10:45:19 +02:00
9b710bed81 store is never read again 2009-07-29 22:37:58 +02:00
5bfb2c6578 use calloc to allocate salt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24989 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-29 09:03:05 +00:00
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
091fba8a25 return 1 on failure, update (c)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16658 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-01-25 12:29:46 +00:00
0c2369acd0 Wrap hdb_entry with hdb_entry_ex, patch originally from Andrew Bartlet
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16378 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-12-12 12:40:12 +00:00
f2cd11a998 Parse extensions.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15892 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-08-11 13:52:26 +00:00
5654000990 lower amount of shadow and const warnings
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15587 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-07 22:06:50 +00:00
6f5805bd03 max-life and max-renew is of unsigned int in asn1 compiler, use that
for the parser too


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14737 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-04-04 18:01:35 +00:00
5836537f76 argument number checks are now done by slc
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-05 11:41:22 +00:00
d970c48c81 print error messages to stderr; change all in-string quoting to use "
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14021 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-04 15:09:42 +00:00
54e18d77a9 make merge/load work again
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14018 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-02 13:43:27 +00:00
cf22688e0c check for local mode
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14008 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-27 17:33:33 +00:00
9929f779ec move kadmin-commands.h from kadmin_locl.h so kadmind does not depend on it
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14000 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-27 15:04:07 +00:00
d7f9fac88e convert to use slc; also add stash subcommand
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13970 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-21 19:19:45 +00:00
0540f13b86 prefix all struct HDB elements with hdb_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12880 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-19 00:25:35 +00:00
921f49e5cb (parse_generation): return if there is no generation (spotted by
Daniel Kouril)


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11380 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-09-04 20:44:35 +00:00
12e80fb1e6 remove unused etypes code, and add parsing of the generation field
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10470 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-08-10 13:52:22 +00:00
8ef4f2e87d increase line buffer to 8k
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10399 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-07-30 06:51:53 +00:00
67422a6b02 s/[gs]et_progname/[gs]etprogname/
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9704 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-02-20 01:44:56 +00:00
3ea518adb5 (doit): print an error and bail out if storing an entry in the
database fails.  The most likely reason for it failing is
out-of-space.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9447 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-01-04 15:59:26 +00:00
1a7c4545a0 fix option parsing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9388 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-12-14 16:25:02 +00:00
9c1353f1f8 add option parsing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9044 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-09-10 19:19:20 +00:00
f6ec8279ca (doit): truncate the log since there's no way of knowing what changes
are going to be added


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8806 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-07-24 04:33:55 +00:00
e8a871c631 (doit): check return value from parse_hdbflags2int correctly
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7953 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-02-16 16:05:28 +00:00
d5c8ae247b checking all parsing for errors and all memory allocations also
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-01-25 22:59:27 +00:00
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
5f9cd99108 check for (un-)encrypted keys
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6103 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-03 17:17:38 +00:00
8de0cc5aff (doit): fix error message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5907 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-04-10 15:28:58 +00:00
36e7fe6745 cast in is* to get rid of stupid warning
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5550 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-03-16 13:29:48 +00:00
aaae186ab9 merge new-crypto branch
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5332 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-02-11 21:03:59 +00:00
b67c0c5636 (parse_keys): abort when detecting errors
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5292 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-01-30 18:16:57 +00:00
6fc8be2015 Load etypes.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4727 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-04-05 05:47:54 +00:00
fc3c776c5b Incorporate into kadmin.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4033 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-16 11:00:53 +00:00
57f97cb91b static-ize and fix fprintf
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3741 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-02 03:53:35 +00:00
ae31038985 adapt to new hdb interface
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3628 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-10-16 04:14:00 +00:00