[cvslog] (2003-01-21 00:11:39 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Mon Jan 20 18:12:01 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2003-01-21 00:11:39 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/dccutil.c src/modules.c src/tcl.c
     src/mod/module.h src/mod/transfer.mod/transfer.c
     src/mod/transfer.mod/transfer.h

Log message:

Files copied to /tmp if copy-to-tmp is enabled were not erased when a
tcl_killdcc was preformed on a transfer idx. Fixing this required that
copy-to-tmp be moved to the core and then exported to modules. I also
cleaned up a few things I noticed along the way.

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.445 eggdrop1.6/doc/UPDATES1.6:1.446
--- eggdrop1.6/doc/UPDATES1.6:1.445	Mon Jan 20 02:51:19 2003
+++ eggdrop1.6/doc/UPDATES1.6	Mon Jan 20 18:11:29 2003
@@ -1,10 +1,13 @@
-$Id: UPDATES1.6,v 1.445 2003/01/20 08:51:19 wcc Exp $
+$Id: UPDATES1.6,v 1.446 2003/01/21 00:11:29 wcc Exp $
 
 Changes in Eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.14
 Found by  Fixed by  What...
+          Wcc       files copied to /tmp from file transfers are now deleted
+                    if the transfer connection is killed (makes resends and
+                    resumes function correctly)
 BarkerJr  Wcc       ignores are now saved if channels.mod is not loaded
 fbs       fbs/      open file descriptors are now closed when the killdcc Tcl
           Wcc       command is used on a transfer socket
Index: eggdrop1.6/src/dccutil.c
diff -u eggdrop1.6/src/dccutil.c:1.43 eggdrop1.6/src/dccutil.c:1.44
--- eggdrop1.6/src/dccutil.c:1.43	Mon Jan 20 02:54:54 2003
+++ eggdrop1.6/src/dccutil.c	Mon Jan 20 18:11:29 2003
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.43 2003/01/20 08:54:54 wcc Exp $
+ * $Id: dccutil.c,v 1.44 2003/01/21 00:11:29 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -258,9 +258,24 @@
 /* Closes an open FD for transfer sockets. */
 void killtransfer(int n)
 {
-  if ((dcc[n].u.xfer->f) && (dcc[n].type->flags & DCT_FILETRAN)) {
-    fclose(dcc[n].u.xfer->f);
-    dcc[n].u.xfer->f = NULL;
+  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) {
+      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);
+    }
   }
 }
 
Index: eggdrop1.6/src/mod/module.h
diff -u eggdrop1.6/src/mod/module.h:1.65 eggdrop1.6/src/mod/module.h:1.66
--- eggdrop1.6/src/mod/module.h:1.65	Mon Jan 20 02:51:19 2003
+++ eggdrop1.6/src/mod/module.h	Mon Jan 20 18:11:29 2003
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.65 2003/01/20 08:51:19 wcc Exp $
+ * $Id: module.h,v 1.66 2003/01/21 00:11:29 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -461,6 +461,7 @@
 #define wild_match_per ((int (*)(const char *, const char *))global[280])
 #define killtransfer ((void(*)(int))global[281])
 #define write_ignores ((int (*)(FILE *, int))global[282])
+#define copy_to_tmp (*(int *)(global[283]))
 
 /* This is for blowfish module, couldnt be bothered making a whole new .h
  * file for it ;)
Index: eggdrop1.6/src/mod/transfer.mod/transfer.c
diff -u eggdrop1.6/src/mod/transfer.mod/transfer.c:1.56 eggdrop1.6/src/mod/transfer.mod/transfer.c:1.57
--- eggdrop1.6/src/mod/transfer.mod/transfer.c:1.56	Fri Dec 27 14:27:40 2002
+++ eggdrop1.6/src/mod/transfer.mod/transfer.c	Mon Jan 20 18:11:29 2003
@@ -1,7 +1,7 @@
 /*
  * transfer.c -- part of transfer.mod
  *
- * $Id: transfer.c,v 1.56 2002/12/27 20:27:40 wcc Exp $
+ * $Id: transfer.c,v 1.57 2003/01/21 00:11:29 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -44,14 +44,13 @@
 
 static Function *global = NULL;
 
-static int copy_to_tmp = 1;	/* Copy files to /tmp before transmitting? */
-static int wait_dcc_xfer = 300;	/* Timeout time on DCC xfers */
 static p_tcl_bind_list H_rcvd, H_sent, H_lost, H_tout;
