Commit Graph

16018 Commits

Author SHA1 Message Date
Jeffrey Altman
dba026b5ef Introduce and apply krb5_storage_from_socket
On Windows a file descriptor is an int value allocated by the
local module instance of the C Run Time Library.  A socket handle is a
SOCKET value allocated by a Winsock Provider for the requested family and
protocol.   These two values cannot be mixed and there is no mechanism for
converting between the two.   The _get_osfhandle() and _open_osfhandle()
functions can work with a standard HANDLE (file, pipe, etc) but cannot be
used for a SOCKET.

The Heimdal krb5_storage_from_fd() routine counted on the osf conversion
functions working on SOCKET values.  Since they do not any attempt to call
krb5_storage_from_fd() on a socket resulted in an assertion being thrown
by the C RTL.

Another problem is SOCKET value truncation when storing a 64-bit value
into a 32-bit int.

To address these problems a new krb5_storage_from_socket() routine is
introduced.  This routine setups a krb5_storage that stores a socket value
as a rk_socket_t and provides a set of helper routines that always use
network ready functions.

The krb5_storage_from_fd() routines no longer use net_read() and
net_write() but provide helpers that follow their logic so that pipes can
be processed.

All call sites that allocate a socket now store the socket as rk_socket_t
and call krb5_storage_from_socket().

All locations that previously called the bare close() on a socket value
now call rk_closesocket().

Change-Id: I045f775b2a5dbf5cf803751409490bc27fffe597
2014-02-04 23:20:08 -05:00
Nicolas Williams
fdabfd6040 Win32 dladdr() wasn't returning 0 in all failures 2014-02-04 15:43:28 -06:00
Nicolas Williams
2fd4c58338 dladdr() on Win32 should't leave dli_fname == NULL 2014-02-04 15:37:45 -06:00
Nicolas Williams
2820cd7716 Revert "Minor WIN32/POSIX bug in resolve_origin()"
This reverts commit c9985fc695.
2014-02-04 14:37:54 -06:00
Jeffrey Altman
6c4423cd46 kadm5: use rk_closesocket to close sockets
kadm5_c_destroy did not use rk_closesocket when cleaning up
the context.  This results in an exception on Windows since a
socket is not a file descriptor.

