summaryrefslogtreecommitdiffstats
path: root/src/util/support
Commit message (Collapse)AuthorAgeFilesLines
...
* In the k5buf module, add a function to append formatted data to aGreg Hudson2008-10-282-3/+114
| | | | | | | | | buffer. ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20932 dc483132-0cff-0310-8789-dd5450dbe970
* The last change to plugins.c erroneously passes a size_t as a fieldGreg Hudson2008-10-281-1/+1
| | | | | | | width to asprintf. Address the signed/unsigned warning cleanup using a cast instead. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20931 dc483132-0cff-0310-8789-dd5450dbe970
* Add the k5buf string module to libkrb5supportGreg Hudson2008-10-285-1/+465
| | | | | | | ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20929 dc483132-0cff-0310-8789-dd5450dbe970
* localize format strings, not final error stringAlexandra Ellwood2008-10-271-76/+34
| | | | | | | | | | | | | | | errors.c should localize the incoming format string, not the string produced by vasprintf. The format string is constant and thus can be added to a localization table, whereas the output string is not. Note that this change depends on error_message also localizing error table strings (which it does for KfM already). ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20927 dc483132-0cff-0310-8789-dd5450dbe970
* signed vs. unsigned warnings cleanupEzra Peisach2008-10-271-7/+7
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20925 dc483132-0cff-0310-8789-dd5450dbe970
* Use strlcpy instead of strcpy in many placesGreg Hudson2008-10-241-1/+2
| | | | | | | ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20919 dc483132-0cff-0310-8789-dd5450dbe970
* Add build system support for strlcpy and strlcat on platforms which doGreg Hudson2008-10-242-0/+97
| | | | | | | | | not provide it natively. ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20916 dc483132-0cff-0310-8789-dd5450dbe970
* Add support for localizing krb5 errors on Mac OS X.Alexandra Ellwood2008-10-241-2/+67
| | | | | | | | | Split into a separate function to make it easier to add support for other localization techniques. ticket: 6245 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20913 dc483132-0cff-0310-8789-dd5450dbe970
* Now that we have support for conditionally exporting symbols from the supportKen Raeburn2008-10-152-0/+110
| | | | | | library, use that for the [v]asprintf replacement functions when needed. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20871 dc483132-0cff-0310-8789-dd5450dbe970
* CCAPI should use common ipc and stream codeAlexandra Ellwood2008-09-301-43/+1
| | | | | | | | | KIM and CCAPI should share the same IPC and stream object types. Modified CCAPI to use code in src/util (stream) and src/util/mac (ipc) ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20787 dc483132-0cff-0310-8789-dd5450dbe970
* Create common stream and ipc layer for CCAPI and KIM. Alexandra Ellwood2008-09-281-0/+507
| | | | | | | | | Will switch CCAPI to this new code later though, so as not to destabilize KfM and the Windows builds. ticket: 6055 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20769 dc483132-0cff-0310-8789-dd5450dbe970
* makedependKen Raeburn2008-09-181-1/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20731 dc483132-0cff-0310-8789-dd5450dbe970
* Based on patch from lxs, with some changes:Ken Raeburn2008-08-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add several new gcc warning flags, used in the KfM build process. Put declarations before code. Fix a bunch of signed/unsigned type mixes, mostly by changing variable types to unsigned int. Fix constness in handling name of default ccache name. Make sure functions get declared with prototypes: krb5int_pthread_loaded krb5int_gmt_mktime krb5int_aes_encrypt krb5int_aes_decrypt gssint_mecherrmap_init gssint_mecherramp_get. Don't shadow global names: stat accept index open encrypt. Fix variable shadowing in LDAP ASN.1 support. Don't define unused krb5int_local_addresses. Don't export internal krb5_change_set_password. Fix error return indications from gssint_oid_to_mech. Create and use k5-gmt_mktime.h to provide one global declaration of krb5int_gmt_mktime, needed before we've generated krb5.h on some platforms. Not incorporated from initial patch: const changes in function signatures. ticket: 6096 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20697 dc483132-0cff-0310-8789-dd5450dbe970
* r820@NOME-KING: raeburn | 2008-08-26 18:37:41 -0400Ken Raeburn2008-08-272-135/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x r821@NOME-KING: raeburn | 2008-08-26 18:51:10 -0400 Remove disabled statistics gathering support. r822@NOME-KING: raeburn | 2008-08-26 18:57:20 -0400 Remove source location tracking. r823@NOME-KING: raeburn | 2008-08-26 19:05:35 -0400 Delete DEBUG_THREADS code. r824@NOME-KING: raeburn | 2008-08-26 19:18:59 -0400 Remove now-no-op assertion checks. r825@NOME-KING: raeburn | 2008-08-26 19:29:49 -0400 Simplify some wrappers. r826@NOME-KING: raeburn | 2008-08-26 19:38:23 -0400 Remove redundant comment. r827@NOME-KING: raeburn | 2008-08-26 19:49:20 -0400 When pthreads must be checked for at run time, don't include the no-op _nothread_mutex stuff too. r828@NOME-KING: raeburn | 2008-08-26 19:54:05 -0400 Remove remaining DEBUG_THREADS bits. r829@NOME-KING: raeburn | 2008-08-26 20:00:22 -0400 fix up initializer r830@NOME-KING: raeburn | 2008-08-26 20:10:37 -0400 Flatten a couple of structs wrapping single elements. r831@NOME-KING: raeburn | 2008-08-26 20:14:01 -0400 Remove k5_pthread_mutex_*lock macros. r832@NOME-KING: raeburn | 2008-08-26 20:19:14 -0400 Update comments a bit for lack of debug support. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20696 dc483132-0cff-0310-8789-dd5450dbe970
* Disable caching on Mac for nowKen Raeburn2008-08-121-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20644 dc483132-0cff-0310-8789-dd5450dbe970
* Always define krb5int_pthread_loaded, for consistencyKen Raeburn2008-08-121-0/+4
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20643 dc483132-0cff-0310-8789-dd5450dbe970
* If CONFIG_SMALL is defined, always use function calls for k5_mutex_lockKen Raeburn2008-08-061-0/+1
| | | | | | | | | and _unlock. On ppc darwin builds with debug info, this makes lib*.dylib a total of about 46K (~3%) smaller; "size" reports a reduction in text and/or "other" sizes for libgssapi_krb5, libkdb5, libkdb_ldap, and libkrb5. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20623 dc483132-0cff-0310-8789-dd5450dbe970
* Catch a few more cases of unchecked k5_mutex_lock callsKen Raeburn2008-07-221-4/+7
| | | | | | ticket: 5962 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20567 dc483132-0cff-0310-8789-dd5450dbe970
* An implementation of opendir() and friends for _WIN32Jeffrey Altman2008-07-211-6/+145
| | | | | | | | | plus an implementation of the plugin support that makes use of them. ticket: 3737 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20554 dc483132-0cff-0310-8789-dd5450dbe970
* (more) After malloc/realloc/calloc/strdup/asprintf failures, useKen Raeburn2008-04-301-12/+12
| | | | | | | | ENOMEM explicitly instead of reading it from errno. This may make static analysis tools less confused about when we return zero vs nonzero values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20313 dc483132-0cff-0310-8789-dd5450dbe970
* After malloc/realloc/calloc failures, return ENOMEM explicitly insteadKen Raeburn2008-04-301-4/+4
| | | | | | | of reading it from errno. This may make static analysis tools less confused about when we return zero vs nonzero values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20312 dc483132-0cff-0310-8789-dd5450dbe970
* Generate a large enough array to hold all the base/extension pairs.Alexandra Ellwood2008-04-251-11/+17
| | | | | | | | Store pairs without overlapping. ticket: 5948 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20308 dc483132-0cff-0310-8789-dd5450dbe970
* Protect CFBundle calls with mutexesAlexandra Ellwood2008-03-211-81/+84
| | | | | | | | | | | | | | | | | CFBundles are refcounted and the recounts are not threadsafe. Protect CFBundles used for loading bundled plugins with a mutex to prevent crashes when multiple threads are loading and unloading the same plugin. As part of this we use thread-safe dlopen/dlsym/dlclose for the actual loading and unloading and just use CFBundle to get the path to the actual executable. This reduces the number of places we need to wrap CFBundles with mutexes and the amount of Mac-specific code in the plugin code. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20285 dc483132-0cff-0310-8789-dd5450dbe970
* Set close-on-exec flag in most places where file descriptors areKen Raeburn2007-10-221-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | opened in our libraries (in case another application thread spawns a new process) and in the KDC programs (in case a plugin library spawns a new process). Checked calls to: open fopen THREEPARAMOPEN mkstemp socket accept dup dup2 pipe. In: util lib plugins kdc kadmin/server krb524. The various programs are less critical than the libraries, as any well-written plugin that spawns a new process should close all file descriptors it doesn't need to communicate with the new process. This approach also isn't bulletproof, as the call to set the close-on-exec flag is necessarily a separate call from creating the file descriptor, and the fork call could happen in between them. So plugins should be careful regardless of this patch; it will only reduce the window of potential lossage should a plugin be poorly written. (AFAIK there are currently no plugins that spawn processes where this would be a problem.) Update dependencies. ticket: 5561 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20143 dc483132-0cff-0310-8789-dd5450dbe970
* Don't define vsnprintf for Windows hereKen Raeburn2007-08-011-6/+0
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19741 dc483132-0cff-0310-8789-dd5450dbe970
* Avoid use of unchecked sprintf in libraries. Use asprintf if theKen Raeburn2007-07-122-20/+14
| | | | | | | output buffer is allocated according to the size of data to be written, or snprintf otherwise. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19703 dc483132-0cff-0310-8789-dd5450dbe970
* Update mkstemp and export-list handling for WindowsKen Raeburn2007-06-281-3/+19
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19646 dc483132-0cff-0310-8789-dd5450dbe970
* Implement S_ISDIR from S_IFMT or _S_IFMT if necessary (e.g., on Windows)Ken Raeburn2007-06-281-0/+10
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19645 dc483132-0cff-0310-8789-dd5450dbe970
* update dependenciesKen Raeburn2007-06-201-0/+3
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19601 dc483132-0cff-0310-8789-dd5450dbe970
* Move (BSD-licensed) mkstemp from libdb2 to libkrb5support, and renameKen Raeburn2007-06-203-3/+143
| | | | | | | | | | | | | the function to krb5int_mkstemp. Generate the symbol export list for libkrb5support at build time. Declare krb5int_mkstemp in k5-platform.h. Change cc_file.c to use mkstemp unconditionally. Make libdb2.so (built for testing only) link against the libkrb5support, and use krb5int_mkstemp if mkstemp is not available. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19600 dc483132-0cff-0310-8789-dd5450dbe970
* provide asprintf functionality for internal useKen Raeburn2007-06-201-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I plan to use asprintf in some gssapi error-message management routines, so let's make sure we have the functionality available, implementing it locally if necessary. This implementation assumes vsnprintf is available, an assumption that the support library is already making at the moment. Since this implementation requires calling vsnprintf potentially multiple times with the same va_list, use va_copy if it's available, or provide a hack version (which should work okay if va_list is a scalar or array type that requires no other special handling, and if va_end does nothing interesting, which is usually the case) if the compiler doesn't provide it. I also changed a couple bits of code to use asprintf, to make sure we exercise our implementation in testing. (C99 requires vsnprintf and va_copy; vasprintf is a GNU/BSD extension, but an oh so useful one....) * configure.in: Check for va_copy, or if va_list objects can be simply assigned. Define HAS_VA_COPY and CAN_COPY_VA_LIST as appropriate. * include/k5-platform.h: Define a va_copy macro if the compiler doesn't provide it. * include/k5-platform.h: If vsnprintf isn't available from the OS, abort compilation. If vasprintf isn't available from the OS, provide k5_{v,}asprintf based on vsnprintf and define {v,}asprintf macros. * lib/krb5/keytab/t_keytab.c (do_test): Use asprintf. * util/support/errors.c (krb5int_vset_error): Use asprintf unconditionally. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19595 dc483132-0cff-0310-8789-dd5450dbe970
* krb5int_open_plugin_dirs errors out if directory does not existAlexandra Ellwood2007-04-051-10/+2
| | | | | | | | | | | If one of the directories in the list doesn't exist and no filenames are passed in because opendir fails and then the code gets an error. opendir() failing should not be a fatal error. The function should just move on to the next directory. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19400 dc483132-0cff-0310-8789-dd5450dbe970
* Zero sockaddrs in fai_add_entry() so we can compare them with memcmp()Alexandra Ellwood2007-03-191-0/+2
| | | | | | | | | | | | If we don't zero the struct sockaddrs in fai_add_entry() then any sin_zero fields will be left as random memory and the memcmp() will return that the addresses are different even if they aren't. ticket: new target_version: 1.6.1 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19235 dc483132-0cff-0310-8789-dd5450dbe970
* Don't use struct in6_addr if we don't have IPv6 supportKen Raeburn2007-02-161-0/+7
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19165 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.c (krb5int_lock_fac, krb5int_unlock_fac): Define only if ↵Ken Raeburn2006-11-021-0/+4
| | | | | | FAI_CACHE git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18755 dc483132-0cff-0310-8789-dd5450dbe970
* Add supp-int.h to provide prototypes for declared internal functions.Ezra Peisach2006-10-185-4/+43
| | | | | | | *.x: Include this header Makefile.in: Update dependencies git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18728 dc483132-0cff-0310-8789-dd5450dbe970
* Use const pointers for error messages.Ken Raeburn2006-10-071-4/+4
| | | | | | Add some debugging hooks in the libkrb5 support. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18661 dc483132-0cff-0310-8789-dd5450dbe970
* Fix AIX version of GET_HOST_BY_NAME to use TMP.ent for the result, notKen Raeburn2006-09-281-1/+1
| | | | | | | | the no-longer-defined my_h_ent. ticket: 4256 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18632 dc483132-0cff-0310-8789-dd5450dbe970
* windows thread support frees thread local storage after TlsSetValueJeffrey Altman2006-09-211-2/+2
| | | | | | | | | | | | | threads.c: The return value of TlsSetValue is non-zero on success. As a result of misinterpreting the return value, the memory set in TLS is then freed. A subsequent call to TlsGetValue returns the invalid pointer. ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18600 dc483132-0cff-0310-8789-dd5450dbe970
* autoconf 2.60 compatibilityKen Raeburn2006-06-281-2/+2
| | | | | | | | | | | Change all file substitutions so that @-patterns start at the beginning of their lines, as now required by autoconf 2.60 (released Monday). ticket: new target_version: 1.5 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18249 dc483132-0cff-0310-8789-dd5450dbe970
* fix plugin.c to compile on WindowsJeffrey Altman2006-06-281-3/+3
| | | | | | | | | | plugins.c: Move a brace so that the Windows case falls within the conditional ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18248 dc483132-0cff-0310-8789-dd5450dbe970
* allow multiple calls to krb5_get_error_message to retrieve messageKen Raeburn2006-06-281-7/+15
| | | | | | | | | | | | | (krb5int_get_error): Don't discard old message if the error codes don't match. Try a little harder not to keep messages in the scratch buffer. Return a copy of the message, or "out of memory" in the scratch buffer. (krb5int_vset_error): Try a little harder not to keep messages in the scratch buffer. ticket: new target_version: 1.5 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18246 dc483132-0cff-0310-8789-dd5450dbe970
* * src/util/support/plugins.c (krb5int_open_plugin): Use RTLD_LOCALTom Yu2006-06-221-1/+6
| | | | | | | | | instead of RTLD_GLOBAL. Use RTLD_GROUP if available. ticket: 3909 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18192 dc483132-0cff-0310-8789-dd5450dbe970
* *sigh*Ken Raeburn2006-06-211-3/+3
| | | | | | | | Stupid typo in last change. ticket: 2759 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18184 dc483132-0cff-0310-8789-dd5450dbe970
* (GET_HOST_BY_NAME, GET_HOST_BY_ADDR) [GETHOSTBYNAME_RETURNS_INT]: TestKen Raeburn2006-06-211-9/+11
| | | | | | | | | | | the output hostent pointer as an additional way of checking for errors. Original patch from Nalin Dahyabhai, needed some tweaking to fit in current sources, especially as updated in ticket 3911. ticket: 2759 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18183 dc483132-0cff-0310-8789-dd5450dbe970
* Revert part of previous changes: Move temporary values that don't needKen Raeburn2006-06-211-18/+23
| | | | | | | | longer storage duration, like error codes, back into GET_*_BY_* macros. ticket: 3911 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18182 dc483132-0cff-0310-8789-dd5450dbe970
* Revert an untested change that wasn't supposed to go into this ticketKen Raeburn2006-06-201-1/+1
| | | | | | ticket: 18180 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18181 dc483132-0cff-0310-8789-dd5450dbe970
* getaddrinfo code uses vars outside of storage durationKen Raeburn2006-06-202-83/+94
| | | | | | | | | | | | | | | The calls to gethostbyname_r and friends were wrapped in macros that declared automatic variables for the auxiliary storage needed, but the pointers returned by the functions would be used outside of that scope, when the storage would no longer be valid. Changed the macro interfaces to define new types for the auxiliary storage, and add a new argument to the macros referring to that storage. Changed call sites accordingly. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18180 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: Set and substitute SUPPORTLIB_MAJOR based on operating system.Ken Raeburn2006-06-151-2/+2
| | | | | | | * util/support/Makefile.in (LIBMAJOR): Use it. (LIBMINOR): Bump. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18152 dc483132-0cff-0310-8789-dd5450dbe970
* Missed a reference to + sizeof() vs * sizeof(). Pointed out byEzra Peisach2006-06-011-1/+1
| | | | | | | | | william fiveash. ticket: 3825 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18071 dc483132-0cff-0310-8789-dd5450dbe970