Commit Graph

28406 Commits

Author SHA1 Message Date
Viktor Dukhovni
a5237e6940 Fix handling of uber record nominal version
When flushing the uber record, retain the current log version.  When the
uber record is the only (thus last) record in the log, return its nominal
version as the last version, not 0.  Upgrade the log if the current uber
record version number is not 0.
2016-06-09 07:04:01 -04:00
Nicolas Williams
316e0d2184 Store the canonical client princ in ipropd-slave
Otherwise we risk storing a name with the referral (empty) realm name,
which will then cause various knock-on effects, such as thinking that
the start_realm is "", and failing to find matching credentials in the
ccache.
2016-06-09 01:13:15 -04:00
Viktor Dukhovni
840dc40574 Refine name canonicalization
When storing credentials whose ticket principal is not equal to the
requested principal, store the ticket under both names not only when
the original realm is the referral realm, but more generally for any
difference at all.  This matches MIT behaviour.

Allow explicit name_canon rules to specify a realm to go with the
canonicalized hostname, if that realm is empty the effect is the
same "use-referrals"

Also fix segfault when no creds and debugging
2016-06-09 01:13:15 -04:00
Nicolas Williams
812b01b4ed Fix KDC segfault with OS X plugins
At least one "windc" plugin provided by OS X lacks a client_access()
entry point and caused the KDC to crash.  The KDC now checks for each
entry point in "windc" plugins and either falls back on alternative
default functionality or fails more gracefully than by crashing.
2016-06-09 01:13:15 -04:00
Nicolas Williams
2623cee389 Do not search system paths for non-ccapi plugins
On OS X anyways, since Heimdal cannot be built to replace the system
Kerberos implementation in OS X (even though it's based on Heimdal).

Heimdal plugins other than the CCAPI plugins have private ABIs with
strong coupling to the internals of the Heimdal libraries, thus using
system plugins in a non-system Heimdal is likely to end in tears (e.g.,
segfaults).

This means, for example, that OS X's plugins for PAC creation and
verification cannot be used by Heimdal.
2016-06-09 01:13:14 -04:00
Viktor Dukhovni
529a91d69a MacOS/X fixes 2016-06-09 01:13:14 -04:00
Viktor Dukhovni
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
Viktor Dukhovni
7d9fcb46b9 Ensure newly allocated ccache handles are zeroed
Otherwise, type-independent fields such as `initialized` have
uninitialized values, and incorrect behaviour may result.
2016-06-02 02:40:50 -04:00
Patrik Lundin
abad8d5700 kdc: fix _kdc_db_fetch when non-zero kvno specified
Prior change 83011252d7 which fixed
cross-realm trusts from AD to Heimdal removed the assignment of
'*kvno_ptr' to 'kvno' in the case where a non-zero key version
number is supplied by the caller.  This breaks cross-realm trusts
from Heimdal to another realm.

This change restores the missing assignment.

Change-Id: Ic041d9d797ba4c8c0c567da55066ba5d3d1874bb
2016-05-20 09:02:33 -04:00
Andrew Bartlett
5ddff2c532 Merge pull request #176 from urisimchoni/signed-kvno
Revert "KVNOs are krb5uint32 in RFC4120, make it so"
2016-05-17 19:05:20 +12:00
Andrew Bartlett
7ad8c26d27 Merge pull request #177 from jelmer/reproducible
Don't put system architecture in generated headers.
2016-05-16 11:09:11 +12:00
Jelmer Vernooij
0113798b18 Don't put system architecture in generated headers.
Including HOST causes the build to be unreproducible.
2016-05-15 23:04:49 +00:00
Andrew Bartlett
2ff110cfa6 Merge pull request #154 from metze-samba/heimdal-for-upstream
lib/krb5: allow predefined PAC_{LOGON_NAME,PRIVSVR_CHECKSUM,SERVER_CH…
2016-05-14 22:32:13 +12:00
Andrew Bartlett
b01d527a35 Merge pull request #171 from jelmer/parallel
Fix parallel builds.
2016-05-14 22:28:25 +12:00
Andrew Bartlett
cc38a9f7d1 Merge pull request #174 from abhinav-upadhyay/fix-krb5.conf.5
Various fixes in kfb5.conf man page:
2016-05-14 22:26:43 +12:00
Roland C. Dowdeswell
4fb67dcbc1 Update .gitignore to catch some additional artefacts. 2016-05-12 16:53:36 -04:00
Roland C. Dowdeswell
82054b4b79 lib/hdb/hdb-mitdb.c: this was failing to build due to undefined variables. 2016-05-12 16:44:51 -04:00
Roland C. Dowdeswell
b49431e47a lib/hcrypto/Makefile.am: set automake option: subdir-objects 2016-05-12 15:18:38 -04:00
Uri Simchoni
f227586b80 tgs_build_reply: fix signed-unsigned mismatch
A KVNO is unsigned and this is reflected in the internal
interfaces. However, for compatibility reasons its encoding
is signed and this creates a pointer mismatch when passing a
kvno pointer to _kdc_db_fetch.

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-05-08 07:58:11 +03:00
Viktor Dukhovni
1017a594ef Use OpenSSL include path as needed
For consistency make "-I" part of the macro value set by autoconf.

For now, don't attempt to handle OpenSSL rpath in cf/crypto.m4.
That's much easier by just setting LDFLAGS when running configure.
Otherwise too many Makefiles to edit and libtool and automake do
their best to undo the rpath.
2016-05-07 05:29:12 -04:00
Viktor Dukhovni
9393d53538 Actually capture libcrypto autoconf results
Also infer lib path not just include path, and set rpath if not from /usr.
Also need libcrypto for test_rand.
2016-05-07 02:36:34 -04:00
Viktor Dukhovni
131c8dd30e Export new ASN1 oid symbols and fix build
We added some new OID symbols in libasn1, make them public.

When an older Heimdal is already installed and its libraries don't
have some newly created symbols we run into build or test problems,
if libtool decides to use installed rather than just-built libraries.
This was happening with a few of test programs in libhx509.  Fixed.
2016-05-06 21:09:03 -04:00
Abhinav Upadhyay
1e085bb4da Various fixes in kfb5.conf man page:
Fix grammar at multiple places
Also, fix mdoc syntax at one place. There should be a space between the
section and the comma in the .Xr macro.
2016-04-28 15:50:48 +05:30
Jeffrey Altman
3de56adbcc Windows: Skip sha256 code sign if !CODESIGN
If we are not code signing we must define an action for _CODESIGN_SHA256
or the build system macros will be unbalanced.

Change-Id: I3c545de3c8ee809709defd12faeead358fde26dd
2016-04-23 20:58:25 -04:00
Jeffrey Altman
6c1ba82623 hcrypto: no openssl build requires evp-hcrypto.h include
When building evp-openssl.c without support for OpenSSL it is necessary
to include evp-hcrypto.h to define the HCRYPTO_FALLBACK functions.

Change-Id: Ifd51f9fcd2b1805a534a9f88992162818afffe7d
2016-04-23 19:03:56 -04:00
Jeffrey Altman
a4dae2513f Windows: add HCRYPTO_FALLBACK config to build system
HCRYPTO_FALLBACK is a required definition for building lib/hcrypto.
However, it wasn't added to the Windows build system.  This change
does so and enables fallback functionality.

Change-Id: I4a711c6da58e8832a61a3c0b2b8d9b10038425f0
2016-04-23 19:02:20 -04:00
Jeffrey Altman
c751314501 Windows: disable weak crypto
Weak crypto is disabled on every other system.  OpenAFS no longer
requires it and AuriStor doesn't need it.  Turn it off.

Change-Id: I6fab2328f71d1c38a655560ab0f83b8df9b53c73
2016-04-23 19:02:20 -04:00
Jelmer Vernooij
a460601ee3 Properly fix parallel builds. 2016-04-20 12:15:27 +00:00
Nicolas Williams
ca0dff891b Check HCRYPTO_FALLBACK in W32 backend 2016-04-19 13:40:47 -05:00
Nicolas Williams
c6c858c0ca Check HCRYPTO_FALLBACK in PKCS#11 backend 2016-04-19 13:40:47 -05:00
Nicolas Williams
7f96a2cc1a Check HCRYPTO_FALLBACK in CC backend 2016-04-19 13:40:47 -05:00
Nicolas Williams
8a749ced78 Check HCRYPTO_FALLBACK in ossl backend 2016-04-19 13:40:47 -05:00
Nicolas Williams
95a996ceae Add --without-hcrypto-fallback option 2016-04-19 13:40:46 -05:00
Nicolas Williams
e751e09108 Fix warnings in test_bulk.c 2016-04-19 13:40:46 -05:00
Nicolas Williams
7df276258a Fix mis-merge in evp-openssl.c 2016-04-19 13:40:46 -05:00
Nicolas Williams
12c922266b Fix 1DES/3DES cast bug and build 2016-04-19 13:40:46 -05:00
Nicolas Williams
a9887a843f cf/crypto.m4: use AC_DEFINE() for hcrypto provider 2016-04-19 13:24:36 -05:00
Nicolas Williams
e02832b199 Fix initialization race in evp-openssl.c 2016-04-19 13:24:36 -05:00
Jeffrey Altman
a234ee5265 Windows: Update code signing to support SHA256
Change-Id: I324e7c56fd73a744127c50e8fc136e8b23d860b0
2016-04-18 23:36:16 -05:00
Jeffrey Altman
bc20b5fad0 Windows: do not search for signtool.exe
Permit an explicit version of signtool.exe to be specified via an
environment variable.  Now that sha256 signatures are required the version
of signtool.exe that matches the SDK or Visual Studio version might not
be sufficient to apply code signatures.

Change-Id: I694e2b319bd692d6358ae7ce3d241da2da7648f8
2016-04-18 23:36:16 -05:00
Jeffrey Altman
4c1728ff73 Windows: code sign gsstool.exe
Change-Id: I1d79de51bdeefe1611eb69248d11d411361ab5d6
2016-04-18 23:36:16 -05:00
Jeffrey Altman
80f8325c64 lib/krb5: krb5_locl.h do not replicate roken.h
Move roken.h to the top of the header after config.h and remove the
includes that are duplicated by roken.h.

Change-Id: I33e29736519177f17c36e5c5948d7022011ab2b2
2016-04-17 17:19:53 -05:00
Jeffrey Altman
ce4fd05b12 fixup pkinit-ec.c (kdc and lib/krb5) includes
All source files must start with

  include <config.h>
  include <roken.h>

when krb5_locl.h or kdc_locl.h are includes, they must come before
other Heimdal include files.

Do not include stdint.h when roken.h is included.
Do not include config.h more than once.

Change-Id: I0baecb5d48317996f48b1a6c41b051f42f2fde61
2016-04-17 17:10:08 -05:00
Jeffrey Altman
87d56ef018 kpasswd: check krb5_unparse_name return
In verify() if krb5_unparse_name() fails 'sname' will be used
unitialized in the subsequent krb5_warnx() and free() calls.

Change-Id: I5a49bf06879eb5a77cf2d1d3f0d4b9c6549aeff8
2016-04-17 15:17:30 -05:00
Jeffrey Altman
4ad2f5830a hcrypto: p11_module_init_once make handle static global
Coverity complains about the leakage of 'handle' when the identifier
goes out of scope.  Change handle into a static global to hold the
value instead of a stack variable.

Change-Id: I040707ac731558f7d523f128a006a80b98d45b79
2016-04-17 15:11:55 -05:00
Jeffrey Altman
a08431b658 gss/mech: fix make_sasl_name ctx leak
The EVP_MD_CTX created in make_sasl_name() must be destroyed
to prevent a memory allocation leak.

Change-Id: I0b7f5b1b0f4f252bfcdaec755d09ed75de505f75
2016-04-17 15:11:42 -05:00
Jeffrey Altman
22c5327287 gssmask: check return of krb5_init_context
Check the return value so that a more obtuse error does not occur
later on.

Change-Id: I2115cc58e6fc24b63272b2ae811d64a4966de5d4
2016-04-17 15:11:14 -05:00
Nicolas Williams
514f719e4a evp-openssl: fallback to hcrypto
The Windows and PKCS#11 backends do this.  The Common Crypto (OS X)
backend does not.  Ideally this should be a ./configure option, and that
might be the next step, but right now we need this fallback in order to
get tests passing in Travis-CI.
2016-04-16 18:05:26 -05:00
Nicolas Williams
c0f6213be7 Fix Windows build (lib/krb5/pkinit-ec.c) 2016-04-16 17:15:49 -05:00
Nicolas Williams
e2137c63f5 Fix Windows build 2016-04-16 16:58:08 -05:00