-static int dcc_limit = 3;	/* Maximum number of simultaneous file
-				   downloads allowed */
+
+static int wait_dcc_xfer = 300;	/* Timeout time on DCC xfers */
+static int dcc_limit = 3;	/* Max simultaneous downloads allowed */
 static int dcc_block = 0;	/* Size of one dcc block */
-static int quiet_reject;        /* Quietly reject dcc chat or sends from
-                                   users without access? */
+static int quiet_reject;        /* Quietly reject dcc chat or sends from users
+				   without access? */
 
 /*
  * Prototypes
@@ -1516,7 +1515,6 @@
 {
   {"max-dloads",	&dcc_limit},
   {"dcc-block",		&dcc_block},
-  {"copy-to-tmp",	&copy_to_tmp},
   {"xfer-timeout",	&wait_dcc_xfer},
   {NULL,		NULL}
 };
@@ -1942,7 +1940,7 @@
   /* 4- 7 */
   (Function) & DCC_FORK_SEND,		/* struct dcc_table		*/
   (Function) at_limit,
-  (Function) & copy_to_tmp,		/* int				*/
+  (Function) 0,				/* Was copy_to_tmp <Wcc[01/20/03]>. */
   (Function) fileq_cancel,
   /* 8 - 11 */
   (Function) queue_file,
Index: eggdrop1.6/src/mod/transfer.mod/transfer.h
diff -u eggdrop1.6/src/mod/transfer.mod/transfer.h:1.15 eggdrop1.6/src/mod/transfer.mod/transfer.h:1.16
--- eggdrop1.6/src/mod/transfer.mod/transfer.h:1.15	Mon Dec 23 20:30:09 2002
+++ eggdrop1.6/src/mod/transfer.mod/transfer.h	Mon Jan 20 18:11:29 2003
@@ -1,7 +1,7 @@
 /*
  * transfer.h -- part of transfer.mod
  *
- * $Id: transfer.h,v 1.15 2002/12/24 02:30:09 wcc Exp $
+ * $Id: transfer.h,v 1.16 2003/01/21 00:11:29 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -37,7 +37,7 @@
 /* 4 - 7 */
 #define DCC_FORK_SEND (*(struct dcc_table *)(transfer_funcs[4]))
 #define at_limit(a) (((int (*) (char *))transfer_funcs[5])(a))
-#define copy_to_tmp (*(int *)(transfer_funcs[6]))
+/* Was copy_to_tmp (moved to core) <Wcc[01/20/03]>. */
 #define fileq_cancel(a,b) (((void (*) (int,char *))transfer_funcs[7])(a,b))
 /* 8 - 11 */
 #define queue_file(a,b,c,d) (((void (*)(char *,char *,char *,char *))transfer_funcs[8])(a,b,c,d))
Index: eggdrop1.6/src/modules.c
diff -u eggdrop1.6/src/modules.c:1.73 eggdrop1.6/src/modules.c:1.74
--- eggdrop1.6/src/modules.c:1.73	Mon Jan 20 02:51:19 2003
+++ eggdrop1.6/src/modules.c	Mon Jan 20 18:11:29 2003
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.73 2003/01/20 08:51:19 wcc Exp $
+ * $Id: modules.c,v 1.74 2003/01/21 00:11:29 wcc Exp $
  */
 /* 
  * Copyright (C) 1997 Robey Pointer
@@ -65,25 +65,25 @@
 
 #include "users.h"
 
-extern Tcl_Interp	*interp;
-extern struct userrec	*userlist, *lastuser;
-extern char		 tempdir[], botnetnick[], botname[], natip[],
-			 hostname[], origbotname[], botuser[], admin[],
-			 userfile[], ver[], notify_new[], helpdir[],
-			 version[], quit_msg[];
-extern int	 noshare, dcc_total, egg_numver, userfile_perm,
-			 use_console_r, ignore_time, must_be_owner,
-			 debug_output, make_userfile, default_flags,
-			 require_p, max_dcc, share_greet, password_timeout,
-			 use_invites, use_exempts, force_expire, do_restart,
-			 protect_readonly, reserved_port_min, reserved_port_max;
-extern time_t now, online_since;
+
+extern struct userrec   *userlist, *lastuser;
 extern struct chanset_t *chanset;
-extern tand_t *tandbot;
+
+extern char tempdir[], botnetnick[], botname[], natip[], hostname[],
+            origbotname[], botuser[], admin[], userfile[], ver[], notify_new[],
+            helpdir[], version[], quit_msg[];
+extern int  parties, noshare, dcc_total, egg_numver, userfile_perm, do_restart,
+            use_console_r, ignore_time, must_be_owner, debug_output, max_dcc,
+            make_userfile, default_flags, require_p, share_greet, use_invites,
+            password_timeout, use_exempts, force_expire, protect_readonly,
+            reserved_port_min, reserved_port_max, copy_to_tmp;
+
 extern party_t *party;
-extern int parties;
-extern sock_list        *socklist;
+extern time_t  now, online_since;
+extern tand_t  *tandbot;
 
+extern Tcl_Interp *interp;
+extern sock_list  *socklist;
 
 int cmd_die();
 int xtra_kill();
@@ -539,7 +539,7 @@
   (Function) quit_msg,		/* char *				*/
   (Function) module_load,
   (Function) module_unload,
