Commit Graph

28218 Commits

Author SHA1 Message Date
Remi Ferrand
298ee93ac2 Autoconf detection of Perl5 and Perl5 modules
Add m4 macros for checking for perl modules (JSON)

Fix #74, #29.

Signed-off-by: Nico Williams <nico@twosigma.com>
2016-11-10 11:55:56 -06:00
Nicolas Williams
7b6bf87685 Also look for editline/readline.h (fix #38) 2016-11-10 11:35:36 -06:00
Roland C. Dowdeswell
eb682c1bf4 Fix weight zero entries when ordering SRV RR results.
In lib/roken/resolve.c, we find rk_dns_srv_order() which re-orders
the results of an SRV RR lookup by the algorithm in RFC2782.  We
note that the algorithm doesn't behave according to the RFC w.r.t.
entries of weight zero.  We solve this by scaling out the remaining
weights by the number of zeros we find at a particular priority
level and acting like the zero weights have a weight of one.
2016-11-10 04:45:07 -05:00
Roland C. Dowdeswell
44a1a2a273 Fix bias in ordering SRV RR results by weight.
In lib/roken/resolve.c, we find rk_dns_srv_order() which re-orders
the results of an SRV RR lookup by the algorithm in RFC2782.  We
fix a bias in the random weight sorting by changing the order of
operations when selecting rnd.  rnd should be a non-zero random
number less than the sum of the weights at a particular priority,
but zero was included as a legitimate output thus biasing the
selection process.  rk_random() % sum is still biased as a 32
bit int modulo a number which doesn't divide 2^32 does not have
a uniform distribution, but the bias should be small enough to
live with for our purposes here.
2016-11-10 04:45:07 -05:00
Nicolas Williams
13cb3b5646 Don't inhibit /etc/services matches 2016-11-09 22:49:03 -06:00
Nicolas Williams
6a68376a33 Don't inhibit /etc/hosts matches (fix #32)
Apending '.' to the hostname passed to `getaddrinfo()` is good for
avoiding extra timeouts when the search list is non-empty and the
network is broken, but searches in /etc/hosts are typically inhibited
then.  The fix is to try again without the trailing '.' if the first
lookup failed for any reason other than a timeout.
2016-11-09 22:49:03 -06:00
Viktor Dukhovni
f9749627f0 New test case detects previous template bug 2016-11-09 18:34:24 -05:00
Sergio Gelato
7c8b66d76b Use off_t in for constants used in iprop log seeks
On 32-bit architectures with _FILE_OFFSET_BITS=64,
 sizeof(off_t) > sizeof(size_t) .

LOG_HEADER_SZ was #define'd as an expression of type size_t, so in order
to get the sign extension right we need -(off_t)LOG_HEADER_SZ instead of
(off_t)(-LOG_HEADER_SZ).  However, we can just define the *_SZ macros to
cast to off_t, then we don't need to worry about negation.

Fixes Debian bug #822749, PR 175.

Signed-off-by (and updated by): Nicolas Williams <nico@twosigma.com>
2016-11-09 13:35:08 -06:00
Viktor Dukhovni
96a31c23fc Drop top-level check-gen.c inadvertently added 2016-11-09 11:53:17 -05:00
Viktor Dukhovni
9be93ad9ff Fix typo 2016-11-09 11:50:07 -05:00
Viktor Dukhovni
be2527500d Restored check-gen.c inadvertently deleted 2016-11-09 11:40:57 -05:00
Simon Wilkinson
67ac841f8f hcrypto: Fix Win 32 cpp checks
The correct test for a windows build is if defined(_WIN32), not just
if _WIN32. Fix a few places in the build which do the wrong thing, as
it gives compiler warnings.
2016-11-09 15:36:04 +00:00
Simon Wilkinson
ac9109ff75 hcrypto: Remove roken.h include from hash.h
All of the hcrypto source files were updated with commit
0f97855826 to include roken.h. This
means that hash.h no longer needs to include the roken header.

Remove the multiple inclusion.
2016-11-09 14:22:38 +00:00
Viktor Dukhovni
3d590d651f Reapply incorectly reverted gen_template bugfix
Without this, template memory allocation is incorrect for nested
sequences, which, as luck would have it, breaks tests on NetBSD
(whose malloc seems to give tighter allocations).

This partly undoes:

    commit 060474df16
    Author: Love Hornquist Astrand <lha@h5l.org>
    Date:   Mon Jun 3 21:45:51 2013 -0700

	quel 64bit warnings, fixup implicit encoding for template,
	fix spelling

Restoring changes from:

    commit 5e081aa4a6
    Author: Viktor Dukhovni <viktor@dukhovni.org>
    Date:   Sun May 27 08:07:28 2012 +0000

	Fix ASN.1 template compiler bug and add test cases more
	likely to trip on similar (structure size/type) errors

For example, without the bugfix, the sizeof(...) argument in multiple
generated nested structure templates is wrong, as seen in the bad vs.
good diff:

    --- test_template_asn1-template.c	2016-11-09 08:23:21.000000000 +0000
    +++ test_template_asn1-template.c	2016-11-09 08:23:40.000000000 +0000
    @@ -593,3 +593,3 @@
     const struct asn1_template asn1_TESTImplicit_tag_ti2_26[] = {
    -/* 0 */ { 0, sizeof(struct TESTImplicit), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTImplicit_ti2), ((void *)1) },
     /* 1 */ { A1_TAG_T(ASN1_C_CONTEXT,CONS,127), offsetof(struct TESTImplicit_ti2, foo), asn1_TESTLargeTag_tag_foo_4 }
    @@ -1618,3 +1618,3 @@
     const struct asn1_template asn1_TESTSeqOf2_tag_strings_68[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf2), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf2_strings), ((void *)1) },
     /* 1 */ { A1_OP_SEQOF, 0, asn1_TESTSeqOfSeq2_val_tag_string_60 }
    @@ -1679,3 +1679,3 @@
     const struct asn1_template asn1_TESTSeqOf3_tag_strings_71[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf3), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf3_strings), ((void *)1) },
     /* 1 */ { A1_OP_SEQOF, 0, asn1_TESTSeqOfSeq2_val_tag_string_60 }
    @@ -1760,3 +1760,3 @@
     const struct asn1_template asn1_TESTSeqOf4_tag_b1_75[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf4), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf4_b1), ((void *)1) },
     /* 1 */ { A1_OP_SEQOF, 0, asn1_TESTSeqOf4_seofTstruct_10 }
    @@ -1765,3 +1765,3 @@
     const struct asn1_template asn1_TESTSeqOf4_tag_b1_74[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf4), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf4_b1), ((void *)1) },
     /* 1 */ { A1_TAG_T(ASN1_C_UNIV,CONS,UT_Sequence), 0, asn1_TESTSeqOf4_tag_b1_75 }
    @@ -1801,3 +1801,3 @@
     const struct asn1_template asn1_TESTSeqOf4_tag_b2_79[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf4), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf4_b2), ((void *)1) },
     /* 1 */ { A1_OP_SEQOF, 0, asn1_TESTSeqOf4_seofTstruct_11 }
    @@ -1842,3 +1842,3 @@
     const struct asn1_template asn1_TESTSeqOf4_tag_b3_84[] = {
    -/* 0 */ { 0, sizeof(struct TESTSeqOf4), ((void *)1) },
    +/* 0 */ { 0, sizeof(struct TESTSeqOf4_b3), ((void *)1) },
     /* 1 */ { A1_OP_SEQOF, 0, asn1_TESTSeqOf4_seofTstruct_12 }
2016-11-09 03:33:34 -05:00
Roland C. Dowdeswell
8b93901db7 lib/roken/simple_exec_w32.c: forgot to assign tmp var back to original
after calling realloc(3).
2016-11-08 17:20:42 -05:00
Roland C. Dowdeswell
37b987a848 lib/krb5/fcache.c: fcc_store_cred() was using ret before setting it. 2016-11-08 17:14:08 -05:00
Nicolas Williams
e40ef47b57 Do not install compile_et (#178) 2016-11-08 16:13:14 -06:00
Nicolas Williams
b83cf2f3bd Support db1 and db3 at the same time 2016-11-08 15:41:38 -06:00
Marcin Cieślak
033001e732 Prefer BDB3/4/5 to BDB1/2 2016-11-08 15:48:40 -05:00
Marcin Cieślak
afead1717c Check for -ldb-5 (Berkeley Database) 2016-11-08 15:48:40 -05:00
Stefan Metzmacher
0ff40e2f4c lib/krb5: destroy a memory ccache on reinit
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12369

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

(Bases on Samba commit 2abc3710a8a63327a769ba0482c553ed274b2113)
2016-11-08 15:36:14 -05:00
Matthieu Hautreux
6c0306843d krb5tgs: let TGS_REQ with NULL caddr returns an addessless ticket
When processing a request, current tgs_make_reply uses the requested
set of addrs of the request to establish the set of addresses to
associate with the ticket in reply.

However, when the request input set of addrs is NULL, it reverts to
using the TGT set of addresses instead. As a result, it is not
possible to acquire an addressless TGS (or forwarded TGT) using a
TGT that is addressed.

This patch remove the fallback ensuring that a TGS_REQ with a set
of addrs set to NULL enables to acquire an addressless ticket.
2016-11-08 15:31:00 -05:00
Roland C. Dowdeswell
a730c89376 lib/krb5/fcache.c: couple of uses of errno after it may have been changed. 2016-11-08 15:19:17 -05:00
Roland C. Dowdeswell
59732ce753 lib/krb5/fcache.c: return errors in fcc_destroy() rather than always 0. 2016-11-08 15:19:17 -05:00
Marcin Cieślak
b9145b859d Enable threads on FreeBSD 10 and 11 2016-11-08 15:15:37 -05:00
Roland C. Dowdeswell
c7f5242cc8 Release 6.99.1 (beta) 2016-10-19 15:32:39 -04:00
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Uri Simchoni
a3bece16c7 lib/krb5: keep a copy of config etypes in the context
When reading configuration file, keep an extra copy of
the encryption types, and use this when resetting the
encryption types to default.

GSSAPI always resets the enctypes to default before obtaining
a TGS, because the enctypes might have previously altered,
so this prevents changing the etypes from the configured ones
to the full set of supported etypes.

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-09-30 08:37:06 -07:00
Jeffrey Altman
a16a9cc939 Merge pull request #203 from sdigit/patch-1
Fix typo in rand-fortuna.c
2016-09-19 16:36:59 -05:00
Sean Davis
316387f619 Fix typo in rand-fortuna.c
`__GNUC__` was written as `__GUNC__`, which could have interesting results as it'll never be defined.
2016-09-19 16:06:03 -05:00
Benjamin Kaduk
aa87e08cc7 Use C99 designated initializers in a couple places
Some portions of libhcrypto are reused by other projects in
diverse environments, including within operating system kernel modules.
In some such build environments, hardening measures such as grsecurity
can (randomly) reorder structure elements, so as to make it harder
for an attacker to determine the offset from a known field's address
to a different field that is needed for an attack.

However, doing so requires the use of C99 designated initializers
to make the source code compatible with such structure rearrangement,
as opposed to the "traditional" C aggregate type initializers, which
just list fields in order.  This feature is also available as a
GCC extension since early versions of GCC.  However, it is not
provided by many common versions of visual studio (and presumably
also not by the vendor compiler for various commercial Unixes),
so the traditional initializers must remain, behind a conditional.
__GNUC__ or __STDC_VERSION__ >= 199901 should be enough to get
most cases with support for designated initializers, at least
for now.

Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-09-01 17:38:47 -05:00
Nicolas Williams
44dec510fd Update to SQLite3 3.14
Newer versions of SQLite3 have a number of new features that are
desirable to users who host other DBs in the same file as the HDB (for
example), as well as performance and bug fixes.

We should consider switching the SQLite3 backend for HDB to WITHOUT
ROWID tables for performance reasons.  We should also consider using
foreign keys instead of triggers.  Making any such changes requires care
to permit both, upgrade and downgrade.

We might want to use the SQLite3 session extension for a SQLite3-
specific, low-level replication (iprop).  Given conflict resultion code,
or a sufficiently normalized schema, the session extension would make it
easy to create a multi-master replication system, not unlike what one
would expect of an LDAP setup, though with none of the atomicity that
LDAP is supposed to provide (specifically, O_EXCL semantics for creates
and predicates for updates) unless we were to add a locking protocol.

Note that as of 3.14, the session extension is mutually exclusive of
WITHOUT ROWID tables.
2016-08-11 14:53:25 -05:00
Nicolas Williams
01c2d5b801 Add lib/sqlite/README 2016-08-11 11:26:41 -05:00
Viktor Dukhovni
09c4e516bf Further polish and docs for hierarchical capaths 2016-08-10 21:09:15 -04:00
Nicolas Williams
76c596ceb8 Complete support for --disable-afs-support 2016-08-10 19:51:11 -05:00
Jeffrey Altman
3e6fb5bb41 Merge pull request #196 from DavidMulder/disable_afs_fix
Properly define the NO_AFS AM_CONDITIONAL
2016-08-10 00:22:03 -05:00
Viktor Dukhovni
b39a4f7c78 Update old_version after timeout
On a low update rate master, if we don't update old_version after
processing a poll timeout, we will generate spurious warnings about
missed (change) signals every time the timer expires, and will
needlessly contact the slaves.
2016-08-09 21:02:44 -04:00
Viktor Dukhovni
fc4e52174c Silence possible compiler warning
Reported by David Mulder, PR 195.
2016-08-09 20:57:04 -04:00
Viktor Dukhovni
99dfbda161 Add missing error check in krb5_check_transited
Reported by David Mulder, PR 195.
2016-08-09 20:52:58 -04:00
David Mulder
4f0a8e7d13 Properly define the NO_AFS AM_CONDITIONAL 2016-08-09 12:19:10 -06:00
Viktor Dukhovni
4b4036c9a6 Implement hierarchical referrals 2016-08-08 16:29:29 -05:00
Viktor Dukhovni
1501740952 Fix transit path validation
Also implement KDC hierarchical transit policy checks.  The "hier_capaths"
parameter defaults to "yes" in [libdefaults] or can be set explicitly in
[realms] per-realm.
2016-08-08 16:29:18 -05:00
Nicolas Williams
0561396c0a Add how-to-test example to kimpersonate.8 2016-08-08 14:14:04 -05:00
Nicolas Williams
ab61e1d395 Add --add and --referral options to kimpersonate 2016-08-08 14:14:04 -05:00
Nicolas Williams
345333c40a Document kimpersonate --ccache option 2016-08-08 14:14:04 -05:00
Nicolas Williams
41b6c829f7 Fix missing .El in krb5.conf.5 2016-08-08 14:14:04 -05:00
Nicolas Williams
6d1571a3c4 Fix --disable-afs-support disable lib/kafs 2016-08-04 18:51:23 -05:00
Jeffrey Altman
f027fc834d Merge pull request #190 from DavidMulder/windows_code_ifdefs
The evp-w32.h header should not be included on all platforms
2016-08-02 18:30:21 -04:00
David Mulder
2bee5966ab The evp-w32.h header should not be included on all platforms 2016-08-02 16:12:46 -06:00
Jeffrey Altman
f0f24fdbb2 Merge pull request #188 from DavidMulder/disable_afs
--disable-afs-support doesn't really disable afs
2016-08-02 16:50:15 -04:00