diff options
author | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-03-14 19:23:27 +0000 |
---|---|---|
committer | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-03-14 19:23:27 +0000 |
commit | c3b9f7f5422161816c33f11952bb6737c1882ab0 (patch) | |
tree | 481e3c61136c3ece4f187af3bc00be1d709e9268 /src | |
parent | ccf124e35aa7efe3a187762a3e017af28122ee03 (diff) |
BUILD : 1.7.8 (622) BUGS : 317 NOTES : Applied Trystans patch to remove old ifdef convertor code
git-svn-id: svn://svn.anope.org/anope/trunk@622 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@470 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 5 | ||||
-rw-r--r-- | src/converter.c | 398 | ||||
-rw-r--r-- | src/init.c | 17 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/makefile.win32 | 5 |
5 files changed, 4 insertions, 424 deletions
diff --git a/src/Makefile b/src/Makefile index 77c35b2a7..edcc0fcdc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,12 +1,12 @@ MYSQL_OBJ = $(MYSQL:.c=.o) RDB_OBJ = $(RDB:.c=.o) IRCD_OBJ = $(IRCDFILE:.c=.o) -OBJS = actions.o base64.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \ +OBJS = actions.o base64.o botserv.o channels.o chanserv.o commands.o compat.o \ config.o datafiles.o encrypt.o events.o helpserv.o hostserv.o init.o language.o list.o log.o mail.o main.o \ memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \ process.o send.o servers.o sessions.o slist.o sockutil.o timeout.o users.o \ $(VSNPRINTF_O) $(RDB_OBJ) $(MYSQL_OBJ) $(IRCD_OBJ) -SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \ +SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c \ config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c language.c list.c log.c mail.c main.c \ memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \ process.c send.c servers.c sessions.c slist.c sockutil.c timeout.c users.c \ @@ -50,7 +50,6 @@ chanserv.o: chanserv.c $(INCLUDES) commands.o: commands.c $(INCLUDES) compat.o: compat.c $(INCLUDES) config.o: config.c $(INCLUDES) -converter.o: converter.c $(INCLUDES) datafiles.o: datafiles.c $(INCLUDES) encrypt.o: encrypt.c $(INCLUDES) events.o: events.c $(INCLUDES) diff --git a/src/converter.c b/src/converter.c deleted file mode 100644 index ad950430c..000000000 --- a/src/converter.c +++ /dev/null @@ -1,398 +0,0 @@ -/* Database converters. - * - * (C) 2003-2005 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ - -#include "services.h" -#include "datafiles.h" - -/* Each converter will try to convert the databases to the format used - * by ircservices-4.3 (that is compatible with Epona). - */ - -#ifdef USE_CONVERTER - -/*************************************************************************/ - -#define IS43_VERSION 7 - -#define SAFER(x) do { \ - if ((x) < 0) { \ - fatal("Read error on %s", rdb); \ - return 0; \ - } \ -} while (0) - -#define SAFEW(x) do { \ - if ((x) < 0) { \ - fatal("Write error on %s", wdb); \ - return 0; \ - } \ -} while (0) - -/*************************************************************************/ -/*****************************ircservices-4.4*****************************/ -/*************************************************************************/ - -#ifdef IS44_CONVERTER - -#define IS44_VERSION 8 -#define IS44_CA_SIZE 13 - -int convert_ircservices_44(void) -{ - dbFILE *f, *g; /* f for reading, g for writing */ - int c, i, j; - char *rdb, *wdb; - - char *tmp; - int16 tmp16; - int32 tmp32; - - char nick[NICKMAX]; - char pass[PASSMAX]; - char chan[CHANMAX]; - - /* NickServ database */ - - if (rename("nick.db", "nick.db.old") == -1) { - fatal("Converter: unable to rename nick.db to nick.db.old: %s", - strerror(errno)); - return 0; - } - - if (!(f = open_db(s_NickServ, "nick.db.old", "r", IS44_VERSION))) { - fatal("Converter: unable to open nick.db.old in read access: %s", - strerror(errno)); - return 0; - } - - if (!(g = open_db(s_NickServ, NickDBName, "w", IS43_VERSION))) { - fatal("Converter: unable to open %s in write access: %s", - NickDBName, strerror(errno)); - return 0; - } - - rdb = sstrdup("nick.db.old"); - wdb = sstrdup(NickDBName); - - get_file_version(f); - - for (i = 0; i < 256; i++) { - while ((c = getc_db(f)) == 1) { - if (c != 1) - fatal("Invalid format in %s", wdb); - - SAFEW(write_int8(1, g)); - - SAFER(read_buffer(nick, f)); - SAFEW(write_buffer(nick, g)); - SAFER(read_buffer(pass, f)); - SAFEW(write_buffer(pass, g)); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - - if (tmp) { - if (tmp) - free(tmp); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - } else { - int32 flags; - int16 memocount, accesscount; - - SAFER(read_int32(&flags, f)); - tmp32 = (flags & ~0x10000000); - SAFEW(write_int32(tmp32, g)); - - /* Suspend stuff that we don't convert */ - if (flags & 0x10000000) { - SAFER(read_buffer(nick, f)); - SAFER(read_string(&tmp, f)); - if (tmp) - free(tmp); - SAFER(read_int32(&tmp32, f)); - SAFER(read_int32(&tmp32, f)); - } - - SAFER(read_int16(&tmp16, f)); - accesscount = tmp16; - SAFEW(write_int16(tmp16, g)); - - if (accesscount) { - for (j = 0; j < accesscount; j++) { - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - } - } - - SAFER(read_int16(&memocount, f)); - SAFEW(write_int16(memocount, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - - if (memocount) { - for (j = 0; j < memocount; j++) { - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_buffer(nick, f)); - SAFEW(write_buffer(nick, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - } - } - - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - } - } /* while (getc_db(f) != 0) */ - SAFEW(write_int8(0, g)); - } /* for (i) */ - - close_db(f); - close_db(g); - - free(rdb); - free(wdb); - - /* ChanServ */ - - rdb = sstrdup("chan.db.old"); - wdb = sstrdup(ChanDBName); - - if (rename("chan.db", rdb) == -1) { - fatal("Converter: unable to rename chan.db to %s: %s", rdb, - strerror(errno)); - return 0; - } - - if (!(f = open_db(s_ChanServ, rdb, "r", IS44_VERSION))) { - fatal("Converter: unable to open %s in read access: %s", rdb, - strerror(errno)); - return 0; - } - - if (!(g = open_db(s_ChanServ, wdb, "w", IS43_VERSION))) { - fatal("Converter: unable to open %s in write access: %s", wdb, - strerror(errno)); - return 0; - } - - get_file_version(f); - - for (i = 0; i < 256; i++) { - while ((c = getc_db(f)) != 0) { - int16 n_levels, accesscount, akickcount, memocount; - - if (c != 1) - fatal("Invalid format in %s", wdb); - - SAFEW(write_int8(1, g)); - - SAFER(read_buffer(chan, f)); - SAFEW(write_buffer(chan, g)); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - - SAFER(read_buffer(pass, f)); - SAFEW(write_buffer(pass, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_buffer(nick, f)); - SAFEW(write_buffer(nick, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - - SAFER(read_int16(&n_levels, f)); - SAFEW(write_int16(n_levels, g)); - - for (j = 0; j < n_levels; j++) { - SAFER(read_int16(&tmp16, f)); - if (j < IS44_CA_SIZE) - SAFEW(write_int16(tmp16, g)); - } - - SAFER(read_int16(&accesscount, f)); - SAFEW(write_int16(accesscount, g)); - - if (accesscount) { - for (j = 0; j < accesscount; j++) { - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - if (tmp16) { - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - } - } - } - - SAFER(read_int16(&akickcount, f)); - SAFEW(write_int16(akickcount, g)); - - if (akickcount) { - for (j = 0; j < akickcount; j++) { - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - if (tmp16) { - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - SAFER(read_buffer(nick, f)); - } - } - } - - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - - SAFER(read_int16(&memocount, f)); - SAFEW(write_int16(memocount, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - - if (memocount) { - for (j = 0; j < memocount; j++) { - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_int16(&tmp16, f)); - SAFEW(write_int16(tmp16, g)); - SAFER(read_int32(&tmp32, f)); - SAFEW(write_int32(tmp32, g)); - SAFER(read_buffer(nick, f)); - SAFER(write_buffer(nick, g)); - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - } - } - - SAFER(read_string(&tmp, f)); - SAFEW(write_string(tmp, g)); - if (tmp) - free(tmp); - } /* while (getc_db(f) != 0) */ - SAFEW(write_int8(0, g)); - } /* for (i) */ - - close_db(f); - close_db(g); - - free(rdb); - free(wdb); - - return 1; -} - -#endif - -/*************************************************************************/ - -#endif - -/*************************************************************************/ diff --git a/src/init.c b/src/init.c index f7650aed4..8c3ad6380 100644 --- a/src/init.c +++ b/src/init.c @@ -318,10 +318,6 @@ static int parse_options(int ac, char **av) forceload = 1; } else if (!strcmp(s, "noexpire")) { noexpire = 1; -#ifdef IS44_CONVERTER - } else if (!strcmp(s, "is44")) { - is44 = 1; -#endif } else if (!strcmp(s, "version")) { fprintf(stdout, "Anope-%s %s %s -- %s\n", version_number, ircd->name, version_flags, version_build); @@ -350,9 +346,6 @@ static int parse_options(int ac, char **av) fprintf(stdout, "-forceload -forceload\n"); fprintf(stdout, "-readonly -readonly\n"); fprintf(stdout, "-noexpire -noexpire\n"); -#ifdef IS44_CONVERTER - fprintf(stdout, "-is44 -is44\n"); -#endif fprintf(stdout, "-version -version\n"); fprintf(stdout, "-help -help\n"); fprintf(stdout, "-log -log logfilename\n"); @@ -599,16 +592,6 @@ int init(int ac, char **av) rand_init(); add_entropy_userkeys(); -#ifdef USE_CONVERTER - /* Convert the databases NOW! */ -# ifdef IS44_CONVERTER - if (is44) { - convert_ircservices_44(); - alog("debug: Databases converted"); - } -# endif -#endif - /* Load up databases */ #ifdef USE_RDB if (UseRDB) diff --git a/src/main.c b/src/main.c index cce61a336..878e12848 100644 --- a/src/main.c +++ b/src/main.c @@ -43,9 +43,6 @@ int skeleton = 0; /* -skeleton */ int nofork = 0; /* -nofork */ int forceload = 0; /* -forceload */ int noexpire = 0; /* -noexpire */ -#ifdef IS44_CONVERTER -int is44 = 0; /* -is44 */ -#endif #ifdef USE_RDB int do_mysql = 0; /* use mysql ? */ diff --git a/src/makefile.win32 b/src/makefile.win32 index 5ff506c0a..8b60c3474 100644 --- a/src/makefile.win32 +++ b/src/makefile.win32 @@ -18,13 +18,13 @@ include ../Makefile.inc.win32 ########################################################################### OBJS = actions.obj base64.obj botserv.obj channels.obj chanserv.obj commands.obj compat.obj \ - converter.obj config.obj datafiles.obj encrypt.obj events.obj helpserv.obj hostserv.obj \ + config.obj datafiles.obj encrypt.obj events.obj helpserv.obj hostserv.obj \ init.obj language.obj list.obj log.obj mail.obj main.obj memory.obj memoserv.obj \ messages.obj misc.obj modules.obj news.obj nickserv.obj operserv.obj \ process.obj send.obj servers.obj sessions.obj slist.obj sockutil.obj \ timeout.obj users.obj $(RDB_O) $(MYSQL_O) $(CAPAB_O) -SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \ +SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c \ config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c language.c list.c \ log.c mail.c main.c memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c \ operserv.c process.c send.c servers.obj sessions.c slist.c sockutil.c \ @@ -66,7 +66,6 @@ chanserv.obj: chanserv.c ..\include\services.h ..\include\pseudo.h commands.obj: commands.c ..\include\services.h ..\include\commands.h ..\include\language.h compat.obj: compat.c ..\include\services.h config.obj: config.c ..\include\services.h -converter.obj: converter.c ..\include\services.h ..\include\datafiles.h datafiles.obj: datafiles.c ..\include\services.h ..\include\datafiles.h encrypt.obj: encrypt.c ..\include\encrypt.h ..\include\sysconf.h events.obj: events.c ..\include\modules.h ..\include\language.h ..\include\version.h |