Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 65039 invoked from network); 26 Feb 2008 10:50:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2008 10:50:45 -0000 Received: (qmail 91408 invoked by uid 500); 26 Feb 2008 10:50:37 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 91256 invoked by uid 500); 26 Feb 2008 10:50:36 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 91241 invoked by uid 99); 26 Feb 2008 10:50:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2008 02:50:36 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2008 10:50:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5071729A0019 for ; Tue, 26 Feb 2008 02:49:51 -0800 (PST) Message-ID: <1693091203.1204022991328.JavaMail.jira@brutus> Date: Tue, 26 Feb 2008 02:49:51 -0800 (PST) From: "Rory Winston (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (NET-173) Duplicate IAC when sending a IAC using TelnetClient.getOutputStream() In-Reply-To: <1970087.1194453470986.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/NET-173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572412#action_12572412 ] Rory Winston commented on NET-173: ---------------------------------- Can you supply a patch for this? > Duplicate IAC when sending a IAC using TelnetClient.getOutputStream() > --------------------------------------------------------------------- > > Key: NET-173 > URL: https://issues.apache.org/jira/browse/NET-173 > Project: Commons Net > Issue Type: Bug > Affects Versions: 1.4 > Environment: Linux > Reporter: Scott Burch > Priority: Blocker > > TelnetOutputStream.java appears to have a bug that if we send a IAC to the stream returned by TelnetClient.getOutputStream() we get duplicate IAC commands to the telnet server. > I looked through the code and I think I have found the reason. > Line 82-85 appears to just send two IAC commands. > 82 case TelnetCommand.IAC: > 83 __client._sendByte(TelnetCommand.IAC); > 84 __client._sendByte(TelnetCommand.IAC); > 85 break; > Line 91-95 appears to send the original character (which is a IAC) and a IAC thus producing two IACs in the stream. > 91 else if (ch == TelnetCommand.IAC) > 92 { > 93 __client._sendByte(ch); > 94 __client._sendByte(TelnetCommand.IAC); > 95 } > 50 public void write(int ch) throws IOException > 51 { > 52 > 53 synchronized (__client) > 54 { > 55 ch &= 0xff; > 56 > 57 if (__client._requestedWont(TelnetOption.BINARY)) > 58 { > 59 if (__lastWasCR) > 60 { > 61 if (__convertCRtoCRLF)this > 62 { > 63 __client._sendByte('\n'); > 64 if (ch == '\n') > 65 { > 66 __lastWasCR = false; > 67 return ; > 68 } > 69 } > 70 else if (ch != '\n') > 71 __client._sendByte('\0'); > 72 } > 73 > 74 __lastWasCR = false; > 75 > 76 switch (ch) > 77 { > 78 case '\r': > 79 __client._sendByte('\r'); > 80 __lastWasCR = true; > 81 break; > 82 case TelnetCommand.IAC: > 83 __client._sendByte(TelnetCommand.IAC); > 84 __client._sendByte(TelnetCommand.IAC); > 85 break; > 86 default: > 87 __client._sendByte(ch); > 88 break; > 89 } > 90 } > 91 else if (ch == TelnetCommand.IAC) > 92 { > 93 __client._sendByte(ch); > 94 __client._sendByte(TelnetCommand.IAC); > 95 } > 96 else > 97 __client._sendByte(ch); > 98 } > 99 } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.