MFH: r372540

Add patches for a couple of issues I found while researching #190055:

 - Use GID_MAX instead of LONG_MAX, they are not the same on 64-bit.
 - Correctly restore the egid after reading the krb5 credential cache.

Approved by:	ports-secteam (rea)