-  (Function) & parties,	/* int					*/
+  (Function) & parties, 	/* int					*/
   /* 276 - 279 */
   (Function) tell_bottree,
   (Function) MD5_Init,
@@ -548,7 +548,8 @@
   /* 280 - 283 */
   (Function) _wild_match_per,
   (Function) killtransfer,
-  (Function) write_ignores
+  (Function) write_ignores,
+  (Function) & copy_to_tmp	/* int					*/
 };
 
 void init_modules(void)
Index: eggdrop1.6/src/tcl.c
diff -u eggdrop1.6/src/tcl.c:1.54 eggdrop1.6/src/tcl.c:1.55
--- eggdrop1.6/src/tcl.c:1.54	Mon Dec 23 20:30:05 2002
+++ eggdrop1.6/src/tcl.c	Mon Jan 20 18:11:29 2003
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.54 2002/12/24 02:30:05 wcc Exp $
+ * $Id: tcl.c,v 1.55 2003/01/21 00:11:29 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -48,50 +48,49 @@
 
 
 extern time_t	online_since;
-extern int	backgrd, flood_telnet_thr, flood_telnet_time;
-extern int	shtime, share_greet, require_p, keep_all_logs;
-extern int	allow_new_telnets, stealth_telnets, use_telnet_banner;
-extern int	default_flags, conmask, switch_logfiles_at, connect_timeout;
-extern int	firewallport, notify_users_at, flood_thr, ignore_time;
-extern int	reserved_port_min, reserved_port_max;
-extern char	origbotname[], botuser[], motdfile[], admin[], userfile[],
-		firewall[], helpdir[], notify_new[], hostname[], myip[],
-		moddir[], tempdir[], owner[], network[], botnetnick[],
-		bannerfile[], egg_version[], natip[], configfile[],
-		logfile_suffix[], textdir[], pid_file[];
-extern int	die_on_sighup, die_on_sigterm, max_logs, max_logsize,
-		enable_simul, dcc_total, debug_output, identtimeout,
-		protect_telnet, dupwait_timeout, egg_numver, share_unlinks,
-		dcc_sanitycheck, sort_users, tands, resolve_timeout,
-		default_uflags, strict_host, userfile_perm;
-extern struct dcc_t	*dcc;
-extern tcl_timer_t	*timer, *utimer;
-
-int	    protect_readonly = 0;	/* turn on/off readonly protection */
-char	    whois_fields[1025] = "";	/* fields to display in a .whois */
-Tcl_Interp *interp;			/* eggdrop always uses the same
-					   interpreter */
-int	    dcc_flood_thr = 3;
-int	    use_invites = 0;		/* Jason/drummer */
-int	    use_exempts = 0;		/* Jason/drummer */
-int	    force_expire = 0;		/* Rufus */
-int	    remote_boots = 2;
-int	    allow_dk_cmds = 1;
-int	    must_be_owner = 1;
-int	    max_dcc = 20;		/* needs at least 4 or 5 just to
-					   get started. 20 should be enough   */
-int	    quick_logs = 0;		/* quick write logs? (flush them
-					   every min instead of every 5	      */
-int	    par_telnet_flood = 1;       /* trigger telnet flood for +f
-					   ppl? - dw			      */
-int	    quiet_save = 0;             /* quiet-save patch by Lucas	      */
-int	    strtot = 0;
-int 	    handlen = HANDLEN;
-int	    utftot = 0;
-int	    clientdata_stuff = 0;
 
