Commit Graph

163 Commits

Author SHA1 Message Date
Nicolas Williams
302250026c kdc: Do not announce via Bonjour when testing
Let's see if this fixes the GitHub Actions OS X CI.
2022-01-20 00:20:30 -06:00
Nicolas Williams
c650e37321 kdc: Fix leak caused by a1481f1f0 2022-01-19 17:32:16 -06:00
Nicolas Williams
a1481f1f05 kdc: Check krb5_ret_uint32() in connect loop 2022-01-18 00:42:11 -06:00
Nicolas Williams
d41467dcde kdc: Explicitly ignore setsockopt() result 2022-01-18 00:16:09 -06:00
Nicolas Williams
cf2bab411d kdc: Fix warnings 2022-01-14 17:59:49 -06:00
Jeffrey Altman
3214c835da kdc: enable keepalive mode on incoming sockets
Change-Id: I72a43486fe772ad3c8e71d8c5cc512bdb89de2d2
2020-07-24 01:32:34 -04:00
Roland C. Dowdeswell
c7d4682aed Define log levels in docs and change default to 0-3.
We define the meaning of the various log levels in the man page
for krb5_openlog(3).  If logging configured and levels are not
specified, we change the default levels to 0-3 which should exclude
debugging messages which are generally only desired in exceptional
circumstances.

We also go through the KDC and adjust the levels to be appropriate.
2019-10-21 13:43:01 +01:00
Nicolas Williams
6deb2a6bae kdc: improve HTTP parsing 2019-10-03 13:09:18 -05:00
Nicolas Williams
d3ef0ee743 kdc: fix leaks 2019-10-03 13:09:18 -05:00
Nicolas Williams
75b5c94a62 kdc: fix invalid free at exit time 2019-10-03 13:09:18 -05:00
Nicolas Williams
9c51900238 Declare kdc log functions to be printf-like
And add a kdc_vlog() function.
2019-07-09 13:17:06 -05:00
Viktor Dukhovni
e014662651 Further improve kdc child process management
- Simplify child process creation rate limit by moving
  select_sleep() to happen right after the parent fork().

- Consider child pid table slots to be empty if the pid is
  non-positive, rather than just -1 or just 0.

- Log warnings should we ever spawn a child with no free
  slot to track it, or reap a child that does not match
  a tracked slot.
