aboutsummaryrefslogtreecommitdiff
path: root/src/slave
AgeCommit message (Collapse)AuthorFilesLines
2017-09-22Add --pid-file option to kpropdGreg Hudson1-2/+34
ticket: 8607
2017-09-22Convert kprop and kpropd to use getopt()Greg Hudson2-141/+84
2017-04-14Remove use of caddr_t in kpropd.cRobbie Harwood1-7/+5
2017-04-12Replace casts with use of sa2sin and sa2sin6Robbie Harwood1-2/+2
2016-10-25make dependGreg Hudson1-14/+17
2016-09-06Consolidate sn2princ_realm() in kprop and kpropdGreg Hudson4-65/+43
In kprop and kpropd, factor out the duplicated implementation of sn2princ_with_realm() into kprop_util.c. Rename it to sn2princ_realm(), remove the type parameter, and require the sname parameter to be specified. Rewrite the function to use krb5_expand_hostname(), avoiding an unnecessary hostrealm lookup.
2016-09-06Rename kprop_sock.c to kprop_util.cGreg Hudson3-7/+7
Change the name of kprop_sock.c so that additional common functions can be added to it.
2016-08-10Fix a variety of one-time leaksGreg Hudson3-7/+5
Eliminate some memory leaks which should not affect normal operation, but which make it harder to detect more serious memory leaks. In kdb5_util, start using the already existing quit() function and remove redundant DB and master key cleanup performed by individual commands. In kdb5_destroy(), use util_context instead of creating a new one. Add an mkey_fullname global variable and use it to make a bunch of krb5_db_setup_mkey_name() calls unnecessary.
2016-07-30make dependGreg Hudson1-17/+14
2016-07-28Use single-colon rules in makefilesGreg Hudson1-5/+3
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.
2016-06-13Fix kprop and kpropd realm handlingMatt Rogers2-72/+101
Add the sn2princ_with_realm() helper function (currently duplicated in kprop.c and kpropd.c) to simplify principal realm substitution. Use sn2princ_with_realm() in kprop.c and kpropd.c in place of krb5_sname_to_principal(), with the default realm if -r is not provided. If a realm is given to kpropd, set it as the default realm on the kpropd_context, allowing a later call of ulog_replay() to open the correct database. Remove referral realm code in kprop.c and kpropd.c. Pass the realm (default or provided) to the kdb5_util and kprop commands called by kadmind. ticket: 8277
2015-04-13Avoid unnecessary iprop full resyncs after resetsGreg Hudson1-5/+11
When resetting the ulog header or initializing it from a dump file kdb_last_t value, instead of setting kdb_num to 0, create a dummy entry for the last_sno value so that we can remember its timestamp. With this change, a slave no longer needs to perform two full resyncs after an upstream header initialization. Dummy entries are never transmitted to downstream slaves because the iprop protocol never transmits the kdb_first_sno update; if one is somehow transmitted, the slave will ignore it because it doesn't have the kdb_commit flag set. reset_header() is renamed to reset_ulog(), takes a kdb_log_context parameter, and is responsible for syncing the header. sync_update() now returns void and aborts if msync() fails, just like sync_header(). A new helper set_dummy() writes a dummy entry and sets the ulog to point to it. Adjust kproplog to recognize and display dummy entries. Adjust t_ulog.c and t_iprop.py for the new behavior. In t_iprop.py, remove a kpropd -t test which became redundant with the previous test. ticket: 8164 (new)
2015-04-13Document kpropd -t and fix it in iprop modeGreg Hudson1-2/+2
If kpropd is asked to run just once, don't exit after starting a full resync; we want to wait for the fullprop child to process the request, and then request incremental updates afterwards. Also don't exit from do_standalone() in the fullprop child, in case multiple full resyncs are required to get the database up to date. Document the -t flag in kpropd.rst. ticket: 8161
2015-04-13In kpropd, poll after finishing resyncGreg Hudson1-1/+5
When kpropd operates in iprop mode, full resyncs are handled by a child process. After a full resync, we want to poll for incremental updates, as the dump we received may have come from a pre-existing dump file which was not current. To make this polling happen promptly, signal the parent process from the child process after a dump is received. With this change, t_iprop.py no longer has to prod kpropd after a full resync occurs, so remove that logic. ticket: 8161
2014-10-24Remove unused variables from kprop.cBen Kaduk1-20/+0
Commit 29dee7d2cece615bec4616fa9b727e77210051db removed the need for a ccache to hold the credentials used by the process, but did not remove the ccname and ccache variables which became unused as a result.
2014-07-08Include autoconf.h before system headersGreg Hudson4-18/+9
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-26Minimize race conditions in t_iprop.pyGreg Hudson1-4/+12
Augment kpropd's debugging output so we can see the starting and ending serial numbers of a sync, and check them in t_iprop.py's wait_for_prop to make sure we're observing the correct sync each time. Try to make sure we only send SIGUSR1 when kpropd is actually sleeping, by waiting for it to print its pre-sleep message to stderr after a full dump and after each sync. This isn't perfect, as there is a short window between printing to stderr and actually sleeping, but we can't do any better until kpropd has a more reliable mechanism for triggering immediate updates.
2014-02-20Implement kpropd -AGreg Hudson1-0/+8
The -A option causes kpropd to contact a specified admin server (normally an intermediate slave running kadmind -proponly) instead of the master admin server. Based on code submitted by Richard Basch. ticket: 7855
2014-02-20Simplify ulog_mapGreg Hudson2-21/+35
Get rid of the caller parameter. The kproplog semantics (without -R) for mapping the ulog are simple and almost completely different from other users of the ulog, so implement them as a static helper in kproplog. With hierarchical iprop, kpropd will need the same semantics as FKCOMMAND and FKADMIND, which were already identical. Get rid of the db_args parameter, since ulog_map no longer opens the database after #7552. Remove an inoperative lseek() call when creating a new ulog file. Rename ulog_filesize to filesize and compute it from scratch each time we use it, for easier analysis. If kdb_hmagic is zero, init the ulog header but don't skip the rest of the function; it's possible that we need to expand the ulog file. Remove an unneeded conditional before calling extend_file_to for an existing ulog. ticket: 7855
2014-02-20Lock around more ulog operationsGreg Hudson2-9/+13
Always lock the ulog when accessing it. We can currently get away with some laxness on iprop slaves because they are mostly synchronous, but hierarchical iprop will allow master and slave operations to take place concurrently, requiring more strict locking. Add new functions ulog_get_last and ulog_set_last, which access the ulog header with locking, and use them in kdb5_util and kpropd. Add locking to ulog_replay and ulog_init_header. ulog_lock and ulog_sync_header are no longer used outside of kdb_log.c after these changes, so make them static functions and remove the ulog_ prefix. Add an unlock_ulog function for clarity.
2014-02-05Modernize iprop codeGreg Hudson3-920/+644
* Don't use "extern" for kdb_log.h prototypes. * Avoid passing structures by value. * Avoid the need to cast the result of the INDEX macro, and use char * instead of unsigned long for pointer arithmetic. * Reorganize kdb_log.c so static helpers are at the top and don't use the "ulog_" prefix. * Get rid of ulog_finish_update_slave since it's more concise to open-code it in ulog_replay. * Get rid of ulog_delete_update. In krb5_db_delete_principal, just call ulog_add_update with kdb_deleted set in upd. * Modernize coding style of kproplog.c. Use k5memdup0 instead of snprintf in print_str to convert a byte range to a C string. Remove an unnecesary textdomain call; libkrb5 takes care of calling bindtextdomain in the library initializer. * Modernize coding style of kpropd.c and kprop.c. No functional changes.
2014-01-30Fix kpropd -xGreg Hudson1-0/+1
A missing break in the switch statement caused kpropd -x to error out with a usage message. ticket: 7854 (new) target_version: 1.12.2 tags: pullup
2013-11-04Avoid deprecated krb5_get_in_tkt_with_keytabBen Kaduk1-21/+13
The kprop code has been pretty unloved, and uses some routines that are marked as deprecated (which show up as warnings in the build log). Use the documented replacement for krb5_get_in_tkt_with_keytab, krb5_get_init_creds_keytab, instead. As a bonus, there is no longer a side effect of a credentials cache that needs to be destroyed. The also-deprecated function krb5_get_in_tkt_with_skey was backending to it when no keyblock was passed in; we can unroll the call to krb5_get_init_creds_keytab ourselves as the documented workaround. While here, improve style compliance with regards to cleanup. The setkey test just wants to know whether it can use the key it just put into a keytab to get credentials; as such the recommended krb5_get_init_creds_keytab is quite sufficient. While here, use that interface to request the particular enctype as well, reducing the scope of an XXX comment. ticket: 6366
2013-11-04Remove last uses of "possibly-insecure" mktemp(3)Ben Kaduk1-9/+7
Many libc implementations include notations to the linker to generate warnings upon references to mktemp(3), due to its potential for insecure operation. This has been the case for quite some time, as was noted in RT #6199. Our usage of the function has decreased with time, but has not yet disappeared entirely. This commit removes the last few instances from our tree. kprop's credentials never need to hit the disk, so a MEMORY ccache is sufficient (and does not need randomization). store_master_key_list is explicitly putting keys on disk so as to do an atomic rename of the stash file, but since the stash file should be in a root-only directory, we can just use a fixed name for the temporary file. When using this fixed name, we must detect (and error out) if the temporary file already exists; add a test to confirm that we do so. ticket: 1794
2013-06-07Fix various warningsGreg Hudson1-2/+2
2013-05-16Reduce boilerplate in makefilesGreg Hudson1-3/+0
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-03-24make dependGreg Hudson1-12/+10
2013-01-25Make kproplog handle underfull iprop logsGreg Hudson1-3/+4
kproplog currently assumes that an iprop log is full once it has circled--which is true right now but will need to change for hierarchical slaves. Avoid this assumption by using the correct index modulus in print_update whether or not the log is full. Based on a patch from Richard Basch <basch@alum.mit.edu>.
2013-01-24Quiet kpropd.c signed/unsigned comparison warningsNicolas Williams1-3/+3
[ghudson@mit.edu: simplify slightly]
2013-01-22Fix iprop log reinitializationGreg Hudson2-11/+3
If the master iprop log is reinitialized to serial number 0, slaves will need to take a full dump--but after that happens, we need to know whether the slave has taken that full dump, we we don't offering full dumps indefinitely. So, record a timestamp in kdb_last_time when we reinitialize the log header, and compare the slave timestamp to kdb_last_time whenever it has the current serial number, even if it's 0. Test this by performing a propagation with sno 0 in t_iprop.py and detecting whether kpropd gets a second UPDATE_FULL_RESYNC_NEEDED response from kadmind. ticket: 7550 (new)
2013-01-10make dependGreg Hudson1-1/+1
Mostly this gets rid of the trailing space on line 2 after bb76891f5386526bdf91bc790c614fc9296cb5fa.
2012-12-19Separate clpreauth and kdcpreauth interfacesGreg Hudson1-6/+6
Since there is no overlap between the clpreauth and kdcpreauth interface declarations, there's no particular reason to combine them into one header. For backward compatibility and convenience, leave behind a preauth_plugin.h which includes both.
2012-10-17Remove install-oldmanBen Kaduk1-6/+0
The old man pages are gone, so we can't install them anymore. Also clean up install and install-unix targets that were installing the old man pages by hand.
2012-10-16Remove nroff man pagesBen Kaduk3-325/+0
We generate man pages from RST sources now; they are checked into the tree in src/man/. The gen-manpages directory is no longer needed.
2012-10-12Make t_iprop.py faster and more robustGreg Hudson1-3/+11
Catch SIGUSR1 in iprop-mode kpropd so that we can use it to interrupt sleeps and make kpropd do an iprop request immediately. In k5test.py, add prod_kpropd and read_from_kpropd methods to allow test scripts to send a SIGUSR1 to kpropd and to read its stdout/stderr output; also allow the test script to specify additional arguments when starting kpropd. In t_iprop.py, start kpropd with -d and, instead of sleeping, read kpropd output until we see an indication that kpropd is in sync with the master. To avoid delays, prod kpropd before waiting for sync and after a completed full prop.
2012-10-10Fix slow kprop dejagnu testGreg Hudson1-1/+1
Fix kpropd -S -t to actually exit after processing one connection (it was breaking out of the switch statement, not the while loop). Use the -t when invoking kpropd from the dejagnu test framework; previously it was unnecessary because kpropd -S -d exited after one connection. Clear up some confusion in the kprop.exp comments about whether kpropd is expected to exit.
2012-10-08Remove an old, incorrect comment in kpropd.cNicolas Williams1-9/+0
We absolutely do not want a parking brake on the kprop protocol as described in the comment being removed. Instead the kprop command should be fixed so it doesn't die on error (assuming it even still does or ever did, neither of which I've checked).
2012-10-08Send kpropd debug msgs to stderrNicolas Williams1-4/+5
2012-10-05Add -R option to kproplog to force full resyncsNicolas Williams1-4/+25
ticket: 7375
2012-10-05Deprecate kpropd -S optionNicolas Williams1-1/+12
ticket: 7376
2012-10-05Improve kpropd debug and syslog outputNicolas Williams1-39/+123
Add additional debug output and syslogs. Remove "kpropd:" from syslogs. Always call openlog(). Clean up C style of a few messages. [ghudson@mit.edu: split and combine commits; commit message]
2012-10-05Improve kpropd behavior in iprop modeNicolas Williams1-222/+174
- Make kpropd in iprop mode fork a child to listen for kprops from the master. The child writes progress and outcome reports to the parent for each kprop. This fixes a race between asking for a full resync and setting up a listener socket for it. - Add runonce (-t) for kpropd do_standalone() too. - Add a new iprop parameter: iprop_resync_timeout. kpropd will keep asking for incremental updates while waiting for a full resync to finish, and will re-request a full resync if kadmind continues to indicate that one is needed after this timeout passes since the previous full resync was requested. - Allow polling intervals less than 10 seconds. [ghudson@mit.edu: split out debug output changes; note polling interval change in commit message] ticket: 7373
2012-07-30Policy extensions + new policy: allowed ks typesNicolas Williams1-1/+1
This simply adds KADM5_API_VERSION_4 and various fields to the policy structures: - attributes (policy-ish principal attributes) - max_life (max ticket life) - max_renewable_life (max ticket renewable life) - allowed_keysalts (allowed key/salt types) - TL data (future policy extensions) Of these only allowed_keysalts is currently implemented. Some refactoring of TL data handling is also done. ticket: 7223 (new)
2012-07-06Allow using locales when gettext is absentBen Kaduk3-0/+3
Previously, if configure did not detect dgettext(), we disabled anything that smelled like localization, inadvertently including setlocale(). Now that we use setlocale(LC_ALL, ""), we have localized dates available as well as messages, so we should not disable calls to setlocale() any more. Since the routines from locale.h are only used in a relatively small number of places, just include the header directly in those files and remove it from k5-platform.h.
2012-07-06Enable all localizations in main functionsBen Kaduk3-3/+3
Bite the bullet and pass LC_ALL to setlocale() instead of just LC_MESSAGES. Calls to setlocale() itself were introduced in fabbf9e443459e8c0161c84563690ed70c7f6a61 for ticket 6918, but only for LC_MESSAGES since only localized strings were needed and that was the most conservative option. However, klist, kadmin, and kinit (and perhaps others) would benefit from localized formats for times (i.e., LC_TIME). If potentially localized data is being sent on the wire, that is a bug that should be fixed. No such bugs are found with the current test suite, so we are comfortable enabling LC_ALL at this time. ticket: 7192
2012-03-22Suppress some gcc uninitialized variable warningsGreg Hudson1-2/+3
ticket: 7107 gcc 4.6.2 reportedly finds some spurious maybe-uninitialized warnings. Suppress them. Patch from Eray Aslan with some adjustment. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25783 dc483132-0cff-0310-8789-dd5450dbe970
2012-02-28Require IPv6 supportKen Raeburn1-3/+1
The configure-time options to enable and disable IPv6 support have been deprecated for some time, but the checks for OS support were kept. This removes those checks, and unconditionally compiles in the IPv6 support. There was a configure-time test to see if the macro INET6 needed to be defined in order to enable (visibility of) OS support for IPv6, which was needed on an IRIX system we tested with. That check is retained, but the revised code is untested on IRIX. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25719 dc483132-0cff-0310-8789-dd5450dbe970
2012-01-09install sphinx-generated manpagesTom Yu1-1/+4
Install sphinx-generated manpages. Original nroff manpages remain for reference until proofreading is complete. Modify doc/rst_source/conf.py to better deal with shadow manpages -- sphinx will now build k5login.5 instead of .k5login.5, and kadmin.1 instead of both kadmin.1 and kadmin.local.8. Proofreaders should ensure that the original nroff manpages (and associated Makefile rules) are deleted once their reST format equivalents have been proofread. ticket: 7064 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25625 dc483132-0cff-0310-8789-dd5450dbe970
2011-10-02Man page spelling corrections from ville.skytta@iki.fiGreg Hudson1-1/+1
ticket: 6968 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25290 dc483132-0cff-0310-8789-dd5450dbe970
2011-09-04Reindent per krb5-batch-reindent.el.Ken Raeburn1-11/+11
Some minor reformatting added in places to avoid exceeding 80 columns. Used Emacs 22.1 built-in C mode. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25144 dc483132-0cff-0310-8789-dd5450dbe970