Avoid side effects in assert expressions

asserts may be compiled out with -DNDEBUG, so it's wrong to use an
assert expression with an important side effect.

(We also have scores of side-effecting asserts in test programs, but
those are less important and can be dealt with separately.)

(back ported from commit 221cd4a23691601a14500bc00146c265b50bdc94)

ticket: 7614 (new)
version_fixed: 1.9.5
status: resolved
PKINIT null pointer deref [CVE-2013-1415]

Don't dereference a null pointer when cleaning up.

The KDC plugin for PKINIT can dereference a null pointer when a
malformed packet causes processing to terminate early, leading to
a crash of the KDC process.  An attacker would need to have a valid
PKINIT certificate or have observed a successful PKINIT authentication,
or an unauthenticated attacker could execute the attack if anonymous
PKINIT is enabled.

CVSSv2 vector: AV:N/AC:M/Au:N/C:N/I:N/A:C/E:P/RL:O/RC:C

This is a minimal commit for pullup; style fixes in a followup.
[kaduk@mit.edu: reformat and edit commit message]

(cherry picked from commit c773d3c775e9b2d88bcdff5f8a8ba88d7ec4e8ed)

ticket: 7619 (new)
version_fixed: 1.9.5
status: resolved
Fix gss_str_to_oid for OIDs with zero-valued arcs

gss_str_to_oid wasn't outputting any bytes for a zero-valued arc.  It
should output one byte with value 0.

[ghudson@mit.edu: commit message]

(cherry picked from commit 54fa4433df7412267375240aba40959e97ac4fe2)

ticket: 7615 (new)
version_fixed: 1.9.5
status: resolved
Fix no_host_referral concatention in KDC

If no_host_referral is set in both [kdcdefaults] and the realm
subsection, we're supposed to concatenate their values.  But the logic
in handle_referral_params would overwrite the value with the
non-concatenated realm value.  Similar bugs of this nature were fixed
in 639c9d0f5a7c68dc98a2a452abc05ca32443cddf (r22037) but this one was
missed.

(cherry picked from commit 6338d039cbd0b138642e3b123ac58dc802d1d907)

ticket: 7616 (new)
version_fixed: 1.9.5
status: resolved
Fix kdb5_util dump.c uninitialized warnings

Some versions of clang report an uninitialized variable warning (which
we treat as an error) in process_k5beta_record.  Due to the if-ladder
style of the function, uninitialized tmpint values can be copied
around in certain error cases, although the garbage values would be
ultimately ignored.  As a minimal fix, initialize the tmpint
variables.

(cherry picked from commit 1b7f7eef8a95bda0135159b2c06a168b56d9f42b)

ticket: 7617 (new)
version_fixed: 1.9.5
status: resolved
Fix initial call to svcraw_create

gssrpc raw services could not work because svcraw_create did not set
svcraw_private after allocating memory for it.

[ghudson@mit.edu: commit message, patch splitting]

(cherry picked from commit 5e3bf4ac6cb02601c5f10c5b2804fd5028c80119)

ticket: 7618 (new)
Fix various result checks

Correct three cases where the wrong expression was checked to see if
an allocation function returned null.

[ghudson@mit.edu: commit message, patch splitting]
[tlyu@mit.edu: omit inapplicable lib/kadm/srv/svr_principal.c change]

(back ported from commit a9ee4a040eeacab1d410ff9e4c862484b531c401)
(cherry picked from commit 2ea07b055f1eb3abbb3a7b7206ab04ff190acf84)

ticket: 7618
version_fixed: 1.9.5
status: resolved