beepcore-java-commits Mailing List for Java BEEP Core (Page 2)
Status: Beta
Brought to you by:
huston
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(22) |
Aug
(1) |
Sep
|
Oct
(16) |
Nov
(60) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(3) |
Feb
|
Mar
(4) |
Apr
(2) |
May
(13) |
Jun
|
Jul
|
Aug
(10) |
Sep
(34) |
Oct
(27) |
Nov
(2) |
Dec
(2) |
2003 |
Jan
|
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(14) |
Jul
(5) |
Aug
(1) |
Sep
(24) |
Oct
(4) |
Nov
(26) |
Dec
(1) |
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Huston F. <hu...@us...> - 2003-11-07 23:01:15
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv8082/src/org/beepcore/beep/core Modified Files: BEEPException.java SessionImpl.java Log Message: Added exception chaining for exceptions that were being remapped Index: BEEPException.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/BEEPException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** BEEPException.java 7 Sep 2002 15:15:49 -0000 1.5 --- BEEPException.java 7 Nov 2003 23:01:12 -0000 1.6 *************** *** 2,6 **** * BEEPException.java $Revision$ $Date$ * ! * Copyright (c) 2001,2002 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the --- 2,6 ---- * BEEPException.java $Revision$ $Date$ * ! * Copyright (c) 2001-2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the *************** *** 52,55 **** --- 52,70 ---- public BEEPException(Throwable cause) { super(cause == null ? null : cause.toString()); + this.cause = cause; + } + + /** + * Constructs a new <code>BEEPException</code> with the specified + * cause and detailed message. + * + * @param message the detailed message which is saved for later + * retrieval by the <code>getMessage()</code> method. + * + * @param cause the cause which is saved for later retrieval by + * the <code>getCause()</code> method. + */ + public BEEPException(String message, Throwable cause) { + super(message); this.cause = cause; } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** SessionImpl.java 7 Nov 2003 17:39:21 -0000 1.10 --- SessionImpl.java 7 Nov 2003 23:01:12 -0000 1.11 *************** *** 1699,1703 **** } } catch (Exception x) { ! throw new BEEPException(x.getMessage()); } } else { --- 1699,1703 ---- } } catch (Exception x) { ! throw new BEEPException(x); } } else { |
From: Huston F. <hu...@us...> - 2003-11-07 23:01:15
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp In directory sc8-pr-cvs1:/tmp/cvs-serv8082/src/org/beepcore/beep/transport/tcp Modified Files: TCPSession.java TCPSessionCreator.java Log Message: Added exception chaining for exceptions that were being remapped Index: TCPSession.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** TCPSession.java 7 Nov 2003 17:39:21 -0000 1.34 --- TCPSession.java 7 Nov 2003 23:01:11 -0000 1.35 *************** *** 411,415 **** } } catch (IOException x) { ! throw new BEEPException("Unable to send SEQ" + x.getMessage()); } --- 411,415 ---- } } catch (IOException x) { ! throw new BEEPException("Unable to send SEQ", x); } Index: TCPSessionCreator.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSessionCreator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** TCPSessionCreator.java 23 Apr 2003 15:23:04 -0000 1.7 --- TCPSessionCreator.java 7 Nov 2003 23:01:12 -0000 1.8 *************** *** 74,78 **** new ProfileRegistry()); } catch (IOException x) { ! throw new BEEPException(x.getMessage()); } } --- 74,78 ---- new ProfileRegistry()); } catch (IOException x) { ! throw new BEEPException(x); } } *************** *** 99,103 **** registry, servername); } catch (IOException x) { ! throw new BEEPException(x.getMessage()); } } --- 99,103 ---- registry, servername); } catch (IOException x) { ! throw new BEEPException(x); } } *************** *** 235,239 **** listenerSockets.put(Integer.toString(port), socket); } catch (Exception x) { ! throw new BEEPException(x.getMessage()); } } --- 235,239 ---- listenerSockets.put(Integer.toString(port), socket); } catch (Exception x) { ! throw new BEEPException(x); } } *************** *** 245,249 **** return TCPSession.createListener(peer, registry); } catch (Exception e) { ! throw new BEEPException(e.getMessage()); } } --- 245,249 ---- return TCPSession.createListener(peer, registry); } catch (Exception e) { ! throw new BEEPException(e); } } *************** *** 273,277 **** return listen(addr, port, registry); } catch (UnknownHostException x) { ! throw new BEEPException(x.getMessage()); } } --- 273,277 ---- return listen(addr, port, registry); } catch (UnknownHostException x) { ! throw new BEEPException(x); } } |
From: Huston F. <hu...@us...> - 2003-11-07 23:01:15
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8082/src/org/beepcore/beep/lib Modified Files: SharedChannel.java Log Message: Added exception chaining for exceptions that were being remapped Index: SharedChannel.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib/SharedChannel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** SharedChannel.java 10 Jun 2003 18:59:22 -0000 1.11 --- SharedChannel.java 7 Nov 2003 23:01:12 -0000 1.12 *************** *** 146,149 **** --- 146,154 ---- return channel.getSession(); } + + public int getState() + { + return channel.getState(); + } /** |
From: Huston F. <hu...@us...> - 2003-11-07 23:01:14
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/tls In directory sc8-pr-cvs1:/tmp/cvs-serv8082/src/org/beepcore/beep/profile/tls Modified Files: TLSProfile.java Log Message: Added exception chaining for exceptions that were being remapped Index: TLSProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/tls/TLSProfile.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** TLSProfile.java 23 Apr 2003 15:23:06 -0000 1.15 --- TLSProfile.java 7 Nov 2003 23:01:11 -0000 1.16 *************** *** 120,124 **** throw new BEEPException("Provider '" + provider + "' not found."); } catch (Exception e) { ! throw new BEEPException(e.getMessage()); } } --- 120,124 ---- throw new BEEPException("Provider '" + provider + "' not found."); } catch (Exception e) { ! throw new BEEPException(e); } } |
From: Huston F. <hu...@us...> - 2003-11-07 17:39:25
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv11493/src/org/beepcore/beep/core Modified Files: ChannelImpl.java Channel.java SessionImpl.java Log Message: Added getState to the Channel interface. Added better toString() methods for channels and sessions. Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** ChannelImpl.java 15 Sep 2003 15:23:30 -0000 1.9 --- ChannelImpl.java 7 Nov 2003 17:39:21 -0000 1.10 *************** *** 43,56 **** // class variables - public static final int STATE_INITIALIZED = 0; - public static final int STATE_STARTING = 1; - public static final int STATE_ACTIVE = 2; - public static final int STATE_TUNING_PENDING = 3; - public static final int STATE_TUNING = 4; - public static final int STATE_CLOSE_PENDING = 5; - public static final int STATE_CLOSING = 6; - public static final int STATE_CLOSED = 7; - public static final int STATE_ABORTED = 8; - private static final BufferSegment zeroLengthSegment = new BufferSegment(new byte[0]); --- 43,46 ---- *************** *** 130,133 **** --- 120,131 ---- private boolean tuningProfile = false; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return super.toString() + " (#" + getNumberAsString() + " " + + getStateString() + " on " + session.toString() + ")"; + } + ChannelImpl(String profile, String number, RequestHandler handler, boolean tuningReset, SessionImpl session) *************** *** 444,454 **** } ! /** ! * returns the state of the <code>Channel</code> ! * The possible states are (all defined as Channel.STATE_*): ! */ ! int getState() { return state; } --- 442,473 ---- } ! public int getState() { return state; + } + + private String getStateString() { + switch (state) { + case STATE_INITIALIZED: + return "initialized"; + case STATE_STARTING: + return "starting"; + case STATE_ACTIVE: + return "active"; + case STATE_TUNING_PENDING: + return "tuning pending"; + case STATE_TUNING: + return "tuning"; + case STATE_CLOSE_PENDING: + return "close pending"; + case STATE_CLOSING: + return "closing"; + case STATE_CLOSED: + return "closed"; + case STATE_ABORTED: + return "aborted"; + default: + return "unknown"; + } } Index: Channel.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Channel.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** Channel.java 10 Jun 2003 18:59:16 -0000 1.33 --- Channel.java 7 Nov 2003 17:39:21 -0000 1.34 *************** *** 27,30 **** --- 27,40 ---- public interface Channel { + public static final int STATE_INITIALIZED = 0; + public static final int STATE_STARTING = 1; + public static final int STATE_ACTIVE = 2; + public static final int STATE_TUNING_PENDING = 3; + public static final int STATE_TUNING = 4; + public static final int STATE_CLOSE_PENDING = 5; + public static final int STATE_CLOSING = 6; + public static final int STATE_CLOSED = 7; + public static final int STATE_ABORTED = 8; + /** * Closes the channel. *************** *** 104,107 **** --- 114,122 ---- */ public Session getSession(); + + /** + * Returns the state of this channel. + */ + public int getState(); /** Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** SessionImpl.java 15 Sep 2003 15:23:30 -0000 1.9 --- SessionImpl.java 7 Nov 2003 17:39:21 -0000 1.10 *************** *** 625,628 **** --- 625,636 ---- } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return super.toString() + " (" + (isInitiator() ? "I " : "L ") + + getStateString() + ")"; + } + synchronized void changeState(int newState) throws BEEPException { try { *************** *** 1208,1211 **** --- 1216,1244 ---- // Warning: nextChannelNumber is a long to detect overflow return nextChannel; + } + + private String getStateString() { + switch (state) { + case SESSION_STATE_INITIALIZED: + return "initialized"; + case SESSION_STATE_GREETING_SENT: + return "greeting sent"; + case SESSION_STATE_ACTIVE: + return "active"; + case SESSION_STATE_TUNING_PENDING: + return "tuning pending"; + case SESSION_STATE_TUNING: + return "tuning"; + case SESSION_STATE_CLOSE_PENDING: + return "close pending"; + case SESSION_STATE_CLOSING: + return "closing"; + case SESSION_STATE_CLOSED: + return "closed"; + case SESSION_STATE_ABORTED: + return "aborted"; + default: + return "unknown"; + } } |
From: Huston F. <hu...@us...> - 2003-11-07 17:39:25
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp In directory sc8-pr-cvs1:/tmp/cvs-serv11493/src/org/beepcore/beep/transport/tcp Modified Files: TCPSession.java Log Message: Added getState to the Channel interface. Added better toString() methods for channels and sessions. Index: TCPSession.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** TCPSession.java 15 Sep 2003 15:23:31 -0000 1.33 --- TCPSession.java 7 Nov 2003 17:39:21 -0000 1.34 *************** *** 224,227 **** --- 224,236 ---- } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return super.toString() + " (" + + socket.getLocalAddress() + ":" + socket.getLocalPort() + "-" + + socket.getInetAddress() + ":" + socket.getPort() + ")"; + } + // Implementation of method declared in Session protected void disableIO() |
From: Huston F. <hu...@us...> - 2003-11-07 17:38:16
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv11293/src/org/beepcore/beep/core Modified Files: ProfileRegistry.java Log Message: Added missing space for 'features' attribute in start elements Index: ProfileRegistry.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ProfileRegistry.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** ProfileRegistry.java 5 Oct 2002 15:29:10 -0000 1.13 --- ProfileRegistry.java 7 Nov 2003 17:38:11 -0000 1.14 *************** *** 246,256 **** sb.append(" localize='"); sb.append(localize); ! sb.append("' "); } if (features != null) { ! sb.append("features='"); sb.append(features); ! sb.append("' "); } --- 246,256 ---- sb.append(" localize='"); sb.append(localize); ! sb.append('\''); } if (features != null) { ! sb.append(" features='"); sb.append(features); ! sb.append('\''); } |
From: Huston F. <hu...@us...> - 2003-11-04 06:06:08
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28651/src/org/beepcore/beep/lib Modified Files: Reply.java Log Message: Applied fix from Lawrence Index: Reply.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib/Reply.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Reply.java 23 Apr 2003 15:23:02 -0000 1.7 --- Reply.java 4 Nov 2003 06:06:05 -0000 1.8 *************** *** 110,132 **** synchronized public boolean hasNext() throws BEEPInterruptedException { - if (this.replies.size() != 0) { - return true; - } - - if (this.complete) { - return false; - } - try { ! this.wait(); } catch (InterruptedException x) { throw new BEEPInterruptedException(x.getMessage()); } ! if (complete) { ! return false; ! } ! ! return true; } --- 110,122 ---- synchronized public boolean hasNext() throws BEEPInterruptedException { try { ! while (replies.size() == 0 && complete == false) { ! this.wait(); ! } } catch (InterruptedException x) { throw new BEEPInterruptedException(x.getMessage()); } ! return replies.size() > 0; } |
From: Huston F. <hu...@us...> - 2003-10-30 14:33:01
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp In directory sc8-pr-cvs1:/tmp/cvs-serv598/src/org/beepcore/beep/profile/sasl/otp Modified Files: SASLOTPProfile.java Log Message: Cleanup Index: SASLOTPProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** SASLOTPProfile.java 15 Sep 2003 15:23:31 -0000 1.13 --- SASLOTPProfile.java 30 Oct 2003 14:32:57 -0000 1.14 *************** *** 317,332 **** synchronized (auth) { auth.wait(); - - SessionCredential cred = session.getLocalCredential(); - - if (cred == null) { - auth.abort("Authentication Failed"); - } else { - success = true; - } } } catch (Exception x) { auth.abort(x.getMessage()); } return session; } --- 317,333 ---- synchronized (auth) { auth.wait(); } } catch (Exception x) { auth.abort(x.getMessage()); } + + SessionCredential cred = session.getLocalCredential(); + + if (cred == null) { + auth.abort("Authentication Failed"); + } else { + success = true; + } + return session; } |
From: Huston F. <hu...@us...> - 2003-10-30 14:30:51
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse In directory sc8-pr-cvs1:/tmp/cvs-serv32616/tls/org/beepcore/beep/profile/tls/jsse Modified Files: TLSProfileJSSE.java Log Message: Added import for 1.2 Index: TLSProfileJSSE.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse/TLSProfileJSSE.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** TLSProfileJSSE.java 15 Sep 2003 15:23:32 -0000 1.9 --- TLSProfileJSSE.java 30 Oct 2003 14:30:45 -0000 1.10 *************** *** 27,30 **** --- 27,32 ---- import org.beepcore.beep.transport.tcp.*; + import com.sun.net.ssl.*; + import javax.net.ssl.*; |
From: Huston F. <hu...@us...> - 2003-10-30 14:29:59
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl In directory sc8-pr-cvs1:/tmp/cvs-serv32397/src/org/beepcore/beep/profile/sasl Modified Files: Blob.java Log Message: Added todo Index: Blob.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/Blob.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Blob.java 23 Apr 2003 15:23:02 -0000 1.8 --- Blob.java 30 Oct 2003 14:29:55 -0000 1.9 *************** *** 293,297 **** String statusString = extractStatusFromBlob(blob); this.status = STATUS_NONE; ! if (statusString != null) { for (int i=0; i<STATUS_LIMIT; i++) { if (statusMappings[i].equals(statusString)) { --- 293,297 ---- String statusString = extractStatusFromBlob(blob); this.status = STATUS_NONE; ! if (statusString != null) { /// @TODO && statusString.equals("") == false for (int i=0; i<STATUS_LIMIT; i++) { if (statusMappings[i].equals(statusString)) { |
From: Huston F. <hu...@us...> - 2003-10-30 14:29:18
|
Update of /cvsroot/beepcore-java/beepcore-java In directory sc8-pr-cvs1:/tmp/cvs-serv32270 Modified Files: TODO Log Message: Removed completed items Index: TODO =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** TODO 2 Apr 2001 22:32:34 -0000 1.2 --- TODO 30 Oct 2003 14:29:14 -0000 1.3 *************** *** 1,8 **** - Make startChannel asynchronous and remove timeout - Make session initiate asynchronous - - Support hostname on channel start - Remove closeChannel from StartChannelListener - - Map piggybacked request into regular message exchanges - Create a sample reliablity/checksum/signature module - - Add threading for Listeners - Add method to ReplyListener to call with updates to MessageStatus --- 1,5 ---- |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:37
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls In directory sc8-pr-cvs1:/tmp/cvs-serv21224/tls/org/beepcore/beep/profile/tls/ptls Modified Files: TLSProfilePureTLS.java Log Message: Merge from PIGGYBACK branch Index: TLSProfilePureTLS.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls/TLSProfilePureTLS.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** TLSProfilePureTLS.java 3 Jun 2003 02:50:53 -0000 1.7 --- TLSProfilePureTLS.java 15 Sep 2003 15:23:32 -0000 1.8 *************** *** 3,7 **** * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. ! * Copyright (c) 2001 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the --- 3,7 ---- * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. ! * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the *************** *** 36,40 **** --- 36,42 ---- import COM.claymoresystems.cert.*; + import java.io.BufferedReader; import java.io.IOException; + import java.io.InputStreamReader; *************** *** 62,66 **** */ public class TLSProfilePureTLS extends TuningProfile ! implements StartChannelListener { --- 64,68 ---- */ public class TLSProfilePureTLS extends TuningProfile ! implements StartChannelListener, RequestHandler { *************** *** 374,397 **** throws StartChannelException { ! TCPSession oldSession = (TCPSession) channel.getSession(); ! // if the data is <ready/> then respond with <proceed/> ! if (data != null) { ! // If data is a ready, prepare a message of proceed to ! // send to the begin call ! if (data.equals(READY1) || data.equals(READY2)) { ! data = PROCEED2; ! } } ! // Freeze this Peer ! // SSLDebug.setDebug( SSLDebug.DEBUG_ALL ); SSLSocket newSocket = null; SessionCredential peerCred = null; try { - // Send a profile back with dat "<proceed />" - this.begin(channel, URI, data); - // negotiate TLS over a new socket context.setPolicy(policy); --- 376,421 ---- throws StartChannelException { ! channel.setRequestHandler(this, true); ! } ! ! /// @TODO Fix error handling in this method ! public void receiveMSG(MessageMSG msg) ! { ! Channel channel = msg.getChannel(); ! InputDataStreamAdapter is = msg.getDataStream().getInputStream(); ! BufferedReader reader = new BufferedReader(new InputStreamReader(is)); ! ! String data; ! ! try { ! try { ! data = reader.readLine(); ! } catch (IOException e) { ! msg.sendERR(BEEPError.CODE_PARAMETER_ERROR, ! "Error reading data"); ! return; ! } ! ! if (data.equals(READY1) == false && data.equals(READY2) == false) { ! msg.sendERR(BEEPError.CODE_PARAMETER_INVALID, ! "Expected READY element"); } ! this.begin(channel); ! ! msg.sendRPY(new StringOutputDataStream(PROCEED2)); ! } catch (BEEPException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate("unable to send ERR"); ! return; ! } ! ! TCPSession oldSession = (TCPSession) channel.getSession(); ! SSLSocket newSocket = null; SessionCredential peerCred = null; try { // negotiate TLS over a new socket context.setPolicy(policy); *************** *** 403,432 **** oldSocket.getInetAddress().getHostName(), oldSocket.getPort(), SSLSocket.SERVER); - } catch (BEEPException e) { - log.error(e.getMessage()); - e.printStackTrace(); - oldSession.terminate(e.getMessage()); } catch (SSLThrewAlertException e) { ! log.error(e.getMessage()); ! e.printStackTrace(); ! oldSession.terminate(e.getMessage()); } catch (IOException e) { ! log.error(e.getMessage()); ! e.printStackTrace(); ! oldSession.terminate(e.getMessage()); } try { - // get the credentials of the peer - Vector cc = null; - if (needPeerAuth) { cc = newSocket.getCertificateChain(); if (cc == null) { log.trace("No certificate chain when there should be one."); ! throw new StartChannelException(550, "No certificate " + ! "chain when there " + "should be one. "); } Enumeration enum = cc.elements(); while (enum.hasMoreElements()) { --- 427,455 ---- oldSocket.getInetAddress().getHostName(), oldSocket.getPort(), SSLSocket.SERVER); } catch (SSLThrewAlertException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; } catch (IOException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; } + // get the credentials of the peer + Vector cc = null; + int cs; + try { if (needPeerAuth) { cc = newSocket.getCertificateChain(); if (cc == null) { log.trace("No certificate chain when there should be one."); ! msg.sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, ! "No certificate chain when there " + "should be one. "); + return; } + Enumeration enum = cc.elements(); while (enum.hasMoreElements()) { *************** *** 442,447 **** } ! int cs = newSocket.getCipherSuite(); // verify that this is authenticated and authorized if (handshakeListener != null) { --- 465,480 ---- } ! cs = newSocket.getCipherSuite(); ! } catch (BEEPException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate("unable to send ERR"); ! return; ! } catch (IOException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; ! } + try { // verify that this is authenticated and authorized if (handshakeListener != null) { *************** *** 450,500 **** handshakeListener.handshakeCompleted(oldSession, cc, cs); } ! // create the peer credential ! Hashtable ht = new Hashtable(); ! ! ht.put(SessionCredential.AUTHENTICATOR, URI); ! ht.put(SessionCredential.ALGORITHM, ! SSLPolicyInt.getCipherSuiteName(cs)); ! ht.put(SessionCredential.AUTHENTICATOR_TYPE, "TLS"); ! ! if (cc != null) { ! ht.put(SessionCredential.REMOTE_CERTIFICATE, cc.elementAt(0)); ! } ! ! peerCred = new SessionCredential(ht); ! // Consider the Profile Registry ! ProfileRegistry preg = oldSession.getProfileRegistry(); ! preg.removeStartChannelListener(URI); ! if (abortSession) { ! this.abort(new BEEPError(451, ERR_TLS_NO_AUTHENTICATION), ! channel); ! } else { ! // Cause the session to be recreated and reset ! Hashtable hash = new Hashtable(); ! hash.put(SessionTuningProperties.ENCRYPTION, "true"); ! SessionTuningProperties tuning = ! new SessionTuningProperties(hash); ! this.complete(channel, generateCredential(), peerCred, ! tuning, preg, newSocket); ! } ! } catch (Exception x) { ! // @todo should be more detailed ! log.error(x.getMessage()); ! x.printStackTrace(); ! throw new StartChannelException(450, x.getMessage()); } - - throw new TuningResetException(URI); } /** --- 483,530 ---- handshakeListener.handshakeCompleted(oldSession, cc, cs); } + } catch (BEEPException e) { + log.error("BEEP Handshake error", e); + channel.getSession().terminate("BEEP Handshake error"); + return; + } ! // create the peer credential ! Hashtable ht = new Hashtable(); ! ht.put(SessionCredential.AUTHENTICATOR, URI); ! ht.put(SessionCredential.ALGORITHM, ! SSLPolicyInt.getCipherSuiteName(cs)); ! ht.put(SessionCredential.AUTHENTICATOR_TYPE, "TLS"); ! if (cc != null) { ! ht.put(SessionCredential.REMOTE_CERTIFICATE, cc.elementAt(0)); ! } ! peerCred = new SessionCredential(ht); ! // Cause the session to be recreated and reset ! Hashtable hash = new Hashtable(); ! hash.put(SessionTuningProperties.ENCRYPTION, "true"); ! SessionTuningProperties tuning = ! new SessionTuningProperties(hash); ! // Consider the Profile Registry ! ProfileRegistry preg = oldSession.getProfileRegistry(); ! preg.removeStartChannelListener(URI); ! try { ! this.complete(channel, generateCredential(), peerCred, ! tuning, preg, newSocket); ! } catch (BEEPException x) { ! BEEPError error = ! new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, ! ERR_TLS_NO_AUTHENTICATION); ! abort(error, channel); } } + /** *************** *** 584,591 **** } catch (SSLThrewAlertException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e.getMessage()); } catch (IOException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e.getMessage()); } --- 614,621 ---- } catch (SSLThrewAlertException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e); } catch (IOException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e); } |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:37
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse In directory sc8-pr-cvs1:/tmp/cvs-serv21224/tls/org/beepcore/beep/profile/tls/jsse Modified Files: TLSProfileJSSE.java Log Message: Merge from PIGGYBACK branch Index: TLSProfileJSSE.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse/TLSProfileJSSE.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** TLSProfileJSSE.java 3 Jun 2003 02:43:43 -0000 1.8 --- TLSProfileJSSE.java 15 Sep 2003 15:23:32 -0000 1.9 *************** *** 33,37 **** --- 33,40 ---- import java.security.KeyStore; + import java.io.BufferedReader; import java.io.FileInputStream; + import java.io.InputStreamReader; + import java.io.IOException; import org.apache.commons.logging.Log; *************** *** 52,56 **** */ public class TLSProfileJSSE extends TLSProfile ! implements Profile, StartChannelListener { // Constants --- 55,59 ---- */ public class TLSProfileJSSE extends TLSProfile ! implements Profile, StartChannelListener, RequestHandler { // Constants *************** *** 178,181 **** --- 181,255 ---- } + class BeepListenerHCL implements HandshakeCompletedListener { + + Channel channel; + boolean notifiedHandshake = false; + boolean waitingForHandshake = false; + + BeepListenerHCL(Channel tuningChannel) + { + this.channel = tuningChannel; + } + + public void handshakeCompleted(HandshakeCompletedEvent event) + { + Session oldSession = channel.getSession(); + + log.debug("HandshakeCompleted"); + synchronized (handshakeListeners) { + Iterator i = TLSProfileJSSE.handshakeListeners.iterator(); + + while (i.hasNext()) { + TLSProfileJSSEHandshakeCompletedListener l = + (TLSProfileJSSEHandshakeCompletedListener) i.next(); + + if (l.handshakeCompleted(oldSession, event) == false) { + BEEPError e = + new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, + ERR_TLS_NO_AUTHENTICATION); + TLSProfileJSSE.this.abort(e, channel); + + return; + } + } + } + + Hashtable h = new Hashtable(); + + try { + h.put(SessionCredential.AUTHENTICATOR, + event.getPeerCertificateChain()[0].getSubjectDN().getName()); + h.put(SessionCredential.REMOTE_CERTIFICATE, + event.getPeerCertificateChain()); + } catch (SSLPeerUnverifiedException e) { + h.put(SessionCredential.AUTHENTICATOR, ""); + h.put(SessionCredential.REMOTE_CERTIFICATE, ""); + } + + ProfileRegistry preg = oldSession.getProfileRegistry(); + + preg.removeStartChannelListener(uri); + + Hashtable hash = new Hashtable(); + + hash.put(SessionTuningProperties.ENCRYPTION, "true"); + + SessionTuningProperties tuning = + new SessionTuningProperties(hash); + + // Cause the session to be recreated and reset + try { + TLSProfileJSSE.this.complete(channel, generateCredential(), + new SessionCredential(h), tuning, + preg, event.getSocket()); + } catch (BEEPException e) { + BEEPError error = + new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, + ERR_TLS_NO_AUTHENTICATION); + TLSProfileJSSE.this.abort(error, channel); + } + } + } + /** * TLS provides encryption and optionally authentication for a session *************** *** 459,481 **** throws StartChannelException { ! try { ! TCPSession oldSession = (TCPSession) channel.getSession(); ! // if the data is <ready/> then respond with <proceed/> ! if (data != null) { ! // If data is a ready, prepare a message of proceed to ! // send to the begin call ! if (data.equals(READY1) || data.equals(READY2)) { ! data = PROCEED2; ! } } ! // Freeze this Peer ! // Send a profile back with data in the 3rd argument ! this.begin(channel, uri, data); ! // Negotiate TLS with the Socket ! Socket oldSocket = oldSession.getSocket(); SSLSocket newSocket = (SSLSocket) socketFactory.createSocket(oldSocket, --- 533,574 ---- throws StartChannelException { ! channel.setRequestHandler(this, true); ! } ! public void receiveMSG(MessageMSG msg) ! { ! Channel channel = msg.getChannel(); ! InputDataStreamAdapter is = msg.getDataStream().getInputStream(); ! ! BufferedReader reader = new BufferedReader(new InputStreamReader(is)); ! ! String data; ! ! try { ! try { ! data = reader.readLine(); ! } catch (IOException e) { ! msg.sendERR(BEEPError.CODE_PARAMETER_ERROR, ! "Error reading data"); ! return; ! } ! ! if (data.equals(READY1) == false && data.equals(READY2) == false) { ! msg.sendERR(BEEPError.CODE_PARAMETER_INVALID, ! "Expected READY element"); } ! this.begin(channel); ! ! msg.sendRPY(new StringOutputDataStream(PROCEED2)); ! } catch (BEEPException e1) { ! channel.getSession().terminate("unable to send ERR"); ! return; ! } ! try { ! Socket oldSocket = ((TCPSession) channel.getSession()).getSocket(); ! /** @TODO add support for serverName */ SSLSocket newSocket = (SSLSocket) socketFactory.createSocket(oldSocket, *************** *** 483,487 **** oldSocket.getPort(), true); ! TLSHandshake l = new TLSHandshake(); newSocket.addHandshakeCompletedListener(l); --- 576,581 ---- oldSocket.getPort(), true); ! ! BeepListenerHCL l = new BeepListenerHCL(channel); newSocket.addHandshakeCompletedListener(l); *************** *** 490,538 **** newSocket.setEnabledCipherSuites(newSocket.getSupportedCipherSuites()); - l.session = channel.getSession(); - newSocket.startHandshake(); ! ! synchronized (l) { ! if (!l.notifiedHandshake) { ! l.waitingForHandshake = true; ! ! l.wait(); ! ! l.waitingForHandshake = false; ! } ! } ! ! // Consider the Profile Registry ! ProfileRegistry preg = oldSession.getProfileRegistry(); ! ! preg.removeStartChannelListener(uri); ! ! if (abortSession) { ! this.abort(new BEEPError(451, ERR_TLS_NO_AUTHENTICATION), ! channel); ! } else { ! Hashtable hash = new Hashtable(); ! ! hash.put(SessionTuningProperties.ENCRYPTION, "true"); ! ! SessionTuningProperties tuning = ! new SessionTuningProperties(hash); ! ! // Cause the session to be recreated and reset ! this.complete(channel, generateCredential(), l.cred, tuning, ! preg, newSocket); ! } ! } catch (Exception x) { ! ! // @todo should be more detailed ! log.error(x.getMessage()); ! ! throw new StartChannelException(450, x.getMessage()); } - - throw new TuningResetException(uri); } ! /** * Called when the underlying BEEP framework receives --- 584,594 ---- newSocket.setEnabledCipherSuites(newSocket.getSupportedCipherSuites()); newSocket.startHandshake(); ! } catch (IOException e) { ! channel.getSession().terminate("TLS error: " + e.getMessage()); ! return; } } ! /** * Called when the underlying BEEP framework receives |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:37
|
Update of /cvsroot/beepcore-java/beepcore-java In directory sc8-pr-cvs1:/tmp/cvs-serv21224 Added Files: .classpath .project Log Message: Merge from PIGGYBACK branch |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:37
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp In directory sc8-pr-cvs1:/tmp/cvs-serv21224/src/org/beepcore/beep/transport/tcp Modified Files: TCPSession.java Log Message: Merge from PIGGYBACK branch Index: TCPSession.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** TCPSession.java 3 Jun 2003 02:41:23 -0000 1.32 --- TCPSession.java 15 Sep 2003 15:23:31 -0000 1.33 *************** *** 220,223 **** --- 220,224 ---- socket = null; + running = false; } } *************** *** 410,413 **** --- 411,419 ---- { running = true; + + if (socket == null) { + running = false; + return; + } try { |
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv21224/src/org/beepcore/beep/core Modified Files: ChannelImpl.java SessionImpl.java TuningProfile.java TuningResetException.java Added Files: PiggybackedMSG.java Log Message: Merge from PIGGYBACK branch Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** ChannelImpl.java 13 Sep 2003 21:10:31 -0000 1.8 --- ChannelImpl.java 15 Sep 2003 15:23:30 -0000 1.9 *************** *** 419,422 **** --- 419,438 ---- } + void abort() + { + setState(ChannelImpl.STATE_ABORTED); + } + + void addPiggybackedMSG(PiggybackedMSG msg) throws BEEPException + { + recvMSGQueue.add(msg); + try { + callbackQueue.execute(this); + } catch (InterruptedException e) { + /** @TODO handle this better */ + throw new BEEPException(e); + } + } + /** * get the number of this <code>Channel</code> as a <code>String</code> Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** SessionImpl.java 10 Jun 2003 18:59:19 -0000 1.8 --- SessionImpl.java 15 Sep 2003 15:23:30 -0000 1.9 *************** *** 21,24 **** --- 21,25 ---- import java.io.IOException; + import java.io.UnsupportedEncodingException; import java.util.Hashtable; *************** *** 38,41 **** --- 39,44 ---- import org.xml.sax.SAXException; + import sun.misc.BASE64Decoder; + import org.beepcore.beep.core.event.ChannelEvent; import org.beepcore.beep.core.event.ChannelListener; *************** *** 86,90 **** /** @todo check this */ ! private static final int MAX_PCDATA_SIZE = 4096; private static final int MAX_START_CHANNEL_WAIT = 60000; private static final int MAX_START_CHANNEL_INTERVAL = 100; --- 89,93 ---- /** @todo check this */ ! static final int MAX_PCDATA_SIZE = 4096; private static final int MAX_START_CHANNEL_WAIT = 60000; private static final int MAX_START_CHANNEL_INTERVAL = 100; *************** *** 960,964 **** // Store the Channel - ch.setState(ChannelImpl.STATE_ACTIVE); channels.put(ch.getNumberAsString(), ch); ((MessageMSG)zero.getAppData()).sendRPY(ds); --- 963,966 ---- *************** *** 977,981 **** } ! private void fireChannelStarted(Channel c) { ChannelListener[] l = this.channelListeners; --- 979,983 ---- } ! void fireChannelStarted(Channel c) { ChannelListener[] l = this.channelListeners; *************** *** 1244,1247 **** --- 1246,1251 ---- return; } catch (StartChannelException e) { + this.enableIO(); + try { ((MessageMSG)zero.getAppData()).sendERR(e); *************** *** 1253,1268 **** } ! try { ! sendProfile(p.uri, ch.getStartData(), ch); ! } catch (BEEPException e) { ! terminate("Error sending profile. " + e.getMessage()); ! return; ! } ! fireChannelStarted(ch); ! if (p.data == null || ch.getState() != ChannelImpl.STATE_TUNING) { ! this.enableIO(); } --- 1257,1307 ---- } ! if (p.data != null && ch.getStartData() == null) { ! byte[] data; ! if (p.base64Encoding) { ! try { ! data = new BASE64Decoder().decodeBuffer(p.data); ! } catch (IOException e) { ! ch.abort(); ! this.enableIO(); ! throw new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, ! "Error parsing piggybacked data."); ! } ! } else { ! try { ! data = p.data.getBytes("UTF-8"); ! } catch (UnsupportedEncodingException e) { ! terminate("UTF-8 not supported"); ! return; ! } ! } ! ! PiggybackedMSG msg = new PiggybackedMSG(ch, data, ! p.base64Encoding); ! ch.setState(ChannelImpl.STATE_STARTING); ! ! try { ! ch.addPiggybackedMSG(msg); ! } catch (BEEPException e) { ! terminate("Error sending profile. " + e.getMessage()); ! return; ! } ! } else { ! try { ! sendProfile(p.uri, ch.getStartData(), ch); ! ch.setState(ChannelImpl.STATE_ACTIVE); ! } catch (BEEPException e) { ! terminate("Error sending profile. " + e.getMessage()); ! return; ! } ! ! fireChannelStarted(ch); ! ! if (p.data == null && ch.getState() != ChannelImpl.STATE_TUNING) { ! this.enableIO(); ! } } *************** *** 1270,1273 **** --- 1309,1314 ---- } + this.enableIO(); + try { ((MessageMSG)zero.getAppData()).sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, "all requested profiles are unsupported"); *************** *** 1917,1922 **** static class CLOSED_SessionOperations implements SessionOperations { public void changeState(SessionImpl s, int newState) throws BEEPException { ! throw new BEEPException("Illegal session state transition (" + ! newState + ")"); } --- 1958,1967 ---- static class CLOSED_SessionOperations implements SessionOperations { public void changeState(SessionImpl s, int newState) throws BEEPException { ! if (newState == Session.SESSION_STATE_ABORTED) { ! log.equals("Error aborting, session already in a closed state."); ! } else { ! throw new BEEPException("Illegal session state transition (" + ! newState + ")"); ! } } Index: TuningProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningProfile.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** TuningProfile.java 27 May 2003 21:37:41 -0000 1.10 --- TuningProfile.java 15 Sep 2003 15:23:30 -0000 1.11 *************** *** 75,79 **** * */ ! public void abort(BEEPError error, Channel channel) throws BEEPException { tuningChannels.remove(channel); --- 75,79 ---- * */ ! public void abort(BEEPError error, Channel channel) { tuningChannels.remove(channel); *************** *** 107,110 **** --- 107,111 ---- ((ChannelImpl)channel).setState(ChannelImpl.STATE_TUNING); session.sendProfile(profile, data, (ChannelImpl)channel); + ((ChannelImpl)channel).setState(ChannelImpl.STATE_ACTIVE); session.disableIO(); } catch (Exception x) { *************** *** 120,123 **** --- 121,133 ---- } } + + protected void begin(Channel channel) + { + log.debug("TuningProfile.begin"); + + SessionImpl session = (SessionImpl)channel.getSession(); + + ((ChannelImpl)channel).setState(ChannelImpl.STATE_TUNING); + } /** *************** *** 134,142 **** */ public void complete(Channel channel, ! SessionCredential localCred, ! SessionCredential peerCred, ! SessionTuningProperties tuning, ! ProfileRegistry registry, ! Object argument) throws BEEPException { --- 144,152 ---- */ public void complete(Channel channel, ! SessionCredential localCred, ! SessionCredential peerCred, ! SessionTuningProperties tuning, ! ProfileRegistry registry, ! Object argument) throws BEEPException { *************** *** 248,251 **** --- 258,262 ---- { ((SessionImpl)session).sendProfile(uri, data, (ChannelImpl)channel); + ((ChannelImpl)channel).setState(ChannelImpl.STATE_ACTIVE); } Index: TuningResetException.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningResetException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** TuningResetException.java 10 Jun 2003 18:59:20 -0000 1.3 --- TuningResetException.java 15 Sep 2003 15:23:30 -0000 1.4 *************** *** 1,3 **** - /* * TuningResetException.java $Revision$ $Date$ --- 1,2 ---- *************** *** 38,41 **** --- 37,41 ---- * * @TODO remove this class + * @deprecated */ public TuningResetException(String message) |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:35
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp In directory sc8-pr-cvs1:/tmp/cvs-serv21224/src/org/beepcore/beep/profile/sasl/otp Modified Files: SASLOTPProfile.java Log Message: Merge from PIGGYBACK branch Index: SASLOTPProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** SASLOTPProfile.java 14 Sep 2003 04:29:50 -0000 1.12 --- SASLOTPProfile.java 15 Sep 2003 15:23:31 -0000 1.13 *************** *** 116,120 **** return userDatabase; } ! static Algorithm getAlgorithm(String name) { --- 116,121 ---- return userDatabase; } ! ! /// @TODO change this to be not static or add a static initializer for algoriths static Algorithm getAlgorithm(String name) { *************** *** 131,190 **** throws StartChannelException { - Blob blob = null; - clearCredential(channel.getSession(), this); - - String authorize, authenticate, challenge = null; - log.debug("SASL-OTP Start Channel CCL"); ! OTPAuthenticator temp = new OTPAuthenticator(this); try { - - // Digest the data - // and generate a response (challenge) if possible - // to embed in the profile back. - if (data != null) { - temp.started(channel); - blob = new Blob(data); - data = blob.getData(); - - try { - blob = temp.receiveIDs(data); - if (log.isDebugEnabled()) { - log.debug("Challenge is=>" + challenge); - } - } catch (SASLException szf) { - temp.abortNoThrow(szf.getMessage()); - // Write an error out in the profile - blob = new Blob(Blob.STATUS_ABORT, - szf.getMessage()); - return; - } - if (log.isDebugEnabled()) { - log.debug("Blobbed64 Challenge is=>" + data); - } - } channel.setRequestHandler(temp); ! if(blob != null) ! sendProfile(channel.getSession(), URI, blob.toString(), ! channel); ! else ! sendProfile(channel.getSession(), URI, null, channel); ! ! // If we processed piggybacked data then blob will be non-null ! // otherwise, we need to 'start' the OTPAuthenticator so that ! // the state transitions remain valid ! if (blob == null) { ! temp.started(channel); ! } ! ! log.debug("Started an SASL-OTP Channel"); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; } ! enableIO(channel.getSession()); ! throw new TuningResetException("SASL ANON RESET"); } --- 132,148 ---- throws StartChannelException { log.debug("SASL-OTP Start Channel CCL"); ! clearCredential(channel.getSession(), this); + OTPAuthenticator temp = new OTPAuthenticator(this); try { channel.setRequestHandler(temp); ! temp.started(channel); ! } catch (SASLException x) { ! throw new StartChannelException(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN, ! x.getMessage()); } ! log.debug("Started an SASL-OTP Channel"); } |
From: Huston F. <hu...@us...> - 2003-09-15 15:23:34
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous In directory sc8-pr-cvs1:/tmp/cvs-serv21224/src/org/beepcore/beep/profile/sasl/anonymous Modified Files: SASLAnonymousProfile.java Log Message: Merge from PIGGYBACK branch Index: SASLAnonymousProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/SASLAnonymousProfile.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** SASLAnonymousProfile.java 14 Sep 2003 04:30:15 -0000 1.11 --- SASLAnonymousProfile.java 15 Sep 2003 15:23:31 -0000 1.12 *************** *** 104,145 **** Session t = channel.getSession(); ! if(data != null) ! { ! try { ! Blob blob = new Blob(data); ! data = blob.getData(); ! ! if (log.isDebugEnabled()) { ! log.debug("SASLAnon...User claims to be=>" + data); ! } ! finishListenerAuthentication(SASLAnonymousProfile.generateCredential(data), ! t); ! ! // Generate a blob indicating that we're done and ! // return it in the profile response to the StartChannel request ! data = null; ! blob = new Blob(Blob.STATUS_COMPLETE,data); ! sendProfile(t, uri, blob.toString(), channel); ! enableIO(channel.getSession()); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; ! } ! // Skip standard start channel handling ! throw new TuningResetException("SASL ANON RESET"); ! } ! else ! { ! try { ! AnonymousAuthenticator auth = new AnonymousAuthenticator(this); ! auth.started(channel); ! sendProfile(t, uri, null, channel); ! enableIO(channel.getSession()); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; ! } ! // Skip standard start channel handling ! throw new TuningResetException("SASL ANON RESET"); } } --- 104,113 ---- Session t = channel.getSession(); ! try { ! AnonymousAuthenticator auth = new AnonymousAuthenticator(this); ! auth.started(channel); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; } } |
From: Huston F. <hu...@us...> - 2003-09-15 14:01:35
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp In directory sc8-pr-cvs1:/tmp/cvs-serv2580/src/org/beepcore/beep/profile/sasl/otp Modified Files: Tag: PIGGYBACKED SASLOTPProfile.java Log Message: Cleaned up piggybacked message handling, removed references to TuningResetException. Index: SASLOTPProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -C2 -r1.11.2.2 -r1.11.2.3 *** SASLOTPProfile.java 1 Sep 2003 18:39:45 -0000 1.11.2.2 --- SASLOTPProfile.java 15 Sep 2003 14:01:32 -0000 1.11.2.3 *************** *** 132,191 **** throws StartChannelException { - Blob blob = null; - clearCredential(channel.getSession(), this); - - String authorize, authenticate, challenge = null; - log.debug("SASL-OTP Start Channel CCL"); ! OTPAuthenticator temp = new OTPAuthenticator(this); try { - - // Digest the data - // and generate a response (challenge) if possible - // to embed in the profile back. - if (data != null) { - temp.started(channel); - blob = new Blob(data); - data = blob.getData(); - - try { - blob = temp.receiveIDs(data); - if (log.isDebugEnabled()) { - log.debug("Challenge is=>" + challenge); - } - } catch (SASLException szf) { - temp.abortNoThrow(szf.getMessage()); - // Write an error out in the profile - blob = new Blob(Blob.STATUS_ABORT, - szf.getMessage()); - return; - } - if (log.isDebugEnabled()) { - log.debug("Blobbed64 Challenge is=>" + data); - } - } channel.setRequestHandler(temp); ! if(blob != null) ! sendProfile(channel.getSession(), URI, blob.toString(), ! channel); ! else ! sendProfile(channel.getSession(), URI, null, channel); ! ! // If we processed piggybacked data then blob will be non-null ! // otherwise, we need to 'start' the OTPAuthenticator so that ! // the state transitions remain valid ! if (blob == null) { ! temp.started(channel); ! } ! ! log.debug("Started an SASL-OTP Channel"); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; } ! enableIO(channel.getSession()); ! throw new TuningResetException("SASL ANON RESET"); } --- 132,148 ---- throws StartChannelException { log.debug("SASL-OTP Start Channel CCL"); ! clearCredential(channel.getSession(), this); + OTPAuthenticator temp = new OTPAuthenticator(this); try { channel.setRequestHandler(temp); ! temp.started(channel); ! } catch (SASLException x) { ! throw new StartChannelException(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN, ! x.getMessage()); } ! log.debug("Started an SASL-OTP Channel"); } |
From: Huston F. <hu...@us...> - 2003-09-15 13:59:50
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls In directory sc8-pr-cvs1:/tmp/cvs-serv1975/tls/org/beepcore/beep/profile/tls/ptls Modified Files: Tag: PIGGYBACKED TLSProfilePureTLS.java Log Message: Cleaned up piggybacked message handling, removed references to TuningResetException. Index: TLSProfilePureTLS.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls/TLSProfilePureTLS.java,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** TLSProfilePureTLS.java 3 Jun 2003 02:50:53 -0000 1.7 --- TLSProfilePureTLS.java 15 Sep 2003 13:59:44 -0000 1.7.2.1 *************** *** 3,7 **** * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. ! * Copyright (c) 2001 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the --- 3,7 ---- * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. ! * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the *************** *** 36,40 **** --- 36,42 ---- import COM.claymoresystems.cert.*; + import java.io.BufferedReader; import java.io.IOException; + import java.io.InputStreamReader; *************** *** 62,66 **** */ public class TLSProfilePureTLS extends TuningProfile ! implements StartChannelListener { --- 64,68 ---- */ public class TLSProfilePureTLS extends TuningProfile ! implements StartChannelListener, RequestHandler { *************** *** 374,397 **** throws StartChannelException { ! TCPSession oldSession = (TCPSession) channel.getSession(); ! // if the data is <ready/> then respond with <proceed/> ! if (data != null) { ! // If data is a ready, prepare a message of proceed to ! // send to the begin call ! if (data.equals(READY1) || data.equals(READY2)) { ! data = PROCEED2; ! } } ! // Freeze this Peer ! // SSLDebug.setDebug( SSLDebug.DEBUG_ALL ); SSLSocket newSocket = null; SessionCredential peerCred = null; try { - // Send a profile back with dat "<proceed />" - this.begin(channel, URI, data); - // negotiate TLS over a new socket context.setPolicy(policy); --- 376,421 ---- throws StartChannelException { ! channel.setRequestHandler(this, true); ! } ! ! /// @TODO Fix error handling in this method ! public void receiveMSG(MessageMSG msg) ! { ! Channel channel = msg.getChannel(); ! InputDataStreamAdapter is = msg.getDataStream().getInputStream(); ! BufferedReader reader = new BufferedReader(new InputStreamReader(is)); ! ! String data; ! ! try { ! try { ! data = reader.readLine(); ! } catch (IOException e) { ! msg.sendERR(BEEPError.CODE_PARAMETER_ERROR, ! "Error reading data"); ! return; ! } ! ! if (data.equals(READY1) == false && data.equals(READY2) == false) { ! msg.sendERR(BEEPError.CODE_PARAMETER_INVALID, ! "Expected READY element"); } ! this.begin(channel); ! ! msg.sendRPY(new StringOutputDataStream(PROCEED2)); ! } catch (BEEPException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate("unable to send ERR"); ! return; ! } ! ! TCPSession oldSession = (TCPSession) channel.getSession(); ! SSLSocket newSocket = null; SessionCredential peerCred = null; try { // negotiate TLS over a new socket context.setPolicy(policy); *************** *** 403,432 **** oldSocket.getInetAddress().getHostName(), oldSocket.getPort(), SSLSocket.SERVER); - } catch (BEEPException e) { - log.error(e.getMessage()); - e.printStackTrace(); - oldSession.terminate(e.getMessage()); } catch (SSLThrewAlertException e) { ! log.error(e.getMessage()); ! e.printStackTrace(); ! oldSession.terminate(e.getMessage()); } catch (IOException e) { ! log.error(e.getMessage()); ! e.printStackTrace(); ! oldSession.terminate(e.getMessage()); } try { - // get the credentials of the peer - Vector cc = null; - if (needPeerAuth) { cc = newSocket.getCertificateChain(); if (cc == null) { log.trace("No certificate chain when there should be one."); ! throw new StartChannelException(550, "No certificate " + ! "chain when there " + "should be one. "); } Enumeration enum = cc.elements(); while (enum.hasMoreElements()) { --- 427,455 ---- oldSocket.getInetAddress().getHostName(), oldSocket.getPort(), SSLSocket.SERVER); } catch (SSLThrewAlertException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; } catch (IOException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; } + // get the credentials of the peer + Vector cc = null; + int cs; + try { if (needPeerAuth) { cc = newSocket.getCertificateChain(); if (cc == null) { log.trace("No certificate chain when there should be one."); ! msg.sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, ! "No certificate chain when there " + "should be one. "); + return; } + Enumeration enum = cc.elements(); while (enum.hasMoreElements()) { *************** *** 442,447 **** } ! int cs = newSocket.getCipherSuite(); // verify that this is authenticated and authorized if (handshakeListener != null) { --- 465,480 ---- } ! cs = newSocket.getCipherSuite(); ! } catch (BEEPException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate("unable to send ERR"); ! return; ! } catch (IOException e) { ! log.error("TLS Error", e); ! channel.getSession().terminate(e.getMessage()); ! return; ! } + try { // verify that this is authenticated and authorized if (handshakeListener != null) { *************** *** 450,500 **** handshakeListener.handshakeCompleted(oldSession, cc, cs); } ! // create the peer credential ! Hashtable ht = new Hashtable(); ! ! ht.put(SessionCredential.AUTHENTICATOR, URI); ! ht.put(SessionCredential.ALGORITHM, ! SSLPolicyInt.getCipherSuiteName(cs)); ! ht.put(SessionCredential.AUTHENTICATOR_TYPE, "TLS"); ! ! if (cc != null) { ! ht.put(SessionCredential.REMOTE_CERTIFICATE, cc.elementAt(0)); ! } ! ! peerCred = new SessionCredential(ht); ! // Consider the Profile Registry ! ProfileRegistry preg = oldSession.getProfileRegistry(); ! preg.removeStartChannelListener(URI); ! if (abortSession) { ! this.abort(new BEEPError(451, ERR_TLS_NO_AUTHENTICATION), ! channel); ! } else { ! // Cause the session to be recreated and reset ! Hashtable hash = new Hashtable(); ! hash.put(SessionTuningProperties.ENCRYPTION, "true"); ! SessionTuningProperties tuning = ! new SessionTuningProperties(hash); ! this.complete(channel, generateCredential(), peerCred, ! tuning, preg, newSocket); ! } ! } catch (Exception x) { ! // @todo should be more detailed ! log.error(x.getMessage()); ! x.printStackTrace(); ! throw new StartChannelException(450, x.getMessage()); } - - throw new TuningResetException(URI); } /** --- 483,530 ---- handshakeListener.handshakeCompleted(oldSession, cc, cs); } + } catch (BEEPException e) { + log.error("BEEP Handshake error", e); + channel.getSession().terminate("BEEP Handshake error"); + return; + } ! // create the peer credential ! Hashtable ht = new Hashtable(); ! ht.put(SessionCredential.AUTHENTICATOR, URI); ! ht.put(SessionCredential.ALGORITHM, ! SSLPolicyInt.getCipherSuiteName(cs)); ! ht.put(SessionCredential.AUTHENTICATOR_TYPE, "TLS"); ! if (cc != null) { ! ht.put(SessionCredential.REMOTE_CERTIFICATE, cc.elementAt(0)); ! } ! peerCred = new SessionCredential(ht); ! // Cause the session to be recreated and reset ! Hashtable hash = new Hashtable(); ! hash.put(SessionTuningProperties.ENCRYPTION, "true"); ! SessionTuningProperties tuning = ! new SessionTuningProperties(hash); ! // Consider the Profile Registry ! ProfileRegistry preg = oldSession.getProfileRegistry(); ! preg.removeStartChannelListener(URI); ! try { ! this.complete(channel, generateCredential(), peerCred, ! tuning, preg, newSocket); ! } catch (BEEPException x) { ! BEEPError error = ! new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED, ! ERR_TLS_NO_AUTHENTICATION); ! abort(error, channel); } } + /** *************** *** 584,591 **** } catch (SSLThrewAlertException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e.getMessage()); } catch (IOException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e.getMessage()); } --- 614,621 ---- } catch (SSLThrewAlertException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e); } catch (IOException e) { session.terminate(e.getMessage()); ! throw new BEEPException(e); } |
From: Huston F. <hu...@us...> - 2003-09-15 13:55:37
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous In directory sc8-pr-cvs1:/tmp/cvs-serv984/src/org/beepcore/beep/profile/sasl/anonymous Modified Files: Tag: PIGGYBACKED SASLAnonymousProfile.java Log Message: Cleaned up piggybacked message handling Index: SASLAnonymousProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/SASLAnonymousProfile.java,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -C2 -r1.10.2.1 -r1.10.2.2 *** SASLAnonymousProfile.java 20 Aug 2003 14:34:41 -0000 1.10.2.1 --- SASLAnonymousProfile.java 15 Sep 2003 13:55:33 -0000 1.10.2.2 *************** *** 104,145 **** Session t = channel.getSession(); ! if(data != null) ! { ! try { ! Blob blob = new Blob(data); ! data = blob.getData(); ! ! if (log.isDebugEnabled()) { ! log.debug("SASLAnon...User claims to be=>" + data); ! } ! finishListenerAuthentication(SASLAnonymousProfile.generateCredential(data), ! t); ! ! // Generate a blob indicating that we're done and ! // return it in the profile response to the StartChannel request ! data = null; ! blob = new Blob(Blob.STATUS_COMPLETE,data); ! sendProfile(t, uri, blob.toString(), channel); ! enableIO(channel.getSession()); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; ! } ! // Skip standard start channel handling ! throw new TuningResetException("SASL ANON RESET"); ! } ! else ! { ! try { ! AnonymousAuthenticator auth = new AnonymousAuthenticator(this); ! auth.started(channel); ! sendProfile(t, uri, null, channel); ! enableIO(channel.getSession()); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; ! } ! // Skip standard start channel handling ! throw new TuningResetException("SASL ANON RESET"); } } --- 104,113 ---- Session t = channel.getSession(); ! try { ! AnonymousAuthenticator auth = new AnonymousAuthenticator(this); ! auth.started(channel); ! } catch (Exception x) { ! channel.getSession().terminate(x.getMessage()); ! return; } } |
From: Huston F. <hu...@us...> - 2003-09-15 13:51:15
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv32548/src/org/beepcore/beep/core Modified Files: Tag: PIGGYBACKED TuningResetException.java Log Message: Deprecated Index: TuningResetException.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningResetException.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -r1.3 -r1.3.2.1 *** TuningResetException.java 10 Jun 2003 18:59:20 -0000 1.3 --- TuningResetException.java 15 Sep 2003 13:51:10 -0000 1.3.2.1 *************** *** 1,3 **** - /* * TuningResetException.java $Revision$ $Date$ --- 1,2 ---- *************** *** 38,41 **** --- 37,41 ---- * * @TODO remove this class + * @deprecated */ public TuningResetException(String message) |
From: Huston F. <hu...@us...> - 2003-09-14 05:39:34
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv31520/src/org/beepcore/beep/core Modified Files: Tag: PIGGYBACKED ChannelImpl.java Log Message: Fix for hang with ERR messages Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -r1.7.2.1 -r1.7.2.2 *** ChannelImpl.java 13 Jul 2003 14:27:46 -0000 1.7.2.1 --- ChannelImpl.java 14 Sep 2003 05:39:30 -0000 1.7.2.2 *************** *** 838,841 **** --- 838,842 ---- if (ds.isComplete() && ds.availableSegment() == false && (status.getMessageType() == Message.MESSAGE_TYPE_RPY || + status.getMessageType() == Message.MESSAGE_TYPE_ERR || status.getMessageType() == Message.MESSAGE_TYPE_NUL)) { |
From: Huston F. <hu...@us...> - 2003-09-14 04:30:18
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous In directory sc8-pr-cvs1:/tmp/cvs-serv21705/src/org/beepcore/beep/profile/sasl/anonymous Modified Files: SASLAnonymousProfile.java Log Message: Fixed IO handling Index: SASLAnonymousProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/SASLAnonymousProfile.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** SASLAnonymousProfile.java 10 Jun 2003 18:59:22 -0000 1.10 --- SASLAnonymousProfile.java 14 Sep 2003 04:30:15 -0000 1.11 *************** *** 121,124 **** --- 121,125 ---- blob = new Blob(Blob.STATUS_COMPLETE,data); sendProfile(t, uri, blob.toString(), channel); + enableIO(channel.getSession()); } catch (Exception x) { channel.getSession().terminate(x.getMessage()); *************** *** 134,137 **** --- 135,139 ---- auth.started(channel); sendProfile(t, uri, null, channel); + enableIO(channel.getSession()); } catch (Exception x) { channel.getSession().terminate(x.getMessage()); |