aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/kdb/db2/libdb2
AgeCommit message (Collapse)AuthorFilesLines
2024-05-22Fix more non-prototype functionsArjun1-1/+1
Add "void" designations to more function declarations and definitions not changed by commits 3ae9244cd021a75eba909d872a92c25db490714d and 4b9d7f7c107f01a61600fddcd8cde3812d0366a2. [ghudson@mit.edu: change additional functions; split into two commits; rewrote commit message]
2024-02-13Avoid strict-prototype compiler errorsSteffen Kieß5-6/+6
Commit 4b9d7f7c107f01a61600fddcd8cde3812d0366a2 added the -Werror=strict-prototypes parameter to the build process, but left behind 28 function definitions using "()" instead of "(void)". Most of these definitions could not cause compiler errors for various reasons (such as an accompanying prototype), but a few could cause errors in gcc depending on the build configuration. For consistency and safety, add "(void)" to all 28 definitions. [ghudson@mit.edu: rewrote commit message]
2023-07-24Eliminate old-style function declarationsKen Hornstein30-571/+190
The C2x standard removes support for non-prototype function declarations, and clang 15 issues warnings for them (https://reviews.llvm.org/D122895). Add -Werror=strict-prototypes to the build and fix all of the non-prototype declarations and definitions. For RPC code, try to be consistent with libtirpc and recent *BSD versions of rpcgen. This includes casting each time a concrete function is used as an xdrproc_t value, since each XDR per-type function accepts a different object pointer type. A few invocations of xdrproc_t values pass a third argument with value LASTUNSIGNED, even though XDR per-type functions accept only two parameters. libtirpc has removed these third arguments; do so here as well. [ghudson@mit.edu: added -Werror=strict-prototypes and fixed declarations it breaks under gcc and clang; added xdrproc_t changes; rewrote commit message; style changes]
2023-04-10Squash a Berkeley DB warningGreg Hudson1-27/+1
In __delpair(), the assignment to next_key is not used unless DEBUG is defined, and the debugging assert can never fail--next_realkey() will always return n + 1 as we just checked KEY_OFF(pagep, n + 1). Remove the variable, the assert, and the otherwise unused next_realkey() function. This change eliminates a warning issued by clang 14.
2020-01-07Work around macOS SIP in the test suiteGreg Hudson2-1/+3
In macOS 10.11 and later with System Integrity Protection enabled, system programs (including the shell) purge DYLD_LIBRARY_PATH from the environment at startup. As a result, any part of "make check" which runs via a shell script must explicitly restore the runtime environment. Add a common rule for runenv.sh, and create and source it where shell scripts are run. Dejagnu's runtest is a shell script, so create a tcl file for the kadmin and RPC unit tests and source it from unix.exp. Avoid using the shell to run commands in several places. Use return_trace=True for tests that previously indirected through /usr/bin/env. Do not include <malloc.h> in t_parse_host_string.c, as it does not exist on macOS and is not needed. Skip the iprop tests on macOS when SIP is enabled, as signal restrictions appear to prevent the kpropd child process from informing the parent process that a full resync has completed. In net-server.c, set SO_REUSEPORT as well as SO_REUSEADDR on listener sockets. Otherwise the krb5kdc processes run by the test suite sometimes fail to start with "address in use" errors. In configure.ac, only generate po/Makefile if we will descend into it.
2019-07-11Fix typosAntoine Cœur3-3/+3
2018-06-18Eliminate use of the 'register' keywordThomas Sondergaard4-9/+9
'register' is a reserved and unused keyword in C++17 so having it present in the public headers presents a a compatibility issue. Also in C the 'register' keyword is mostly obsolete, so remove all uses of it. [ghudson@mit.edu: adjusted style of some of the affected lines]
2017-04-14Avoid using tmpnam(3) in db2's hash.cRobbie Harwood1-16/+3
As we do not rely on anonymous db2 databases, get rid of the code using tmpnam() for hash databases and reporting EINVAL if a filename is not specified. [ghudson@mit.edu: rewrote commit message; condensed conditionals]
2016-09-08Clean up libdb2 warningsTom Yu12-56/+63
Clean up many pointer alignment warnings by casting through (void *). Clean up many signed-unsigned comparison warnings by casting to unsigned types or redeclaring variables as unsigned types as appropriate.
2016-09-08Test bt_split.c unaligned accessTom Yu1-2/+24
ticket: 8493
2016-09-08Fix unaligned accesses in bt_split.cTom Yu1-6/+12
In the libdb2 btree back end, splitting a page at an overflow key could result in an unaligned access, causing a crash (and data corruption) on platforms with strict alignment. This probably occurs only rarely in practice. ticket: 8493 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
2016-09-08Fix bt_debug.c unaligned accesses and formatsTom Yu1-28/+39
Use memcpy to fix some unaligned accesses in bt_debug.c. Also fix some argument width issues with fprintf. Clean up warnings. ticket: 8478
2016-08-29Avoid byte-swap cache corruption in libdb2Tom Yu2-0/+9
Apply a patch from NetBSD to restore the cached copy of a page to the machine byte order after a write operation swapped it to the file byte order. As a regression test, modify test13 to sync the database file after each put to exercise this bug. ticket: 8483 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
2016-08-29Add known file test case for btree byte swapTom Yu4-3/+159
Add a regression test for the preceding bugfix. This test uses btree database files with known contents and byte orders with short keys and overflow data items. ticket: 8485
2016-08-29Fix btree byte swapping for overflow dataTom Yu1-6/+9
When operating on a btree database file of the opposite endianness, libdb2 was swapping the wrong bytes if a record had a short key but overflow data. Fix this bug by not incrementing p when swapping a P_BIGKEY overflow pointer, and by always skipping the full key size before swapping a P_BIGDATA overflow pointer (instead of assuming that a P_BIGKEY pointer always precedes a P_BIGDATA pointer). ticket: 8485 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
2016-08-29Test btree unaligned byte swappingTom Yu1-2/+34
Add a regression test for unaligned accesses during btree byte swapping. ticket: 8484
2016-08-29Avoid unaligned access in btree byte swappingTom Yu1-8/+14
Apply a patch from NetBSD to use temporary character buffers instead of doing an unaligned read when swapping bytes. ticket: 8484 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
2016-08-16Recursive btree traversal test caseTom Yu2-9/+118
Add an unlink page command to the dbtest program. This dbtest command finds a page that has both a left and a right neighbor and unlinks it, making it inaccessible to conventional sequential traversal. This simulates some btree corruption that has been seen in the field. Unlike the bttest command, the dbtest unlink command always searches for a leaf page with both a left and a right sibling, and doesn't allow the user to specify internal pages or a specific page number. Add a new dbtest command to recursively dump a btree database. Add a new test case to run.test that uses these new commands to verify the correct functioning of the recursive btree traversal options. ticket: 8476
2016-08-16Add bttest unlink page commandTom Yu4-6/+94
To enable testing of recursive btree traversal, add an unlink page command to the bttest program (used for debugging the libdb2 btree back end). This new bttest command can unlink a specified page number, or it can search for and unlink a page that has both a left and a right sibling. (The user can specify whether to find an internal page or a leaf page.) This unlinking makes the page inaccessible to conventional sequential traversal, simulating some btree corruption that has been seen in the field. ticket: 8476
2016-08-16Refactor btree recursive traversal codeTom Yu5-403/+171
Previous releases had a nonstandard entry point (bt_rseq) into libdb2 to perform recursive traversal of a btree database that might be corrupt so that an operator could attempt data recovery. This entry point became inaccessible to user commands after krb5-1.5 due to integration of the DAL. Refactor the recursive traversal code into the existing btree sequential traversal code, accepting new movement flags R_RNEXT (recursively advance to next item) and R_RPREV. Add commands to the libdb2 btree test program bttest to exercise this functionality. Fix up the existing "rlist" command of bttest to use the updated interface. ticket: 8476 (new) subject: Restore recursive dump functionality
2016-08-16Fix MPOOL_IGNOREPIN to ease btree debuggingTom Yu2-3/+3
Various libdb2 test programs use the MPOOL_IGNOREPIN flag to examine arbitrary mpool pages that may or may not be pinned. This flag is apparently intended to allow fetching pages that are already pinned, and to avoid setting the MPOOL_PINNED flag. When there was a cache hit, mpool_get was setting MPOOL_PINNED anyway, causing aborts when using debugging programs such as dbtest and bttest. Fix this inconsistency by not setting MPOOL_PINNED when returning a cached page when the caller requested MPOOL_IGNOREPIN. In bttest, add MPOOL_IGNOREPIN to allow dumping of pages while they are pinned without disrupting their pinned status. ticket: 8478
2016-08-16Fix void return in __bt_dpageTom Yu1-1/+1
ticket: 8478
2016-08-16Make bttest build with restricted lib exportsTom Yu4-2/+41
On platforms that use strict library export lists, the libdb2 btree debugging program bttest won't build with -DDEBUG or -DSTATISTICS because some needed functions aren't in the export list. Add the missing bt_debug.c and mpool.c functions to libdb.exports. Stub out these functions when built without -DDEBUG or -DSTATISTICS to avoid unreferenced symbols, because conditionalizing library export lists isn't easy. ticket: 8478
2016-08-16Fix bttest printing of unterminated stringsTom Yu1-4/+4
The libdb2 btree debugging program bttest can attempt to print keys or data that aren't null-terminated, reading past the end of the length-counted byte array. Use the "%.*s" format specifier to provide an explicit length when printing keys or data. ticket: 8478
2016-08-16Improve EINTR handling in bttestTom Yu1-1/+7
The libdb2 btree debugging program bttest doesn't handle EINTR in its input loop. This causes difficulties with debugging using lldb, because bttest gets signals like SIGSTOP when being attached, and lldb doesn't seem to share the terminal well with a program being debugged. ticket: 8478 (new) subject: usability improvements for bttest
2016-07-28Use single-colon rules in makefilesGreg Hudson7-10/+10
Double-colon rules allow the flexibility to specify commands in multiple places, but they also make the order of commands and dependencies dependent on the order of declarations in the Makefile. Convert all of our double-colon rules to single-colon rules, with the exception of "clean-unix" and "clean-windows" which have commands defined in both post.in and in numerous Makefile.in files.
2014-07-12Remove unused variablesLukas Slebodnik2-8/+3
[ghudson@mit.edu: squashed with similar commits]
2014-07-08Include autoconf.h before system headersGreg Hudson1-2/+2
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
2014-02-26Assume <stdint.h> and fixed-width typesGreg Hudson1-6/+0
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.
2014-02-19Use system dictionary for db2 tests againGreg Hudson1-4/+13
The built-in word list is not long enough for all of the libdb2 tests to run properly. Revert d21a86e47a7cda29225013e08d060095b94b2ee7 and go back to using the system dictionary if we find one. However, omit any lines from the chosen word list which contain non-alphabetical characters. ticket: 7860
2014-02-19Use TAILQ macros instead of CIRCLEQ in libdb2Greg Hudson2-27/+24
The optimizer in gcc 4.8.1 (but not the current gcc head revision) breaks the queue.h CIRCLEQ macros, apparently due to an overzealous strict aliasing deduction. Use TAILQ macros in the libdb2 mpool code instead. ticket: 7860
2014-02-11Don't use system dictionary files for DB2 testsGreg Hudson1-8/+0
The system dictionary may contain entries with punctuation, which can confuse the shell. It's more predictable to always use the word list from the source tree. ticket: 7860 status: open
2014-01-15Remove mentions of krb5-send-prTom Yu1-2/+1
Start the process of deprecating krb5-send-pr. In practice, it causes frustration for some users, and free-form email is good enough for most bug reports. Continue to install krb5-send-pr for now, but plan to remove it from the tree in the future, probably replaced by a script that instructs the user to send email manually. ticket: 5566 target_version: 1.12.1 tags: pullup
2013-05-31Fix warnings in dbtest.cGilles Espinasse1-20/+38
Check return values of read() and write(). Avoid some unsigned comparisons. Cast a ptrdiff_t value to int for use with %d in a format string. [ghudson@mit.edu: rewrap long lines; fix one more warning; commit message]
2013-05-31Link dbtest with libkrb5supportGreg Hudson1-2/+2
In a static build, linking dbtest could fail on platforms where libdb2 depends on krb5support (platforms without a native mkstemp). Reported by Gilles Espinasse <g.esp@free.fr>. ticket: 7651
2013-05-16Reduce boilerplate in makefilesGreg Hudson2-6/+1
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.
2013-01-10make dependGreg Hudson5-5/+5
Mostly this gets rid of the trailing space on line 2 after bb76891f5386526bdf91bc790c614fc9296cb5fa.
2013-01-07Fix various result checksNickolai Zeldovich1-1/+1
Correct three cases where the wrong expression was checked to see if an allocation function returned null. [ghudson@mit.edu: commit message, patch splitting] ticket: 7534 target_version: 1.11.1 tags: pullup
2012-12-20Avoid null dereference in BDB dbtree error caseGreg Hudson1-3/+3
An error case in __bt_first would deference a null pointer. This is an old upstream BDB bug. Use a separate variable to hold the result of mpool_get() until it has been checked. Reported by Nickolai Zeldovich <nickolai@csail.mit.edu>. ticket: 7511
2012-07-12Handle huge /bin directories in libdb2 testTom Yu1-6/+7
The test suite for libdb2 uses /bin as a source of filenames and contents for insertion into databases. Fedora 17 (and possibly other OSes) have /bin symlinked to /usr/bin, which can vastly increase the number of files found, exceeding some limits of the test databases. Truncate this list of files at 100 to prevent this problem. ticket: 7201 (new) status: pullup target_version: 1.10.3
2012-07-03Minor cleanups relating to size_t being unsignedBen Kaduk1-1/+1
In order to use -1 as a sentinel value, we should explicitly cast to make it clear what we are doing. It might be better to use a less convoluted sentinel value such as SIZE_T_MAX, though. Additionally, since size_t is unsigned and at least as wide as an int, a loop with int index variable that compares against a size_t for its termination check could become an infinite loop. Make the loop index size_t for consistency.
2012-06-04Fix -DDEBUG compilation errorsHenry B. Hotz1-0/+1
ticket: 7150
2012-05-17Add missing $(LIBS) to some shared librariesTom Yu1-1/+1
Add $(LIBS) to the $(SHLIB_EXPLIBS) for some shared libraries which did not previously include it, which prevented gcov from working properly in some cases. Patch from W. Trevor King. ticket: 7138
2011-09-05Initialize some more variablesKen Raeburn1-1/+1
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25151 dc483132-0cff-0310-8789-dd5450dbe970
2011-09-05Fix "may be used uninitialized" warnings in db2 code, even though allKen Raeburn6-9/+11
such cases appear to be safe. This will permit making uninitialized-variable messages fatal. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25147 dc483132-0cff-0310-8789-dd5450dbe970
2010-11-28Use for loops for recursion in the Windows build, cutting down on theGreg Hudson7-7/+7
verbiage in Makefile.in files. For correctness of output, every Makefile.in mydir= definition is changed to use $(S) instead of /. ticket: 6826 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24536 dc483132-0cff-0310-8789-dd5450dbe970
2010-11-03Avoid running off the end of the spares array in db2's page_to_oaddr()Greg Hudson1-1/+1
in unrealistically large databases. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24507 dc483132-0cff-0310-8789-dd5450dbe970
2009-12-08Remove dependency on /bin/csh in test suiteEzra Peisach1-2/+14
The libdb2 test suite would fail if /bin/csh was not present. The tests did not execute /bin/csh - but used the contents as data to put into the test database. Iterate over a few "known" files until one is found that could be used for it... Tests for /bin/csh, /bin/cat, /usr/bin/cat, /bin/ls, /usr/bin/ls. If none of these exist - then fail. ticket: 6593 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23458 dc483132-0cff-0310-8789-dd5450dbe970
2009-11-22Consolidate Makefile variables now that we have only a single globalGreg Hudson8-16/+2
configure script: $(SRCTOP) --> $(top_srcdir) $(srcdir)/$(thisconfigdir) --> $(top_srcdir) $(thisconfigdir) --> $(BUILDTOP) $(myfulldir) --> $(mydir) ticket: 6583 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23308 dc483132-0cff-0310-8789-dd5450dbe970
2009-10-31make mark-cstyleTom Yu25-92/+87
make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970