public void messageReceived( IoSession session, Object message )
{
log.debug( "{} RCVD: {}", session.getRemoteAddress(), message );
InetAddress clientAddress = ( ( InetSocketAddress ) session.getRemoteAddress() ).getAddress();
ChangePasswordRequest request = ( ChangePasswordRequest ) message;
try
{
ChangePasswordContext changepwContext = new ChangePasswordContext();
changepwContext.setConfig( server.getConfig() );
changepwContext.setStore( store );
changepwContext.setClientAddress( clientAddress );
changepwContext.setRequest( request );
changepwContext.setReplayCache( server.getReplayCache() );
session.setAttribute( getContextKey(), changepwContext );
ChangePasswordService.execute( session, changepwContext );
session.write( changepwContext.getReply() );
}
catch ( KerberosException ke )
{
if ( log.isDebugEnabled() )
{
log.warn( ke.getLocalizedMessage(), ke );
}
else
{
log.warn( ke.getLocalizedMessage() );
}
KrbError errorMessage = getErrorMessage( server.getConfig().getServicePrincipal(), ke );
session.write( new ChangePasswordError( request.getVersionNumber(), errorMessage ) );
}
catch ( Exception e )
{
log.error( I18n.err( I18n.ERR_152, e.getLocalizedMessage() ), e );
KrbError error = getErrorMessage( server.getConfig().getServicePrincipal(), new ChangePasswordException(
ChangePasswdErrorType.KRB5_KPASSWD_UNKNOWN_ERROR ) );
session.write( new ChangePasswordError( request.getVersionNumber(), error ) );
}
}