Date: Sun, 13 Oct 2002 19:43:18 +0200 (CEST) From: Cejka Rudolf <cejkar@fit.vutbr.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/44019: Fixes for ftp/wu-ftpd-2.6.2 Message-ID: <200210131743.g9DHhIkW013100@kazi.fit.vutbr.cz>
next in thread | raw e-mail | index | archive | help
>Number: 44019 >Category: ports >Synopsis: Fixes for ftp/wu-ftpd-2.6.2 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Oct 13 10:50:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Rudolf Cejka >Release: FreeBSD 4.6-STABLE i386 >Organization: FIT, Brno University of Technology, Czech Republic >Environment: >Description: I have several patches for ftp/wu-ftpd-2.6.2, which I use on ftp.cz.FreeBSD.org in various modifications for more than one year, so I finally decided I can share them with others ;-) patch-ra: This is not very good patch and there should be a better fix, but I use it and it works for me with full satisfaction - problems with SIGPIPE on sockets: If somebody downloads a file and connection is broken (you can use kill -9 ftp_client), partial download is not logged into xferlog and information about partially downloaded file is lost. Authors of wu-ftpd said to me, that on Linux it works, so maybe broken connection on Linux does not generate SIGPIPE and maybe we can use "Implement SO_NOSIGPIPE option for sockets." since June 2002 instead of my old patch. patch-rb: NCARGS (= ARG_MAX = 65536) is very small on FreeBSD and it is used in wu-ftpd in place, where it is not needed. If you use file completion in ftp client (NLIST command on server) in some big directory, for example in FreeBSD/distfiles with > 100 KB of filenames, wu-ftpd daemon in this listing fails. This patch increases NCARGS by using another macro from 65536 to 524288 - I hope it is sufficient for most cases. patch-rc: Since transition to configure, ftpd process title is not updated and it is not possible without this patch (or define SPT_TYPE for compilation) to see ftpd status via ftpwho or ps -ax listing. patch-rd - patch-rk: It is very easy to download more than MAX_INT bytes now... So extend session statistics to long long and when client is exiting session, goodbye message with session statistics is not overflowed. -- cut here -- patch-ra: --- src/ftpd.x Thu Jan 11 14:33:12 2001 +++ src/ftpd.c Thu Jan 11 14:35:17 2001 @@ -936,7 +936,7 @@ #endif #ifdef SIGPIPE - (void) signal(SIGPIPE, lostconn); + (void) signal(SIGPIPE, SIG_IGN); #ifdef NEED_SIGFIX sigaddset(&block_sigmask, SIGPIPE); #endif -- cut here -- cut here -- patch-rb: --- src/glob.x Thu Jan 11 14:37:12 2001 +++ src/glob.c Thu Jan 11 14:37:27 2001 @@ -45,10 +45,12 @@ #include "proto.h" +#define ARGSIZ (524288) + #define QUOTE 0200 #define TRIM 0177 #define eq(a,b) (strcmp(a, b)==0) -#define GAVSIZ (NCARGS/6) +#define GAVSIZ (ARGSIZ/6) #define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR) static char **gargv; /* Pointer to the (stack) arglist */ @@ -149,7 +151,7 @@ gargv = agargv; sortbas = agargv; gargc = 0; - gnleft = NCARGS - 4; + gnleft = ARGSIZ - 4; } static void collect(register char *as) -- cut here -- cut here -- patch-rc: --- src/ftpd.x Mon Jun 24 15:23:31 2002 +++ src/ftpd.c Mon Jun 24 15:23:47 2002 @@ -6587,7 +6587,7 @@ #define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf)) #ifndef SPT_TYPE -#define SPT_TYPE SPT_REUSEARGV +#define SPT_TYPE SPT_BUILTIN #endif #if SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN -- cut here -- cut here -- patch-rd: --- src/acl.x Mon Jun 24 15:56:40 2002 +++ src/acl.c Mon Jun 24 16:00:05 2002 @@ -161,7 +161,7 @@ } else { if (!(aclbuf = (char *) malloc((unsigned) finfo.st_size + 1))) { - syslog(LOG_ERR, "could not malloc aclbuf (%d bytes)", finfo.st_size + 1); + syslog(LOG_ERR, "could not malloc aclbuf (%qd bytes)", finfo.st_size + 1); (void) fclose(aclfile); return (0); } -- cut here -- cut here -- patch-re: --- configure.in Mon Jun 24 16:27:48 2002 +++ configure.x Mon Jun 24 16:27:29 2002 @@ -601,7 +601,7 @@ if(sizeof(time_t)<=4) return 0; return 1; -}],[ result="u" +}],[ result="lu" AC_DEFINE_UNQUOTED(T_FORMAT, "$result") AC_MSG_RESULT(time_t is just a long - using %u)],[ result="no" ], [ result="no" ]) if test $result = "no"; then -- cut here -- cut here -- patch-rf: --- src/private.x Mon Jun 24 16:03:52 2002 +++ src/private.c Mon Jun 24 16:04:04 2002 @@ -209,7 +209,7 @@ } else { if (!(passbuf = (char *) malloc((unsigned) finfo.st_size + 1))) { - (void) syslog(LOG_ERR, "could not malloc passbuf (%d bytes)", + (void) syslog(LOG_ERR, "could not malloc passbuf (%qd bytes)", finfo.st_size + 1); (void) fclose(prvfile); return; -- cut here -- cut here -- patch-rg: --- src/conversions.x Mon Jun 24 16:04:28 2002 +++ src/conversions.c Mon Jun 24 16:04:36 2002 @@ -107,7 +107,7 @@ } else { if (!(convbuf = (char *) malloc((unsigned) finfo.st_size + 1))) { - syslog(LOG_ERR, "could not malloc convbuf (%d bytes)", finfo.st_size + 1); + syslog(LOG_ERR, "could not malloc convbuf (%qd bytes)", finfo.st_size + 1); (void) fclose(convfile); return (0); } -- cut here -- cut here -- patch-rh: --- src/ftpd.x Mon Jun 24 16:15:23 2002 +++ src/ftpd.c Mon Jun 24 16:19:26 2002 @@ -307,31 +307,31 @@ int TCPwindowsize = 0; /* 0 = use system default */ #ifdef TRANSFER_COUNT -int data_count_total = 0; /* total number of data bytes */ -int data_count_in = 0; -int data_count_out = 0; -int byte_count_total = 0; /* total number of general traffic */ -int byte_count_in = 0; -int byte_count_out = 0; -int file_count_total = 0; /* total number of data files */ -int file_count_in = 0; -int file_count_out = 0; -int xfer_count_total = 0; /* total number of transfers */ -int xfer_count_in = 0; -int xfer_count_out = 0; +long long data_count_total = 0; /* total number of data bytes */ +long long data_count_in = 0; +long long data_count_out = 0; +long long byte_count_total = 0; /* total number of general traffic */ +long long byte_count_in = 0; +long long byte_count_out = 0; +long long file_count_total = 0; /* total number of data files */ +long long file_count_in = 0; +long long file_count_out = 0; +long long xfer_count_total = 0; /* total number of transfers */ +long long xfer_count_in = 0; +long long xfer_count_out = 0; #ifdef TRANSFER_LIMIT -int file_limit_raw_in = 0; -int file_limit_raw_out = 0; -int file_limit_raw_total = 0; -int file_limit_data_in = 0; -int file_limit_data_out = 0; -int file_limit_data_total = 0; -int data_limit_raw_in = 0; -int data_limit_raw_out = 0; -int data_limit_raw_total = 0; -int data_limit_data_in = 0; -int data_limit_data_out = 0; -int data_limit_data_total = 0; +long long file_limit_raw_in = 0; +long long file_limit_raw_out = 0; +long long file_limit_raw_total = 0; +long long file_limit_data_in = 0; +long long file_limit_data_out = 0; +long long file_limit_data_total = 0; +long long data_limit_raw_in = 0; +long long data_limit_raw_out = 0; +long long data_limit_raw_total = 0; +long long data_limit_data_in = 0; +long long data_limit_data_out = 0; +long long data_limit_data_total = 0; #ifdef RATIO /* 1998/08/04 K.Wakui */ #define TRUNC_KB(n) ((n)/1024+(((n)%1024)?1:0)) off_t total_free_dl = 0; @@ -5385,12 +5385,12 @@ else lreply(0, " No data connection"); #ifdef TRANSFER_COUNT - lreply(0, " %d data bytes received in %d files", data_count_in, file_count_in); - lreply(0, " %d data bytes transmitted in %d files", data_count_out, file_count_out); - lreply(0, " %d data bytes total in %d files", data_count_total, file_count_total); - lreply(0, " %d traffic bytes received in %d transfers", byte_count_in, xfer_count_in); - lreply(0, " %d traffic bytes transmitted in %d transfers", byte_count_out, xfer_count_out); - lreply(0, " %d traffic bytes total in %d transfers", byte_count_total, xfer_count_total); + lreply(0, " %qd data bytes received in %qd files", data_count_in, file_count_in); + lreply(0, " %qd data bytes transmitted in %qd files", data_count_out, file_count_out); + lreply(0, " %qd data bytes total in %qd files", data_count_total, file_count_total); + lreply(0, " %qd traffic bytes received in %qd transfers", byte_count_in, xfer_count_in); + lreply(0, " %qd traffic bytes transmitted in %qd transfers", byte_count_out, xfer_count_out); + lreply(0, " %qd traffic bytes total in %qd transfers", byte_count_total, xfer_count_total); #endif reply(211, "End of status"); } -- cut here -- cut here -- patch-ri: --- src/ftpcmd.x Mon Jun 24 16:19:53 2002 +++ src/ftpcmd.y Mon Jun 24 16:20:40 2002 @@ -100,18 +100,18 @@ extern int restricted_user; /* global flag indicating if user is restricted to home directory */ #ifdef TRANSFER_COUNT -extern int data_count_total; -extern int data_count_in; -extern int data_count_out; -extern int byte_count_total; -extern int byte_count_in; -extern int byte_count_out; -extern int file_count_total; -extern int file_count_in; -extern int file_count_out; -extern int xfer_count_total; -extern int xfer_count_in; -extern int xfer_count_out; +extern long long data_count_total; +extern long long data_count_in; +extern long long data_count_out; +extern long long byte_count_total; +extern long long byte_count_in; +extern long long byte_count_out; +extern long long file_count_total; +extern long long file_count_in; +extern long long file_count_out; +extern long long xfer_count_total; +extern long long xfer_count_in; +extern long long xfer_count_out; #endif extern int retrieve_is_data; @@ -884,8 +884,8 @@ syslog(LOG_INFO, "QUIT"); #ifdef TRANSFER_COUNT if (logged_in) { - lreply(221, "You have transferred %d bytes in %d files.", data_count_total, file_count_total); - lreply(221, "Total traffic for this session was %d bytes in %d transfers.", byte_count_total, xfer_count_total); + lreply(221, "You have transferred %qd bytes in %qd files.", data_count_total, file_count_total); + lreply(221, "Total traffic for this session was %qd bytes in %qd transfers.", byte_count_total, xfer_count_total); lreply(221, "Thank you for using the FTP service on %s.", hostname); } #endif /* TRANSFER_COUNT */ -- cut here -- cut here -- patch-rj: --- src/extensions.x Mon Jun 24 16:21:18 2002 +++ src/extensions.c Mon Jun 24 16:23:10 2002 @@ -108,31 +108,31 @@ pdata, anonymous, guest; #ifdef TRANSFER_COUNT -extern int data_count_total; /* total number of data bytes */ -extern int data_count_in; -extern int data_count_out; -extern int byte_count_total; /* total number of general traffic */ -extern int byte_count_in; -extern int byte_count_out; -extern int file_count_total; /* total number of data files */ -extern int file_count_in; -extern int file_count_out; -extern int xfer_count_total; /* total number of transfers */ -extern int xfer_count_in; -extern int xfer_count_out; +extern long long data_count_total; /* total number of data bytes */ +extern long long data_count_in; +extern long long data_count_out; +extern long long byte_count_total; /* total number of general traffic */ +extern long long byte_count_in; +extern long long byte_count_out; +extern long long file_count_total; /* total number of data files */ +extern long long file_count_in; +extern long long file_count_out; +extern long long xfer_count_total; /* total number of transfers */ +extern long long xfer_count_in; +extern long long xfer_count_out; #ifdef TRANSFER_LIMIT -extern int file_limit_raw_in; -extern int file_limit_raw_out; -extern int file_limit_raw_total; -extern int file_limit_data_in; -extern int file_limit_data_out; -extern int file_limit_data_total; -extern int data_limit_raw_in; -extern int data_limit_raw_out; -extern int data_limit_raw_total; -extern int data_limit_data_in; -extern int data_limit_data_out; -extern int data_limit_data_total; +extern long long file_limit_raw_in; +extern long long file_limit_raw_out; +extern long long file_limit_raw_total; +extern long long file_limit_data_in; +extern long long file_limit_data_out; +extern long long file_limit_data_total; +extern long long data_limit_raw_in; +extern long long data_limit_raw_out; +extern long long data_limit_raw_total; +extern long long data_limit_data_in; +extern long long data_limit_data_out; +extern long long data_limit_data_total; #ifdef RATIO /* 1998/08/06 K.Wakui */ #define TRUNC_KB(n) ((n)/1024+(((n)%1024)?1:0)) extern time_t login_time; @@ -456,10 +456,10 @@ case 'x': switch (*++inptr) { case 'u': /* upload bytes */ - sprintf(outptr,"%d", TRUNC_KB(data_count_in) ); + sprintf(outptr,"%qd", TRUNC_KB(data_count_in) ); break; case 'd': /* download bytes */ - sprintf(outptr,"%d", TRUNC_KB(data_count_out) ); + sprintf(outptr,"%qd", TRUNC_KB(data_count_out) ); break; case 'R': /* rate 1:n */ if( upload_download_rate > 0 ) { @@ -499,16 +499,16 @@ break; case 'U': /* upload limit */ if( data_limit_raw_in > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_raw_in)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_raw_in)); } else if( data_limit_data_in > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_data_in)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_data_in)); } else if( data_limit_raw_total > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_raw_total)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_raw_total)); } else if( data_limit_data_total > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_data_total)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_data_total)); } else { strcpy(outptr, "unlimited"); @@ -516,16 +516,16 @@ break; case 'D': /* download limit */ if( data_limit_raw_out > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_raw_out)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_raw_out)); } else if( data_limit_data_out > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_data_out)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_data_out)); } else if( data_limit_raw_total > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_raw_total)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_raw_total)); } else if( data_limit_data_total > 0 ) { - sprintf(outptr,"%d", TRUNC_KB(data_limit_data_total)); + sprintf(outptr,"%qd", TRUNC_KB(data_limit_data_total)); } else { strcpy(outptr, "unlimited"); -- cut here -- cut here -- patch-rk: --- src/access.x Mon Jun 24 16:24:08 2002 +++ src/access.c Mon Jun 24 16:23:31 2002 @@ -886,12 +886,12 @@ int data_in = 0; int data_out = 0; int data_total = 0; - extern int file_limit_raw_in; - extern int file_limit_raw_out; - extern int file_limit_raw_total; - extern int file_limit_data_in; - extern int file_limit_data_out; - extern int file_limit_data_total; + extern long long file_limit_raw_in; + extern long long file_limit_raw_out; + extern long long file_limit_raw_total; + extern long long file_limit_data_in; + extern long long file_limit_data_out; + extern long long file_limit_data_total; /* file-limit [<raw>] <in|out|total> <count> [<class>] */ while (getaclentry("file-limit", &entry)) { -- cut here >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210131743.g9DHhIkW013100>