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]

ticket: 7523 (new)
target_version: 1.11.1
tags: pullup
Fix a small memory leak in util_errmap

Calls to gssint_mecherrmap_map_errcode would result in calling
mecherror_copy with a zero-length mech OID, which would result in an
OID with 0 for length and malloc(0) for elements.  On platforms which
return non-null from malloc(0), gssint_mecherrmap_destroy() wouldn't
free the elements pointer.

Avoid calling malloc(0) and don't use the length field to decide
whether to free an elements pointer.
Fix gss_str_to_oid and gss_oid_to_str edge cases

Neither function correctly handled OIDs whose second arc exceeds 47
(theoretically possible if the first arc is 2).  gss_str_to_oid had
additional problems: it used scanf, it didn't consistently protect
against read overrun if the input buffer wasn't null-terminated, and
it could get confused by + or - characters in the first two arcs.  Fix
gss_oid_to_str and rewrite gss_str_to_oid.

Also add a test program.

ticket: 7524 (new)
Merge branch 'master' of https://github.com/krb5/krb5
Revert "Tree-based incremental propagation..."

This reverts commit fd2a8ab2f6ed80b463073c2b109a69030c94c2ed.
iprop fixes (patch 1/4)
When a policy change is enacted, a ulog reset is required, otherwise, the
slave servers do not receive a new full dump with the new policy definitions.
Principal updates may be referencing a "new" policy which doesn't exist
and fail.

Fix includes a block size edge condition in ulog_resize (if the ulog
entry size fit exactly in the blocksize, there is no need to resize, but
the existing code would have forced a resize)
iprop fix (part 2/4)
In preparation for another patch, and based on ulog being a circular buffer,
have kproplog loop through the ulog based on the index for the serial number
and assume early entries may be missing. Dereferencing of the ulog should be
consistent with how the KDC dereferences the ulog.

This works with both a ulog where the entry numbers range from m-n where the
number of entries may be smaller than the ulog limit and m need not be 1.
Because the KDC implements dereferencing based on the (sno-1)%size, this is
the correct way.  The current code worked only because the KDC previously
never might have a ulog not at the maximum size with m>1.  My next patch
will allow such.
iprop patch (3/4)
This patch enables a slave to track changes from the master and commit them to
the local ulog.  This facilitates a slave to be promoted as a master and for
other slaves to still sync up because their last ulog state can be found.

In essence, when kpropd processes a ulog entry received via iprop, it will
also commit it to the ulog according to the locally configured ulog history
definitions/size to be maintained.

The first DB update when received from a full dump will be set.  Even though
the first entry is not available as an individual record update, it will be
the baseline for future ulog updates.  The first entry will be updated when
the ulog size reaches its limit, after which it will be based on the circular
ulog buffer.
iprop patch (4/4)
This patch enables a slave to be pointed to a different server for receiving
the iprop updates instead of the defined realm master. This allows a site
to setup a tree based propagation hierarchy in case they want to use regional
servers and protect their WAN links. It also may be used in large environments
where there is a concern about too many slaves interacting with a single
master.