summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* make dependGreg Hudson2014-07-081-0/+3
|
* Include autoconf.h before system headersGreg Hudson2014-07-0815-57/+20
| | | | | | | | | Include autoconf.h (either directly or via proxy) before system headers, so that feature test macros defined there can affect the system namespace. Where include order was changed, eliminate some redundant or unnecessary includes. ticket: 7961
* Simplify usage of strerror_rGreg Hudson2014-07-083-28/+2
| | | | | | | | Take advantage of the strerror_r portability wrapper to simplify code using it. Remove unused macros related to strerror_r in ldap_service_stash.c and plugins.c. ticket: 7961
* Define k5-platform.h wrapper for strerror_rGreg Hudson2014-07-083-1/+101
| | | | | | | | On systems where strerror_r is not the POSIX version, define it to k5_strerror_r. Implement k5_strerror_r in libkrb5support using strerror_s, strerror, or the GNU strerror_r as appropriate. ticket: 7961
* Avoid using length fields in socket addressesGreg Hudson2014-07-041-9/+0
| | | | | | | | | | | | Remove code to set or reference the length fields of socket addresses (sa_len/sin_len/sin6_len), since they aren't portable and setting them is not required. Remove autoconf tests for those fields which are no longer used or which were never used. There is one exception: in localaddr.c, we still neeed to reference sa_len for the definition of ifreq_size on platforms which have sa_len. Leave that behind, along with the autoconf test which defines SA_LEN.
* Use sa_setport and sa_getport where appropriateGreg Hudson2014-06-271-9/+2
| | | | | | Use sa_setport and sa_getport in place of existing static helpers or open-coded switch statements in net-server.c, fake-addrinfo.c, and svc_tcp.c.
* Load plugins with RTLD_NODELETE if possibleGreg Hudson2014-06-261-5/+14
| | | | | | | | | | | | | | | | | | On platforms which support RTLD_NODELETE, use it to load plugin modules. While using this flag makes plugins stay in the process map after libkrb5/libgssapi_krb5 are unloaded, it solves several problems: 1. It prevents plugin modules which link against OpenSSL (PKINIT and k5tls) from repeatedly initializing instances of libssl or libcrypto, leaking heap memory each time. This is only an issue because we cannot safely uninitialize OpenSSL. 2. It prevents finalization ordering issues from causing a process crash when unloading libgssapi_krb5 (issue #7135). 3. It makes memory leak tracing with valgrind easier. ticket: 7947 (new)
* Remove DEBUG_ERROR_LOCATIONS supportGreg Hudson2014-06-052-33/+1
| | | | | It wasn't being used and it added too much complexity to the error-handling functions.
* Add a simple KDC proxy test serverNalin Dahyabhai2014-06-021-0/+18
| | | | | | | | This proxy server uses python-paste to run the kdcproxy from https://pypi.python.org/pypi/kdcproxy. It should be used along with the proxy.pem certificate in ../tests/dejagnu/proxy-certs. ticket: 7929
* Have k5test.py provide 'runenv' to python testsNalin Dahyabhai2014-06-021-5/+10
| | | | | | | Expose the formerly-internal _runenv module as k5test.runenv, so that settings we store in the top-level runenv.py will be available to them. ticket: 7929
* Fix typo in k5test.pyBen Kaduk2014-05-191-1/+1
| | | | The principal/principle confusion strikes again.
* Add k5_buf_get_spaceGreg Hudson2014-05-172-0/+11
| | | | | Add a new k5_buf method to make room in the buffer for the caller to fill in.
* Remove compile_et.cGreg Hudson2014-04-307-790/+6
| | | | | | We have used awk scripts in preference to the C version of compile_et since 1994 (r4426). Get rid of the sources for the C version and all of the Makefile.in references to them.
* Update sample configs to include master_kdcGreg Hudson2014-04-152-8/+9
| | | | | | | | | | | | Where we have ATHENA.MIT.EDU stanzas in sample or test krb5.conf files which define kdc entries, also define a master_kdc entry. Remove default_domain and v4_instance_convert entries in examples as they are only needed for krb5/krb4 principal conversions. In the krb5_conf.rst example, remove enctype specifications as we don't want to encourage their use when they aren't necessary, and remove a redundant domain_realm entry. ticket: 7901 (new)
* Always stat profile files after reopening themWill Fiveash2014-03-201-0/+1
| | | | | | | | | | | Some applications write a profile file and then immediately use it via a krb5_context. If we have a cached copy of the profile we wrote, make sure to update it by forcing a stat when we reuse an existing prf_data_t object. [ghudson@mit.edu: commit message] ticket: 7884
* Rewrite GSS sequence state tracking codeGreg Hudson2014-03-182-6/+6
| | | | | | | | | | | | | Replace util_ordering.c with a new file util_seqstate.c, implemented using a bitmap of previously received sequence numbers instead of a 20-element circular queue. This approach has slightly different limitations--it can check for replays for values within 64 of the expected next number, where the old code could check within the range of the last 20 received numbers regardless of how far apart they are. The new approach should work as well or better for any realistic packet reordering scenario. ticket: 7879 (new)
* Improve internal API for GSS sequence numbersGreg Hudson2014-03-181-2/+2
| | | | | | | | | | Use an opaque structure type instead of a void pointer for the sequence number state. Rename all functions to use a g_seqstate prefix rather than a mix of g_order and g_queue. Remove the unneccessary indirection from the state object parameter in g_seqstate_check and g_seqstate_free. Return OM_uint32 where we return a GSS major code, long where we return an errno value, and void where we can't fail.
* Fix two omissions in stdint.h changesGreg Hudson2014-02-261-4/+2
| | | | | | | | Since we no longer prefix an "#include <stdint.h>" in the gssapi.h preamble at build time, include it in gssapi.hin. Update util/gss/kernel-lib/Makefile.in to account for gssapi_krb5.h being in the source tree.
* Eliminate internal fixed-width type wrappersGreg Hudson2014-02-263-16/+14
| | | | | Directly use stdint.h names for integer types in preference to the various internal names we have made up for them.
* Assume <stdint.h> and fixed-width typesGreg Hudson2014-02-262-9/+1
| | | | | | | Make unconditional use of <stdint.h> and fixed-width types such as uint32_t. k5-plugin.h doesn't use any special integer types, so remove the conditional include block there. Nothing uses INT64_FMT/UINT64_FMT, so leave those out of k5-platform.h for now.
* Remove krb5-send-prTom Yu2014-01-2812-1462/+11
| | | | | | | Remove the GNATS-based krb5-send-pr script and replace it with a script that instructs users to send email. ticket: 7840 (new)
* Avoid assertion failure in error_messageGreg Hudson2014-01-171-2/+3
| | | | | | | | | | | | r17942 added a call to get_thread_buffer in the first part of error_message, prior to the call to com_err_initialize. This can cause an assertion failure from k5_getspecific if error_message is called on a system error before any other com_err functions are called. Move the initialization call earlier to prevent this. ticket: 7822 (new) target_version: 1.12.2 tags: pullup
* make dependTom Yu2013-12-101-0/+3
|
* Fix race in util/profile/Makefile.inGreg Hudson2013-10-211-7/+1
| | | | | | $(BUILDTOP)/include/profile.h was being updated by two different rules, which could collide with make -j. Use a dependency from includes instead of a redundant rule.
* Add an internal constant-time comparison functionGreg Hudson2013-10-033-1/+49
| | | | | | | k5_bcmp acts similarly to the deprecated Unix bcmp() function, returning zero if two memory regions are equal and nonzero if they are not. It is implemented such that it should take the same amount of time regardless of how many bytes are equal within the memory regions.
* Add "which" function to k5testGreg Hudson2013-09-281-0/+13
| | | | | Add a utility function in k5test.py to look for a command in the executable path, and remove it from t_kdb.py.
* Use macros instead of magic numbers in json.cZhanna Tsitkov2013-09-191-6/+7
| | | | Avoid using "magic numbers" for better maintainability.
* Remove redundant domain_realm mappingsBen Kaduk2013-08-121-12/+7
| | | | | | | | | | | | | | | | | | | This fixes a long-standing documentation bug where we claimed that a domain_realm mapping for a host name would not affect entries under that domain name. The code has always had the behavior where a host name mapping implies the corresponding domain name mapping, since the 1.0 release. While here, replace media-lab with csail in example files, as the media lab realm is no longer in use. Also strip port 88 from KDC specifications, and drop the harmful default_{tgs,tkt}_enctypes lines from src/util/profile/krb5.conf. Further cleanup on these files to remove defunct realms may be in order. ticket: 7690 (new) tags: pullup target_version: 1.11.4
* Add base64 functions to libkrb5support exportsRobbie Harwood (frozencemetery)2013-07-301-0/+2
| | | | | This was previously not an issue because nothing outside of libkrb5support used them.
* Clarify and improve k5_json_object_setGreg Hudson2013-07-162-3/+25
| | | | | Document that k5_json_object_set can be used to overwrite an existing key, and make it possible to remove a key by setting it to NULL.
* Fix various warningsGreg Hudson2013-06-071-9/+7
|
* Fix rc4 string-to-key on unterminated inputsGreg Hudson2013-05-271-16/+20
| | | | | | | | | | | The internal UTF-8 to UCS-2 conversion functions did not properly respect their length arguments, instead assuming that the input string is terminated with a zero bytes. As a result, krb5int_arcfour_string_to_key could fail on unterminated inputs. Fix the underlying support functions to read their inputs only up to the specified length. ticket: 7643 (new)
* Reduce boilerplate in makefilesGreg Hudson2013-05-168-53/+3
| | | | | | | | | Provide default values in pre.in for PROG_LIBPATH, PROG_RPATH, SHLIB_DIRS, SHLIB_RDIRS, and STOBJLISTS so that they don't have to be specified in the common case. Rename KRB5_RUN_ENV and KRB5_RUN_VARS to RUN_SETUP (already the most commonly used name) and RUN_VARS. Make sure to use DEFINES for local defines (not DEFS). Remove some other unnecessary makefile content.
* Assume mutex locking cannot failGreg Hudson2013-05-149-177/+97
| | | | | | | | | | | | Locking and unlocking a non-recursive mutex is a simple memory operation and should not fail on any reasonable platform with correct usage. A pthread mutex can return EDEADLK on lock or EPERM on unlock, or EINVAL if the mutex is uninitialized, but all of these conditions would reflect serious bugs in the calling code. Change the k5_mutex_lock and k5_mutex_unlock wrappers to return void and adjust all call sites. Propagate this change through k5_cc_mutex_lock and k5_cc_mutex_unlock as well.
* Add missing plugins.c to SRCS in util/supportGreg Hudson2013-05-022-0/+5
| | | | | | Reported by Arlene Berry. ticket: 7629
* Avoid passing null pointers to memcpy/memcmpGreg Hudson2013-04-082-2/+4
| | | | | | | | | | | | | | | By a strict reading of the C standard, memcpy and memcmp have undefined behavior if their pointer arguments aren't valid object pointers, even if the length argument is 0. Compilers are becoming more aggressive about breaking code with undefined behavior, so we should try to avoid it when possible. In a krb5_data object, we frequently use NULL as the data value when the length is 0. Accordingly, we should avoid copying from or comparing the data field of a length-0 krb5_data object. Add checks to our wrapper functions (like data_eq and k5_memdup) and to code which works with possibly-empty krb5_data objects. In a few places, use wrapper functions to simplify the code rather than adding checks.
* Free unconditionally in plugins.cGreg Hudson2013-03-291-8/+8
| | | | | Get rid of unnecessary null checks before freeing values in libkrb5support's plugin code.
* Export verto_set_flags from libvertoGreg Hudson2013-03-261-0/+1
| | | | | | | | | | When the bundled libverto was updated from 0.2.2 to 0.2.5, verto_set_flags should have been added to libverto.exports along with the other new functions. ticket: 7594 (new) target_version: 1.11.2 tags: pullup
* make dependGreg Hudson2013-03-241-42/+31
|
* Add missing .gitignore entries and clean rulesGreg Hudson2013-02-271-1/+1
| | | | ticket: 7585
* Modernize k5bufGreg Hudson2013-02-146-161/+183
| | | | | | Rename the krb5int_buf_ family of functions to use the k5_ prefix for brevity. Reformat some k5buf implementation code to match current practices.
* Add k5_json_array_fmt and use it in export_cred.cGreg Hudson2013-02-133-0/+121
| | | | | | Add a template-based array constructor for convenient marshalling of structured values as JSON array values. Use it to simplify export_cred.c.
* Make internal JSON functions return error codesGreg Hudson2013-02-132-273/+346
| | | | | | | | | Return error codes (0, ENOMEM, or EINVAL) from JSON support functions instead of returning results directly. This makes error handling simpler for functions which assemble JSON objects and then return a krb5_error_code values. Adjust all callers. Use shims in export_cred.c to minimize changes there; it will be redesigned internally in a subsequent commit.
* Add kprop Python testsGreg Hudson2013-02-071-3/+9
| | | | | | Create a K5Realm.kprop_port method so test scripts can invoke kprop usefully, and create a simple Python test script exercising the same kprop functionality as the dejagnu suite's kprop.exp.
* Fix COPY_FIRST_CANONNAME hostent searchViktor Dukhovni2013-01-311-11/+11
| | | | | | | | | | | In fake-addrinfo.c, the COPY_FIRST_CANONNAME logic erroneously assumes that h_name is the same as h_aliases[0]. Look at h_name before h_aliases for an FQDN, since h_name is normally the forward-canonicalized name and h_aliases are not. [ghudson@mit.edu: rewrote commit message] ticket: 7556 (new)
* Verify iprop test results more thoroughlyGreg Hudson2013-01-221-2/+2
| | | | | | | In k5test.py, allow run_kadminl to take an environment argument. In t_iprop.py, perform some queries on the slaves after each propagation to spot-check that it got modifications from master. Use a helper function to check serial numbers for conciseness.
* Add k5test support for KDC special environmentsGreg Hudson2013-01-111-11/+15
| | | | | | Accept environment parameters in the K5Realm start_kdc and start_kadmind methods, so that krb5kdc or kadmind can be started or restarted with a modified configuration.
* make dependGreg Hudson2013-01-107-7/+7
| | | | | Mostly this gets rid of the trailing space on line 2 after bb76891f5386526bdf91bc790c614fc9296cb5fa.
* Fix signed overflow check in k5_ucs2s_to_utf8sGreg Hudson2012-12-201-3/+1
| | | | | | | | Signed overflow must be checked before it happens, since modern versions of gcc will optimize out checks of the result. Reported by Nickolai Zeldovich <nickolai@csail.mit.edu>. ticket: 7511
* Simplify k5test.py environmentsGreg Hudson2012-12-203-250/+170
| | | | | | | | | | | | | | The initial k5test.py design, copied from the dejagnu suite, is to create config files and environments for four expected roles: client, server, master, and slave. This approach exaggerates the complexity of the common case, where the configurations don't need to vary, and limits us to having just one slave for kprop/iprop tests. Instead, create just one configuration by default, and add a special_env() method which sets up a differently configured environment for the few test cases which need one. The run_as_*() methods are collapsed into just run(), which accepts an optional argument for the environment returned by special_env().