Commit Graph

1594 Commits

Author SHA1 Message Date
Love Hornquist Astrand
c7cd31ef9d make sure we propagate an error code in case of wrong number of ms-san
Patch from Matthieu Hautreux
2013-02-10 19:07:44 -08:00
Love Hornquist Astrand
58ff480763 rewrite send to kdc to be more agressive, try kdcs in paralell and easier to configure behavior 2013-02-10 19:02:52 -08:00
Love Hornquist Astrand
8ceff72d80 enabled the performance hack 2012-12-27 13:06:25 +01:00
Love Hornquist Astrand
4e40f3e30f Make a memory copy of the keytab to avoid unbuffered krb5_storage
300req/s faster (20% performance increase)
2012-12-27 12:40:40 +01:00
Love Hornquist Astrand
039b1941ea do chdir("/") after chroot() 2012-11-27 21:58:06 -08:00
Love Hornquist Astrand
0570fbf9fd don't double free fd 2012-11-27 21:58:05 -08:00
Dana Koch
a95cae113d Fix typo with return values in realloc_descrs.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-11-22 17:24:40 -08:00
Dana Koch
3f71aca591 If multiple accept's happen during a select, make sure it gets stored correctly, and does not clobber an existing open descriptor.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-11-17 14:07:59 -08:00
Love Hornquist Astrand
029de6cfa4 pass back an heim_error from hx509_cert_init 2012-10-07 06:33:13 -07:00
Roland C. Dowdeswell
be5afdbf7f Make concurrent builds work.
To stop the errors when building concurrently, we make a number of
changes:

        1.  stop including generated files in *_SOURCES,

        2.  make *-protos.h and *-private.h depend on the *_SOURCES,

        3.  make all objects depend on *-{protos,private}.h,

        4.  in a few places change dir/header.h to $(srcdir)/dir/header.h,

This appears to work for me with make -j16 on a 4-way box.
2012-08-08 00:04:04 +01:00
Nicolas Williams
a3947acb38 Fix segfault in MIT dump entry parsing code 2012-05-19 21:57:53 -05:00
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
Love Hörnquist Åstrand
ec152cdf1a drain pool for each request 2012-04-05 22:55:01 -07: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
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
f4ba41ebdd Pluggable libheimbase interface for DBs and misc libheimbase enhancements
[Code reviewed by Love Hörnquist Åstrand <lha@kth.se>]

    Added heim_db_*() entry points for dealing with databases, and
    make krb5_aname_to_localname() use it.

    The following enhancements to libheimbase are included:

     - Add heim_data_t and heim_string_t "reference" variants to
       avoid memory copies of potentially large data/strings.

       See heim_data_ref_create() and heim_string_ref_create().

     - Added enhancements to heim_array_t to allow their use for
       queues and stacks, and to improve performance.  See
       heim_array_insert_value().

     - Added XPath-like accessors for heim_object_t.  See
       heim_path_get(), heim_path_copy(), heim_path_create(), and
       heim_path_delete().  These are used extensively in the DB
       framework's generic composition of ACID support and in the
       test_base program

     - Made libheimbase more consistent with Core Foundation naming
       conventions.  See heim_{dict, array}_{get, copy}_value() and
       heim_path_{get, copy}().

     - Added functionality to and fixed bugs in base/json.c:
        - heim_serialize();
        - depth limit for JSON parsing (for DoS protection);
        - pretty-printing;
        - JSON compliance (see below);
        - flag options for parsing and serializing; these are needed
          because of impedance mismatches between heim_object_t and
          JSON (e.g., heim_dict_t allows non-string keys, but JSON
          does not; heimbase supports binary data, while JSON does
          not).

     - Added heim_error_enomem().

     - Enhanced the test_base program to test new functionality and
       to use heim_path*() to better test JSON encoding.  This
       includes some fuzz testing of JSON parsing, and running the
       test under valgrind.

     - Started to add doxygen documentation for libheimbase (but doc
       build for libheimbase is still incomplete).

    Note that there's still some incomplete JSON support:

     - JSON string quoting is not fully implemented;

     - libheimbase lacks support for real numbers, while JSON has
       it -- otherwise libheimbase is a superset of JSON,
       specifically in that any heim_object_t can be a key for an
       associative array.

    The following DB backends are supported natively:

     - "sorted-text", a binary search of sorted (in C locale), flat
       text files;

     - "json", a backend that stores DB contents serialized as JSON
       (this is intended for configuration-like contents).

    The DB framework supports:

     - multiple key/value tables per-DB
     - ACID transactions

    The DB framework also natively implements ACID transactions for
    any DB backends that a) do not provide transactions natively, b)
    do provide lock/unlock/sync methods (even on Windows).  This
    includes autocommit of DB updates outside transactions.

    Future DB enhancements may include:

     - add backends for various DB types (BDB, CDB, MDB, ...);

     - make libhdb use heim_db_t;

     - add a command-line tool for interfacing to databases via
       libheimbase (e.g., to get/set/delete values, create/copy/
       backup DBs, inspect history, check integrity);

     - framework-level transaction logging (with redo and undo
       logging), for generic incremental replication;

     - framework-level DB integrity checking.

       We could store a MAC of the XOR of a hash function applied to
       {key, value} for every entry in the DB, then use this to check
       DB integrity incrementally during incremental replication, as
       well as for the whole DB.
2012-02-05 16:26:32 -06:00
Nicolas Williams
6dd66df594 Make master build on Windows
Add strtoll()/strtoull() to lib/roken
    Add stdint.h to lib/roken (Windows only)
    Add logic to detect whether to use lib/roken's stdint.h based on
        Visual Studio version
    Add include of stdint.h in generated ASN.1 code
    Export missing symbols for 64-bit integers in lib/asn1
    Export missing symbols for FAST
    Add missing sources to kdc/NTMakefile
    Fix issue in kuserok
    Fix bsearch issues
