Ken Raeburn [Thu, 21 Apr 2005 23:16:26 +0000 (23:16 +0000)]
* implementor.texinfo (Local Addresses): Drop Mac OS 9, add Solaris 9, HP-UX
11.
(IPv6 Support, Host Address Lookup): Update for fake getaddrinfo code moved to
support library.
(Thread System Requirements): Use @code when listing function names. Add a
couple notes about some problematic routines.
(Internal Thread API): Update k5_mutex_t description to indicate there's always
non-OS data included. Describe case where thread support is disabled.
(Advanced Shared Library Requirements): Describe recently raised Windows
DllMain issues. Describe finalization code. Multiple init/fini functions are
now allowed in a library. Describe LIBINITFUNC and LIBFINIFUNC makefile
variables. Mention lib.in can have rules for generating temporary files for
dealing with export lists.
Ken Raeburn [Thu, 21 Apr 2005 21:44:37 +0000 (21:44 +0000)]
Stop generating per-directory sed scripts, and use perl to compute the patterns
on the fly instead. (Next step, someday, integrate this script and depfix.sed,
so we only have to run one script.)
* config/post.in (depend-dependencies): Use (and depend on) depfix2.pl instead
of .depfix2.sed.
(.depfix2.sed): Target deleted.
(DEPTARGETS): Delete .depfix2.sed and .depfix2.tmp.
* util/depgen.sed: Deleted.
* util/depfix2.pl: New file.
Ken Raeburn [Wed, 20 Apr 2005 03:10:12 +0000 (03:10 +0000)]
Compute reltopdir at autoconf time instead of at configure time. This has the
happy side effect of stopping autoreconf from creating directories named
"$ac_config_fragdir" all over the source tree.
* aclocal.m4 (fileexists, K5_TOPDIR): New macros.
(V5_SET_TOPDIR): Don't test for AC_LOCALDIR any more. Use K5_TOPDIR computed
at autoconf time, but still verify that the contents are what we expect. Don't
use shell variables in the argument to AC_CONFIG_AUX_DIR.
Ken Raeburn [Wed, 13 Apr 2005 20:38:36 +0000 (20:38 +0000)]
Allow compile-time specification that small code space is desired
* d3_cbc.c (krb5int_des3_cbc_encrypt, krb5int_des3_cbc_decrypt): Don't declare
left and right variables as registers.
* f_cksum.c (mit_des_cbc_cksum): Likewise.
* f_cbc.c (krb5int_des_cbc_encrypt, krb5int_des_cbc_decrypt): Likewise.
(krb5int_des_cbc_encrypt): For full blocks, use GET_HALF_BLOCK to read and then
xor, instead of processing each byte individually.
(krb5int_des_do_encrypt_2, krb5int_des_do_decrypt_2) [CONFIG_SMALL]: New
functions, wrapping large macros with the DES inner loops.
* f_tables.h (DES_DO_ENCRYPT_1, DES_DO_DECRYPT_1): Renamed from non-_1 names.
(krb5int_des_do_encrypt_2, krb5int_des_do_decrypt_2): Declare if CONFIG_SMALL
is defined.
(DES_DO_ENCRYPT, DES_DO_DECRYPT): Expand to _1 macros or _2 function calls
depending on whether CONFIG_SMALL is defined.
With CONFIG_SMALL defined, on x86/gcc/glibc, this drops about 5K (25%) of the
code/table space.
Ken Raeburn [Wed, 13 Apr 2005 20:19:31 +0000 (20:19 +0000)]
* aesopt.h: On PalmOS, include FloatMgr.h to get endianness flag.
(ENC_UNROLL, DEC_UNROLL, ENC_ROUND, LAST_ENC_ROUND, DEC_ROUND, LAST_DEC_ROUND,
KEY_SCHED): If CONFIG_SMALL is defined, set to NONE or NO_TABLES as
appropriate.
(Latter change drops about 40K -- over 85% -- from AES code/table size in
shared libraries on x86/glibc/gcc.)
Ken Raeburn [Sat, 26 Mar 2005 02:02:40 +0000 (02:02 +0000)]
* configure.in: Don't check for getpwnam_r and getpwuid_r in the thread-safety
warnings. The tests done elsewhere in the tree are stricter and may not
agree.
Ken Raeburn [Sat, 26 Mar 2005 02:00:47 +0000 (02:00 +0000)]
This patch tightens up our determination of whether we can use
getpw{nam,uid}_r, and using the set flags, creates macros providing a
consistent API, and if possible thread safety.
* configure.in: Don't check for getpwnam_r and getpwuid_r with AC_CHECK_FUNCS;
use AC_CHECK_FUNC, and only set shell variables. Run stricter tests on return
types and numbers of arguments, and only define the C macros if these
parameters can actually be determined.
* k5-platform.h (k5_getpwnam_r, k5_getpwuid_r): New macros.
Ken Raeburn [Fri, 25 Mar 2005 21:36:55 +0000 (21:36 +0000)]
shared library support for HP-UX 10
Our somewhat outdated HP-UX support (which was targeted at HP-UX 10, not 11)
does not have support for shared library initialization and finalization
functions, nor for shared library export lists. The former was causing
compilation failures unless shared library support was disabled.
* include/k5-platform.h: Expand on init/fini comments some more.
(MAKE_FINI_FUNCTION): Add an HP-UX specific variant that defines an auxiliary
function fitting the signature of HP-UX 10 library combined
initializer/finalizer functions.
* config/lib.in (hpux10.exports): New target, constructed similar to
osf1.exports but with HP-UX 10.x linker options, no initializers, and "errno"
explicitly added to the export list.
* shlib.conf (*-*-hpux*): Combine PICFLAGS setting with SHLIB_EXPFLAGS and
LDCOMBINE setting. Add linker option "-c hpux10.exports" to LDCOMBINE. Set
SHLIB_EXPORT_FILE_DEP to hpux10.exports. Set use_linker_fini_option.
Ken Raeburn [Fri, 25 Mar 2005 21:28:30 +0000 (21:28 +0000)]
threaded test program built even with thread support disabled
* Makefile.in (all-unix): Use @THREAD_SUPPORT@ and helper targets to build
programs only if thread support is enabled.
(all-unix-0, all-unix-1): New helper targets.
Tom Yu [Tue, 22 Mar 2005 22:49:11 +0000 (22:49 +0000)]
* gic_keytab.c (krb5_get_init_creds_keytab): When calling
krb5_get_init_creds() for the second time (with use_master=1),
also accept KRB5_REALM_UNKNOWN as a soft error, and use the result
from the first call to krb5_get_init_creds(). This can happen
when no master KDC is configured.
threads.c (thread_termination): Free array of pointers to thread-specific data (t) on thread termination. Use existing mutex to prevent the deletion of the array from interfering with the global list of thread specific data (used for library termination)
Jeffrey Altman [Tue, 15 Mar 2005 06:32:39 +0000 (06:32 +0000)]
krb5_c_is_keyed_cksum() is a boolean function. It cannot safely return
an error value. Change the error condition to return False (0) instead
of 0xFFFFFFFF.
Ken Raeburn [Sun, 13 Mar 2005 07:34:23 +0000 (07:34 +0000)]
profile library should check high-resolution timestamps if available
With the current profile code, it's possible for a file to be read when
partially written, with the writing of the new file contents being completed
within the same 1-second clock value, causing the profile code not to re-read
the contents. Using a higher-resolution timestamp, available on many systems
now, should help reduce that window. (Checking file sizes should also,
consider doing that separately.)
* configure.in: Check struct stat for fields st_mtimensec,
st_mtimespec.tv_nsec, and st_mtim.tv_usec.
* prof_file.c (profile_update_file_data): If one of them is found, use it as
the fractional part of the timestamp. Do re-read the file if the fractional
parts don't match.
* prof_int.h (struct _prf_data_t): Add new field frac_ts.
Jeffrey Altman [Sun, 6 Mar 2005 00:18:30 +0000 (00:18 +0000)]
* sn2princ.c (krb5_sname_to_principal):
conditionalize the use of reverse dns lookups. The default
is to use the existing behavior. rdns can be disabled by
specifying [libdefaults] rdns=false
Ken Raeburn [Sat, 5 Mar 2005 00:12:44 +0000 (00:12 +0000)]
I think the hpux change here should prevent it from overriding the
user-specified options, but still add in the necessary flags.
* aclocal.m4 (KRB5_AC_ENABLE_THREADS): Expand on error message if failing.
Substitute THREAD_SUPPORT -> 0 or 1 in makefiles. For HP-UX, set
PTHREAD_CFLAGS, not CFLAGS.
Ken Raeburn [Fri, 4 Mar 2005 23:50:45 +0000 (23:50 +0000)]
hpux10 has gmtime_r with wrong return type, breaking asn.1 encoder
The hpux10 gmtime_r returns int (0 means success), whereas the POSIX
gmtime_r returns a pointer (NULL means failure).
* configure.in: Check return type of gmtime_r, and define GMTIME_R_RETURNS_INT
if it returns int. If the return type can't be determined, pretend the
function isn't there.
Ken Raeburn [Fri, 4 Mar 2005 00:05:08 +0000 (00:05 +0000)]
profile_clear_relation doesn't work, iterator still sees deleted nodes
The "deleted" flag was being checked when writing out the file, but
not when iterating through using the profile handle being used to do
the deletions.
* prof_tree.c (profile_node_iterator): After checking skip_num counter, also
skip over deleted nodes.
* prof_test1 (test3): New proc.
(top level): Run it.
Ken Raeburn [Thu, 3 Mar 2005 23:25:32 +0000 (23:25 +0000)]
time-delta parser doesn't work on HP-UX 10
A build on Lenny's machine (built with gcc 2.7, thread support disabled, static
libraries only) is failing tests because the HP header files define "WS" as a
macro that expands to 2, while the delta-t grammar uses "WS" as the name of a
terminal symbol (which under bison turns into a C macro).
Renaming the terminal in the grammar (and custom lexer) fixes the problem.
* x-deltat.y (tok_WS): Renamed terminal from "WS", which conflicts with HP-UX
10 header files. Updated all productions.
(mylex): Updated.
* Makefile.in ($(srcdir)/deltat.c): Enable dependencies in maintainer mode.
* deltat.c: Updated.
Ken Raeburn [Wed, 23 Feb 2005 22:47:14 +0000 (22:47 +0000)]
possible profile null pointer deref in threaded app
There seems to be a problem with a null pointer popping up when
profile_node_iterator reads ...->data->root to start walking through the
contents. Don't have a lot of details, but I've got some patches that might
tighten things up a little.
* prof_tree.c (profile_node_iterator): Check that the root node pointer is not
null; raise assertion failure if it is.
* prof_int.h: Include k5-platform.h.
(struct _prf_data_t): Reorder fields, and insert some padding.
* prof_file.c (scan_shared_trees_locked): Check that the "root" field isn't
null.
(profile_open_file): Update the in-memory file contents after updating the
refcount instead of before.
(profile_update_file_data): If the root node in the file data is null, always
do the update. Check that it's not null before returning a success
indication.
(profile_dereference_data_locked): Scan linked list of file data objects for
sanity check, before and after.
(profile_dereference_data_locked): Don't do it here.
Ken Raeburn [Wed, 16 Feb 2005 19:57:15 +0000 (19:57 +0000)]
* init_ctx.c (init_common): Delete redundant library initialization call that
was run only on UNIX. Test assertion that krb5_ui_8 really did get a proper
64-bit type.
Ken Raeburn [Wed, 9 Feb 2005 00:50:50 +0000 (00:50 +0000)]
Exercise the dynamic loading/unloading of libraries a bit more.
Athena's old IRIX systems fail this test now.
* t_loader.c (verbose): New variable.
(do_close_1): Drop filename argument. Change messages accordingly, and only
display them if verbose. Line up "done" messages vertically.
(do_open_1): Likewise. Add library version argument, used when on AIX, in
combination with RTLD_MEMBER.
(do_open): Don't pass filename. Do pass library version; callers changed.
(do_close): Don't pass filename.
(get_sym_1): Renamed from get_sym, added line number argument. Print messages
if verbose.
(get_sym): New macro.
(xbasename): Function deleted.
(HORIZ): New macro.
(main): Turn off output buffering. Print messages before and after calling
functions in loaded libraries. Disable first set of tests, that don't call any
functions. Test gssapi library without loading any other libraries, then test
it after loading com_err, and unload com_err first.
Ken Raeburn [Wed, 9 Feb 2005 00:41:40 +0000 (00:41 +0000)]
There is a memory leak here, if a thread has registered some per-thread data
when we delete the key. Fixing it will require walking through the per-thread
data of every thread and freeing the objects... and watching for deadlocks in
the case where a thread is exiting at the same time.
* threads.c (k5_key_delete) [pthread case]: Reset flags and destructor function
pointer to unset state.
(krb5int_thread_support_init, krb5int_thread_support_fini): If
SHOW_INITFINI_FUNCS is defined, print some tracing messages.
Ken Raeburn [Wed, 9 Feb 2005 00:11:14 +0000 (00:11 +0000)]
Build system support for a library having more than one init/fini symbol
defined, when using linker options to specify these functions. Now
LIBINITFUNC/LIBFINIFUNC are considered lists of symbols, ordered from
lowest-level (init run first, fini run last) to highest-level.
* lib.in (config.status): Change target to be in $thisconfigdir rather than
local.
(osf1.exports): Create a temporary file then rename into place. Add options
for library init/fini symbols, handling multiple values.
* shlib.conf (case alpha*-dec-osf*): Don't handle init/fini symbols here.
(case mips-sgi-irix*): Handle multiple init/fini symbols. Always set $initfini
before it gets used.
(case *-*-solaris*, not gcc): Handle multiple init/fini symbols.
(case *-*-aix*): Handle multiple fini symbols.
Ken Raeburn [Thu, 3 Feb 2005 00:27:33 +0000 (00:27 +0000)]
* Makefile.in (gssapi.h): Change SIZEOF symbols to start with GSS_ when
extracting from autoconf.h. Don't look for HAVE_ or USE_ symbols. Add
${include_xom} to the prologue.
(include_xom): New variable.
* gssapi.h: Always include stddef.h unconditionally.
(GSS_SIZEOF_INT, GSS_SIZEOF_LONG, GSS_SIZEOF_SHORT): Don't define.
* k5-thread.h (k5_os_mutex_lock): Under Irix, invoke
k5_pthread_mutex_lock() with the k5_os_mutex, not the
pthread_mutex_t.
(k5_pthread_assert_locked,unlocked): If DEBUG_THREADS not used, provide
correct prototype. Add missing close paren.
Test programs show that under irix, the mutex locking/unlocking code was
working - even with the wrong memory use... I do not understand why.
Jeffrey Altman [Mon, 17 Jan 2005 23:57:51 +0000 (23:57 +0000)]
Some applications such as Eudora on Windows load and unload the Kerberos
libraries as part of a plug-in. Plugins are often loaded for a specific
purpose and then unregistered. In order to support this model, the libraries
must restore the library state to the uninitialized state when the library
is unloaded.
Ezra Peisach [Mon, 17 Jan 2005 17:37:27 +0000 (17:37 +0000)]
* gc_frm_kdc.c (krb5_get_cred_from_kdc_opt): More memory leaks
fixed as introduced in ticket #2541. Do not rely on knowledge that
upon failure from krb5_cc_retrieve_cred, returned credential data
is untouched.
Testsuite passes all tests, but would like another set of eyes to look over code
before closing ticket.
Jeffrey Altman [Sat, 15 Jan 2005 06:34:08 +0000 (06:34 +0000)]
* cp_key_cnt.c, copy_princ.c:
prevent krb5_copy_principal() and krb5_copy_keyblock() from
calling malloc(0). On platforms in which malloc(0) returns
NULL, these functions will return an ENOMEM error the way
they were written.
Tom Yu [Fri, 14 Jan 2005 06:02:01 +0000 (06:02 +0000)]
* authgss_prot.c (xdr_rpc_gss_wrap_data): Use xdr_alloc to avoid
size limit issues. Use (unsigned int)-1 instead of MAX_NETOBJ_SZ.
(xdr_rpc_gss_unwrap_data): Use (unsigned int)-1 instead of
MAX_NETOBJ_SZ.
* xdr.c (xdr_bytes): Don't assign from *sizep if XDR_FREE, since
it'll be uninitialized then. Shuts up Purify.