diff -cr telnetd-2.0.orig/build.xml telnetd-2.0/build.xml
*** telnetd-2.0.orig/build.xml 2005-03-15 13:21:38.000000000 +1100
--- telnetd-2.0/build.xml 2006-03-21 12:05:30.000000000 +1100
***************
*** 13,19 ****
* Note:
* This will affect all attributes. Although these selective resets are defined
* in ECMA 048 (the successor of the ANSI X3.64 standard) they are obviously not
* implemented for all attributes in standard terminal emulations.
*
*/
public void resetAttributes() throws IOException;
/**
* Method that sends a signal to the user. This is defined for
* ANY NVT which is part of the internet protocol standard.
* The effect on the terminal might differ by the terminal type or
* telnet client/terminal emulator implementation.
*/
public void bell() throws IOException;
/**
* Method that ensures all written bytes to be send over the
* network. If autoflushing is off, this will be necessary to
* flush buffered data already written.
*/
public void flush() throws IOException;
/**
* Closes this BasicTerminalIO.
*/
public void close() throws IOException;
/**
* Sets the terminal to be used for this BasicTerminalIO.
*
* @param terminalname the name of the terminal.
* @see net.wimpi.telnetd.io.terminal.TerminalManager
*/
public void setTerminal(String terminalname) throws IOException;
/**
* Sets the default terminal.
*
* @see net.wimpi.telnetd.io.terminal.TerminalManager
*/
public void setDefaultTerminal() throws IOException;
/**
* Method to retrieve the actual rows on the clients terminal
* screen.
*
* @return int that represents the number of rows.
*/
public int getRows();
/**
* Method to retrieve the actual columns on the clients temrinal
* screen.
*
* @return int that represents the number of columns.
*/
public int getColumns();
/**
* Mutator method for the signalling attribute.
*
* @param b Boolean that flags on(true) or off(false)
*/
public void setSignalling(boolean b);
/**
* Accessor method for checking signalling attribute.
*
* @return Boolean that represents if signalling is either
* turned on(true) or off(false).
*/
public boolean isSignalling();
/**
* Mutator method for the autoflushing mechanism.
*
* @param b Boolean that flags on(true) or off(false)
*/
public void setAutoflushing(boolean b);
/**
* Accessor method for the autoflushing mechanism.
*
* @return Boolean that represents if autoflushing is either
* turned on(true) or off(false).
*/
public boolean isAutoflushing();
/**
* Resets the terminal device.
*/
public void resetTerminal() throws IOException;
/**
* Sets the linewrapping mode.
*
* @param b true if linewrapping on, false otherwise.
*/
public void setLinewrapping(boolean b) throws IOException;
/**
* Tests if terminal is in linewrapping mode.
*
* @return true if linewrapping, false otherwise.
*/
public boolean isLineWrapping() throws IOException;
/**
* Allows to define a scroll region.
* EXPERIMENTAL
*
* @param topmargin the top margin in rows.
* @param bottommargin the bottom margin in rows.
* @return true if scrolling supported, false otherwise.
* @throws IOException if an I/O error occurs.
*/
public boolean defineScrollRegion(int topmargin, int bottommargin)
throws IOException;
//Constants
/**
* Left (defining a direction on the terminal)
*/
public static final int UP = 1001;
/**
* Right (defining a direction on the terminal)
*/
public static final int DOWN = 1002;
/**
* Up (defining a direction on the terminal)
*/
public static final int RIGHT = 1003;
/**
* Down (defining a direction on the terminal)
*/
public static final int LEFT = 1004;
/**
* Tabulator (defining the tab key)
*/
public static final int TABULATOR = 1301;
/**
* Delete (defining the del key)
*/
public static final int DELETE = 1302;
/**
* Backspace (defining the backspace key)
*/
public static final int BACKSPACE = 1303;
/**
* Enter (defining the return or enter key)
*/
public static final int ENTER = 10;
/**
* Color init (defining ctrl-a atm)
*/
public static final int COLORINIT = 1304;
/**
* Logout request (defining ctrl-d atm)
*/
public static final int LOGOUTREQUEST = 1306;
/**
* Black
*/
public static final int BLACK = 30;
/**
* Red
*/
public static final int RED = 31;
/**
* Green
*/
public static final int GREEN = 32;
/**
* Yellow
*/
public static final int YELLOW = 33;
/**
* Blue
*/
public static final int BLUE = 34;
/**
* Magenta
*/
public static final int MAGENTA = 35;
/**
* Cyan
*/
public static final int CYAN = 36;
/**
* White
*/
public static final int WHITE = 37;
/**
* CRLF (defining carriage+linebreak which is obligation)
*/
public static final String CRLF = "\r\n";
}//interface BasicTerminalIO
\ No newline at end of file
--- 29,488 ----
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
***/
!
! package net.wimpi.telnetd.io;
!
! import java.io.IOException;
!
!
! /**
! * Interface that represents the supported
! * terminal oriented low-level I/O capabilities.
! *
! * @author Dieter Wimberger
! * @version 2.0 (14/03/2005)
! */
! public interface BasicTerminalIO {
!
!
! /**
! * Method that retrieves Input from the underlying
! * Stream, translating Terminal specific escape
! * sequences and returning a (constant defined) key,
! * or a character.
! *
! * @return int that represents a constant defined key.
! */
! public int read() throws IOException;
!
! public boolean ready() throws IOException;
!
! /**
! * Method that writes a raw byte to the terminal.
! * @param b a byte value to be written.
! */
! public void write(byte b) throws IOException;
!
! /**
! * Method that writes a character to the terminal.
! *
! * @param ch Character that should be written on the screen
! */
! public void write(char ch) throws IOException;
!
! /**
! * Method that writes a String to the terminal,
! *
! * @param str String that should be written to the terminal.
! */
! public void write(String str) throws IOException;
!
! /**
! * Method that places the cursor on the terminal
! * on the given absolute position.
! *
! * @param row Integer that represents the desired row coord.
! * @param col Integer that represents the desired column coord.
! */
! public void setCursor(int row, int col) throws IOException;
!
! /**
! * Method that moves the cursor relative from the actual
! * position given times into a given direction.
! *
! * @param direction Constant defined integer.
! * @param times Integer that represents the desired column coord.
! */
! public void moveCursor(int direction, int times) throws IOException;
!
! /**
! * Convenience method to move cursor to the right.
! * Wraps moveCursor method.
! *
! * @param times Integer that represents the times the cursor should be moved.
! * @see BasicTerminalIO#moveCursor
! */
! public void moveRight(int times) throws IOException;
!
! /**
! * Convenience method to move cursor to the left.
! * Wraps moveCursor method.
! *
! * @param times Integer that represents the times the cursor should be moved.
! * @see BasicTerminalIO#moveCursor
! */
! public void moveLeft(int times) throws IOException;
!
! /**
! * Convenience method to move the cursor up.
! * Wraps moveCursor method.
! *
! * @param times Integer that represents the times the cursor should be moved.
! * @see BasicTerminalIO#moveCursor
! */
! public void moveUp(int times) throws IOException;
!
! /**
! * Convenience method to move the cursor down.
! * Wraps moveCursor method.
! *
! * @param times Integer that represents the times the cursor should be moved.
! * @see BasicTerminalIO#moveCursor
! */
! public void moveDown(int times) throws IOException;
!
! /**
! * Method that places the cursor at "home", which is defining
! * first Row,first Column.
! * Note that it might be wrapping moveCursor, or be a specific
! * Escape Sequence.
! */
! public void homeCursor() throws IOException;
!
! /**
! * Method that stores the actual Cursor position, either client-side,
! * or if not possible server-side.
! * Note:
! *
! * Note:
! * This will affect all attributes. Although these selective resets are defined
! * in ECMA 048 (the successor of the ANSI X3.64 standard) they are obviously not
! * implemented for all attributes in standard terminal emulations.
! *
! */
! public void resetAttributes() throws IOException;
!
! /**
! * Method that sends a signal to the user. This is defined for
! * ANY NVT which is part of the internet protocol standard.
! * The effect on the terminal might differ by the terminal type or
! * telnet client/terminal emulator implementation.
! */
! public void bell() throws IOException;
!
! /**
! * Method that ensures all written bytes to be send over the
! * network. If autoflushing is off, this will be necessary to
! * flush buffered data already written.
! */
! public void flush() throws IOException;
!
! /**
! * Closes this BasicTerminalIO.
! */
! public void close() throws IOException;
!
! /**
! * Sets the terminal to be used for this BasicTerminalIO.
! *
! * @param terminalname the name of the terminal.
! * @see net.wimpi.telnetd.io.terminal.TerminalManager
! */
! public void setTerminal(String terminalname) throws IOException;
!
! /**
! * Sets the default terminal.
! *
! * @see net.wimpi.telnetd.io.terminal.TerminalManager
! */
! public void setDefaultTerminal() throws IOException;
!
!
! /**
! * Method to retrieve the actual rows on the clients terminal
! * screen.
! *
! * @return int that represents the number of rows.
! */
! public int getRows();
!
! /**
! * Method to retrieve the actual columns on the clients temrinal
! * screen.
! *
! * @return int that represents the number of columns.
! */
! public int getColumns();
!
!
! /**
! * Mutator method for the signalling attribute.
! *
! * @param b Boolean that flags on(true) or off(false)
! */
! public void setSignalling(boolean b);
!
! /**
! * Accessor method for checking signalling attribute.
! *
! * @return Boolean that represents if signalling is either
! * turned on(true) or off(false).
! */
! public boolean isSignalling();
!
! /**
! * Mutator method for the autoflushing mechanism.
! *
! * @param b Boolean that flags on(true) or off(false)
! */
! public void setAutoflushing(boolean b);
!
! /**
! * Accessor method for the autoflushing mechanism.
! *
! * @return Boolean that represents if autoflushing is either
! * turned on(true) or off(false).
! */
! public boolean isAutoflushing();
!
! /**
! * Resets the terminal device.
! */
! public void resetTerminal() throws IOException;
!
! /**
! * Sets the linewrapping mode.
! *
! * @param b true if linewrapping on, false otherwise.
! */
! public void setLinewrapping(boolean b) throws IOException;
!
! /**
! * Tests if terminal is in linewrapping mode.
! *
! * @return true if linewrapping, false otherwise.
! */
! public boolean isLineWrapping() throws IOException;
!
! /**
! * Allows to define a scroll region.
! * EXPERIMENTAL
! *
! * @param topmargin the top margin in rows.
! * @param bottommargin the bottom margin in rows.
! * @return true if scrolling supported, false otherwise.
! * @throws IOException if an I/O error occurs.
! */
! public boolean defineScrollRegion(int topmargin, int bottommargin)
! throws IOException;
!
! //Constants
!
! /**
! * Left (defining a direction on the terminal)
! */
! public static final int UP = 1001;
!
! /**
! * Right (defining a direction on the terminal)
! */
! public static final int DOWN = 1002;
!
! /**
! * Up (defining a direction on the terminal)
! */
! public static final int RIGHT = 1003;
!
! /**
! * Down (defining a direction on the terminal)
! */
! public static final int LEFT = 1004;
!
! /**
! * Tabulator (defining the tab key)
! */
! public static final int TABULATOR = 1301;
!
! /**
! * Delete (defining the del key)
! */
! public static final int DELETE = 1302;
!
! /**
! * Backspace (defining the backspace key)
! */
! public static final int BACKSPACE = 1303;
!
! /**
! * Enter (defining the return or enter key)
! */
! public static final int ENTER = 10;
!
! /**
! * Color init (defining ctrl-a atm)
! */
! public static final int COLORINIT = 1304;
!
! /**
! * Logout request (defining ctrl-d atm)
! */
! public static final int LOGOUTREQUEST = 1306;
!
! /**
! * Black
! */
! public static final int BLACK = 30;
!
! /**
! * Red
! */
! public static final int RED = 31;
!
! /**
! * Green
! */
! public static final int GREEN = 32;
!
! /**
! * Yellow
! */
! public static final int YELLOW = 33;
!
! /**
! * Blue
! */
! public static final int BLUE = 34;
!
! /**
! * Magenta
! */
! public static final int MAGENTA = 35;
!
! /**
! * Cyan
! */
! public static final int CYAN = 36;
!
! /**
! * White
! */
! public static final int WHITE = 37;
!
! /**
! * CRLF (defining carriage+linebreak which is obligation)
! */
! public static final String CRLF = "\r\n";
!
! }//interface BasicTerminalIO
!
diff -cr telnetd-2.0.orig/src/net/wimpi/telnetd/io/TelnetIO.java telnetd-2.0/src/net/wimpi/telnetd/io/TelnetIO.java
*** telnetd-2.0.orig/src/net/wimpi/telnetd/io/TelnetIO.java 2005-03-15 13:04:26.000000000 +1100
--- telnetd-2.0/src/net/wimpi/telnetd/io/TelnetIO.java 2007-05-14 15:46:57.000000000 +1000
***************
*** 99,104 ****
--- 99,108 ----
public TelnetIO() {
}//constructor
+ public int available() throws IOException {
+ return m_In.available();
+ }
+
public void initIO() throws IOException {
//we make an instance of our inner class
m_IACHandler = new IACHandler();
diff -cr telnetd-2.0.orig/src/net/wimpi/telnetd/io/TerminalIO.java telnetd-2.0/src/net/wimpi/telnetd/io/TerminalIO.java
*** telnetd-2.0.orig/src/net/wimpi/telnetd/io/TerminalIO.java 2005-03-15 13:04:26.000000000 +1100
--- telnetd-2.0/src/net/wimpi/telnetd/io/TerminalIO.java 2007-05-14 15:47:21.000000000 +1000
***************
*** 132,137 ****
--- 132,141 ----
return i;
}//read
+ public boolean ready() throws IOException {
+ return (m_TelnetIO.available() > 0);
+ }
+
public void write(byte b) throws IOException {
m_TelnetIO.write(b);
if (m_Autoflush) {
diff -cr telnetd-2.0.orig/src/net/wimpi/telnetd/net/PortListener.java telnetd-2.0/src/net/wimpi/telnetd/net/PortListener.java
*** telnetd-2.0.orig/src/net/wimpi/telnetd/net/PortListener.java 2005-03-15 13:04:26.000000000 +1100
--- telnetd-2.0/src/net/wimpi/telnetd/net/PortListener.java 2007-09-11 16:49:29.154052184 +1000
***************
*** 37,42 ****
--- 37,43 ----
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
+ import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
***************
*** 58,63 ****
--- 59,65 ----
private static Log log = LogFactory.getLog(PortListener.class);
private String m_Name;
+ private String m_Interface;
private int m_Port; //port number running on
private int m_FloodProtection; //flooding protection
private ServerSocket m_ServerSocket = null; //server socket
***************
*** 72,82 ****
* Constructs a PortListener instance.
* Its private because its called by a factory method.
*
* @param port int that specifies the port number of the server socket.
* @param floodprot that specifies the server socket queue size.
*/
! private PortListener(String name, int port, int floodprot) {
m_Name = name;
m_Available = false;
m_Port = port;
m_FloodProtection = floodprot;
--- 74,86 ----
* Constructs a PortListener instance.
* Its private because its called by a factory method.
*
+ * @param iface String which speicfies the network interface of the server socket
* @param port int that specifies the port number of the server socket.
* @param floodprot that specifies the server socket queue size.
*/
! private PortListener(String name, String iface, int port, int floodprot) {
m_Name = name;
+ m_Interface = iface;
m_Available = false;
m_Port = port;
m_FloodProtection = floodprot;
***************
*** 162,171 ****
should be handled properly, but denial of service attacks via massive parallel
program logins should be prevented with this.
*/
! m_ServerSocket = new ServerSocket(m_Port, m_FloodProtection);
//log entry
! Object[] args = {new Integer(m_Port), new Integer(m_FloodProtection)};
log.info(MessageFormat.format(logmsg, args));
do {
--- 166,176 ----
should be handled properly, but denial of service attacks via massive parallel
program logins should be prevented with this.
*/
! m_ServerSocket = new ServerSocket(m_Port, m_FloodProtection,
! (m_Interface != null) ? InetAddress.getByName(m_Interface) : null);
//log entry
! Object[] args = { (m_Interface != null) ? m_Interface : "" , new Integer(m_Port), new Integer(m_FloodProtection)};
log.info(MessageFormat.format(logmsg, args));
do {
***************
*** 218,230 ****
try {
//1. read settings of the port listener itself
int port = Integer.parseInt(settings.getProperty(name + ".port"));
int floodprot = Integer.parseInt(settings.getProperty(name + ".floodprotection"));
if (new Boolean(settings.getProperty(name + ".secure")).booleanValue()) {
//do nothing for now, probably set factory in the future
}
! pl = new PortListener(name, port, floodprot);
} catch (Exception ex) {
log.error("createPortListener()", ex);
throw new BootException("Failure while creating PortListener instance:\n" +
--- 223,236 ----
try {
//1. read settings of the port listener itself
+ String iface = settings.getProperty(name + ".interface");
int port = Integer.parseInt(settings.getProperty(name + ".port"));
int floodprot = Integer.parseInt(settings.getProperty(name + ".floodprotection"));
if (new Boolean(settings.getProperty(name + ".secure")).booleanValue()) {
//do nothing for now, probably set factory in the future
}
! pl = new PortListener(name, iface, port, floodprot);
} catch (Exception ex) {
log.error("createPortListener()", ex);
throw new BootException("Failure while creating PortListener instance:\n" +
***************
*** 246,251 ****
}//createPortListener
private static final String logmsg =
! "Listening to Port {0,number,integer} with a connectivity queue size of {1,number,integer}.";
}//class PortListener
--- 252,257 ----
}//createPortListener
private static final String logmsg =
! "Listening to Interface {0} Port {1,number,integer} with a connectivity queue size of {2,number,integer}.";
}//class PortListener