2012-01-17 12:10:14 -06:00
Nicolas Williams
11763aecc7 There's no HEIM_BOOL_TRUE; use heim_bool_create(1) instead 2012-01-13 16:18:50 -06:00
Love Hornquist Astrand
07a88f4b5a use no-store 2012-01-10 22:54:16 +01:00
Love Hornquist Astrand
9b0bc022f1 support kgetcred 2012-01-10 22:54:16 +01:00
Russ Allbery
0f81a468a3 Link kdc-tester with libheimbase directly
It directly uses symbols provided by that library.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2011-12-22 14:52:58 -06:00
Nicolas Williams
265d9ba5ca Error/warning cleanups for clang (LLVM) 2011-11-28 14:42:06 -06:00
Nicolas Williams
c757eb7fb0 Rename and fix as/tgs-use-strongest-key config parameters
Different ticket session key enctype selection options should
    distinguish between target principal type (krbtgt vs. not), not
    between KDC request types.
2011-11-25 17:21:04 -06:00
Love Hörnquist Åstrand
fa304162db test rsa mode too 2011-11-23 09:43:56 -08:00
Love Hörnquist Åstrand
04895ee955 extract out perf number code 2011-11-23 07:10:35 -08:00
Love Hörnquist Åstrand
dce7b990ed handle writing credential into ccache, use them in as fast-ccache and then destory them 2011-11-22 17:57:05 -08:00
Nicolas Williams
35f4032381 Add PKINIT support in kdc-tester and check-tester 2011-11-22 18:48:41 -06:00
Nicolas Williams
d630567f70 Add performance measurements for FAST (with host key and user keys, not password) 2011-11-22 17:05:06 -06:00
Love Hornquist Astrand
72e88209f8 support keytab testing (and use it) 2011-11-22 11:00:51 -08:00
Nicolas Williams
1572b762b6 Fix missing symbols. 2011-11-22 00:32:52 -06:00
Love Hörnquist Åstrand
a82fb8ae3e perf counter 2011-11-21 20:57:17 -08:00
Love Hörnquist Åstrand
af7f0eb746 less verbose 2011-11-21 20:34:36 -08:00
Love Hörnquist Åstrand
6af6e27c50 glue in send_to_kdc 2011-11-21 20:34:36 -08:00
Love Hörnquist Åstrand
c4721dd1d0 add basic support for pkinit 2011-11-21 20:34:35 -08:00
Love Hörnquist Åstrand
503266c4a3 use json to drive kdc-tester 2011-11-21 20:34:35 -08:00
Nicolas Williams
124eccf014 Make this work with kvno 0 and no kvno 2011-11-15 21:53:34 -06:00
Nicolas Williams
38f726d8b4 Fix bug in key rollover code in TGS, make check-kdc test what we can
We can't test the key rollover support in the TGS in the x-realm
    path using just Heimdal because the krb5_get_creds() path will try a
    referral, which will produce a cross-realm TGT that has the
    enc_part.kvno set.  But we can test this for the plain TGT case.
2011-11-15 21:53:34 -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
Love Hörnquist Åstrand
b26fc106de fix typo, from Robert Simmons 2011-11-13 10:01:41 -08:00
Nicolas Williams
8586d9f88e Fix enctype selection issues for PAC and other authz-data signatures
We were using the enctype from the PA-TGS-REQ's AP-REQ's Ticket to
    decide what key from the service's realm's krbtgt principal to use.
    This breaks when: a) we're doing cross-realm, b) the service's
    realm's krbtgt principal doesn't have keys for the enctype used in
    the cross-realm TGT.

    The fix is to pick the correct key (strongest or first, per-config)
    from the service's realm's krbtgt principal.
2011-11-09 00:32:38 -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
Love Hörnquist Åstrand
f0fb8b1bef merge error 2011-10-28 19:34:35 -07:00
Love Hörnquist Åstrand
1a1bd736c0 merge support for FAST in as-req codepath 2011-10-28 19:25:48 -07:00
Nicolas Williams
a5e77c578e Deferred hostname canon using name canon rules 2011-10-22 14:54:13 -05:00
Love Hornquist Astrand
8192b9ed35 remove refernces to kerberos 4 and kaserver 2011-10-12 12:40:59 +02:00
Nicolas Williams
4c6976a6bd Fix check-des
The previous fix was incomplete.  But it also finally uncovered an
    old check-des problem that I'd had once and which may have gotten
    papered over by changing the default of one of the *strongest* KDC
    parameters.  The old problem is that we were passing the wrong
    enctype to _kdc_encode_reply(): we were passing the session key
    enctype where the ticket enc-part key's enctype was expected.

    The whole enctype being passed in is superfluous anyways.  Let's
    clean that up next.
2011-10-12 01:17:54 -05:00
Nicolas Williams
12cd2c9cbd Fix TGS ticket enc-part key selection
When I added support for configuring how the KDC selects session,
    reply, and ticket enc-part keys I accidentally had the KDC use the
    session key selection algorithm for selecting the ticket enc-part
    key.  This becomes a problem when using a Heimdal KDC with an MIT
    KDB as the HDB backend and when the krbtgt keys are not in
    strongest-to-weakest order, in which case forwardable tickets minted
    by the Heimdal KDC will not be accepted by MIT KDCs with the same
    KDB.
2011-10-11 23:57:58 -05:00
Love Hornquist Astrand
b94080696a indent 2011-09-09 10:31:46 +02:00
Andrew Bartlett
714d166d04 heimdal: Try to handle the PAC checking when we are in a cross-realm environment
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-09-09 10:20:52 +02:00