directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r278642 - /directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/
Date Sun, 04 Sep 2005 23:34:19 GMT
Author: erodriguez
Date: Sun Sep  4 16:34:02 2005
New Revision: 278642

URL: http://svn.apache.org/viewcvs?rev=278642&view=rev
Log:
Logging update to Change Password protocol:
o  Removed numerous System.out statements
o  Added logging in key places
o  Added a new context monitor
o  Enabled the request, context, and reply monitors in the processing chain

Added:
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java
  (with props)
Modified:
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/BuildReply.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordChain.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordExceptionHandler.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ConfigureChangePasswordChain.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetAuthHeader.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetServerEntry.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorReply.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorRequest.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ProcessPasswordChange.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicket.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicketAuthHeader.java

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/BuildReply.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/BuildReply.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/BuildReply.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/BuildReply.java
Sun Sep  4 16:34:02 2005
@@ -18,6 +18,8 @@
 
 import java.net.InetAddress;
 
+import org.apache.changepw.exceptions.ChangePasswordException;
+import org.apache.changepw.exceptions.ErrorType;
 import org.apache.changepw.messages.ChangePasswordReplyModifier;
 import org.apache.kerberos.chain.Context;
 import org.apache.kerberos.chain.impl.CommandBase;
@@ -37,9 +39,14 @@
 import org.apache.kerberos.messages.value.EncryptedData;
 import org.apache.kerberos.messages.value.EncryptionKey;
 import org.apache.kerberos.messages.value.HostAddress;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BuildReply extends CommandBase
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( BuildReply.class );
+
     public boolean execute( Context context ) throws Exception
     {
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
@@ -57,10 +64,6 @@
         modifier.setSenderAddress( new HostAddress( InetAddress.getLocalHost() ) );
         EncKrbPrivPart privPart = modifier.getEncKrbPrivPart();
 
-        System.out.println( "Sender address " + privPart.getSenderAddress() );
-        System.out.println( "Recipient address " + privPart.getRecipientAddress() );
-        System.out.println( "Localhost address " + InetAddress.getLocalHost() );
-
         EncKrbPrivPartEncoder encoder = new EncKrbPrivPartEncoder();
         byte[] encodedPrivPart = encoder.encode( privPart );
 
@@ -76,7 +79,8 @@
         }
         catch ( KerberosException ke )
         {
-            ke.printStackTrace();
+            log.error( ke.getMessage(), ke );
+            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR );
         }
 
         PrivateMessage privateMessage = new PrivateMessage( encPrivPart );
@@ -101,8 +105,10 @@
         }
         catch ( KerberosException ke )
         {
-            ke.printStackTrace();
+            log.error( ke.getMessage(), ke );
+            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR );
         }
+
         ApplicationReply appReply = new ApplicationReply( encRepPart );
 
         // return status message value object
@@ -112,6 +118,6 @@
 
         changepwContext.setReply( replyModifier.getChangePasswordReply() );
 
