[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip DHCPD.java, 1.4, 1.5 Telnet_server.java, 1.20
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2007-10-20 22:54:48
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10516/core/protocolsuite/tcp_ip Modified Files: DHCPD.java Telnet_server.java Log Message: new mechanism for "no" processing was developed; some console commands was added & fixed Index: DHCPD.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPD.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DHCPD.java 20 Oct 2007 13:27:20 -0000 1.4 --- DHCPD.java 20 Oct 2007 22:54:40 -0000 1.5 *************** *** 364,366 **** --- 364,374 ---- } + public void excludeAddress(String low_ip, String high_ip){ + + } + + public void no_excludeAddress(String low_ip, String high_ip){ + + } + } Index: Telnet_server.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Telnet_server.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Telnet_server.java 20 Oct 2007 13:27:21 -0000 1.20 --- Telnet_server.java 20 Oct 2007 22:54:40 -0000 1.21 *************** *** 13,16 **** --- 13,18 ---- import java.util.regex.*; import core.Error; + import java.util.Enumeration; + import java.util.Hashtable; import java.util.Vector; *************** *** 22,25 **** --- 24,31 ---- public class Telnet_server extends Application{ + public class TSession{ + public String user; + } + private ApplicationLayerDevice mDevice; private String cmdline = ""; *************** *** 31,35 **** private String login = "root"; private String temp = ""; ! private Vector<Integer> connections = new Vector<Integer>(1); /** Creates a new instance of Telnet Server */ --- 37,41 ---- private String login = "root"; private String temp = ""; ! public Hashtable connections = new Hashtable(); /** Creates a new instance of Telnet Server */ *************** *** 62,66 **** public void Accept(int listenSock, int sessionSock){ ! connections.add(new Integer(sessionSock)); } --- 68,72 ---- public void Accept(int listenSock, int sessionSock){ ! connections.put(new Integer(sessionSock), new TSession()); } *************** *** 75,80 **** { mParentStack.SL().close(appSock); ! for(int i=0; i<connections.size(); i++){ ! mParentStack.SL().close(connections.get(i).intValue()); } islogin=false; --- 81,89 ---- { mParentStack.SL().close(appSock); ! Enumeration keys = connections.keys(); ! while(keys.hasMoreElements()){ ! Integer key = (Integer)keys.nextElement(); ! mParentStack.SL().close(key.intValue()); ! connections.remove(key); } islogin=false; *************** *** 85,90 **** { mParentStack.SL().free(appSock); ! for(int i=0; i<connections.size(); i++){ ! mParentStack.SL().free(connections.get(i).intValue()); } islogin=false; --- 94,102 ---- { mParentStack.SL().free(appSock); ! Enumeration keys = connections.keys(); ! while(keys.hasMoreElements()){ ! Integer key = (Integer)keys.nextElement(); ! mParentStack.SL().free(key.intValue()); ! connections.remove(key); } islogin=false; *************** *** 129,137 **** temp = ""; cmdline = ""; ! try{ ! connections.remove(new Integer(sock)); ! }catch(Exception e){ ! printLayerInfo("Cannot listen on port: " + e.toString()); ! } } --- 141,145 ---- temp = ""; cmdline = ""; ! connections.remove(new Integer(sock)); } *************** *** 195,199 **** else if(ispass) { ispass = false; ! if(temp.compareTo(login)==0 && cmdline.compareTo(password)==0) { outData += "\r\nWelcome to " + mParentStack.getParentNodeName() + "\r\n" + runcmd(""); } --- 203,208 ---- else if(ispass) { ispass = false; ! if(isAuth(temp, cmdline)) { ! ((TSession)connections.get(new Integer(sock))).user = temp; outData += "\r\nWelcome to " + mParentStack.getParentNodeName() + "\r\n" + runcmd(""); } *************** *** 436,439 **** return password; } ! } --- 445,455 ---- return password; } ! ! private boolean isAuth(String user, String pass){ ! boolean auth = false; ! if((user.equals(login) && pass.equals(password)) || pass.equals(mDevice.getUserPassword(user))){ ! auth = true; ! } ! return auth; ! } } |