diff --git a/doc/sphinx_source/modules/mod/transfer.rst b/doc/sphinx_source/modules/mod/transfer.rst index d914c64c6..1d804c229 100644 --- a/doc/sphinx_source/modules/mod/transfer.rst +++ b/doc/sphinx_source/modules/mod/transfer.rst @@ -1,4 +1,4 @@ -Last revised: January 1, 2002 +Last revised: November 29, 2023 .. _transfer: @@ -27,13 +27,6 @@ There are also some variables you can set in your config file: but admits that may be too small. 1024 is standard these days. Set this to 0 to use turbo-dcc (recommended). - set copy-to-tmp 1 - Enable this setting if you want to copy files to a temporary location - before sending or receiving them. This might be useful for file - stability, but if your directories are NFS mounted, it's a pain. - Setting this to 1 is not advised for big files or if you're low on - disk space. - set xfer-timeout 30 Set here the time (in seconds) to wait before an inactive transfer times out. diff --git a/doc/sphinx_source/using/tcl-commands.rst b/doc/sphinx_source/using/tcl-commands.rst index 34399b0e9..2f8f9717c 100644 --- a/doc/sphinx_source/using/tcl-commands.rst +++ b/doc/sphinx_source/using/tcl-commands.rst @@ -1,7 +1,7 @@ .. highlight:: text Eggdrop Tcl Commands -Last revised: January 24, 2021 +Last revised: November 29, 2023 ==================== Eggdrop Tcl Commands @@ -2011,9 +2011,6 @@ dccsend | 4 | the file was queued for later transfer, which means that person has | | | too many file transfers going right now | +-------+---------------------------------------------------------------------+ - | 5 | copy-to-tmp is enabled and the file already exists in the temp | - | | directory | - +-------+---------------------------------------------------------------------+ Module: transfer diff --git a/eggdrop.conf b/eggdrop.conf index 1b8de6651..fedb6d919 100755 --- a/eggdrop.conf +++ b/eggdrop.conf @@ -1445,12 +1445,6 @@ set max-dloads 3 # 0 is turbo-dcc (recommended). set dcc-block 0 -# Enable this setting if you want to copy files to a temporary location before -# sending or receiving them. This might be useful for file stability, but if -# your directories are NFS mounted, it's a pain. Setting this to 1 is not -# advised for big files or if you're low on disk space. -set copy-to-tmp 1 - # Set here the time (in seconds) to wait before an inactive transfer times out. set xfer-timeout 30 diff --git a/src/dccutil.c b/src/dccutil.c index b3a80e2cb..e1223b2af 100644 --- a/src/dccutil.c +++ b/src/dccutil.c @@ -33,7 +33,7 @@ #include "tandem.h" extern struct dcc_t *dcc; -extern int dcc_total, dcc_flood_thr, backgrd, copy_to_tmp, max_socks; +extern int dcc_total, dcc_flood_thr, backgrd, max_socks; extern char botnetnick[], version[]; extern time_t now; extern sock_list *socklist; @@ -311,25 +311,11 @@ void dcc_chatter(int idx) /* Closes an open FD for transfer sockets. */ void killtransfer(int n) { - int i, ok = 1; - if (dcc[n].type->flags & DCT_FILETRAN) { if (dcc[n].u.xfer->f) { fclose(dcc[n].u.xfer->f); dcc[n].u.xfer->f = NULL; } - if (dcc[n].u.xfer->filename && copy_to_tmp) { - for (i = 0; i < dcc_total; i++) { - if ((i != n) && (dcc[i].type->flags & DCT_FILETRAN) && - (dcc[i].u.xfer->filename) && - (!strcmp(dcc[i].u.xfer->filename, dcc[n].u.xfer->filename))) { - ok = 0; - break; - } - } - if (ok) - unlink(dcc[n].u.xfer->filename); - } } } diff --git a/src/mod/filesys.mod/filesys.c b/src/mod/filesys.mod/filesys.c index 5b40ffebd..53da53f3d 100644 --- a/src/mod/filesys.mod/filesys.c +++ b/src/mod/filesys.mod/filesys.c @@ -392,13 +392,6 @@ static int _dcc_send(int idx, char *filename, char *nick, int resend) dcc[idx].nick); return 0; } - if (x == DCCSEND_FCOPY) { - dprintf(idx, "Can't make temporary copy of file!\n"); - putlog(LOG_FILES | LOG_MISC, "*", - "Refused dcc %sget %s: copy to temporary location FAILED!", - resend ? "re" : "", filename); - return 0; - } nfn = strrchr(filename, '/'); if (nfn == NULL) nfn = filename; diff --git a/src/mod/share.mod/share.c b/src/mod/share.mod/share.c index 40452536a..247c0b781 100644 --- a/src/mod/share.mod/share.c +++ b/src/mod/share.mod/share.c @@ -1242,10 +1242,7 @@ static void share_ufsend(int idx, char *par) putlog(LOG_MISC, "*", "NO MORE DCC CONNECTIONS -- can't grab userfile"); dprintf(idx, "s e I can't open a DCC to you; I'm full.\n"); zapfbot(idx); - } else if (copy_to_tmp && !(f = tmpfile())) { - putlog(LOG_MISC, "*", "CAN'T WRITE TEMPORARY USERFILE DOWNLOAD FILE!"); - zapfbot(idx); - } else if (!copy_to_tmp && !(f = fopen(s, "wb"))) { + } else if (!(f = fopen(s, "wb"))) { putlog(LOG_MISC, "*", "CAN'T WRITE USERFILE DOWNLOAD FILE!"); zapfbot(idx); } else { @@ -2353,7 +2350,7 @@ char *share_start(Function *global_funcs) global = global_funcs; - module_register(MODULE_NAME, share_table, 2, 4); + module_register(MODULE_NAME, share_table, 2, 5); if (!module_depend(MODULE_NAME, "eggdrop", 108, 0)) { module_undepend(MODULE_NAME); return "This module requires Eggdrop 1.8.0 or later."; diff --git a/src/mod/transfer.mod/help/set/transfer.help b/src/mod/transfer.mod/help/set/transfer.help index 1a5b01505..959b4d448 100644 --- a/src/mod/transfer.mod/help/set/transfer.help +++ b/src/mod/transfer.mod/help/set/transfer.help @@ -16,13 +16,6 @@ mode, the bot will dump transfers as fast as possible, only stopping to count acks after it's finished. This can dramatically improve the speed of file transfers, and is recommended. -%{help=set copy-to-tmp}%{+n} -### %bset copy-to-tmp%b <0/1> - Enable this setting if you want to copy files to a temporary location - before sending or receiving them. This might be useful for file - stability, but if your directories are NFS mounted, it's a pain. - Setting this to 1 is not advised for big files or if you're low on - disk space. %{help=set xfer-timeout}%{+n} ### %bset xfer-timeout%b <#> This is the number of seconds to wait before a dcc send or get is diff --git a/src/mod/transfer.mod/help/transfer.help b/src/mod/transfer.mod/help/transfer.help index bc64802ac..2af240cf3 100644 --- a/src/mod/transfer.mod/help/transfer.help +++ b/src/mod/transfer.mod/help/transfer.help @@ -4,6 +4,6 @@ support for userfile sharing. Config file variables for configuring the transfer module: - %bxfer-timeout copy-to-tmp dcc-block%b - %bmax-dloads sharefail-unlink%b + %bxfer-timeout dcc-block max-dloads%b + %bsharefail-unlink%b (Use %b'.help set '%b for more info) diff --git a/src/mod/transfer.mod/transfer.c b/src/mod/transfer.mod/transfer.c index 1c7c39342..69e89496f 100644 --- a/src/mod/transfer.mod/transfer.c +++ b/src/mod/transfer.mod/transfer.c @@ -291,10 +291,9 @@ static void eof_dcc_send(int idx) + strlen(dcc[idx].u.xfer->origname) + 1); sprintf(nfn, "%s%s", dcc[idx].u.xfer->dir, dcc[idx].u.xfer->origname); - if (copy_to_tmp && (l = fcopyfile(dcc[idx].u.xfer->f, nfn))) { - putlog(LOG_MISC | LOG_FILES, "*", TRANSFER_FAILED_MOVE, nfn); - } - /* Only close now in case it was a tmpfile, as it's deleted upon close */ + /* Only close now in case it was a tmpfile, as it's deleted upon close + * TODO: This comment could be checked after copy-to-tmp was removed + */ fclose(dcc[idx].u.xfer->f); /* lookup handle */ @@ -302,17 +301,14 @@ static void eof_dcc_send(int idx) u = get_user_by_host(s); hand = u ? u->handle : "*"; - /* Add to file database if not tmpfile or if copyfile succeeded */ - if (!copy_to_tmp || !l) { - module_entry *fs = module_find("filesys", 0, 0); - - if (fs != NULL) { - Function f = fs->funcs[FILESYS_ADDFILE]; - f(dcc[idx].u.xfer->dir, dcc[idx].u.xfer->origname, hand); - } - stats_add_upload(u, dcc[idx].u.xfer->length); - check_tcl_sentrcvd(u, dcc[idx].nick, nfn, H_rcvd); + /* Add to file database */ + module_entry *fs = module_find("filesys", 0, 0); + if (fs != NULL) { + Function f = fs->funcs[FILESYS_ADDFILE]; + f(dcc[idx].u.xfer->dir, dcc[idx].u.xfer->origname, hand); } + stats_add_upload(u, dcc[idx].u.xfer->length); + check_tcl_sentrcvd(u, dcc[idx].nick, nfn, H_rcvd); nfree(nfn); ok = 0; @@ -988,18 +984,7 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from, else nfn++; - if (copy_to_tmp) { - f = tmpfile(); - if (!f) - return DCCSEND_BADFN; - if (copyfilef(filename, f)) { - fclose(f); - return DCCSEND_FCOPY; - } - } else - f = fopen(filename, "r"); - - if (!f) + if (!(f = fopen(filename, "r"))) return DCCSEND_BADFN; if ((i = new_dcc(&DCC_GET_PENDING, sizeof(struct xfer_info))) == -1) { diff --git a/src/mod/transfer.mod/transfer.h b/src/mod/transfer.mod/transfer.h index 163190355..70c33633e 100644 --- a/src/mod/transfer.mod/transfer.h +++ b/src/mod/transfer.mod/transfer.h @@ -28,8 +28,7 @@ enum dccsend_types { DCCSEND_FULL, /* DCC table is full */ DCCSEND_NOSOCK, /* Can not open a listening socket */ DCCSEND_BADFN, /* No such file */ - DCCSEND_FEMPTY, /* File is empty */ - DCCSEND_FCOPY /* File failed to copy to tmpfile */ + DCCSEND_FEMPTY /* File is empty */ }; /* File matching */ @@ -65,7 +64,7 @@ enum dccsend_types { #define TRANSFER_NOTICE_FNTOOLONG get_language(0xf17) #define TRANSFER_TOO_BAD get_language(0xf18) #define TRANSFER_NOTICE_TOOBAD get_language(0xf19) -#define TRANSFER_FAILED_MOVE get_language(0xf1a) +/* #define TRANSFER_FAILED_MOVE get_language(0xf1a) */ #define TRANSFER_THANKS get_language(0xf1b) #define TRANSFER_NOTICE_THANKS get_language(0xf1c) #define TRANSFER_USERFILE_LOST get_language(0xf1d) diff --git a/src/mod/transfer.mod/transferqueue.c b/src/mod/transfer.mod/transferqueue.c index 101bfa235..9758bc213 100644 --- a/src/mod/transfer.mod/transferqueue.c +++ b/src/mod/transfer.mod/transferqueue.c @@ -140,11 +140,6 @@ static void send_next_file(char *to) dprintf(DP_HELP, TRANSFER_NOTICE_SOCKERR, this->to); strcpy(s, this->to); flush_fileq(s); - } else if (x == DCCSEND_FCOPY) { - putlog(LOG_FILES | LOG_MISC, "*", TRANSFER_COPY_FAILED, this->file); - dprintf(DP_HELP, TRANSFER_FILESYS_BROKEN, this->to); - strcpy(s, this->to); - flush_fileq(s); } else { if (x == DCCSEND_FEMPTY) { putlog(LOG_FILES, "*", TRANSFER_LOG_FILEEMPTY, this->file); diff --git a/src/modules.c b/src/modules.c index e1712489b..4737d2ea9 100644 --- a/src/modules.c +++ b/src/modules.c @@ -82,9 +82,11 @@ extern int parties, noshare, dcc_total, egg_numver, userfile_perm, ignore_time, must_be_owner, raw_log, max_dcc, make_userfile, default_flags, require_p, share_greet, use_invites, use_exempts, password_timeout, force_expire, protect_readonly, reserved_port_min, reserved_port_max, - copy_to_tmp, quiet_reject; + quiet_reject; extern volatile sig_atomic_t do_restart; +int copy_to_tmp = 0; /* TODO: remove from module API for eggdrop 2.0 */ + #ifdef IPV6 extern int pref_af; #endif diff --git a/src/tcl.c b/src/tcl.c index bbd12fcbc..6557645d5 100644 --- a/src/tcl.c +++ b/src/tcl.c @@ -86,7 +86,6 @@ int remote_boots = 2; int allow_dk_cmds = 1; int must_be_owner = 1; int quiet_reject = 1; -int copy_to_tmp = 1; int max_socks = 100; int quick_logs = 0; int par_telnet_flood = 1; @@ -498,7 +497,6 @@ static tcl_ints def_tcl_ints[] = { {"force-expire", &force_expire, 0}, {"dupwait-timeout", &dupwait_timeout, 0}, {"userfile-perm", &userfile_perm, 0}, - {"copy-to-tmp", ©_to_tmp, 0}, {"quiet-reject", &quiet_reject, 0}, {"cidr-support", &cidr_support, 0}, {"remove-pass", &remove_pass, 0},