Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: Ncat and windows line endings
From: David Fifield <david () bamsoftware com>
Date: Thu, 4 Jun 2009 21:00:33 -0600

On Thu, Jun 04, 2009 at 04:25:11PM +0100, jah wrote:
On 04/06/2009 02:30, David Fifield wrote:
Here is the patch. It sets _O_TEXT mode on stdin when the input is from
the console (checked using the _isatty function), and _O_BINARY
otherwise. It sets _O_BINARY on stdout. So the terminal sends \n for
line endings, and no newline translation is done anywhere else, just
like on Unix.

This sounds like a good idea and it certainly would dispense with the
need for an -L option which should be a good thing.
I've attached the half of the patch I previously [1] posted that
converts LF to CRLF throughout the buffer.  Thanks a bug report from
Venkat Sanaka I've fixed an error I made in the original patch too.

I committed the _O_TEXT/_O_BINARY change. I have a couple of suggestions
for the patch.

It doesn't do translation in UDP listen mode. Actually, -C has never
worked in UDP listen mode. Here's a chance to fix it.

You should use the same technique in listen mode that you do in broker
and connect mode, namely, to use a tempbuf variable to keep track of
whether a new buffer has been allocated. That way, there is no overhead
for memory allocation and copying a buffer with o.crlf is false.

With those changes, this is good to check in.

David Fifield

Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]