Fix KDC worker process argument parsing

To create worker processes, the KDC shuts down realms, forks off the
worker processes, then reinitializes realms in each child.
Reinitializing realms requires making a second pass over the
command-line arguments.  To do this with getopt, optind must be
reinitialized to 1 for each pass; otherwise, no options will be seen
the second time around.

ticket: 7945
target_version: 1.12.2
tags: pullup
Add socket-utils.h helpers for ports

Add sa_setport, sa_getport, and sa_is_inet helpers for conveniently
manipulating port numbers on IPv4 and IPv6 socket addresses.
Use sa_setport and sa_getport where appropriate

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.
Add a family-independent bindresvport_sa function

This functions allows you to pass IPv4 and IPv6 addresses.  If no
address is given, t will determine the family by checking the socket
with getsockname.

[ghudson@mit.edu: clarified commit message, split out setport helper,
squashed with next commit, minimized code changes from old
bindresvport, used socket-utils.h helpers]

ticket: 7935 (new)
Use binresvport_sa when creating RPC handles

Make clnttcp_create, clntudp_bufcreate, svctcp_create, and
svcudp_bufcreate work with unbound IPv6 sockets using bindresvport_sa
and other socket helpers.  For caller-supplied sockets, call
getsockname to determine the address family we should attempt to bind.

[ghudson@mit.edu: clarified commit message, minimized code changes,
used socket-utils.h helpers, fixed fallback find on bindresvport
failure, restored getsockaddr call to get port after binding]

ticket: 7935
Fix unlikely null dereference in TGS client code

If krb5_get_tgs_ktypes fails (due to an out-of-memory condition or an
error re-reading the profile), k5_make_tgs_req will dereference a null
pointer.  Check the return value before dereferencing defenctypes.

[ghudson@mit.edu: clarified commit message]

ticket: 7952 (new)
target_version: 1.12.2
tags: pullup
Remove indent workaround in man page RST sources

docutils 0.10 properly adds indentation to example blocks in man
pages, so we do not need to force an extra indentation level.  Get rid
of the workaround wherever we use it.

ticket: 7954 (new)
target_version: 1.12.2
tags: pullup