}
private static void processPasswordChange( ChangePasswordContext changepwContext ) throws KerberosException
{
PrincipalStore store = changepwContext.getStore();
Authenticator authenticator = changepwContext.getAuthenticator();
String newPassword = Strings.utf8ToString( changepwContext.getPasswordData().getNewPasswd() );
KerberosPrincipal byPrincipal = KerberosUtils.getKerberosPrincipal(
authenticator.getCName(),
authenticator.getCRealm() );
KerberosPrincipal targetPrincipal = null;
PrincipalName targName = changepwContext.getPasswordData().getTargName();
if ( targName != null )
{
targetPrincipal = new KerberosPrincipal( targName.getNameString(), PrincipalNameType.KRB_NT_PRINCIPAL.getValue() );
}
else
{
targetPrincipal = byPrincipal;
}
// usec and seq-number must be present per MS but aren't in legacy kpasswd
// seq-number must have same value as authenticator
// ignore r-address
store.changePassword( byPrincipal, targetPrincipal, newPassword, changepwContext.getTicket().getEncTicketPart().getFlags().isInitial() );
LOG.debug( "Successfully modified password for {} BY {}.", targetPrincipal, byPrincipal );
}