[cvslog] Module eggdrop-devel: Change committed

cvslog cvs at tsss.iavalley.cc.ia.us
Fri Oct 27 14:40:01 CST 2000


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop-devel
Commit time: 2000-10-27 19:39:41 UTC

Modified files:
     doc/UPDATES1.5 src/patch.h src/mod/filesys.mod/dbcompat.c
     src/mod/filesys.mod/filedb3.c src/mod/filesys.mod/filedb3.h
     src/mod/filesys.mod/files.c

Log message:

fabian: applied filesys_remote_ln patch

---------------------- diff included ----------------------
Index: eggdrop-devel/doc/UPDATES1.5
diff -u eggdrop-devel/doc/UPDATES1.5:1.277 eggdrop-devel/doc/UPDATES1.5:1.278
--- eggdrop-devel/doc/UPDATES1.5:1.277	Fri Oct 27 14:38:50 2000
+++ eggdrop-devel/doc/UPDATES1.5	Fri Oct 27 14:39:30 2000
@@ -4,6 +4,9 @@
 
 1.5.5
 Found by  Fixed by  What...
+fabulous  Fabian    The filesys module did not support remotely linked files.
+                    Instead, the bot crashed in various places and didn't even
+                    attempt to save/load the link information.
           Eule      Removed duplicate servlimit check from irc.mod.
           Eule      Added `e' as global- and channel-flag for users exempted
                     from the stopnethack checks.
Index: eggdrop-devel/src/mod/filesys.mod/dbcompat.c
diff -u eggdrop-devel/src/mod/filesys.mod/dbcompat.c:1.7 eggdrop-devel/src/mod/filesys.mod/dbcompat.c:1.8
--- eggdrop-devel/src/mod/filesys.mod/dbcompat.c:1.7	Sat Mar  4 14:38:20 2000
+++ eggdrop-devel/src/mod/filesys.mod/dbcompat.c	Fri Oct 27 14:39:30 2000
@@ -4,7 +4,7 @@
  * 
  * Written for filedb3 by Fabian Knittel <fknittel at gmx.de>
  * 
- * $Id: dbcompat.c,v 1.7 2000/03/04 20:38:20 fabian Exp $
+ * $Id: dbcompat.c,v 1.8 2000/10/27 19:39:30 fabian Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -244,7 +244,7 @@
   Context;
   filedb_readtop(*fdb_s, &fdbt);
   /* Old DB version? */
-  if ((fdbt.version > 0) && (fdbt.version < FILEDB_VERSION3)) {
+  if (fdbt.version > 0 && fdbt.version < FILEDB_VERSION3) {
     char *tempdb;
 
     Context;
Index: eggdrop-devel/src/mod/filesys.mod/filedb3.c
diff -u eggdrop-devel/src/mod/filesys.mod/filedb3.c:1.15 eggdrop-devel/src/mod/filesys.mod/filedb3.c:1.16
--- eggdrop-devel/src/mod/filesys.mod/filedb3.c:1.15	Tue Sep 12 10:26:53 2000
+++ eggdrop-devel/src/mod/filesys.mod/filedb3.c	Fri Oct 27 14:39:30 2000
@@ -4,7 +4,7 @@
  * 
  * Rewritten by Fabian Knittel <fknittel at gmx.de>
  * 
- * $Id: filedb3.c,v 1.15 2000/09/12 15:26:53 fabian Exp $
+ * $Id: filedb3.c,v 1.16 2000/10/27 19:39:30 fabian Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -39,8 +39,6 @@
  *  | filename      |      |                     |
  *  |- - - - - - - -|      |                     |
  *  | description   |      |                     |
- *  |- - - - - - - -|      |                     |
- *  | share link    |      |                     |
  *  |- - - - - - - -|      |  Dynamic length     |  Complete entry
  *  | channel name  |      |                     |
  *  |- - - - - - - -|      |                     |
@@ -48,6 +46,8 @@
  *  |- - - - - - - -|      |                     |
  *  | flags_req     |      |                     |
  *  |- - - - - - - -|      |                     |
+ *  | share link    |      |                     |
+ *  |- - - - - - - -|      |                     |
  *  | buffer        |     _|                    _|
  *  |---------------|
  *  | ...           |
@@ -310,6 +310,8 @@
     fdh.uploader_len = strlen(fdbe->uploader) + 1;
   if (fdbe->flags_req)
     fdh.flags_req_len = strlen(fdbe->flags_req) + 1;
+  if (fdbe->sharelink)
+    fdh.sharelink_len = strlen(fdbe->sharelink) + 1;
 
   odyntot = fdbe->dyn_len;		/* Old length of dynamic data	*/
   obuftot = fdbe->buf_len;		/* Old length of spare space	*/
@@ -393,6 +395,8 @@
       fwrite(fdbe->uploader, 1, fdh.uploader_len, fdb);
     if (fdbe->flags_req)
       fwrite(fdbe->flags_req, 1, fdh.flags_req_len, fdb);
+    if (fdbe->sharelink)
+      fwrite(fdbe->sharelink, 1, fdh.sharelink_len, fdb);
   } else
     fseek(fdb, ndyntot, SEEK_CUR);	/* Skip over dynamic data */
   fseek(fdb, nbuftot, SEEK_CUR);	/* Skip over buffer	  */
@@ -464,19 +468,27 @@
   fdbe->pos = pos;			/* Save position		*/
   fdbe->_type = TYPE_EXIST;		/* Entry exists in DB		*/
 
+  /* This is useful for cases where we don't read the rest of the
+   * data, but need to know whether the file is a link.
+   */
+  if (fdh.sharelink_len > 0)
+    fdbe->stat |= FILE_ISLINK;
+  else
+    fdbe->stat &= ~FILE_ISLINK;
+
   /* Read additional data from db */
   if (get >= GET_FILENAME) {
     filedb_read(fdb, fdbe->filename, fdh.filename_len);
   } else
     fseek(fdb, fdh.filename_len, SEEK_CUR);
-  if ((get < GET_FULL) || (fdh.stat & FILE_UNUSED))
-    fseek(fdb, fdh.desc_len + fdh.chan_len + fdh.uploader_len
-	  + fdh.flags_req_len, SEEK_CUR);
+  if (get < GET_FULL || (fdh.stat & FILE_UNUSED))
+    fseek(fdb, filedb_tot_dynspace(fdh) - fdh.filename_len, SEEK_CUR);
   else if (get == GET_FULL) {
     filedb_read(fdb, fdbe->desc, fdh.desc_len);
     filedb_read(fdb, fdbe->chan, fdh.chan_len);
     filedb_read(fdb, fdbe->uploader, fdh.uploader_len);
     filedb_read(fdb, fdbe->flags_req, fdh.flags_req_len);
+    filedb_read(fdb, fdbe->sharelink, fdh.sharelink_len);
   }
   fseek(fdb, fdh.buffer_len, SEEK_CUR);	/* Skip buffer			*/
   Context;
@@ -633,7 +645,7 @@
 {
   filedb_top fdbt;
 
-  fdbt.version = FILEDB_VERSION3;
+  fdbt.version = FILEDB_NEWEST_VER;
   fdbt.timestamp = now;
   filedb_writetop(fdb, &fdbt);
 }
@@ -712,8 +724,9 @@
   fdbe = filedb_getfile(fdb, ftell(fdb), GET_FILENAME);
   while (fdbe) {
     where = ftell(fdb);
-    if (!(fdbe->stat & FILE_UNUSED) && !(fdbe->sharelink) && fdbe->filename) {
-      s = nmalloc(strlen(path) + strlen(fdbe->filename) + 2);
+    if (!(fdbe->stat & FILE_UNUSED) && !(fdbe->stat & FILE_ISLINK) &&
+	fdbe->filename) {
+      s = nmalloc(strlen(path) + 1 + strlen(fdbe->filename) + 1);
       sprintf(s, "%s/%s", path, fdbe->filename);
       if (stat(s, &st) != 0)
 	/* gone file */
@@ -810,7 +823,7 @@
 	return NULL;
       }
       lockfile(fdb);
-      fdbt.version = FILEDB_VERSION3;
+      fdbt.version = FILEDB_NEWEST_VER;
       fdbt.timestamp = now;
       filedb_writetop(fdb, &fdbt);
       filedb_update(npath, fdb, sort);
@@ -824,7 +837,7 @@
   
   lockfile(fdb);			/* Lock it from other bots */
   filedb_readtop(fdb, &fdbt);
-  if (fdbt.version < FILEDB_VERSION3) {
+  if (fdbt.version < FILEDB_NEWEST_VER) {
     if (!convert_old_db(&fdb, s)) {
       /* Conversion failed. Unlock file again and error out.
        * (convert_old_db() could have modified fdb, so check
@@ -1084,7 +1097,6 @@
     if (!fdbe) {
       reject = FILES_FILEDNE;
     } else {
-      free_fdbe(&fdbe);
       if ((!(fdbe->stat & FILE_SHARE)) ||
 	  (fdbe->stat & (FILE_HIDDEN | FILE_DIR)))
 	reject = FILES_NOSHARE;
@@ -1107,6 +1119,7 @@
 	  my_free(s);
 	my_free(s1);
       }
+      free_fdbe(&fdbe);
     }
   }
   s1 = nmalloc(strlen(botnetnick) + strlen(dir) + strlen(what) + 3);
Index: eggdrop-devel/src/mod/filesys.mod/filedb3.h
diff -u eggdrop-devel/src/mod/filesys.mod/filedb3.h:1.8 eggdrop-devel/src/mod/filesys.mod/filedb3.h:1.9
--- eggdrop-devel/src/mod/filesys.mod/filedb3.h:1.8	Sat Sep  9 06:39:11 2000
+++ eggdrop-devel/src/mod/filesys.mod/filedb3.h	Fri Oct 27 14:39:30 2000
@@ -4,7 +4,7 @@
  * 
  * Written by Fabian Knittel <fknittel at gmx.de>
  * 
- * $Id: filedb3.h,v 1.8 2000/09/09 11:39:11 fabian Exp $
+ * $Id: filedb3.h,v 1.9 2000/10/27 19:39:30 fabian Exp $
  */
 /* 
  * Copyright (C) 1999, 2000  Eggheads
@@ -61,7 +61,8 @@
   unsigned short int _type;		/* Type of entry (private)	*/
 
   /* NOTE: These three are only valid during one db open/close. Entry
-   *       movements often invalidate them too.
+   *       movements often invalidate them too, so make sure you know
+   *       what you're doing before using/relying on them.
    */
   long pos;				/* Last position in the filedb	*/
   unsigned short int dyn_len;		/* Length of dynamic data in DB	*/
@@ -69,7 +70,8 @@
 
   char *filename;			/* Filename			*/
   char *desc;				/* Description			*/
-  char *sharelink;			/* Share link			*/
+  char *sharelink;			/* Share link. Points to remote
+		 			   file on linked bot.		*/
   char *chan;				/* Channel name			*/
   char *uploader;			/* Uploader			*/
   char *flags_req;			/* Required flags		*/
@@ -99,15 +101,18 @@
     my_free(target);							\
 } while (0)
 
+/* Macro to calculate the total length of dynamic data. */
 #define filedb_tot_dynspace(fdh) ((fdh).filename_len + (fdh).desc_len +	\
-	(fdh).chan_len + (fdh).uploader_len + (fdh).flags_req_len)
+	(fdh).chan_len + (fdh).uploader_len + (fdh).flags_req_len + \
+	(fdh).sharelink_len)
 
 #define filedb_zero_dynspace(fdh) {					\
-	(fdh).filename_len  = 0;					\
-	(fdh).desc_len	    = 0;					\
-	(fdh).chan_len	    = 0;					\
-	(fdh).uploader_len  = 0;					\
-	(fdh).flags_req_len = 0;					\
+	(fdh).filename_len	= 0;					\
+	(fdh).desc_len		= 0;					\
+	(fdh).chan_len		= 0;					\
+	(fdh).uploader_len	= 0;					\
+	(fdh).flags_req_len	= 0;					\
+	(fdh).sharelink_len	= 0;					\
 }
 
 /* Memory debugging makros */
@@ -124,16 +129,18 @@
  */
 
 #define FILEDB_VERSION1	0x0001
-#define FILEDB_VERSION2	0x0002
-#define FILEDB_VERSION3	0x0003	/* Newest DB version			*/
+#define FILEDB_VERSION2	0x0002	/* DB version used for 1.3, 1.4		*/
+#define FILEDB_VERSION3	0x0003
+#define FILEDB_NEWEST_VER FILEDB_VERSION3	/* Newest DB version	*/
 
 #define POS_NEW		0	/* Position which indicates that the
-				 * entry wants to be repositioned.	*/
+				   entry wants to be repositioned.	*/
 
-#define FILE_UNUSED	0x0001	/* Deleted entry */
-#define FILE_DIR	0x0002	/* It's actually a directory */
-#define FILE_SHARE	0x0004	/* Can be shared on the botnet */
-#define FILE_HIDDEN	0x0008	/* Hidden file */
+#define FILE_UNUSED	0x0001	/* Deleted entry.			*/
+#define FILE_DIR	0x0002	/* It's actually a directory.		*/
+#define FILE_SHARE	0x0004	/* Can be shared on the botnet.		*/
+#define FILE_HIDDEN	0x0008	/* Hidden file.				*/
+#define FILE_ISLINK	0x0010	/* The file is a link to another bot.	*/
 
 #define FILEDB_ESTDYN	50	/* Estimated dynamic length of an entry	*/
 
Index: eggdrop-devel/src/mod/filesys.mod/files.c
diff -u eggdrop-devel/src/mod/filesys.mod/files.c:1.25 eggdrop-devel/src/mod/filesys.mod/files.c:1.26
--- eggdrop-devel/src/mod/filesys.mod/files.c:1.25	Thu Aug 31 13:08:56 2000
+++ eggdrop-devel/src/mod/filesys.mod/files.c	Fri Oct 27 14:39:30 2000
@@ -2,7 +2,7 @@
  * files.c - part of filesys.mod
  *   handles all file system commands
  * 
- * $Id: files.c,v 1.25 2000/08/31 18:08:56 fabian Exp $
+ * $Id: files.c,v 1.26 2000/10/27 19:39:30 fabian Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -436,7 +436,8 @@
       nicklen = (int) me->funcs[SERVER_NICKLEN];
   }
   if (!par[0]) {
-    dprintf(idx, "%s: %sget <file(s)> [nickname]\n", MISC_USAGE, resend ? "re" : "");
+    dprintf(idx, "%s: %sget <file(s)> [nickname]\n", MISC_USAGE,
+	    resend ? "re" : "");
     return;
   }
   what = newsplit(&par);
@@ -723,7 +724,7 @@
  */
 static void cmd_ln(int idx, char *par)
 {
-  char *share, *newpath, *newfn = NULL, *p;
+  char *share, *newpath = NULL, *newfn = NULL, *p;
   FILE *fdb;
   filedb_entry *fdbe;
 
Index: eggdrop-devel/src/patch.h
diff -u eggdrop-devel/src/patch.h:1.355 eggdrop-devel/src/patch.h:1.356
--- eggdrop-devel/src/patch.h:1.355	Fri Oct 27 14:38:50 2000
+++ eggdrop-devel/src/patch.h	Fri Oct 27 14:39:30 2000
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  * 
- * $Id: patch.h,v 1.355 2000/10/27 19:38:50 fabian Exp $
+ * $Id: patch.h,v 1.356 2000/10/27 19:39:30 fabian Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -40,11 +40,11 @@
 /*
  *
  */
-patch("972678644");	/* current unixtime */
+patch("972678682");	/* current unixtime */
 /*
  *
  */
-patch("expired2");
+patch("filesys_remote_ln");
 /*
  *
  */
----------------------- End of diff -----------------------



More information about the Changes mailing list