Commit Graph

665 Commits

Author SHA1 Message Date
Nicolas Williams
57f1545a46 Add support for writing to KDB and dumping HDB to MIT KDB dump format
Before this change Heimdal could read KDBs.  Now it can write to
    them too.

    Heimdal can now also dump HDBs (including KDBs) in MIT format, which
    can then be imported with kdb5_util load.

    This is intended to help in migrations from MIT to Heimdal by
    allowing migrations from Heimdal to MIT so that it is possible
    to rollback from Heimdal to MIT should there be any issues.  The
    idea is to allow a) running Heimdal kdc/kadmind with a KDB, or
    b) running Heimdal with an HDB converted from a KDB and then
    rollback by dumping the HDB and loading a KDB.

    Note that not all TL data types are supported, only two: last
    password change and modify-by.  This is the minimum necessary.
    PKINIT users may need to add support for KRB5_TL_USER_CERTIFICATE,
    and for databases with K/M history we may need to add KRB5_TL_MKVNO
    support.

    Support for additional TL data types can be added in
    lib/hdb/hdb-mitdb.c:_hdb_mdb_value2entry() and
    lib/hdb/print.c:entry2mit_string_int().
2012-05-03 14:24:18 -05:00
Roland C. Dowdeswell
0c0a4ff071 Add require-pwchange flag to HDB and honour it if present in mit-db:.
Also remove +requires_pwchange on passwd changes.
2012-03-06 11:39:20 +00:00
Love Hörnquist Åstrand
65987846fd make bind principal a common function 2012-02-28 00:03:20 -08:00
Roland C. Dowdeswell
0da84c0c3a Add require-pwchange flag to HDB and honour it if present in mit-db:. 2012-02-27 10:19:54 +00:00
Roland C. Dowdeswell
800a4e5c94 We're free(3)ing the wrong ptr, here. 2012-02-24 18:56:29 +00:00
Roland C. Dowdeswell
e8779d5d4a Add -Wshadow and deal with the warnings. 2012-02-21 11:17:55 +00:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Nicolas Williams
19d378f44d Add 64-bit integer support to ASN.1 compiler
ASN.1 INTEGERs will now compile to C int64_t or uint64_t, depending
    on whether the constraint ranges include numbers that cannot be
    represented in 32-bit ints and whether they include negative
    numbers.

    Template backend support included.  check-template is now built with
    --template, so we know we're testing it.

    Tests included.
2011-12-12 20:01:20 -06:00
Nicolas Williams
417dff03ba Fix trailing whitespace 2011-11-29 14:50:44 -06:00
Roland C. Dowdeswell
af011f57fc Provide server side kadm5_chpass_principal_3() with ks_tuple implementation.
We enable kadm5_chpass_principal_3() in the server side of the
library.  The client kadm5 library calls will still return the
error KAMD5_KS_TUPLE_NO_SUPP.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2011-11-29 14:47:37 -06:00
Roland C. Dowdeswell
00bea41dcb Fix hdb_generate_key_set() to honour ks_tuple, n_ks_tuple.
The code was generating a char ** of string representations of the
ks_tuple() array but it was not using it.  We modify the code to:

	1.  extend the array returned by ks_tuple2str() to include
	    enough space for the trailing NULL and ensure that there
	    is a NULL at the end,

	2.  not free the array before exiting ks_tuple2str() as we
	    intend to use it in the caller,

	3.  re-organise the pointers in hdb_generate_key_set() to
	    make it more clear how we are to free things that have
	    been allocated.

	4.  free the char ** given us by ks_tuple2str() if it has
	    been allocated.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2011-11-29 14:47:37 -06:00
Roland C. Dowdeswell
2f6ad56c46 Reverse order of n_ks_tuple and ks_tuple in hdb_generate_key_set().
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2011-11-29 14:47:37 -06:00
Nicolas Williams
c9609cdb37 Initial patch for dealing with AD x-realm key rollover
AD issues x-realm TGTs with kvno 0.  On key x-realm trust key change
    we need to be able to try current and previous keys for trust, else
    we will have some failures.
2011-11-15 21:53:33 -06:00
Nicolas Williams
19b6c47f72 Handle 1DES enctype similarity in MIT HDB
We have some cross-realm principals in an MIT KDB with one kind of
    1DES enctype, but the other realm's KDCs issue x-realm TGTs where
    the ticket encpart key enctype is a different 1DES enctype.  We need
    this to work if we use Heimdal with the MIT HDB backend.

    An alternative would be to check for similar (or, rather,
    compatible) enctypes in the KDC (and elsewhere?).  This patch avoids
    the need to make such ugly changes elsewhere.
2011-11-09 00:59:15 -06:00
Nicolas Williams
3bebbe5323 Fixes to make Heimdal -Wall -Werror clean
These fixes make developer mode build, at least on Ubuntu.
2011-11-02 21:42:08 -05:00
Nicolas Williams
1b03abb250 This should be the final fix for enctype 0 issues (tested)
But how to build an MIT KDB with enctype 0 keys for testing in
    Heimdal?  Hmmm...
2011-10-06 00:55:54 -05:00
Nicolas Williams
e15cabe10a Fix for enctype 0 / length 0 keys in MIT HDB backend was incomplete 2011-10-05 17:50:26 -05:00
Nicolas Williams
3d6f86af27 Fix segfault in hdb-mitdb when princ have salt 2011-10-02 23:08:37 -05:00
Love Hornquist Astrand
923f3a434f free krb5_storage when dne 2011-09-30 12:44:34 +02:00
Jeffrey Altman
15796ce63d Add missing export
Patchset 0c893d3980 left
out the export of hdb_change_kvno for Windows.

