source: npl/system/netkit-ftp/patches/12-netkit-ftp-0.17-multihome.patch @ ca72aba

Last change on this file since ca72aba was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 3.2 KB
  • netkit-ftp-0.17/ftp/ftp_var.h

    old new  
    6969Extern int      bell;           /* ring bell on cmd completion */
    7070Extern int      doglob;         /* glob local file names */
    7171Extern int      autologin;      /* establish user account on connection */
     72Extern int      multihome;      /* multi homed host, use same interface for cmd and data channels */
    7273Extern int      proxy;          /* proxy server connection active */
    7374Extern int      proxflag;       /* proxy connection exists */
    7475Extern int      sunique;        /* store files on server with unique name */
  • netkit-ftp-0.17/ftp/ftp.c

    old new  
    132132static sigjmp_buf ptabort;
    133133static int ptabflg = 0;
    134134static int abrtflag = 0;
     135struct sockaddr_in source;
    135136
    136137void lostpeer(int);
    137138extern int connected;
     
    153154char *
    154155hookup(const char *host, const char *port)
    155156{
    156         int s, tos, error;
     157        int s, tos, error, alen;
    157158        socklen_t len;
    158159        static char hostnamebuf[256];
    159160        struct addrinfo hints, *res, *res0;
     
    278279        }
    279280        if (verbose)
    280281                printf("Connected to %s (%s).\n", hostname, hbuf);
    281         if (getreply(0) > 2) {  /* read startup message from server */
     282        alen = sizeof(source);
     283        getsockname(s,(struct sockaddr*)&source, &alen);
     284        source.sin_port = 0;    /* We just want the addr, not the port */
     285
     286        if (getreply(0) > 2) {  /* read startup message from server    */
    282287                if (cin)
    283288                        (void) fclose(cin);
    284289                if (cout)
     
    12541259                        perror("ftp: socket");
    12551260                        return(1);
    12561261                }
     1262                if((multihome) &&
     1263                        bind(data, (struct sockaddr*)&source, sizeof(source)) == -1) {
     1264                        close(data);
     1265                        data = -1;
     1266                        perror("ftp multihome bind");
     1267                        return(1);
     1268                }
    12571269                if (options & SO_DEBUG &&
    12581270                    setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
    12591271                               sizeof (on)) < 0)
  • netkit-ftp-0.17/ftp/main.c

    old new  
    9393        printf("\t   -n: inhibit auto-login\n");
    9494        printf("\t   -e: disable readline support, if present\n");
    9595        printf("\t   -g: disable filename globbing\n");
     96        printf("\t   -m: don't force data channel interface to the same as control channel\n");
    9697        printf("\t   -v: verbose mode\n");
    9798        printf("\t   -t: enable packet tracing [nonfunctional]\n");
    9899        printf("\t   -d: enable debugging\n");
     
    120121        doglob = 1;
    121122        interactive = 1;
    122123        autologin = 1;
     124        multihome = 1;
    123125        passivemode = 1;
    124126
    125127        cp = strrchr(argv[0], '/');
     
    172174                                rl_inhibit = 1;
    173175                                break;
    174176                               
     177                        case 'm':
     178                                multihome = 0;
     179                                break;
     180
    175181                        case 'h':
    176182                                usage();
    177183                                exit(0);
  • netkit-ftp-0.17/ftp/ftp.1

    old new  
    9292executable. Otherwise, does nothing.
    9393.It Fl g
    9494Disables file name globbing.
     95.It Fl m
     96The default requires that ftp explicitly binds to the same interface for the data
     97channel as the control channel in passive mode. Useful on multi-homed
     98clients. This option disables this behavior.
    9599.It Fl v
    96100Verbose option forces
    97101.Nm ftp
Note: See TracBrowser for help on using the repository browser.