Change-Id: I9ebddad61f0199acb495a0773925df4f41e4fef2
2014-02-03 15:40:32 -05:00
Jeffrey Clark
cc1faff15f Simple hdb plugin test
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2014-01-31 08:49:55 +01:00
Jeffrey Clark
c1c7da7f79 Fix compiling hdb ldap as a module
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2014-01-31 08:49:51 +01:00
Love Hörnquist Åstrand
d8d0e659ce make sure h is set at when we find a match, from [GITHUB #54] 2014-01-31 08:45:29 +01:00
Viktor Dukhovni
bb895bdd90 Fix k5login_authoritative
In the previous implementation when .k5login or .k5login.d existed
and k5login_authoritative was false, no further plugins were tried.
Also when k5login_authoritative was true and .k5login did not match,
the directory was never tried.
2014-01-08 21:46:06 -05:00
Luke Howard
788d39b3ce set m->gm_mech.gm_name 2014-01-04 16:31:01 +11:00
Luke Howard
4ff005a6a4 gm_mech_oid must be set
mechanism credentials created by dynamically loaded mechanisms do not work
because the gm_mech_oid field is unset for such mechanisms (instead, only
gm_mech.gm_mech_oid is).
2014-01-04 15:58:10 +11:00
Russ Allbery
22c7f07ed8 Add symbol versioning for libkadm5clnt
In order to support plugins for kadmin that use libkadm5srv, the
libkadm5clnt library has to be versioned to avoid hijacking all
of the function calls that should go to the server library.  Omit
the _kadm5_ clients from the public interface, and version
everything else.

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2013-12-23 13:20:26 +01:00
Nicolas Williams
c9985fc695 Minor WIN32/POSIX bug in resolve_origin() 2013-12-13 13:28:51 -06:00
Arran Cudbard-Bell
f604e424d1 Issue #491: bus error in resolve_origin()
resolve_origin attempts to insert '\0' into a field from a DL_info
struct, causes BUS error.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2013-12-13 13:27:57 -06:00
Nicolas Williams
38a92f759d Add kx509 parameters to verify_krb5_conf.c 2013-12-10 00:47:11 -06:00
Nicolas Williams
318f89d602 Document kx509 parameters 2013-12-05 16:00:21 -06:00
Love Hörnquist Åstrand
6b2ebfcf8a Merge pull request #48 from pettai/master
Allow validation of kdigest stuff
2013-11-28 14:33:03 -08:00
Fredrik Pettai
418fdb7f79 Also validate kdigest hacks
Add validation of the kdigest configuration parameters
2013-11-28 14:14:11 +01:00
Love Hörnquist Åstrand
91a2802779 Merge pull request #45 from jelmer/hx509-heimbase
Include heimbase.h in hx509.h; required for heim_err_t.
2013-11-20 05:13:26 -08:00
Nicolas Williams
fdcb8f3862 Fix callers of heim_ntlm_encode_type3; make build 2013-11-20 01:20:01 -06:00
Nicolas Williams
2c16b0da30 Be verbose about MIT dump entry parsing failures 2013-11-20 01:07:54 -06:00
Nicolas Williams
e9d21aeffc Fix bug in loading MIT dumps 2013-11-20 01:07:54 -06:00
Jelmer Vernooij
906922b990 Include heimbase.h in hx509.h; required for heim_err_t.
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2013-11-20 00:42:26 +00:00
Love Hörnquist Åstrand
bd661203cf test type1 encodings 2013-11-18 15:43:44 +01:00
Love Hörnquist Åstrand
576f103203 try to use the right domain/hostname offset/ucs2 encoding
reported by Joe Mason
2013-11-17 17:43:47 +01:00
Love Hörnquist Åstrand
3af1b3a8a6 use constants 2013-11-17 17:03:10 +01:00
Love Hörnquist Åstrand
cde59c543d bump libheimntlm to the version from OSX 10.9 Mavericks 2013-11-17 13:15:55 +01:00
Ross L Richardson
22a5077835 Minor language problems 2013-11-17 12:48:41 +01:00
Love Hörnquist Åstrand
7d163f234b check that e have sane values 2013-10-30 22:29:19 -07:00
Nicolas Williams
7d45909537 Fix krb5's gss_pseudo_random() (n is big-endian)
The first enctype RFC3961 prf output length's bytes are correct because
the little- and big-endian representations of unsigned zero are the
same.  The second block of output was wrong because the counter was not
being encoded as big-endian.

This change could break applications.  But those applications would not
have been interoperating with other implementations anyways (in
particular: MIT's).
2013-10-30 14:26:15 -05:00
Love Hornquist Astrand
ca24e29ad9 move krb5_generate_random() to krb5_init_context() and document (in doxygen) why its called 2013-10-22 18:19:11 -07:00
Love Hornquist Astrand
7439cb7c54 check the EE if its a proxy certificate and fail up front 2013-10-21 08:43:24 -07:00
Love Hornquist Astrand
056224c32f more comments about how useful krb5_generate_random_block() is 2013-10-21 08:32:11 -07:00
Love Hornquist Astrand
516c12c9a9 intruduce krb5_generate_random() that can fail and return an error, check for it at krb5_context creation time 2013-10-21 08:22:02 -07:00
Love Hornquist Astrand
10f3c8b56e add possible to set rules on what enctypes to use based on glob matching on principal 2013-10-18 10:01:55 +02:00
Love Hornquist Astrand
072f4ce697 remove unused [kadmin]pre-auth that is no longer there (if it ever was) 2013-10-17 18:52:01 +02:00
Viktor Dukhovni
9a9ba1e197 Reduce RNG false positive error rate 2013-10-17 00:29:51 -04:00
Viktor Dukhovni
146f5b72e6 Link test_rand with math library.
Also deal with size_t to int casts for test_rand printf output.
2013-10-16 23:49:32 -04:00
Viktor Dukhovni
1364508cbf Hopefully fix test_rand breakage 2013-10-16 22:04:01 -04:00
Love Hornquist Astrand
1d84562886 add HDBGET: that only supports get, iteration doesnt really make sense for the HDB keytab except when dumping 2013-10-15 12:40:39 +02:00
Love Hornquist Astrand
d1eb0da071 init more of the fields 2013-10-15 12:07:02 +02:00
Love Hornquist Astrand
94d3958d2e add NO_ACCEPTABLE_KDF 2013-10-15 11:52:37 +02:00
Jeffrey Altman
50381859a0 hdb: fix parsing of mkey db string
The use of the wrong value for the length of ":mkey=" was identified
by Brian May and reported via github:

  https://github.com/heimdal/heimdal/issues/40

Change-Id: I0aed86a5bb0359b7a266369076fde5e62f23b5fe
2013-10-13 19:59:48 -04:00
Jeffrey Altman
e8d2100880 libtommath: fix typo in bn_mp_mod.c
Change-Id: Ieec5c01d5bd59b9268f41933389b1b32a4c4d0c6
2013-10-08 21:32:39 -05:00
Jeffrey Altman
8dc29ae1a0 libtommath: remove bn_mp_isprime.c
Now that mp_prime() is no longer used, remove bn_mp_isprime.c from
the source tree.

Change-Id: Ie0f7ce3184c000f27ae5b9dbe07b323c02ce7199
2013-10-08 17:02:07 -05:00
Moritz Lenz
b709d39aa5 libtommath: Fix mp_mod(a, b, c) if b < 0 and a = n * b, n integer
it used to return b, now it return 0.

From https://github.com/libtom/libtommath

Change-Id: I99f5d42c09a6fbddfb32b7dd0ed10ef04f1c08a5
2013-10-08 16:17:14 -05:00
Steffen Jaeckel
7fe018e418 libtommath: mp_error_to_string: return const char* instead of char*
From https://github.com/libtom/libtommath

Change-Id: Idd5cbab380f5d504fece93afb3a5fcc026309482
2013-10-08 16:17:13 -05:00
Steffen Jaeckel
5bc653f0ef libtommath: allow mp_shrink to shrink initialized, but empty MPI's
from https://github.com/libtom/libtommath

Change-Id: I5814caeb44db710957152a7d47b03f9beb6e5147
2013-10-07 17:20:57 -05:00
Jeffrey Altman
28051fa99c Convert mp_find_prime to use mp_prime_is_prime
Modify the signature of mp_find_prime() to permit the number of
Miller-Rabin rounds to be specified.  In addition, valid responses
now include MP_NO, MP_YES, and MP_VAL which is returned when
mp_prime_is_prime() fails.

Change-Id: I0195129a4dd75875e6dddb6d49a5ceb30afb1a17
2013-10-07 15:18:42 -05:00
Jeffrey Altman
1859a85350 libtommath: protect functions by tommath_class macros
libtommath protects the inclusion of functions by wrapping their
declarations by CPP #ifdef tests and defining the matching macros
within libtommath_class.h.

Add missing macros:

  BN_MP_FIND_PRIME_C
  BN_MP_ISPRIME_C

Change-Id: Ic577300114f8e88d7a3af3d9f717a249d57f03b1
2013-10-07 14:00:21 -05:00