Change-Id: Ie41a867054465994249a651725c72fcec333f19d
2011-09-23 15:26:32 -04:00
Nicolas Williams
0c893d3980 Fixed booboos from kadm5 key history patch set
Also: add support for ignoring null enctype / zero-length keys,
    which *can* be found in MIT DB entries created in pre-historic
    times.

    Also: make the mitdb HDB backend more elegant (e.g., use the ASN.1
    compiler's generated sequence/array utility functions.

    Also: add a utility function needed for kadm5 kvno change
    improvements and make kadmin's mod --kvno work correctly and
    naturally.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-09-22 15:13:13 +02:00
Luke Howard
775a452313 some Windows build fixes 2011-09-12 20:11:36 +10:00
Love Hörnquist Åstrand
c9e37efbe1 try get spelling right 2011-07-30 14:27:32 -07:00
Stefan Metzmacher
272d7511ca lib/hdb: add HDB_F_FOR_AS_REQ and HDB_F_FOR_TGS_REQ flags
This will be used to indicate to the backend if a fetch is for
an AS REQ or TGS REQ. Samba needs to take some action in the
HDB_F_FOR_TGS_REQ case and always canonicalize the principal
names, even without HDB_F_CANON.

metze

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-07-30 11:56:46 -07:00
Love Hörnquist Åstrand
5fc3d6fffa spelling 2011-07-27 08:28:44 -07:00
Love Hörnquist Åstrand
5732d85e29 generate sequence for HDB-Ext-KeySet and Keys 2011-07-26 20:18:57 -07:00
Love Hörnquist Åstrand
8b7e31c301 plug memory leak 2011-07-26 20:15:33 -07:00
Love Hörnquist Åstrand
74ec640500 Only free ext on replace 2011-07-24 20:23:30 -07:00
Love Hörnquist Åstrand
2ae9bbb915 update (c) 2011-07-24 20:04:02 -07:00
Love Hörnquist Åstrand
1a6195153f start to use KRB5_ENCTYPE_ 2011-07-24 20:02:10 -07:00
Love Hörnquist Åstrand
f9afd37eed use add_HDB_Ext_KeySet and plug memory leak 2011-07-24 18:14:25 -07:00
Love Hörnquist Åstrand
e32186d9de expore more 2011-07-24 16:15:06 -07:00
Love Hörnquist Åstrand
8fccb51d49 Merge pull request #12 from nicowilliams/krb5_admin_patches_2nd
Krb5 admin patches 2nd

This has all the patches needed for krb5_admind to build and pass most tests, that includes:
- more kadm5 API compatibility (including very basic profile functionality)
- multi-kvno support (useful for key rollovers) (a test for this is included in tests/db/check-kdc)

Unfinished:
- password history (currently uses key history, needs to be separated and use digests)
- policies (only default policy allowed)
- mit kdb changes not tested yet


Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-07-24 15:41:36 -07:00
Linus Nordberg
2e35198908 Add version-script.map to _DEPENDENCIES.
Added to 11 out of 14 directories with map files.  Not lib/ntlm,
lib/hcrypto and kdc which have the map file as an explicit dependency
to _OBBJECTS.

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-07-24 14:07:59 -07:00
Love Hörnquist Åstrand
f60ec15834 partly unify enctype/keytype since there is only enctypes 2011-07-24 14:03:08 -07:00
Nicolas Williams
95262936c7 s/assert/heim_assert/ and remove dead code 2011-07-24 11:07:27 -05:00
Love Hörnquist Åstrand
12403a31ce sprinkle more windows files 2011-07-23 11:18:21 -07:00
Nicolas Williams
1eb56edd86 Introduce Keys ::= SEQUENCE OF Key in hdb.asn1 so we can get convenience utils. 2011-07-22 16:07:08 -05:00
Nicolas Williams
689d4f4dd9 Another HDB_F_DECRYPT-isn't-critical fix. 2011-07-22 16:07:08 -05:00
Nicolas Williams
5335559845 Oops, HDB_F_DECRYPT isn't critical; making it so breaks tests. 2011-07-22 16:07:08 -05:00
Nicolas Williams
a246c394d2 Fix warnings. 2011-07-22 16:07:08 -05:00
Nicolas Williams
f2897efd09 Make the KDC path work. 2011-07-22 16:07:08 -05:00
Nicolas Williams
31974aa24c More s/int/size_t/ for iterators. Also fixed a stupid bug. 2011-07-22 16:07:06 -05:00
Nicolas Williams
cf1c898e95 Undo a s/size_t/int/. Iterators must be unsigned. 2011-07-22 16:07:05 -05:00
Nicolas Williams
0674e4b13a Ooops! Mind those tags when re-ordering ASN.1 SEQUENCEs! (hdb_keyset) 2011-07-22 16:07:05 -05:00
Nicolas Williams
53ea8ac59b Make changes to hdb_keyset type be backward-compatible. 2011-07-22 16:06:01 -05:00
Nicolas Williams
a280ed4d4c Forgot a file for the hdb_keyset backwards-compat extention. 2011-07-22 16:06:01 -05:00
Nicolas Williams
3794d8b37b Changed lib/hdb/Makefile.am to use --sequence=HDB-Ext-KeySet 2011-07-22 16:06:01 -05:00
Nicolas Williams
355ae357eb Moved set_time field of hdb_keyset to end and add extensibility marker. 2011-07-22 16:06:01 -05:00
Nicolas Williams
c2ec368c36 Add HDB extension for storing policy regarding what historic keys may be used for 2011-07-22 16:06:00 -05:00