Fix addprinc -randkey when policy requires multiple character classes
The fix for ticket #6074 (r20650) caused a partial regression of
ticket #115 (r9210) because the dummy password contained only one
character class. As a minimal 1.7 fix, use all five character classes
in the dummy password.
Remove autoconf.h on "make distclean".
Check for the presence of a build in the src tree for "make depend".
Suggest "make distclean" when "make depend" detects a build in the
src tree or an attempt to make depend in the src tree.
Create DB headers before recursing for "make depend" in
plugins/kdb/db2/libdb2, to restore the r22486 functionality ("make
depend" in an unbuilt source tree) after r22572 (predictable "make
depend" output for DB headers).
Ken Raeburn [Tue, 15 Sep 2009 06:17:17 +0000 (06:17 +0000)]
Check __BIG_ENDIAN__ and __LITTLE_ENDIAN__ to determine endianness.
In fallback code, check ia64 platforms for hpux vs everything else;
HP-UX uses big-endian mode.
In ksetpwd (a program we don't yet install), don't display the new
password to stderr. Cherry-picked from Luke's s4u branch since it's
an unrelated change.
Supply canonical name if present in LDAP iteration
In the presence of aliases, LDAP iteration was supplying the first
principal it found within the expected realm, which is not necessarily
the same as the canonical name. If the entry has a canonical name
field, use that in preference to any of the principal names.
Supply LDAP service principal aliases to non-referrals clients
In the LDAP back end, return aliases when the CLIENT_REFERRALS_ONLY
flag isn't set (abusing that flag to recognize a client name lookup).
Based on a patch from Luke Howard.
Greg Hudson [Fri, 28 Aug 2009 21:22:10 +0000 (21:22 +0000)]
Clean up a little bit of test suite spew in env-setup: first, when
using BSD options with ps, they should not be prefixed with a '-';
second, the Linux ps supports both BSD and System V options, so change
the structure of the tests not to warn when both forms work.
Greg Hudson [Fri, 28 Aug 2009 21:02:51 +0000 (21:02 +0000)]
Update a kadm5 testing library function which was calling
kadm5_get_principal without a mask argment. This was causing many
lib/kadm5 tests to fail, but the failures weren't being recorded
properly, so "make check" was still exiting successfully.
Tom Yu [Fri, 28 Aug 2009 20:29:24 +0000 (20:29 +0000)]
Remove bogus conditional from tcl_kadm5_randkey_principal(), which was
causing unparse_keyblocks() to get stack garbage as num_keys when
num_var was "null", thus overrunning the end of the array.
Greg Hudson [Fri, 28 Aug 2009 16:00:54 +0000 (16:00 +0000)]
Disable the COPY_FIRST_CANONNAME workaround on Linux glibc 2.4 and
later, since it leaks memory on fixed glibc versions. We will still
leak memory on glibc 2.3.4 through 2.3.6 (e.g. RHEL 4) but that's
harder to detect.
Greg Hudson [Thu, 27 Aug 2009 13:40:50 +0000 (13:40 +0000)]
Memory leak in spnego accept_sec_context error path
If the underlying mechanism's accept_sec_context returns an error, the
spnego accept_sec_context was leaving allocated data in
*context_handle, which is incorrect for the first call according to
RFC 2744.
Fix this by mirroring some code from the spnego init_sec_context,
which always cleans up the half-constructed context in case of error.
This is allowed (though not encouraged) by RFC 2744 for second and
subsequent calls; since we were already doing it in init_sec_context,
it seems simpler to do that than keep track of whether this is a first
call or not.
Ken Raeburn [Fri, 21 Aug 2009 22:37:55 +0000 (22:37 +0000)]
Rename db2 header files db.h and db-config.h in the source tree, so
that there will always be only one version of each name in the include
path (namely, the copy made in the build tree, or the generated db.h
if not using the in-tree one). This should fix some minor problems
with different dependency lists generated on different systems.
Sort and uniquify dependency header names before doing substitutions,
as well as after. Look for the db2 headers listed in sorted order.
Don't copy db-ndbm.h into the build tree; let libdb2 find it from the
source tree only.
Ken Raeburn [Fri, 21 Aug 2009 18:32:50 +0000 (18:32 +0000)]
Change "vague-errors" compile-time conditionals into run-time
conditionals, based on a variable initialized based on the
compile-time conditional (but probably eventually set from the config
file or command line).
Greg Hudson [Mon, 17 Aug 2009 19:40:48 +0000 (19:40 +0000)]
Modify kadm5 initializers to accept krb5 contexts
Add krb5_context parameters to all kadm5 initialization functions.
This allows extended error information to be retrieved by the caller
when an error is returned.
Greg Hudson [Thu, 13 Aug 2009 21:25:54 +0000 (21:25 +0000)]
Remove kadmin v1 API support
The kadmin v1 API and the even older ovsec_kadm_* API were legacy when
kadmin was first incorporated in 1996, and compatibility with them is
no longer believed to be necessary.
The uninstalled kadmin/passwd has been removed (since it used the ovsec
API). The test suite has been updated to use the v2 API where
appropriate, and the parts specifically designed to test the old API
have been excised.
Greg Hudson [Wed, 12 Aug 2009 18:53:47 +0000 (18:53 +0000)]
Reply message ordering bug in ftpd
user() was replying to the user command and then calling login(),
which could send a continuation reply if it fails to chdir to the
user's homedir. Continuation replies must come before the actual
reply; the mis-ordering was causing ftp and ftpd to deadlock. To fix
the bug, invoke login() before reply() so that the continuation reply
comes first.
Ken Raeburn [Wed, 12 Aug 2009 17:58:24 +0000 (17:58 +0000)]
r22529@squish: raeburn | 2009-08-12 13:49:45 -0400
.
r22530@squish: raeburn | 2009-08-12 13:55:57 -0400
Change KRBCONF_KDC_MODIFIES_KDB to a mostly run-time option.
Change all code conditionals to test a new global variable, the
initial value of which is based on KRBCONF_KDC_MODIFIES_KDB. There is
currently no way to alter the value from the command line; that will
presumably be desired later.
Change initialize_realms to store db_args in a global variable. In
process_as_req, call db_open instead of the old set_name + init.
Don't reopen if an error is reported by krb5_db_fini.
Add a test of running kinit with an incorrect password, to trigger a
kdb update if enabled.
r22531@squish: raeburn | 2009-08-12 13:58:13 -0400
Fix trailing whitespace.
Greg Hudson [Mon, 10 Aug 2009 19:35:34 +0000 (19:35 +0000)]
Correct the t_nfold build rules again. We don't have a simple way of
plucking object files from other directories (we don't know for sure
what extension to use), so build an nfold.o in this directory from the
nfold.c in the ../krb source directory.
Greg Hudson [Mon, 10 Aug 2009 05:16:24 +0000 (05:16 +0000)]
In pkinit_clnt.c, make private functions static. There and in
pkinit_srv.c, only declare static functions when necessary for forward
references (as is consistent with the other pkinit sources). Remove
the empty functions pkinit_init_client_profile and
pkinit_fini_client_profile.
Greg Hudson [Mon, 10 Aug 2009 04:42:44 +0000 (04:42 +0000)]
Remove pkinit_identity_process_option, which wasn't doing anything
besides picking a subsidiary function based on the (constant) input
argument. Remove the associated constants from pkinit.h as well. No
functional change.
Greg Hudson [Fri, 7 Aug 2009 19:17:57 +0000 (19:17 +0000)]
Fix the LDAP build, which was broken by the build reordering in
r22406. Build kdb5_util's getdate from the kadmin/cli getdate
source, instead of borrowing the object file from the kadmin/cli
build directory.
Greg Hudson [Mon, 3 Aug 2009 23:18:42 +0000 (23:18 +0000)]
In crypto_tests: for t_nfold, link against an nfold object file in the
build directory, not the source directory. Remove the nfold object
from the t_encrypt dependency list since we don't directly use it in
the linking rule.
Greg Hudson [Mon, 3 Aug 2009 20:27:03 +0000 (20:27 +0000)]
Get "make depend" to work in an unbuilt source tree, since bad deps
files can make it difficult to build the tree. To do this, make the
depends target depend on generated header files and on header file
copies or links into the main include directory.
Greg Hudson [Mon, 3 Aug 2009 17:57:05 +0000 (17:57 +0000)]
In configure.in's list of Makefiles to generate, remove the trailing
slash from lib/crypto/krb as it breaks Makefile auto-regeneration.
While here, wrap the list to fit within 80 columns and use tab indents
to match the surrounding lines.
Zhanna Tsitkov [Mon, 3 Aug 2009 14:19:16 +0000 (14:19 +0000)]
Crypto modularity proj: Separate files under crypto directory based on their functionality. Move Kerberos specific files into krb subdir and MIT specific - into builtin subdir. Place all tests into crypto_tests subfolder.
Include <assert.h> in k5-platform.h, since we use assertions in some
of the macros defined there, as well as in many source files which do
not themselves include <assert.h>. Report and fix by Rainer Weikusat.
In the processing code for enctype lists, add support for "DEFAULT"
to indicate the default list, for families (des/des3/aes/rc4), and
for removing entries from the current list (-foo). Also add unit
tests and document.
Tom Yu [Fri, 10 Jul 2009 19:46:20 +0000 (19:46 +0000)]
check for slogin failure in setup_root_shell
Add a check for a slogin message that indicates an unknown public key
fingerprint, as rlogin looks like it points to slogin by default on
Debian Lenny.
Tom Yu [Fri, 10 Jul 2009 19:20:26 +0000 (19:20 +0000)]
Add a new '-W' option to kadmind and kdb5_util create to allow reading
weak random numbers on startup, to avoid long delays in testing
situations. Use only for testing.
Ken Raeburn [Thu, 18 Jun 2009 23:25:25 +0000 (23:25 +0000)]
reduce some mutex performance problems in profile library
In profile_node_iterator we unlock a mutex in order to call
profile_update_file_data, which wants to lock that mutex itself, and
then when it returns we re-lock the mutex. (We don't use recursive
mutexes, and I would continue to argue that we shouldn't.) On the
Mac, when running multiple threads, it appears that this results in
very poor peformance, and much system and user CPU time is spent
working with the locks. (Linux doesn't seem to suffer as much.)
So: Split profile_update_file_data into a locking wrapper, and an
inner routine that does the real work but requires that the lock be
held on entry. Call the latter from profile_node_iterator *without*
unlocking first, and only unlock if there's an error. This doesn't
move any significant amount of work into the locking region; it pretty
much just joins locking regions that were disjoint for no good reason.
On my tests on an 8-core Mac, in a test program running
gss_init_sec_context in a loop in 6 threads, this brought CPU usage
per call down by 40%, and improved wall-clock time even more.
Single-threaded performance improved very slightly, probably in the
noise.
Linux showed modest improvement (5% or less) in CPU usage in a
3-thread test on a 4-core system.
Similar tests with gss_accept_sec_context showed similar contention
around the profile-library mutexes, but I haven't analyzed the
performance changes there from this patch.
Ken Raeburn [Thu, 18 Jun 2009 21:56:48 +0000 (21:56 +0000)]
minor memory leak in 'none' replay cache type
The replay cache type implementations are responsible for freeing the
main rcache structure when the cache handle is closed. The 'none'
rcache type wasn't doing this, resulting in a small memory leak each
time such a cache was opened and closed. Not a big deal for a server
process servicing a single client, but it could accumulate (very very
slowly) for a long-running server.
Greg Hudson [Thu, 18 Jun 2009 17:34:17 +0000 (17:34 +0000)]
Remove the new configure option --enable-static-only, and instead
require --enable-static --disable-shared for the same effect. Error
out if only one of those two is specified.
While here, remove an unnecessary clause in the --disable-rpath block,
and make the notices consistent when using shared and static
libraries.
Ezra Peisach [Thu, 11 Jun 2009 17:01:13 +0000 (17:01 +0000)]
krb5int_yarrow_final could deref NULL if out of memory
krb5int_yarrow_final tests if the Yarrow_CTX* is valid (not NULL) -
and if not - signals and error for return - but still invokes
mem_zero (memset) with it as an argument. This will only happen in
an out-of-memory situation.
Ezra Peisach [Wed, 10 Jun 2009 02:55:22 +0000 (02:55 +0000)]
krb5int_rd_chpw_rep could call krb5_free_error with random value
clang picked up on a path in which krberror is not set and passed as
an argument to krb5_free_error(). Essentially if the clearresult
length < 2 but everything decodes - you can hit this path...
Greg Hudson [Mon, 8 Jun 2009 10:01:57 +0000 (10:01 +0000)]
Restore limited support for static linking
Add enough static linking support to run the test suite without shared
libraries, to facilitate gcov and other kinds of instrumentation. The
necessary changes include:
* Undo some of the changes which removed static linking support,
and cannibalize the defunct krb5_force_static conditional block
in aclocal.m4.
* Add --enable-static-only configure option.
* For plugins, use a different symbol name for static and dynamic
builds, via a macro in k5plugin.h.
* Add build machinery for building static libraries for plugins
(somewhat grotty due to the difference in names).
* Move plugin subdirs earlier in SUBDIRS in src/Makefile.in.
* Make the in-tree KDB5 plugins dependencies of libkdb5 in a static
build (aclocal.m4 has to know what they are).
* In kdb5.c, cannibalize the broken _KDB5_STATIC_LINK support to
allow "loading" of statically linked plugin libraries.
Preauth, authdata, locate, and GSSAPI plugins are not handled by this
change, as they are not currently necessary to the test suite.
Supporting GSSAPI plugins may be a bit tricky but the others should be
straightforward if they become needed.
$(STLIBEXT) changes from .a-nobuild to .a in a normal shared build as
a result of these changes (except on AIX where aclocal.m4 changes it).
This does not seem to be important as we avoid selecting the static
library for building via other means.