+extern char origbotname[], botuser[], motdfile[], admin[], userfile[],
+            firewall[], helpdir[], notify_new[], hostname[], myip[], moddir[],
+            tempdir[], owner[], network[], botnetnick[], bannerfile[],
+            egg_version[], natip[], configfile[], logfile_suffix[], textdir[],
+            pid_file[];
+extern int  backgrd, flood_telnet_thr, flood_telnet_time, shtime, share_greet,
+            require_p, keep_all_logs,  allow_new_telnets, stealth_telnets,
+            use_telnet_banner, default_flags, conmask, switch_logfiles_at,
+            connect_timeout, firewallport, notify_users_at, flood_thr,
+            ignore_time, reserved_port_min, reserved_port_max, die_on_sighup,
+            die_on_sigterm, max_logs, max_logsize, enable_simul, dcc_total,
+            debug_output, identtimeout, protect_telnet, dupwait_timeout,
+            egg_numver, share_unlinks, dcc_sanitycheck, sort_users, tands,
+            resolve_timeout, default_uflags, strict_host, userfile_perm;
+	
+extern struct dcc_t *dcc;
+extern tcl_timer_t  *timer, *utimer;
+
+Tcl_Interp *interp;
+
+int  protect_readonly = 0;	/* turn on/off readonly protection */
+char whois_fields[1025] = "";
+
+int dcc_flood_thr = 3;
+int use_invites = 0;		/* Jason/drummer */
+int use_exempts = 0;		/* Jason/drummer */
+int force_expire = 0;		/* Rufus */
+int remote_boots = 2;
+int allow_dk_cmds = 1;
+int must_be_owner = 1;
+int copy_to_tmp = 1;
+int max_dcc = 20;
+int quick_logs = 0;
+int par_telnet_flood = 1;       /* dw */
+int quiet_save = 0;             /* Lucas */
+int strtot = 0;
+int handlen = HANDLEN;
+int utftot = 0;
+int clientdata_stuff = 0;
 
-/* Prototypes for tcl */
+
+/* Prototypes for Tcl */
 Tcl_Interp *Tcl_CreateInterp();
 
 int expmem_tcl()
@@ -489,8 +488,7 @@
   {"hourly-updates",		&notify_users_at,	0},
   {"switch-logfiles-at",	&switch_logfiles_at,	0},
   {"connect-timeout",		&connect_timeout,	0},
-  {"reserved-port",		&reserved_port_min,		0},
-  /* booleans (really just ints) */
+  {"reserved-port",		&reserved_port_min,	0},
   {"require-p",			&require_p,		0},
   {"keep-all-logs",		&keep_all_logs,		0},
   {"open-telnets",		&allow_new_telnets,	0},
@@ -499,7 +497,6 @@
   {"uptime",			(int *) &online_since,	2},
   {"console",			&conmask,		0},
   {"default-flags",		&default_flags,		0},
-  /* moved from eggdrop.h */
   {"numversion",		&egg_numver,		2},
   {"die-on-sighup",		&die_on_sighup,		1},
   {"die-on-sigterm",		&die_on_sigterm,	1},
@@ -520,20 +517,21 @@
   {"resolve-timeout",		&resolve_timeout,	0},
   {"must-be-owner",		&must_be_owner,		1},
   {"paranoid-telnet-flood",	&par_telnet_flood,	0},
-  {"use-exempts",		&use_exempts,		0},			/* Jason/drummer */
-  {"use-invites",		&use_invites,		0},			/* Jason/drummer */
-  {"quiet-save",		&quiet_save,		0},			/* Lucas */
-  {"force-expire",		&force_expire,		0},			/* Rufus */
+  {"use-exempts",		&use_exempts,		0}, /* Jason/drummer */
+  {"use-invites",		&use_invites,		0}, /* Jason/drummer */
+  {"quiet-save",		&quiet_save,		0}, /* Lucas */
+  {"force-expire",		&force_expire,		0}, /* Rufus */
   {"dupwait-timeout",		&dupwait_timeout,	0},
-  {"strict-host",		&strict_host,		0}, 			/* drummer */
+  {"strict-host",		&strict_host,		0}, /* drummer */
   {"userfile-perm",		&userfile_perm,		0},
-  {NULL,			NULL,			0}	/* arthur2 */
+  {"copy-to-tmp",               &copy_to_tmp,		0},
+  {NULL,			NULL,			0}  /* arthur2 */
 };
 
 static tcl_coups def_tcl_coups[] =
 {
-  {"telnet-flood",	&flood_telnet_thr,	&flood_telnet_time},
-  {"reserved-portrange", &reserved_port_min, &reserved_port_max},
+  {"telnet-flood",	 &flood_telnet_thr,	&flood_telnet_time},
+  {"reserved-portrange", &reserved_port_min,	&reserved_port_max},
   {NULL,		NULL,			NULL}
 };
 
----------------------- End of diff -----------------------



More information about the Changes mailing list