2017-10-30 18:39:23 -04:00
Quanah Gibson-Mount
e7879208e4 Fixes https://github.com/heimdal/heimdal/issues/310, use PF_UNIX instead
of PF_LOCAL
2017-09-25 18:31:42 -05:00
Jeffrey Altman
237cd892d9 kdc: unused pid element is (pid_t)-1 not zero
When the termination of a child process is observed by reap_kid() it
clears the pids[] element by assigning it the invalid pid value
(pid_t)-1. However, start_kdc() assumes that the unused pid[[] element
value is 0.  As a result, each pid[] element's associated child process
can only be restarted once since start_kdc() will not be able to locate
an unused element.

This change alters start_kdc() to initialize all elements of pids[] to
(pid_t)-1 and use that as the marker for unused elements.  By doing so
start_kdc() can properly record child process pids and indefinitely
restart child processes as necessary.

Change-Id: Ia93c9284ab21289994eca7fc9cf1278be7c00683
2017-07-27 22:03:51 -05:00
Jeffrey Altman
ebae52f3cc kdc: de_http stricter parsing
In de_http() treat any sequence of '%' not followed by two hex digits
as invalid.

Change-Id: I812665c1a2806f8daba06d267bbee57287aa2314
2017-03-13 19:17:29 -04:00
Nicolas Williams
5f2e4fb368 kdc: add --testing option for leak testing
The kdc nowadays forks and restarts worker children.  This is nice, but
for leak checking in tests on OS X with leak(1) we really need the
worker to be the one process.
2016-12-06 22:44:23 -06:00
Jeffrey Altman
a1d3ab05c4 kdc: start_kdc avoid warning
The prior structure of the code was safe but can appear otherwise to
static analyzers since the assignment to pids[i] occurs after exitting
the for() loop.

While here use calloc() instead of malloc()/memset().

Change-Id: I8455aa259fd8c7c17778827937ec26127fe0785c
2016-11-19 09:57:14 -05:00
Nicolas Williams
953dc07391 Round #1 of scan-build warnings cleanup 2016-11-15 21:27:20 -06:00
Viktor Dukhovni
529a91d69a MacOS/X fixes 2016-06-09 01:13:14 -04:00
Nicolas Williams
69eb97a92d kdc: num_kdc_procs < 1 -> use NCPUs 2016-02-29 19:13:12 -06:00
Nicolas Williams
1575f4f69a KDC: Don't confuse master process with master 2016-01-21 12:43:31 -06:00
Nicolas Williams
a6e36356b5 KDC: fix C-style 2016-01-21 12:43:30 -06:00
Nicolas Williams
4f87d85d65 Fix Windows build: no fork for kdc 2016-01-20 15:03:30 -06:00
Luke Howard
d135020e8f kdc: Fix compile error on OS X
bonjour_kid() was missing the krb5_context parameter name, preventing
compilation on Darwin (where __APPLE__ is defined)
2015-12-09 10:46:38 +11:00
Roland C. Dowdeswell
352a7e94a3 Make the KDC use a multi-process model.
We now fork(2) a number of separate KDC processes rather than a single
process.  By default, the number is selected by asking how many CPUs
the machine has.  We also have a master process which monitors all
of the children (which do the actual work) and it will restart kids
who die for any reason.  The children will die when the parent dies.

In the case of MacOS X, we also move the bonjour code into another
separate child as it creates threads and this is known to play
rather poorly with fork(2).  We could move this logic into a
designated child at some point in the future.

We slow down the spawning to one every 25ms to prevent instant crashes
and restarts from consuming all available system time.  This approach
may want to be revisited in the future.
2015-11-06 15:39:30 -05:00
Nicolas Williams
b48bed5f42 Daemons detach atomically to avoid having to wait
Tests that start daemons have to "wait" for them to start.

This commit makes Heimdal daemons prep to detach (when requested) by
forking early, then having the child signal readiness to the parent when
the child really is ready.  The parent exits only which the child is
ready.  This means that tests will no longer need to wait for daemons.

However, tests will still need a pidfile or such so they can stop the
daemons.

Note that the --detach options should not be used on OS X from launchd,
only from tests.
2015-03-24 11:49:59 -05:00
Love Hörnquist Åstrand
37afa01be3 rename roken base64, fixes #107 2014-08-22 20:57:24 -07:00
Dana Koch
a95cae113d Fix typo with return values in realloc_descrs.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-11-22 17:24:40 -08:00
Dana Koch
3f71aca591 If multiple accept's happen during a select, make sure it gets stored correctly, and does not clobber an existing open descriptor.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-11-17 14:07:59 -08:00
Love Hörnquist Åstrand
503266c4a3 use json to drive kdc-tester 2011-11-21 20:34:35 -08:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
657297a738 clean the last bits of KRB4 support in KDC 2011-05-07 11:44:15 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
4f11e546b5 comment + indent 2010-06-29 11:38:12 -07:00
Love Hornquist Astrand
a36f3c7d2a if its a multiline query, truncate after the first line 2010-06-29 11:37:44 -07:00
Love Hornquist Astrand
faa1528394 make http transport work again 2010-06-02 08:32:03 -07:00
Love Hornquist Astrand
dde9ae659b drop RCSID 2010-03-16 12:50:09 -07:00
Asanka Herath
0ad290b500 Fix missing #endif 2009-12-01 16:42:28 -05:00
Love Hornquist Astrand
86f4c66efd Merge branch 'master' into wip/win32-port2 2009-11-25 05:41:14 -08:00
Asanka Herath
b191b1e12f Make kdc build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-11-24 22:19:37 -08:00
Love Hornquist Astrand
f1c0c1bba3 prefix SOCKET symbols with rk_ 2009-11-25 05:29:18 +01:00
Asanka Herath
d47c01083b Use SOCKET data type instead of ints for sockets in kdc 2009-11-24 10:18:19 -08:00
Love Hornquist Astrand
6fada85f78 if the UDP packet is truncated, return too packet large 2009-09-16 16:06:11 -07:00
Love Hörnquist Åstrand
ef65ca7a16 free data on write error back on the tcp socket cid#123, make sure we dont write more data back then we got
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24105 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-12-11 05:00:29 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
10df17bf54 Use unsigned where appropriate.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22877 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-07 18:50:56 +00:00
Love Hörnquist Åstrand
9a0cc41169 Update link.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22434 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-01-14 09:21:37 +00:00
Love Hörnquist Åstrand
23ed41b109 Move up krb5_kdc_save_request so we can catch the reply data too.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20958 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-07 04:35:05 +00:00
Love Hörnquist Åstrand
44e3c4e620 Option to save the request to disk.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20950 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-07 03:07:42 +00:00