-        return STOP_CHAIN;
+        return CONTINUE_CHAIN;
     }
 }

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordChain.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordChain.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordChain.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordChain.java
Sun Sep  4 16:34:02 2005
@@ -31,16 +31,30 @@
     public ChangePasswordChain()
     {
         super();
-        log.debug( "Change password processing begun" );
         addCommand( new ChangePasswordExceptionHandler() );
-        //addCommand( new MonitorRequest() );
+
+        if ( log.isDebugEnabled() )
+        {
+            addCommand( new MonitorRequest() );
+        }
+
         addCommand( new ConfigureChangePasswordChain() );
         addCommand( new GetAuthHeader() );
         addCommand( new VerifyServiceTicket() );
         addCommand( new GetServerEntry() );
         addCommand( new VerifyServiceTicketAuthHeader() );
+
+        if ( log.isDebugEnabled() )
+        {
+            addCommand( new MonitorContext() );
+        }
+
         addCommand( new ProcessPasswordChange() );
         addCommand( new BuildReply() );
-        //addCommand( new MonitorReply() );
+
+        if ( log.isDebugEnabled() )
+        {
+            addCommand( new MonitorReply() );
+        }
     }
 }

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordExceptionHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordExceptionHandler.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordExceptionHandler.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordExceptionHandler.java
Sun Sep  4 16:34:02 2005
@@ -21,9 +21,13 @@
 import org.apache.kerberos.exceptions.KerberosException;
 import org.apache.kerberos.messages.ErrorMessage;
 import org.apache.kerberos.service.ErrorMessageHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ChangePasswordExceptionHandler extends ErrorMessageHandler
 {
+    private static final Logger log = LoggerFactory.getLogger( ChangePasswordExceptionHandler.class
);
+
     public boolean execute( Context context ) throws Exception
     {
         return CONTINUE_CHAIN;
@@ -36,11 +40,11 @@
             return CONTINUE_CHAIN;
         }
 
+        log.debug( exception.getMessage() );
+
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
         ChangePasswordConfiguration config = changepwContext.getConfig();
         KerberosException ke = (KerberosException) exception;
-
-        System.out.println( "Exception " + exception.getMessage() + " occurred." );
 
         ErrorMessage errorMessage = getErrorMessage( config.getChangepwPrincipal(), ke );
 

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ConfigureChangePasswordChain.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ConfigureChangePasswordChain.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ConfigureChangePasswordChain.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ConfigureChangePasswordChain.java
Sun Sep  4 16:34:02 2005
@@ -27,8 +27,6 @@
 
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Configuring change password chain." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
 
         changepwContext.setReplayCache( replayCache );

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetAuthHeader.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetAuthHeader.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetAuthHeader.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetAuthHeader.java
Sun Sep  4 16:34:02 2005
@@ -29,8 +29,6 @@
 {
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Extracting authentication header." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
         ChangePasswordRequest request = (ChangePasswordRequest) changepwContext.getRequest();
 

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetServerEntry.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetServerEntry.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetServerEntry.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/GetServerEntry.java
Sun Sep  4 16:34:02 2005
@@ -27,8 +27,6 @@
 {
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Getting server entry." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
 
         KerberosPrincipal principal = changepwContext.getTicket().getServerPrincipal();

Added: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java?rev=278642&view=auto
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java
(added)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java
Sun Sep  4 16:34:02 2005
@@ -0,0 +1,102 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.changepw.service;
+
+import java.net.InetAddress;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import org.apache.kerberos.chain.Context;
+import org.apache.kerberos.chain.impl.CommandBase;
+import org.apache.kerberos.messages.ApplicationRequest;
+import org.apache.kerberos.messages.components.Authenticator;
+import org.apache.kerberos.messages.components.Ticket;
+import org.apache.kerberos.messages.value.HostAddress;
+import org.apache.kerberos.messages.value.HostAddresses;
+import org.apache.kerberos.replay.ReplayCache;
+import org.apache.kerberos.store.PrincipalStore;
+import org.apache.kerberos.store.PrincipalStoreEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MonitorContext extends CommandBase
+{
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( MonitorContext.class );
+
+    public boolean execute( Context context ) throws Exception
+    {
+        if ( log.isDebugEnabled() )
+        {
+            try
+            {
+                ChangePasswordContext changepwContext = (ChangePasswordContext) context;
+
+                PrincipalStore store = changepwContext.getStore();
+                ApplicationRequest authHeader = changepwContext.getAuthHeader();
+                Ticket ticket = changepwContext.getTicket();
+                ReplayCache replayCache = changepwContext.getReplayCache();
+                long clockSkew = changepwContext.getConfig().getClockSkew();
+
+                Authenticator authenticator = changepwContext.getAuthenticator();
+                KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
+
+                InetAddress clientAddress = changepwContext.getClientAddress();
+                HostAddresses clientAddresses = ticket.getClientAddresses();
+
+                boolean caddrContainsSender = false;
+
+                if ( ticket.getClientAddresses() != null )
+                {
+                    caddrContainsSender = ticket.getClientAddresses().contains( new HostAddress(
clientAddress ) );
+                }
+
+                StringBuffer sb = new StringBuffer();
+                sb.append( "Monitoring context:" );
+                sb.append( "\n\t" + "store                  " + store );
+                sb.append( "\n\t" + "authHeader             " + authHeader );
+                sb.append( "\n\t" + "ticket                 " + ticket );
+                sb.append( "\n\t" + "replayCache            " + replayCache );
+                sb.append( "\n\t" + "clockSkew              " + clockSkew );
+                sb.append( "\n\t" + "clientPrincipal        " + clientPrincipal );
+                sb.append( "\n\t" + "clientAddress          " + clientAddress );
+                sb.append( "\n\t" + "clientAddresses        " + clientAddresses );
+                sb.append( "\n\t" + "caddr contains sender  " + caddrContainsSender );
+
+                KerberosPrincipal ticketServerPrincipal = ticket.getServerPrincipal();
+                PrincipalStoreEntry ticketPrincipal = changepwContext.getServerEntry();
+
+                sb.append( "\n\t" + "principal              " + ticketServerPrincipal );
+                sb.append( "\n\t" + "cn                     " + ticketPrincipal.getCommonName()
);
+                sb.append( "\n\t" + "realm                  " + ticketPrincipal.getRealmName()
);
+                sb.append( "\n\t" + "principal              " + ticketPrincipal.getPrincipal()
);
+                sb.append( "\n\t" + "SAM type               " + ticketPrincipal.getSamType()
);
+                sb.append( "\n\t" + "Key type               " + ticketPrincipal.getEncryptionKey().getKeyType()
);
+                sb.append( "\n\t" + "Key version            " + ticketPrincipal.getEncryptionKey().getKeyVersion()
);
+
+                log.debug( sb.toString() );
+            }
+            catch ( Exception e )
+            {
+                // This is a monitor.  No exceptions should bubble up.
+                log.error( "Error in context monitor", e );
+            }
+        }
+
+        return CONTINUE_CHAIN;
+    }
+}

Propchange: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorReply.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorReply.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorReply.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorReply.java
Sun Sep  4 16:34:02 2005
@@ -31,26 +31,28 @@
 
     public boolean execute( Context context ) throws Exception
     {
-        ChangePasswordContext changepwContext = (ChangePasswordContext) context;
-
-        ChangePasswordReply reply = (ChangePasswordReply) changepwContext.getReply();
-        short authHeaderLength = reply.getAuthHeaderLength();
-        short messageLength = reply.getMessageLength();
-        short versionNumber = reply.getVersionNumber();
-        ApplicationReply appReply = reply.getApplicationReply();
-        PrivateMessage priv = reply.getPrivateMessage();
-
         if ( log.isDebugEnabled() )
         {
-            StringBuffer sb = new StringBuffer();
-            sb.append( "Responding to change password request:" );
-            sb.append( "\n\t" + "authHeaderLength " + authHeaderLength );
-            sb.append( "\n\t" + "messageLength    " + messageLength );
-            sb.append( "\n\t" + "versionNumber    " + versionNumber );
-            sb.append( "\n\t" + "appReply         " + appReply );
-            sb.append( "\n\t" + "priv             " + priv );
+            try
+            {
+                ChangePasswordContext changepwContext = (ChangePasswordContext) context;
+
+                ChangePasswordReply reply = (ChangePasswordReply) changepwContext.getReply();
+                ApplicationReply appReply = reply.getApplicationReply();
+                PrivateMessage priv = reply.getPrivateMessage();
+
+                StringBuffer sb = new StringBuffer();
+                sb.append( "Responding with change password reply:" );
+                sb.append( "\n\t" + "appReply               " + appReply );
+                sb.append( "\n\t" + "priv                   " + priv );
 
-            log.debug( sb.toString() );
+                log.debug( sb.toString() );
+            }
+            catch ( Exception e )
+            {
+                // This is a monitor.  No exceptions should bubble up.
+                log.error( "Error in reply monitor", e );
+            }
         }
 
         return CONTINUE_CHAIN;

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorRequest.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorRequest.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorRequest.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/MonitorRequest.java
Sun Sep  4 16:34:02 2005
@@ -19,10 +19,6 @@
 import org.apache.changepw.messages.ChangePasswordRequest;
 import org.apache.kerberos.chain.Context;
 import org.apache.kerberos.chain.impl.CommandBase;
-import org.apache.kerberos.messages.ApplicationRequest;
-import org.apache.kerberos.messages.components.Ticket;
-import org.apache.kerberos.messages.value.EncryptionKey;
-import org.apache.kerberos.replay.ReplayCache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,35 +29,30 @@
 
     public boolean execute( Context context ) throws Exception
     {
-        ChangePasswordContext changepwContext = (ChangePasswordContext) context;
-
-        ChangePasswordRequest request = (ChangePasswordRequest) changepwContext.getRequest();
-        short authHeaderLength = request.getAuthHeaderLength();
-        short messageLength = request.getMessageLength();
-        short versionNumber = request.getVersionNumber();
-
-        ApplicationRequest authHeader = changepwContext.getAuthHeader();
-        Ticket ticket = changepwContext.getTicket();
-        EncryptionKey serverKey = changepwContext.getServerEntry().getEncryptionKey();
-        long clockSkew = changepwContext.getConfig().getClockSkew();
-        ReplayCache replayCache = changepwContext.getReplayCache();
-        String principal = changepwContext.getServerEntry().getPrincipal().getName();
-
         if ( log.isDebugEnabled() )
         {
-            StringBuffer sb = new StringBuffer();
-            sb.append( "Responding to change password request:" );
-            sb.append( "\n\t" + "authHeaderLength " + authHeaderLength );
-            sb.append( "\n\t" + "messageLength    " + messageLength );
-            sb.append( "\n\t" + "versionNumber    " + versionNumber );
-            sb.append( "\n\t" + "authHeader       " + authHeader );
-            sb.append( "\n\t" + "ticket           " + ticket );
-            sb.append( "\n\t" + "principal        " + principal );
-            sb.append( "\n\t" + "serverKey        " + serverKey );
-            sb.append( "\n\t" + "clockSkew        " + clockSkew );
-            sb.append( "\n\t" + "replayCache      " + replayCache );
-
-            log.debug( sb.toString() );
+            try
+            {
+                ChangePasswordContext changepwContext = (ChangePasswordContext) context;
+
+                ChangePasswordRequest request = (ChangePasswordRequest) changepwContext.getRequest();
+                short authHeaderLength = request.getAuthHeaderLength();
+                short messageLength = request.getMessageLength();
+                short versionNumber = request.getVersionNumber();
+
+                StringBuffer sb = new StringBuffer();
+                sb.append( "Responding to change password request:" );
+                sb.append( "\n\t" + "authHeaderLength " + authHeaderLength );
+                sb.append( "\n\t" + "messageLength    " + messageLength );
+                sb.append( "\n\t" + "versionNumber    " + versionNumber );
+
+                log.debug( sb.toString() );
+            }
+            catch ( Exception e )
+            {
+                // This is a monitor.  No exceptions should bubble up.
+                log.error( "Error in request monitor", e );
+            }
         }
 
         return CONTINUE_CHAIN;

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ProcessPasswordChange.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ProcessPasswordChange.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ProcessPasswordChange.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ProcessPasswordChange.java
Sun Sep  4 16:34:02 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.changepw.service;
 
+import java.io.IOException;
+
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
@@ -33,25 +35,24 @@
 import org.apache.kerberos.io.decoder.EncKrbPrivPartDecoder;
 import org.apache.kerberos.messages.components.Authenticator;
 import org.apache.kerberos.messages.components.EncKrbPrivPart;
-import org.apache.kerberos.messages.components.Ticket;
 import org.apache.kerberos.messages.value.EncryptedData;
 import org.apache.kerberos.messages.value.EncryptionKey;
 import org.apache.kerberos.store.PrincipalStore;
 import org.apache.kerberos.store.operations.ChangePassword;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ProcessPasswordChange extends CommandBase
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( ProcessPasswordChange.class
);
+
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Processing password change." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
         ChangePasswordRequest request = (ChangePasswordRequest) changepwContext.getRequest();
         PrincipalStore store = changepwContext.getStore();
         Authenticator authenticator = changepwContext.getAuthenticator();
-        Ticket ticket = changepwContext.getTicket();
-
-        System.out.println( "Ticket principal " + ticket.getServerPrincipal() );
 
         // TODO - check ticket is for service authorized to change passwords
         // ticket.getServerPrincipal().getName().equals(config.getChangepwPrincipal().getName()));
@@ -63,7 +64,9 @@
 
         // getDecryptedData the request's private message with the subsession key
         EncryptedData encReqPrivPart = request.getPrivateMessage().getEncryptedPart();
+
         EncKrbPrivPart privatePart;
+
         try
         {
             EncryptionEngine engine = EncryptionEngineFactory.getEncryptionEngineFor( subSessionKey
);
@@ -75,8 +78,13 @@
         }
         catch ( KerberosException ke )
         {
-            ke.printStackTrace();
-            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_AUTHERROR );
+            log.error( ke.getMessage(), ke );
+            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR );
+        }
+        catch ( IOException ioe )
+        {
+            log.error( ioe.getMessage(), ioe );
+            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR );
         }
 
         ChangePasswordData passwordData = null;
@@ -104,19 +112,16 @@
         KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
         KerberosKey newKey = new KerberosKey( clientPrincipal, password.toCharArray(), "DES"
);
 
-        System.out.println( "Got client principal " + clientPrincipal );
-        System.out.println( "Got client password " + password );
-
         // store password in database
         try
         {
-            String principalName = (String) store.execute( new ChangePassword( clientPrincipal,
-                    newKey ) );
-            System.out.println( "Successfully modified principal " + principalName );
+            String principalName = (String) store.execute( new ChangePassword( clientPrincipal,
newKey ) );
+            log.debug( "Successfully modified principal " + principalName );
         }
         catch ( Exception e )
         {
-            e.printStackTrace();
+            log.error( e.getMessage(), e );
+            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_HARDERROR );
         }
 
         return CONTINUE_CHAIN;

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicket.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicket.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicket.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicket.java
Sun Sep  4 16:34:02 2005
@@ -26,8 +26,6 @@
 {
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Verifying service ticket." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
         ChangePasswordConfiguration config = changepwContext.getConfig();
         Ticket ticket = changepwContext.getTicket();

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicketAuthHeader.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicketAuthHeader.java?rev=278642&r1=278641&r2=278642&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicketAuthHeader.java
(original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/VerifyServiceTicketAuthHeader.java
Sun Sep  4 16:34:02 2005
@@ -30,8 +30,6 @@
 {
     public boolean execute( Context context ) throws Exception
     {
-        System.out.println( "Verifying service ticket's authentication header." );
-
         ChangePasswordContext changepwContext = (ChangePasswordContext) context;
 
         ApplicationRequest authHeader = changepwContext.getAuthHeader();



Mime
View raw message