[BusyBox] bug#1242: marked as done (netcat '-i' option)

BusyBox.net bug Tracking System owner at busybox.net
Fri Apr 26 18:16:03 UTC 2002


Your message dated Fri, 26 Apr 2002 18:00:50 -0600
with message-id <20020427000049.GB3265 at codepoet.org>
and subject line [BusyBox] bug#1242: netcat '-i' option
has caused the attached bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Erik Andersen
(administrator, BusyBox.net bugs database)

--------------------------------------
Received: (at submit) by bugs.busybox.net; 20 Apr 2002 20:00:33 +0000
>From cristian.ionescu-idbohrn at axis.com  Sat Apr 20 14:00:33 2002
Received: from krynn.axis.se (krynn.axis.se [193.13.178.10])
	by winder.codepoet.org (Postfix) with ESMTP id BB0AC15760E
	for <submit at bugs.busybox.net>; Sat, 20 Apr 2002 14:00:31 -0600 (MDT)
Received: from cicero.axis.se (IDENT:user84102 at cicero.axis.se [10.13.1.40])
	by krynn.axis.se (8.12.2/8.12.2/Debian -5) with ESMTP id g3KK0KGp004921
	for <submit at bugs.busybox.net>; Sat, 20 Apr 2002 22:00:20 +0200
Date: Sat, 20 Apr 2002 22:00:20 +0200 (CEST)
From: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>
Sender: cii at cicero.axis.se
Reply-To: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>
To: submit at bugs.busybox.net
Subject: netcat '-i' option
Message-ID: <Pine.LNX.4.44.0204202130020.22502-100000 at cicero.axis.se>
Organisation: Axis Communications AB <http://www.axis.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Package: busybox
Version: 0.61.pre+cvs+2002-04-20:21:01
Severity: wishlist

Would you please add the '-i' option to netcat. It seems to be
required in order to be able to talk to an smtp-server.

This script below (which I'd like to use to be informed when the
floppyfw firewall dhcp-assigned-ip-address changes) works with a full
blown netcat, but not with the busybox one:

,---- nc-mail ----
| #!/bin/sh -e
|
| SMTP_HOST_=<smtp-server name/ip>
| FROM_HOST_=<ffw-hostname>
| FROM_=<sender email-address>
| TO_=<receipient email-adress>
|
| FFWEXTIP_=`ifconfig eth0 | grep 'addr:' | cut -d\: -f2 | cut -d\  -f1`
| TIME_=`date +%Y-%m-%d:%T`
|
|
| echo "EHLO $FROM_HOST_
| MAIL From: $FROM_
| RCPT To: $TO_
| DATA
| From: $FROM_
| To: $TO_
| Subject: time: $TIME_, extip: $FFWEXTIP_
| .
| QUIT" | nc -i 1 $SMTP_HOST_ 25
|
| exit 0
`----

It looks like the mods required would be minimal. Here is a patch (not
tested yet):

--- networking/nc.c.original    Wed May 16 17:40:48 2001
+++ networking/nc.c     Sat Apr 20 21:49:33 2002
@@ -42,7 +42,7 @@

 int nc_main(int argc, char **argv)
 {
-       int do_listen = 0, lport = 0, tmpfd, opt, sfd;
+       int do_listen = 0, delay = 0, lport = 0, tmpfd, opt, sfd;
        char buf[BUFSIZ];

        struct sockaddr_in address;
@@ -52,6 +52,9 @@ int nc_main(int argc, char **argv)

        while ((opt = getopt(argc, argv, "lp:")) > 0) {
                switch (opt) {
+                       case 'i':
+                               delay = atoi(optarg);
+                               break;
                        case 'l':
                                do_listen++;
                                break;
@@ -131,6 +134,10 @@ int nc_main(int argc, char **argv)

                                if (full_write(ofd, buf, nread) < 0)
                                        perror_msg_and_die("write");
+
+                               if (delay > 0) {
+                                       sleep(delay);
+                               }
                        }
                }
        }


Cheers,
Cristian

---------------------------------------
Received: (at 1242-done) by bugs.busybox.net; 27 Apr 2002 00:00:52 +0000
>From andersen at codepoet.org  Fri Apr 26 18:00:51 2002
Received: by winder.codepoet.org (Postfix, from userid 1000)
	id 9BAF41577D2; Fri, 26 Apr 2002 18:00:50 -0600 (MDT)
Date: Fri, 26 Apr 2002 18:00:50 -0600
From: Erik Andersen <andersen at codepoet.org>
To: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>,
	1242-done at bugs.busybox.net
Subject: Re: [BusyBox] bug#1242: netcat '-i' option
Message-ID: <20020427000049.GB3265 at codepoet.org>
Reply-To: andersen at codepoet.org
References: <Pine.LNX.4.44.0204202130020.22502-100000 at cicero.axis.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Pine.LNX.4.44.0204202130020.22502-100000 at cicero.axis.se>
User-Agent: Mutt/1.3.28i
X-Operating-System: Linux 2.4.18-rmk1, Rebel-NetWinder(Intel StrongARM 110 rev 3), 185.95 BogoMips
X-No-Junk-Mail: I do not want to get *any* junk mail.

On Sat Apr 20, 2002 at 10:00:20PM +0200, Cristian Ionescu-Idbohrn wrote:
> Package: busybox
> Version: 0.61.pre+cvs+2002-04-20:21:01
> Severity: wishlist
> 
> Would you please add the '-i' option to netcat. It seems to be
> required in order to be able to talk to an smtp-server.

done.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the busybox mailing list