bin/176713: [patch] nc(1) closes network socket too soon
Fernando Apesteguía
fernando.apesteguia at gmail.com
Sat Jul 20 15:58:54 UTC 2013
On Sat, Jul 20, 2013 at 4:31 PM, Ronald F. Guilmette
<rfg at tristatelogic.com>wrote:
>
>
> Could someone please take a look at this bug report (bin/176713) and
> also at the simple patch that I provided to fix the problem?
>
> This is quite a serious problem, and my PR has been pending with no
> action since Wed, 6 Mar 2013.
>
>
> Regards,
> rfg
>
>
> P.S. Please note that in reality, I do not believe that it is necessary
> to add a new -q option in order to preserve backwards compatability,
> however
> I proposed one because in my experience there is always going to be some
> purist who will claim that *any* change in semantics, however small or
> helpful, in *any* software ``may'' break something. In reality, the
> problem in this can most easily be solved simply by removing the one
> statement:
>
> shutdown(nfd, SHUT_WR);
>
> entirely from the source, rather than making it conditional on -q, as I
> suggested in my PR, bin/176713.
>
It seems to work for me:
Old version:
$ echo 193.0.6.139 | nc whois.ripe.net 43
% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf
with the patched version:
echo 193.0.6.139 | ./nc -q whois.ripe.net 43
% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf
% Note: this output has been filtered.
% To receive output for a database update, use the "-B" flag.
% Information related to '193.0.0.0 - 193.0.7.255'
% Abuse contact for '193.0.0.0 - 193.0.7.255' is 'abuse at ripe.net'
inetnum: 193.0.0.0 - 193.0.7.255
netname: RIPE-NCC
descr: RIPE Network Coordination Centre
org: ORG-RIEN1-RIPE
descr: Amsterdam, Netherlands
remarks: Used for RIPE NCC infrastructure.
country: NL
admin-c: JDR-RIPE
admin-c: BRD-RIPE
tech-c: OPS4-RIPE
status: ASSIGNED PI
source: RIPE # Filtered
mnt-by: RIPE-NCC-MNT
mnt-lower: RIPE-NCC-MNT
organisation: ORG-RIEN1-RIPE
org-name: Reseaux IP Europeens Network Coordination Centre (RIPE NCC)
org-type: RIR
descr: RIPE NCC Operations
address: Reseaux IP Europeens Network Coordination Centre (RIPE NCC)
P.O. Box 10096
1016 EB Amsterdam
Netherlands
phone: +31205354444
fax-no: +31205354445
admin-c: AP110-RIPE
admin-c: MENN1-RIPE
abuse-c: ops4-ripe
mnt-ref: RIPE-NCC-MNT
mnt-ref: RIPE-NCC-HM-MNT
mnt-by: RIPE-NCC-HM-MNT
source: RIPE # Filtered
role: RIPE NCC Operations
address: Singel 258
address: 1016 AB Amsterdam
address: The Netherlands
phone: +31 20 535 4444
fax-no: +31 20 535 4445
abuse-mailbox: abuse at ripe.net
admin-c: JDR-RIPE
admin-c: BRD-RIPE
tech-c: GL7321-RIPE
tech-c: JA47
tech-c: MENN1-RIPE
tech-c: EMIL-RIPE
tech-c: RCO-RIPE
tech-c: APZ-RIPE
tech-c: CNAG-RIPE
tech-c: RPM-RIPE
tech-c: SO2011-RIPE
tech-c: RH5357-RIPE
tech-c: DCW-RIPE
tech-c: FMUL-RIPE
nic-hdl: OPS4-RIPE
mnt-by: RIPE-NCC-MNT
source: RIPE # Filtered
person: Brian Riddle
address: IT Manager
address: RIPE NCC - Operations
address: Singel 258
address: 1016AB Amsterdam
address: The Netherlands
phone: +31 20 535 4444
fax-no: +31 20 535 4445
nic-hdl: BRD-RIPE
source: RIPE # Filtered
mnt-by: RIPE-NCC-MNT
person: Jochem de Ruig
address: RIPE NCC
address: Singel 258
address: 1016AB Amsterdam
address: The Netherlands
phone: +31 20 535 4444
fax-no: +31 20 535 4445
nic-hdl: JDR-RIPE
source: RIPE # Filtered
mnt-by: RIPE-NCC-MNT
% Information related to '193.0.0.0/21AS3333'
route: 193.0.0.0/21
descr: RIPE-NCC
origin: AS3333
mnt-by: RIPE-NCC-MNT
source: RIPE # Filtered
% This query was served by the RIPE Database Query Service version 1.66.3
(WHOIS2)
Tested on:
FreeBSD hammer 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29
18:27:25 UTC 2013
root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
amd64
>
> P.P.S. I have just realized that yet one more critical enhancement for
> nc is called for, and I will be filing a separate and additional PR for
> that soon. I hope that someone will be able to take a look at that as
> soon as it is filed.
>
Just out of curiosity. What is it about?
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
More information about the freebsd-hackers
mailing list