Date: Wed, 17 May 2000 10:17:13 +0100 (BST) From: dwmalone@maths.tcd.ie To: FreeBSD-gnats-submit@freebsd.org Subject: bin/18619: ftp cmds.c thinks gateport is a short after IPv6 changes. Message-ID: <200005171017.aa48755@walton.maths.tcd.ie>
next in thread | raw e-mail | index | archive | help
>Number: 18619 >Category: bin >Synopsis: ftp cmds.c thinks gateport is a short, it's a char *. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 17 02:20:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: David Malone >Release: FreeBSD 5.0-CURRENT i386 >Organization: School of Mathematics, Trinity College, Dublin, Ireland. >Environment: FreeBSD 4.X and 5.X >Description: On 2000/01/27 IPv6 changes were made to ftp, which changed gateport from a network bite order short to a char *, for use with getaddrinfo. Unfortunately cmds.c seems to have been missed in this merge, resulting in some confused code. >How-To-Repeat: If you try to set the gate port and then ftp this will cause a core dump: % ftp ftp> gate localhost 1 Gate ftp: on, server localhost, port 1. ftp> open localhost Segmentation fault (core dumped) Compiling ftp also gives warnings: cc -O -pipe -DINET6 -g -c /usr/src/usr.bin/ftp/cmds.c /usr/src/usr.bin/ftp/cmds.c: In function `status': /usr/src/usr.bin/ftp/cmds.c:661: warning: initialization makes integer from poin ter without a cast /usr/src/usr.bin/ftp/cmds.c: In function `setgate': /usr/src/usr.bin/ftp/cmds.c:892: warning: assignment makes pointer from integer without a cast /usr/src/usr.bin/ftp/cmds.c:906: warning: initialization makes integer from poin ter without a cast >Fix: The following patch seems to work, but I'm sure the IPv6 people have a working version in their own tree. Index: cmds.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/usr.bin/ftp/cmds.c,v retrieving revision 1.16 diff -u -r1.16 cmds.c --- cmds.c 1999/08/28 01:01:28 1.16 +++ cmds.c 2000/05/17 09:11:15 @@ -657,8 +657,8 @@ } pswitch(0); } - printf("Gate ftp: %s, server %s, port %d.\n", onoff(gatemode), - *gateserver ? gateserver : "(none)", ntohs(gateport)); + printf("Gate ftp: %s, server %s, port %s.\n", onoff(gatemode), + *gateserver ? gateserver : "(none)", gateport); printf("Passive mode: %s.\n", onoff(passivemode)); printf("Mode: %s; Type: %s; Form: %s; Structure: %s.\n", modename, typename, formname, structname); @@ -889,7 +889,7 @@ code = -1; return; } - gateport = htons(port); + asprintf(&gateport, "%d", port); } strncpy(gsbuf, argv[1], sizeof(gsbuf) - 1); gsbuf[sizeof(gsbuf) - 1] = '\0'; @@ -902,8 +902,8 @@ "Disabling gate-ftp mode - no gate-ftp server defined.\n"); gatemode = 0; } else { - printf("Gate ftp: %s, server %s, port %d.\n", onoff(gatemode), - *gateserver ? gateserver : "(none)", ntohs(gateport)); + printf("Gate ftp: %s, server %s, port %s.\n", onoff(gatemode), + *gateserver ? gateserver : "(none)", gateport); } code = gatemode; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005171017.aa48755>