Bryan Drewery 23 лет назад
Родитель
Сommit
11d21f57e7
58 измененных файлов с 1129 добавлено и 8926 удалено
  1. 0 20
      COPYRIGHT
  2. 97 211
      Makefile.in
  3. 14 24
      bldall
  4. 0 87
      bldleaf
  5. 206 576
      configure
  6. 7 6
      configure.in
  7. 0 0
      configure.temp
  8. 23 1
      doc/CHANGES
  9. 43 0
      doc/COPYRIGHTS
  10. 8 9
      doc/CREDITS
  11. 0 0
      doc/README
  12. 0 0
      doc/conf
  13. 0 44
      md5/Makefile
  14. 0 30
      md5/global.h
  15. 0 1
      md5/hm
  16. 0 36
      md5/md5.h
  17. 0 333
      md5/md5c.c
  18. 0 244
      md5/mddriver.c
  19. 0 15
      md5/t
  20. 0 1308
      misc/config.guess
  21. 0 1413
      misc/config.sub
  22. 17 0
      misc/fstrings
  23. 0 251
      misc/install-sh
  24. 49 0
      misc/maketype
  25. 0 39
      misc/mkinstalldirs
  26. 1 0
      pack.conf
  27. 27 7
      src/Makefile.in
  28. 46 12
      src/cmds.c
  29. 2 2
      src/compat/Makefile.in
  30. 13 4
      src/dcc.c
  31. 2 3
      src/eggdrop.h
  32. 0 1
      src/lang.h
  33. 22 13
      src/main.c
  34. BIN
      src/makesalt
  35. 8 2
      src/makesalt.c
  36. 0 50
      src/md5/Makefile.in
  37. 0 39
      src/md5/global.h
  38. 0 28
      src/md5/md5.h
  39. 0 313
      src/md5/md5c.c
  40. 44 14
      src/misc.c
  41. 0 43
      src/mod/blowfish.mod/Makefile
  42. 0 282
      src/mod/blowfish.mod/bf_tab.h
  43. 0 466
      src/mod/blowfish.mod/blowfish.c
  44. 0 33
      src/mod/blowfish.mod/blowfish.h
  45. 4 1
      src/mod/channels.mod/cmdschan.c
  46. 0 0
      src/mod/confdefs.h
  47. 0 3
      src/mod/config.log
  48. 0 2738
      src/mod/dns.mod/Makefile.in
  49. 92 5
      src/mod/irc.mod/msgcmds.c
  50. 4 0
      src/mod/server.mod/server.c
  51. 20 6
      src/mod/server.mod/servmsg.c
  52. 118 95
      src/mod/share.mod/share.c
  53. 5 19
      src/pcrypt.c
  54. 3 0
      src/proto.h
  55. 59 69
      src/settings.c
  56. 167 0
      src/stringfix.c
  57. 1 3
      src/tcldcc.c
  58. 27 27
      src/users.c

+ 0 - 20
COPYRIGHT

@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-

+ 97 - 211
Makefile.in

@@ -13,6 +13,8 @@ prefix = @prefix@
 DEST = @DEST@
 DEST = @DEST@
 EGGEXEC = @EGGEXEC@
 EGGEXEC = @EGGEXEC@
 EGGVERSION = @EGGVERSION@
 EGGVERSION = @EGGVERSION@
+LEAFEXEC = leaf
+HUBEXEC = hub
 
 
 # things you can put here:
 # things you can put here:
 #   -Wall            if you're using gcc and it supports it
 #   -Wall            if you're using gcc and it supports it
@@ -22,14 +24,15 @@ EGGVERSION = @EGGVERSION@
 #   -DDEBUG_MEM      to be able to debug memory allocation (.debug)
 #   -DDEBUG_MEM      to be able to debug memory allocation (.debug)
 #                    These can both be set by using 'make debug'
 #                    These can both be set by using 'make debug'
 #                    or 'make sdebug'
 #                    or 'make sdebug'
-CFLGS =
+CFLGS = -fno-strict-aliasing 
 
 
 # configure SHOULD set these...you may need to tweak them to get modules
 # configure SHOULD set these...you may need to tweak them to get modules
 # to compile .. if you do...let the devel-team know the working settings
 # to compile .. if you do...let the devel-team know the working settings
 # btw to turn STRIP off, do 'STRIP = touch' not 'STRIP ='
 # btw to turn STRIP off, do 'STRIP = touch' not 'STRIP ='
 
 
 # defaults
 # defaults
-CC = @CC@
+#CC = @CC@
+CC = gcc-2.95
 LD = @CC@
 LD = @CC@
 STRIP = @STRIP@
 STRIP = @STRIP@
 RANLIB = @RANLIB@
 RANLIB = @RANLIB@
@@ -63,8 +66,6 @@ XLIBS = @TCL_LIBS@ @LIBS@
 TCLLIB = @TCLLIB@
 TCLLIB = @TCLLIB@
 TCLLIBFN = @TCLLIBFN@
 TCLLIBFN = @TCLLIBFN@
 
 
-DEBCFLAGS = -DDEBUG_ASSERT -DDEBUG_MEM 
-
 modconf = $(top_srcdir)/misc/modconfig --top_srcdir=$(top_srcdir)
 modconf = $(top_srcdir)/misc/modconfig --top_srcdir=$(top_srcdir)
 
 
 post_config  =  echo "" && \
 post_config  =  echo "" && \
@@ -80,58 +81,58 @@ egg_install_msg =  echo "" && \
 		   echo "Now run \"make install\" to install your bot." && \
 		   echo "Now run \"make install\" to install your bot." && \
 		   echo ""
 		   echo ""
 
 
-MAKE_MODEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD)' \
-'STRIP=$(MOD_STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS)' \
-'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=' 'MODOBJS='
+CFLAGS = @CFLAGS@ -I.. @DEFS@ $(CFLGS)
+DEBCFLAGS = @CFLAGS@ -I.. @DEFS@ -DDEBUG_ASSERT -DDEBUG_MEM $(CFLGS)
+
+MAKE_LEAF = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=$(STRIP)' \
+'RANLIB=$(RANLIB)' 'CFLAGS=$(CFLAGS) -DSTATIC -DLEAF' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'EGGEXEC=$(LEAFEXEC)' 'EGGBUILD=(leaf)' 'LD=$(LD)' \
+'MODS=$(MODSALL) $(MODSLEAF)' 'MODOBJS=mod/*.o' 'CFLGS=$(CFLGS) -DLEAF'
 
 
-MAKE_MODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
-'STRIP=$(SHLIB_STRIP)' 'CFLGS=$(CFLGS)' 'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)'
+MAKE_HUB = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=$(STRIP)' \
+'RANLIB=$(RANLIB)' 'CFLAGS=$(CFLAGS) -DSTATIC -DHUB' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'EGGEXEC=$(HUBEXEC)' 'EGGBUILD=(hub)' 'LD=$(LD)' \
+'MODS=$(MODSALL) $(MODSHUB)' 'MODOBJS=mod/*.o' 'CFLGS=$(CFLGS) -DHUB'
 
 
-MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
-'STRIP=$(STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS) -DSTATIC' \
-'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static version)' \
-'MODOBJS=mod/*.o'
+MAKE_DLEAF = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=touch' \
+'RANLIB=$(RANLIB)' 'CFLAGS=-g3 $(DEBCFLAGS) -DSTATIC -DLEAF' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'EGGEXEC=$(LEAFEXEC)' 'EGGBUILD=(debug leaf)' 'LD=$(LD) -g' \
+'MODS=$(MODSALL) $(MODSLEAF)' 'MODOBJS=mod/*.o' 'CFLGS=$(CFLGS) -DLEAF'
 
 
-MAKE_DEBEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD) -g' \
-'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
-'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(debug version)' 'MODOBJS='
+MAKE_DHUB = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=touch' \
+'RANLIB=$(RANLIB)' 'CFLAGS=-g3 $(DEBCFLAGS) -DSTATIC -DHUB' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'EGGEXEC=$(HUBEXEC)' 'EGGBUILD=(debug hub)' 'LD=$(LD) -g' \
+'MODS=$(MODSALL) $(MODSHUB)' 'MODOBJS=mod/*.o' 'CFLGS=$(CFLGS) -DHUB'
 
 
-MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
-'XLIBS=$(XLIBS)' 'STRIP=touch' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
-'MOD_EXT=$(MOD_EXT)'
+MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=$(STRIP)' \
+'RANLIB=$(RANLIB)' 'CFLAGS=$(CFLAGS) -DSTATIC -DSTANDALONE' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'LD=$(LD)'
 
 
-MAKE_SDEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD) -g' \
-'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) -DSTATIC $(CFLGS)' \
-'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' 'XLIBS=$(XLIBS)' \
-'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static and debug version)' 'MODOBJS=mod/*.o'
+MAKE_DUTILS = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'STRIP=touch' \
+'RANLIB=$(RANLIB)' 'CFLAGS=-g3 $(DEBCFLAGS) -DSTATIC -DSTANDALONE' 'XREQS=$(XREQS)' \
+'XLIBS=$(XLIBS)' 'LD=$(LD)'
 
 
 MAKE_DEPEND = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 MAKE_DEPEND = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)'
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)'
 
 
 MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
 MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
 
 
-MAKE_INSTALL = $(MAKE) 'MAKE=$(MAKE)' 'DEST=$(DEST)'
-
-all: @DEFAULT_MAKE@
+cleanutils:
+	@rm -f stringfix
 
 
-eggclean:
-	@rm -f $(EGGEXEC) *.$(MOD_EXT) *.stamp core DEBUG *~
+clean:  cleanutils
 	@cd src && $(MAKE) clean
 	@cd src && $(MAKE) clean
 	@cd src/md5 && $(MAKE) clean
 	@cd src/md5 && $(MAKE) clean
 	@cd src/compat && $(MAKE) clean
 	@cd src/compat && $(MAKE) clean
+	@rm -f $(HUBEXEC) $(LEAFEXEC) *.$(MOD_EXT) *.so *.stamp core DEBUG *~ key configure.temp makesalt
 
 
-clean: eggclean
-	@cd src/mod && $(MAKE) clean
-
-distclean: eggclean clean-modconfig
+distclean: clean clean-modconfig
 	@cd src/mod && $(MAKE) distclean
 	@cd src/mod && $(MAKE) distclean
 	@rm -f Makefile src/Makefile src/md5/Makefile src/compat/Makefile src/mod/Makefile
 	@rm -f Makefile src/Makefile src/md5/Makefile src/compat/Makefile src/mod/Makefile
-	@rm -f config.cache config.log config.status config.h lush.h
+	@rm -f config.cache config.log config.status config.h lush.h stamp.*
 	@rm -rf autom4te.cache
 	@rm -rf autom4te.cache
 
 
+
 distrib: distclean
 distrib: distclean
 	@rm -f `find . \( -name '*~' -o -name '*#' -o -name '*.orig' \
 	@rm -f `find . \( -name '*~' -o -name '*#' -o -name '*.orig' \
 		-o -name '*.rej' -o -name '*.bak' \) -print`
 		-o -name '*.rej' -o -name '*.bak' \) -print`
@@ -154,6 +155,12 @@ depend:
 eggautoconf:
 eggautoconf:
 	@$(modconf) eggautoconf
 	@$(modconf) eggautoconf
 
 
+salt:
+	@echo [*] Compiling MakeSalt for Encryption..
+	@$(CC) -I. -o makesalt src/makesalt.c
+	@./makesalt
+
+
 config:
 config:
 	@$(modconf) modules-still-exist
 	@$(modconf) modules-still-exist
 	@$(modconf) detect-modules
 	@$(modconf) detect-modules
@@ -163,206 +170,85 @@ config:
 	@$(modconf) Makefile
 	@$(modconf) Makefile
 	@$(post_config)
 	@$(post_config)
 
 
-new-iconfig:
-	@$(modconf) modules-still-exist
-	@$(modconf) update-depends
-	@$(modconf) -n configure
-	@$(post_iconfig)
-	@$(post_config)
-
-iconfig:
-	@$(modconf) modules-still-exist
-	@$(modconf) detect-modules
-	@$(modconf) update-depends
-	@$(modconf) configure
-	@$(post_iconfig)
-	@$(post_config)
-
 clean-modconfig:
 clean-modconfig:
 	@rm -f .modules .known_modules
 	@rm -f .modules .known_modules
 
 
-conftest:
-	@if test ! -f .modules; then \
-		echo ""; \
-		echo "You have NOT configured the modules yet. This has to be done"; \
-		echo "before you can start compiling."; \
-		echo ""; \
-		echo "   Run \"make config\" or \"make iconfig\" now."; \
-		echo ""; \
-		exit 1; \
-	fi
-
 reconfig: clean-modconfig config
 reconfig: clean-modconfig config
 
 
-eggdrop: modegg modules
+utils:
+	@./misc/maketype utils
+	@cd src; $(MAKE_UTILS) ../stringfix
 
 
-modegg: modtest
-	@rm -f src/mod/mod.xlibs
-	@cd src && $(MAKE_MODEGG) $(EGGEXEC)
-	@echo ""
-	@ls -l $(EGGEXEC)
+dutils:
+	@./misc/maketype utils
+	@cd src; $(MAKE_DUTILS) ../stringfix
 
 
-modules: modtest
-	@cd src/mod && $(MAKE_MODULES) modules
-	@echo ""
-	@echo "modules made:"
-	@ls -l *.$(MOD_EXT)
-	@$(egg_install_msg)
 
 
-static: eggtest
+
+depleaf:
+	@cat /dev/null > lush.h
+	@cd src && $(MAKE_DEPEND) depleaf
+	@cd src/md5 && $(MAKE_DEPEND) depleaf
+	@cd src/mod && $(MAKE_DEPEND) depleaf
+	@cd src/compat && $(MAKE_DEPEND) depleaf
+
+dephub:
+	@cat /dev/null > lush.h
+	@cd src && $(MAKE_DEPEND) dephub
+	@cd src/md5 && $(MAKE_DEPEND) dephub
+	@cd src/mod && $(MAKE_DEPEND) dephub
+	@cd src/compat && $(MAKE_DEPEND) dephub
+
+
+leaf:	salt config
 	@echo ""
 	@echo ""
-	@echo "Making module objects for static linking..."
+	@echo "Making leaf"
 	@echo ""
 	@echo ""
 	@rm -f src/mod/mod.xlibs
 	@rm -f src/mod/mod.xlibs
-	@cd src/mod && $(MAKE_STATIC) static
+	@./misc/maketype leaf
 	@echo ""
 	@echo ""
-	@echo "Making core eggdrop for static linking..."
+	@cd src/mod && $(MAKE_LEAF) static
 	@echo ""
 	@echo ""
-	@cd src && $(MAKE_STATIC) $(EGGEXEC)
+	@cd src && $(MAKE_LEAF) $(LEAFEXEC)
 	@echo ""
 	@echo ""
-	@ls -l $(EGGEXEC)
-	@$(egg_install_msg)
-
-debug: debegg debmodules
 
 
-debegg: modtest
-	@cd src && $(MAKE_DEBEGG) $(EGGEXEC)
+dleaf:  salt config
 	@echo ""
 	@echo ""
-	@ls -l $(EGGEXEC)
-
-debmodules: modtest
-	@cd src/mod && $(MAKE_DEBMODULES) modules
+	@echo "Making debug leaf"
+	@echo ""
+	@rm -f src/mod/mod.xlibs
+	@./misc/maketype leaf
+	@echo ""
+	@cd src/mod && $(MAKE_DLEAF) static
+	@echo ""
+	@cd src; $(MAKE_DLEAF) $(LEAFEXEC)
 	@echo ""
 	@echo ""
-	@echo "modules made:"
-	@ls -l *.$(MOD_EXT)
-	@$(egg_install_msg)
 
 
-sdebug: eggtest
+hub:	salt config
 	@echo ""
 	@echo ""
-	@echo "Making module objects for static linking..."
+	@echo "Making hub"
 	@echo ""
 	@echo ""
 	@rm -f src/mod/mod.xlibs
 	@rm -f src/mod/mod.xlibs
-	@cd src/mod && $(MAKE_SDEBUG) static
+	@rm -f src/mod/mod.xlibs
+	@./misc/maketype hub
+	@echo ""
+	@cd src/mod && $(MAKE_HUB) static
+	@echo ""
+	@cd src && $(MAKE_HUB) $(HUBEXEC)
 	@echo ""
 	@echo ""
-	@echo "Making core eggdrop for static linking..."
+
+dhub:   salt config
+	@echo ""
+	@echo "Making debug hub"
 	@echo ""
 	@echo ""
-	@cd src && $(MAKE_SDEBUG) $(EGGEXEC)
+	@rm -f src/mod/mod.xlibs
+	@./misc/maketype hub
 	@echo ""
 	@echo ""
-	@ls -l $(EGGEXEC)
-	@$(egg_install_msg)
-
-eggtest: conftest
-	@if test -f EGGMOD.stamp; then \
-		echo "You're trying to do a STATIC build of eggdrop when you've";\
-		echo "already run 'make' for a module build.";\
-		echo "You must first type \"make clean\" before you can build";\
-		echo "a static version.";\
-		exit 1;\
-	fi
-	@echo "stamp" >EGGDROP.stamp
-
-modtest: conftest
-	@if [ -f EGGDROP.stamp ]; then \
-		echo "You're trying to do a MODULE build of eggdrop when you've";\
-		echo "already run 'make' for a static build.";\
-		echo "You must first type \"make clean\" before you can build";\
-		echo "a module version.";\
-		exit 1;\
-	fi
-	@echo "stamp" >EGGMOD.stamp
-
-install: ainstall
-
-dinstall: eggdrop ainstall
-
-sinstall: static ainstall
-
-ainstall: install-start install-bin install-modules install-data \
-install-filesys \
-install-end
-
-install-start:
-	@if test ! -f $(EGGEXEC); then \
-		echo ""; \
-		echo "You haven't compiled eggdrop yet."; \
-		echo "To compile eggdrop use:"; \
-		echo "  make <target>"; \
-		echo ""; \
-		echo "  valid targets: eggdrop static debug sdebug"; \
-		echo ""; \
-		exit 1; \
-	fi
-	@if test "x$(DEST)" = "x"; then \
-		echo "You must specify a destination directory with DEST="; \
-		exit 1; \
-	fi
+	@cd src/mod && $(MAKE_DHUB) static
 	@echo ""
 	@echo ""
-	@echo
-	@echo "Installing in directory: '$(DEST)'."
-	@echo
-	@if test ! -d $(DEST); then \
-		echo "Creating directory: $(DEST)."; \
-		$(top_srcdir)/misc/mkinstalldirs $(DEST); \
-	fi
-
-install-bin:
-	@if test -f $(DEST)/o$(EGGEXEC); then \
-		rm -f $(DEST)/o$(EGGEXEC); \
-	fi
-	@if test -h $(DEST)/$(EGGEXEC); then \
-		echo "Removing symlink to archival eggdrop binary."; \
-		rm -f $(DEST)/$(EGGEXEC); \
-	fi
-	@if test -f $(DEST)/$(EGGEXEC); then \
-		echo "Renamed the old '$(EGGEXEC)' executable to 'o$(EGGEXEC)'."; \
-		mv -f $(DEST)/$(EGGEXEC) $(DEST)/o$(EGGEXEC); \
-	fi
-	@echo "Copying new '$(EGGEXEC)' executable and creating symlink."
-	@$(INSTALL_PROGRAM) $(EGGEXEC) $(DEST)/$(EGGEXEC)-$(EGGVERSION)
-	@(cd $(DEST) && $(LN_S) $(EGGEXEC)-$(EGGVERSION) $(EGGEXEC))
-
-install-modules:
-	@if test -h $(DEST)/modules; then \
-		echo "Removing symlink to archival modules directory."; \
-		rm -f $(DEST)/modules; \
-	fi
-	@if test -d $(DEST)/modules; then \
-		echo "Moving old modules into 'modules.old' directory."; \
-		rm -rf $(DEST)/modules.old; \
-		mv -f $(DEST)/modules $(DEST)/modules.old; \
-	fi
-	@if test ! "x`echo *.$(MOD_EXT)`" = "x*.$(MOD_EXT)"; then \
-		if test ! -d $(DEST)/modules-$(EGGVERSION); then \
-			echo "Creating modules-$(EGGVERSION) directory and symlink."; \
-			$(top_srcdir)/misc/mkinstalldirs $(DEST)/modules-$(EGGVERSION); \
-		fi; \
-		(cd $(DEST) && $(LN_S) modules-$(EGGVERSION) modules); \
-		echo "Copying new modules."; \
-		for i in *.$(MOD_EXT); do \
-			$(INSTALL_PROGRAM) $$i $(DEST)/modules-$(EGGVERSION)/; \
-		done; \
-	fi
-
-install-data:
-	@if test ! -d $(DEST)/logs; then \
-		echo "Creating 'logs' subdirectory."; \
-		$(top_srcdir)/misc/mkinstalldirs $(DEST)/logs; \
-	fi;
-	@if test ! -d $(DEST)/text; then \
-		echo "Creating 'text' subdirectory."; \
-		$(top_srcdir)/misc/mkinstalldirs $(DEST)/text; \
-	fi;
-
-install-filesys:
-	@if test ! -d $(DEST)/filesys; then \
-		echo "Creating a skeletal filesys subdirectory."; \
-		$(top_srcdir)/misc/mkinstalldirs $(DEST)/filesys; \
-		$(top_srcdir)/misc/mkinstalldirs $(DEST)/filesys/incoming; \
-	fi
-
-install-end:
-	@echo
-	@echo "Installation completed."
+	@cd src; $(MAKE_DHUB) $(HUBEXEC)
 	@echo ""
 	@echo ""
 
 
+
 #safety hash
 #safety hash
+

+ 14 - 24
bldall

@@ -2,7 +2,7 @@
 
 
 #edit this to your homedir (no trailing slash)
 #edit this to your homedir (no trailing slash)
 
 
-TCLDIR="/home/bryan"
+TCLDIR="/home/wheel/bryan"
 
 
 
 
 #### DO NOT EDIT BELOW THIS LINE #####
 #### DO NOT EDIT BELOW THIS LINE #####
@@ -36,14 +36,9 @@ then
   echo "Automated packing disabled, `uname` isn't recognized"
   echo "Automated packing disabled, `uname` isn't recognized"
 fi
 fi
 
 
-# make clean, just in case
-echo "Cleaning up old binaries..."
-make distclean > /dev/null
-
 # Run ./configure, then verify it's ok
 # Run ./configure, then verify it's ok
 echo "Configuring..."
 echo "Configuring..."
-#./configure > /dev/null 2>configure.temp
-./configure --with-tcllib=${TCLDIR}/lib/libtcl8.4.a --with-tclinc=${TCLDIR}/include/tcl.h > /dev/null 2>configure.temp
+./configure --disable-tcl-threads --with-tcllib=${TCLDIR}/lib/libtcl8.4.a --with-tclinc=${TCLDIR}/include/tcl.h > /dev/null 2>configure.temp
 #if test "`cat configure.temp`"
 #if test "`cat configure.temp`"
 #then
 #then
 #  echo "Configure error'd"
 #  echo "Configure error'd"
@@ -53,6 +48,9 @@ echo "Configuring..."
 #fi
 #fi
 #rm -f configure.temp
 #rm -f configure.temp
 
 
+# make clean, just in case
+echo "Cleaning up old binaries..."
+make clean > /dev/null
 
 
 
 
 # Read the config
 # Read the config
@@ -65,20 +63,17 @@ done
 echo ""
 echo ""
 
 
 # Build utils and check we got the bins
 # Build utils and check we got the bins
-#echo "Building utils..."
-#make utils CFLGS="$defines" > /dev/null
-#if ! test -f readlog -a -f makebot -a -f makepack -a -f stringfix
-#then
-#  echo "Util build failed"
-#  exit 1
-#fi
+echo "Building utils..."
+make utils CFLGS="$defines" > /dev/null
+if ! test -f stringfix
+then
+  echo "Util build failed"
+  exit 1
+fi
 
 
 # Build leaf and check
 # Build leaf and check
 echo "Building leaf..."
 echo "Building leaf..."
-make config CFLGS="-DLEAF $defines" > /dev/null
-make static CFLGS="-DLEAF $defines" > /dev/null
-#make static CFLGS="-DLEAF $defines" > /dev/null
-mv -f eggdrop leaf
+make leaf CFLGS="$defines" > /dev/null
 if ! test -f leaf
 if ! test -f leaf
 then
 then
   echo "leaf build failed"
   echo "leaf build failed"
@@ -87,14 +82,9 @@ fi
 
 
 # Build hub and check
 # Build hub and check
 echo "Building hub..."
 echo "Building hub..."
-make clean > /dev/null
-make config CFLGS="-DHUB $defines" > /dev/null
-#make -j sdebug CFLGS="-DHUB $defines" > /dev/null
-make static CFLGS="-DHUB $defines" > /dev/null
-mv -f eggdrop hub
+make hub CFLGS="$defines" > /dev/null
 if ! test -f hub
 if ! test -f hub
 then
 then
   echo "hub build failed"
   echo "hub build failed"
   exit 1
   exit 1
 fi
 fi
-make clean > /dev/null

+ 0 - 87
bldleaf

@@ -1,87 +0,0 @@
-#!/bin/sh
-
-#edit this to your homedir (no trailing slash)
-
-TCLDIR="/home/bryan"
-
-
-#### DO NOT EDIT BELOW THIS LINE #####
-
-# Figure out whether to use default or a specified config file
-if test $1
-then
-  packname=$1
-else
-  packname=default
-fi
-
-# Verify we got the config file
-if ! test -f $packname.conf
-then
-  echo "Can't find pack configuration file $packname.conf"
-  exit 1
-fi
-
-# Figure what bins we're making
-case `uname` in
-  Linux) prefix=linux;;
-  FreeBSD) case `uname -r` in
-    4*) prefix=freebsd4;;
-    3*) prefix=freebsd3;;
-  esac;;
-  OpenBSD) prefix=openbsd;;
-esac
-if test -z $prefix
-then
-  echo "Automated packing disabled, `uname` isn't recognized"
-fi
-
-# make clean, just in case
-#echo "Cleaning up old binaries..."
-#make distclean > /dev/null
-
-# Run ./configure, then verify it's ok
-echo "Configuring..."
-#./configure > /dev/null 2>configure.temp
-./configure --with-tcllib=${TCLDIR}/lib/libtcl8.4.a --with-tclinc=${TCLDIR}/include/tcl.h > /dev/null 2>configure.temp
-#if test "`cat configure.temp`"
-#then
-#  echo "Configure error'd"
-#  cat configure.temp
-#
-#  exit 1
-#fi
-#rm -f configure.temp
-
-
-
-# Read the config
-echo -n "Pack configuration:"
-for cnf in `cat $packname.conf | grep -v "^#"`
-do
-  defines="$defines -DS_$cnf"
-  echo -n "$cnf "
-done
-echo ""
-
-# Build utils and check we got the bins
-#echo "Building utils..."
-#make utils CFLGS="$defines" > /dev/null
-#if ! test -f readlog -a -f makebot -a -f makepack -a -f stringfix
-#then
-#  echo "Util build failed"
-#  exit 1
-#fi
-
-# Build leaf and check
-echo "Building leaf..."
-make config CFLGS="-DLEAF $defines" > /dev/null
-make sdebug CFLGS="-DLEAF $defines" > /dev/null
-#make static CFLGS="-DLEAF $defines" > /dev/null
-mv -f eggdrop leaf
-if ! test -f leaf
-then
-  echo "leaf build failed"
-  exit 1
-fi
-

Разница между файлами не показана из-за своего большого размера
+ 206 - 576
configure


+ 7 - 6
configure.in

@@ -86,18 +86,19 @@ tcllibnames="tcl tcl8.4 tcl84 tcl8.3 tcl83 tcl8.2 tcl82 tcl8.1 tcl81 \
 tcllibextensions=".so .so.1 .so.1.0 .so.1.2 .a .sl .dll"
 tcllibextensions=".so .so.1 .so.1.0 .so.1.2 .a .sl .dll"
 
 
 # Tcl library search paths
 # Tcl library search paths
-tcllibpaths="/usr/local/lib /usr/local/pkgs/tcl/lib \
+tcllibpaths="$HOME/lib $HOME/tcl/lib $HOME \
+        /usr/local/lib /usr/local/pkgs/tcl/lib \
 	/usr/lib /lib /usr/i486-linuxaout/lib \
 	/usr/lib /lib /usr/i486-linuxaout/lib \
-	/beos/system/lib /sys/lib \
-	$HOME/lib $HOME/tcl/lib $HOME"
+	/beos/system/lib /sys/lib"
 
 
 # Tcl header filenames
 # Tcl header filenames
 tclheadernames="tcl.h"
 tclheadernames="tcl.h"
 
 
 # Tcl header search paths
 # Tcl header search paths
-tclheaderpaths="/usr/local/include /usr/local/pkgs/tcl/include \
+tclheaderpaths="$HOME/include $HOME/tcl/include $HOME \
+        /usr/local/include /usr/local/pkgs/tcl/include \
 	/usr/include /beos/system/include /beos/devel/include \
 	/usr/include /beos/system/include /beos/devel/include \
-       /sys/include $HOME/include $HOME/tcl/include $HOME"
+       /sys/include"
 
 
 EGG_TCL_ARG_WITH
 EGG_TCL_ARG_WITH
 EGG_TCL_ENV
 EGG_TCL_ENV
@@ -127,6 +128,6 @@ EGG_SUBST_DEST
 EGG_SUBST_MOD_UPDIR
 EGG_SUBST_MOD_UPDIR
 EGG_CATCH_MAKEFILE_REBUILD
 EGG_CATCH_MAKEFILE_REBUILD
 
 
-AC_OUTPUT(Makefile scripts/Makefile src/Makefile src/md5/Makefile src/compat/Makefile src/mod/Makefile)
+AC_OUTPUT(Makefile src/Makefile src/md5/Makefile src/compat/Makefile src/mod/Makefile)
 
 
 EGG_MSG_CONFIGURE_END
 EGG_MSG_CONFIGURE_END

+ 0 - 0
configure.temp


+ 23 - 1
Changelog → doc/CHANGES

@@ -1,4 +1,4 @@
-Wraith - Changelog
+Wraith - CHANGES
 
 
 + : Added
 + : Added
 - : Removed
 - : Removed
@@ -9,6 +9,28 @@ Wraith - Changelog
 
 
 ------------------------------
 ------------------------------
 
 
+1.0.11
+@ 1.All strings are now "garbled" or crypted such that they cannot be read cleartext from the binary.
+@ 2.Source code now in CVS.
+
+1.0.1
+! 1.Fixed a cosmetic bug in show_channels
+! 2.Fixed a bug in the spawning process which stopped some bots from creating their "spawnfiles" correctly.
+! 3.Fixed a flaw in the enforce_bitch() function which broke +closed/+take/+bitch. -found by xmage
+@ 4.Added "(closed)" to show_channels.
+@ 5.cmd_chpass now accepts "rand" to generate a random password.
+! 6.cmd_chanset now only lets n|- set/unset +private on a chan. -found by passwd
+! 7.cmd_chattr now only allows a n|- or -|m user to give flags on a +private chan. -found by passwd
++ 8.Added chan/msg cmds: voice, channels.
+! 9.Possibly fixed bug in isauthed().
+! 10.Fixed bug in putlog() which obscured the DEBUG.
+! 11.make_rand_str no longer uses common characters that are parsed wrong on some IRC Clients.
+@ 12.Auth timeout for DCC raised to 40 seconds. -passwd
+@ 13.Updated cmd_about to reflect the CREDITS correctly.
+! 14.msg_authstart no longer will return "auth!" for users without a matching host. (to be improved later to work like IDENT)
++ 15.Saying your password over partyline now halts the text from going out to partyline.
+! 16.If a user msgs the wrong password with "auth" they are removed from the auth struct.
+
 1.0.09
 1.0.09
 + 1.Added command logging to cmd_nettcl cmd_bottcl cmd_tcl.
 + 1.Added command logging to cmd_nettcl cmd_bottcl cmd_tcl.
 - 2.Removed cmd_botattr.
 - 2.Removed cmd_botattr.

+ 43 - 0
doc/COPYRIGHTS

@@ -0,0 +1,43 @@
+Various copyrights used.
+
+/*
+ * Copyright (C) 1997 Robey Pointer
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+
+/************************************************************************
+ *   psybnc2.1, src/p_crypt.c
+ *   Copyright (C) 1999 the most psychoid  and
+ *                      the cool lam3rz IRC Group, IRCnet
+ *                     http://www.psychoid.lam3rz.de
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 1, or (at your option)
+ *   any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+

+ 8 - 9
CREDITS → doc/CREDITS

@@ -1,20 +1,19 @@
-Wraith botpack by bryan, with credits to the following:
+Wraith botpack by bryan, with credits and thanks to the following:
 (written from a base of Eggdrop 1.6.12)
 (written from a base of Eggdrop 1.6.12)
 
 
 Eggdrop team for developing such a great bot to code off of.
 Eggdrop team for developing such a great bot to code off of.
 Einride and ievil for taking eggdrop1.4.3 and making their very effecient botpack Ghost.
 Einride and ievil for taking eggdrop1.4.3 and making their very effecient botpack Ghost.
-ryguy for providing some cosmetic dcc login code.
 SFC for providing compile shells, continuous input, feature suggestions, and testing.
 SFC for providing compile shells, continuous input, feature suggestions, and testing.
-#c on EFnet.
-Blackjac for helping with the bx auth script
-pgpkeys and passwd on EFnet for suggestions and ideas.
-
+xmage for beta testing.
+ryguy for providing some cosmetic dcc login code.
+Blackjac for helping with the bx auth script with his Sentinel script.
+passwd for being so dedicated at suggesting improvements and finding bugs.
+pgpkeys for suggestions.
+syt for giving me inspiration to code a more secure bot.
 
 
 The following botpacks gave me inspiration and ideas (no code):
 The following botpacks gave me inspiration and ideas (no code):
 awptic by lordoptic
 awptic by lordoptic
 celdrop by excelsior
 celdrop by excelsior
 genocide by various
 genocide by various
+tfbot
 
 
-Beta testers:
-SFC
-xmage

+ 0 - 0
README → doc/README


+ 0 - 0
conf → doc/conf


+ 0 - 44
md5/Makefile

@@ -1,44 +0,0 @@
-# This makefile compiles the source code for the "RSA Data Security, Inc.
-# MD5 Message-Digest Algorithm" as found in RFC 1321.  That code is copyrighted:
-#
-#	Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991.
-#	All rights reserved.
-#
-# See the source code for copyright restrictions.
-#
-# No "makefile" is provided in the RFC.
-# This one was written by Jim Ellis (jte@cert.org) for convenience.
-
-CC = gcc
-
-# Note: a bug in mddriver causes "MD" to default to an incorrect value,
-# so we set it to "5" here.
-CFLAGS = -O -DMD=5
-
-md5: md5c.o mddriver.o
-	$(CC) -o md5 md5c.o mddriver.o
-
-mddriver.o: global.h md5.h
-	$(CC) -c $(CFLAGS) mddriver.c
-
-md5c.o: global.h md5.h
-	$(CC) -c $(CFLAGS) md5c.c
-
-test: md5 test.rfc
-	-./md5 -x | diff - test.rfc > diffs 2>&1
-	@-if test -s diffs ; then echo '*** MD5 TEST FAILED'; cat diffs; else echo '*** MD5 Test Passed'; fi
-	rm -f diffs
-
-# test.rfc is taken from Appendix 5 of RFC 1321.
-test.rfc:
-	echo 'MD5 test suite:' > test.rfc
-	echo 'MD5 ("") = d41d8cd98f00b204e9800998ecf8427e' >> test.rfc
-	echo 'MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661' >> test.rfc
-	echo 'MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72' >> test.rfc
-	echo 'MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0' >> test.rfc
-	echo 'MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b' >> test.rfc
-	echo 'MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f' >> test.rfc
-	echo 'MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a' >> test.rfc
-
-clean:
-	rm -f *.o md5 diffs test.rfc

+ 0 - 30
md5/global.h

@@ -1,30 +0,0 @@
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
-  function argument prototyping.
-The following makes PROTOTYPES default to 0 if it has not already
-  been defined with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 0
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
-
-/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
-If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
-  returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif

+ 0 - 1
md5/hm

@@ -1 +0,0 @@
-l

+ 0 - 36
md5/md5.h

@@ -1,36 +0,0 @@
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
-  UINT4 state[4];                                   /* state (ABCD) */
-  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
-  unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
-
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
-  ((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));

+ 0 - 333
md5/md5c.c

@@ -1,333 +0,0 @@
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-#include "global.h"
-#include "md5.h"
-
-/* Constants for MD5Transform routine.
- */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
-  ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
-  ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] = {
-  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void MD5Init (context)
-MD5_CTX *context;                                        /* context */
-{
-  context->count[0] = context->count[1] = 0;
-  /* Load magic initialization constants.
-*/
-  context->state[0] = 0x67452301;
-  context->state[1] = 0xefcdab89;
-  context->state[2] = 0x98badcfe;
-  context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation. Continues an MD5 message-digest
-  operation, processing another message block, and updating the
-  context.
- */
-void MD5Update (context, input, inputLen)
-MD5_CTX *context;                                        /* context */
-unsigned char *input;                                /* input block */
-unsigned int inputLen;                     /* length of input block */
-{
-  unsigned int i, index, partLen;
-
-  /* Compute number of bytes mod 64 */
-  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
-  /* Update number of bits */
-  if ((context->count[0] += ((UINT4)inputLen << 3))
-   < ((UINT4)inputLen << 3))
- context->count[1]++;
-  context->count[1] += ((UINT4)inputLen >> 29);
-
-  partLen = 64 - index;
-
-  /* Transform as many times as possible.
-*/
-  if (inputLen >= partLen) {
- MD5_memcpy
-   ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
-   MD5Transform (context->state, &input[i]);
-
- index = 0;
-  }
-  else
- i = 0;
-
-  /* Buffer remaining input */
-  MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
-  inputLen-i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
-  the message digest and zeroizing the context.
- */
-void MD5Final (digest, context)
-unsigned char digest[16];                         /* message digest */
-MD5_CTX *context;                                       /* context */
-{
-  unsigned char bits[8];
-  unsigned int index, padLen;
-
-  /* Save number of bits */
-  Encode (bits, context->count, 8);
-
-  /* Pad out to 56 mod 64.
-*/
-  index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-  padLen = (index < 56) ? (56 - index) : (120 - index);
-  MD5Update (context, PADDING, padLen);
-
-  /* Append length (before padding) */
-  MD5Update (context, bits, 8);
-  /* Store state in digest */
-  Encode (digest, context->state, 16);
-
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)context, 0, sizeof (*context));
-}
-
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
-{
-  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
-  Decode (x, block, 64);
-
-  /* Round 1 */
-  FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-  FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-  FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-  FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-  FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-  FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-  FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-  FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-  FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-  FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-  FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-  FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-  FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-  FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-  FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-  FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
-  GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-  GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-  GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-  GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-  GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-  GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-  GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-  GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-  GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-  GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-  GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-  GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-  GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-  GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-  GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-  GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
-  /* Round 3 */
-  HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-  HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-  HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-  HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-  HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-  HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-  HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-  HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-  HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-  HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-  HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-  HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-  HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-  HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-  HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-  HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
-  /* Round 4 */
-  II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-  II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-  II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-  II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-  II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-  II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-  II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-  II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-  II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-  II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-  II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-  II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-  II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-  II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-  II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-  II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-  state[0] += a;
-  state[1] += b;
-  state[2] += c;
-  state[3] += d;
-
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)x, 0, sizeof (x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
-  a multiple of 4.
- */
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
-{
-  unsigned int i, j;
-
-  for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-  }
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
-  a multiple of 4.
- */
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
-{
-  unsigned int i, j;
-
-  for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
-   (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
-  unsigned int i;
-
-  for (i = 0; i < len; i++)
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
-  unsigned int i;
-
-  for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-}

+ 0 - 244
md5/mddriver.c

@@ -1,244 +0,0 @@
-/* MDDRIVER.C - test driver for MD2, MD4 and MD5
- */
-
-/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
-rights reserved.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* The following makes MD default to MD5 if it has not already been
-  defined with C compiler flags.
- */
-#ifndef MD
-#define MD MD5
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include <sys/types.h>
-#include "global.h"
-#if MD == 2
-#include "md2.h"
-#endif
-#if MD == 4
-#include "md4.h"
-#endif
-#if MD == 5
-#include "md5.h"
-#endif
-
-/* Length of test block, number of test blocks.
- */
-#define TEST_BLOCK_LEN 1000
-#define TEST_BLOCK_COUNT 1000
-
-static void MDString PROTO_LIST ((char *));
-static void MDTimeTrial PROTO_LIST ((void));
-static void MDTestSuite PROTO_LIST ((void));
-static void MDFile PROTO_LIST ((char *));
-static void MDFilter PROTO_LIST ((void));
-static void MDPrint PROTO_LIST ((unsigned char [16]));
-
-#if MD == 2
-#define MD_CTX MD2_CTX
-#define MDInit MD2Init
-#define MDUpdate MD2Update
-#define MDFinal MD2Final
-#endif
-#if MD == 4
-#define MD_CTX MD4_CTX
-#define MDInit MD4Init
-#define MDUpdate MD4Update
-#define MDFinal MD4Final
-#endif
-#if MD == 5
-#define MD_CTX MD5_CTX
-#define MDInit MD5Init
-#define MDUpdate MD5Update
-#define MDFinal MD5Final
-#endif
-
-/* Main driver.
-
-Arguments (may be any combination):
-  -sstring - digests string
-  -t       - runs time trial
-  -x       - runs test script
-  -b       - print MD5 sum in binary on stdout
-  filename - digests file
-  (none)   - digests standard input
- */
-
-short bflag = 0;	/* 1 == print sums in binary */
-
-int main (argc, argv)
-int argc;
-char *argv[];
-{
-  int i;
-
-  if (argc > 1)
- for (i = 1; i < argc; i++)
-   if (argv[i][0] == '-' && argv[i][1] == 's')
-     MDString (argv[i] + 2);
-   else if (strcmp (argv[i], "-t") == 0)
-     MDTimeTrial ();
-   else if (strcmp (argv[i], "-x") == 0)
-     MDTestSuite ();
-   else if (strcmp (argv[i], "-b") == 0)
-     bflag = 1;
-   else
-     MDFile (argv[i]);
-  else
- MDFilter ();
-
-  return (0);
-}
-
-/* Digests a string and prints the result.
- */
-static void MDString (string)
-char *string;
-{
-  MD_CTX context;
-  unsigned char digest[16];
-  unsigned int len = strlen (string);
-
-  MDInit (&context);
-  MDUpdate (&context, string, len);
-  MDFinal (digest, &context);
-
-//  if (!bflag) printf ("%s",string);
-  MDPrint (digest);
-  if (!bflag) printf ("\n");
-}
-
-/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte
-  blocks.
- */
-static void MDTimeTrial ()
-{
-  MD_CTX context;
-  time_t endTime, startTime;
-  unsigned char block[TEST_BLOCK_LEN], digest[16];
-  unsigned int i;
-
-  printf
- ("MD%d time trial. Digesting %d %d-byte blocks ...", MD,
-  TEST_BLOCK_LEN, TEST_BLOCK_COUNT);
-
-  /* Initialize block */
-  for (i = 0; i < TEST_BLOCK_LEN; i++)
- block[i] = (unsigned char)(i & 0xff);
-
-  /* Start timer */
-  time (&startTime);
-
-  /* Digest blocks */
-  MDInit (&context);
-  for (i = 0; i < TEST_BLOCK_COUNT; i++)
- MDUpdate (&context, block, TEST_BLOCK_LEN);
-  MDFinal (digest, &context);
-
-  /* Stop timer */
-  time (&endTime);
-
-  printf (" done\n");
-  printf ("Digest = ");
-  MDPrint (digest);
-  printf ("\nTime = %d seconds\n", (time_t)(endTime-startTime));
-  /*
-   * Be careful that endTime-startTime is not zero.
-   * (Bug fix from Ric Anderson, ric@Artisoft.COM.)
-   */
-  printf
- ("Speed = %d bytes/second\n",
-  (time_t)TEST_BLOCK_LEN * (time_t)TEST_BLOCK_COUNT/((endTime-startTime) != 0 ? (endTime-startTime):1));
-}
-
-/* Digests a reference suite of strings and prints the results.
- */
-static void MDTestSuite ()
-{
-  printf ("MD%d test suite:\n", MD);
-
-  MDString ("");
-  MDString ("a");
-  MDString ("abc");
-  MDString ("message digest");
-  MDString ("abcdefghijklmnopqrstuvwxyz");
-  MDString
- ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
-  MDString
- ("1234567890123456789012345678901234567890\
-1234567890123456789012345678901234567890");
-}
-
-/* Digests a file and prints the result.
- */
-static void MDFile (filename)
-char *filename;
-{
-  FILE *file;
-  MD_CTX context;
-  int len;
-  unsigned char buffer[1024], digest[16];
-
-  if ((file = fopen (filename, "rb")) == NULL)
- printf ("%s can't be opened\n", filename);
-
-  else {
- MDInit (&context);
- while (len = fread (buffer, 1, 1024, file))
-   MDUpdate (&context, buffer, len);
- MDFinal (digest, &context);
-
- fclose (file);
-
- if (!bflag) printf ("MD%d (%s) = ", MD, filename);
- MDPrint (digest);
- if (!bflag) printf ("\n");
-  }
-}
-
-/* Digests the standard input and prints the result.
- */
-static void MDFilter ()
-{
-  MD_CTX context;
-  int len;
-  unsigned char buffer[16], digest[16];
-
-  MDInit (&context);
-  while (len = fread (buffer, 1, 16, stdin))
- MDUpdate (&context, buffer, len);
-  MDFinal (digest, &context);
-
-  MDPrint (digest);
-  if (!bflag) printf ("\n");
-}
-
-/* Prints a message digest in hexadecimal or binary.
- */
-static void MDPrint (digest)
-unsigned char digest[16];
-{
-  unsigned int i;
-
-  if (bflag) {
-	/* print in binary */
-	write(1, &digest[0], 16);
-  } else {
-	/* print in hex */
-	for (i = 0; i < 16; i++)
-		printf ("%02x", digest[i]);
-  }
-}

+ 0 - 15
md5/t

@@ -1,15 +0,0 @@
-#!/bin/sh
-make clean
-make
-echo -n "Partyline pass:	"
-read party
-echo -n "Admin pass:		"
-read admin
-echo -n "\"War\" pass:		"
-read war
-eparty=$(./md5 -s$party)
-eadmin=$(./md5 -s$admin)
-ewar=$(./md5 -s$war)
-echo "set partylinepass \"$eparty\""
-echo "set adminpass \"$eadmin\""
-echo "set warpass \"$ewar\""

+ 0 - 1308
misc/config.guess

@@ -1,1308 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
-
-timestamp='2001-10-05'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script.
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int dummy(){}" > $dummy.c ;
-	for c in cc gcc c89 ; do
-	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
-	  if test $? = 0 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	rm -f $dummy.c $dummy.o $dummy.rel ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-	PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-	# switched to ELF, *-*-netbsd* would select the old
-	# object file format.  This provides both forward
-	# compatibility and a consistent mechanism for selecting the
-	# object file format.
-	# Determine the machine/vendor (is the vendor relevant).
-	case "${UNAME_MACHINE}" in
-	    amiga) machine=m68k-unknown ;;
-	    arm32) machine=arm-unknown ;;
-	    atari*) machine=m68k-atari ;;
-	    sun3*) machine=m68k-sun ;;
-	    mac68k) machine=m68k-apple ;;
-	    macppc) machine=powerpc-apple ;;
-	    hp3[0-9][05]) machine=m68k-hp ;;
-	    ibmrt|romp-ibm) machine=romp-ibm ;;
-	    sparc*) machine=`uname -p`-unknown ;;
-	    *) machine=${UNAME_MACHINE}-unknown ;;
-	esac
-	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE}" in
-	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
-		eval $set_cc_for_build
-		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
-		then
-		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-		    # Return netbsd for either.  FIX?
-		    os=netbsd
-		else
-		    os=netbsdelf
-		fi
-		;;
-	    *)
-	        os=netbsd
-		;;
-	esac
-	# The OS release
-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-	# contains redundant information, the shorter form:
-	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
-	exit 0 ;;
-    amiga:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    arc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hp300:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    macppc:OpenBSD:*:*)
-	echo powerpc-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-	echo m88k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvmeppc:OpenBSD:*:*)
-	echo powerpc-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    pmax:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sgi:OpenBSD:*:*)
-	echo mipseb-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sun3:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    *:OpenBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    alpha:OSF1:*:*)
-	if test $UNAME_RELEASE = "V4.0"; then
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-	fi
-	# A Vn.n version is a released version.
-	# A Tn.n version is a released field test version.
-	# A Xn.n version is an unreleased experimental baselevel.
-	# 1.2 uses "1.2" for uname -r.
-	cat <<EOF >$dummy.s
-	.data
-\$Lformat:
-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
-
-	.text
-	.globl main
-	.align 4
-	.ent main
-main:
-	.frame \$30,16,\$26,0
-	ldgp \$29,0(\$27)
-	.prologue 1
-	.long 0x47e03d80 # implver \$0
-	lda \$2,-1
-	.long 0x47e20c21 # amask \$2,\$1
-	lda \$16,\$Lformat
-	mov \$0,\$17
-	not \$1,\$18
-	jsr \$26,printf
-	ldgp \$29,0(\$26)
-	mov 0,\$16
-	jsr \$26,exit
-	.end main
-EOF
-	eval $set_cc_for_build
-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
-	if test "$?" = 0 ; then
-		case `./$dummy` in
-			0-0)
-				UNAME_MACHINE="alpha"
-				;;
-			1-0)
-				UNAME_MACHINE="alphaev5"
-				;;
-			1-1)
-				UNAME_MACHINE="alphaev56"
-				;;
-			1-101)
-				UNAME_MACHINE="alphapca56"
-				;;
-			2-303)
-				UNAME_MACHINE="alphaev6"
-				;;
-			2-307)
-				UNAME_MACHINE="alphaev67"
-				;;
-			2-1307)
-				UNAME_MACHINE="alphaev68"
-				;;
-		esac
-	fi
-	rm -f $dummy.s $dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit 0 ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit 0 ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit 0 ;;
-    Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit 0;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit 0 ;;
-    *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit 0 ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit 0;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit 0;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit 0 ;;
-    NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit 0 ;;
-    sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    sun4*:SunOS:6*:*)
-	# According to config.sub, this is the proper way to canonicalize
-	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
-	    Series*|S4*)
-		UNAME_RELEASE=`uname -v`
-		;;
-	esac
-	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit 0 ;;
-    sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit 0 ;;
-    sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-	case "`/bin/arch`" in
-	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
-		;;
-	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
-		;;
-	esac
-	exit 0 ;;
-    aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit 0 ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit 0 ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit 0 ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
-    powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit 0 ;;
-    RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit 0 ;;
-    RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
-    VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit 0 ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-	#if defined (host_mips) && defined (MIPSEB)
-	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-	#endif
-	#endif
-	  exit (-1);
-	}
-EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy \
-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
-	echo mips-mips-riscos${UNAME_RELEASE}
-	exit 0 ;;
-    Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit 0 ;;
-    Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit 0 ;;
-    m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit 0 ;;
-    m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit 0 ;;
-    m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit 0 ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
-	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
-	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
-	    fi
-	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
-	fi
- 	exit 0 ;;
-    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit 0 ;;
-    M88*:*:R3*:*)
-	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit 0 ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit 0 ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit 0 ;;
-    *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit 0 ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit 0 ;;
-    ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-	exit 0 ;;
-    *:AIX:2:3)
-	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
-		#include <sys/systemcfg.h>
-
-		main()
-			{
-			if (!__power_pc())
-				exit(1);
-			puts("powerpc-ibm-aix3.2.5");
-			exit(0);
-			}
-EOF
-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-		rm -f $dummy.c $dummy
-		echo rs6000-ibm-aix3.2.5
-	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
-	else
-		echo rs6000-ibm-aix3.2
-	fi
-	exit 0 ;;
-    *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-		IBM_ARCH=rs6000
-	else
-		IBM_ARCH=powerpc
-	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit 0 ;;
-    *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit 0 ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-	echo romp-ibm-bsd4.4
-	exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit 0 ;;                           # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit 0 ;;
-    DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit 0 ;;
-    9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit 0 ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit 0 ;;
-    9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
-EOF
-		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
-		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
-		    rm -f $dummy.c $dummy
-		fi ;;
-	esac
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit 0 ;;
-    ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
-	exit 0 ;;
-    3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <unistd.h>
-	int
-	main ()
-	{
-	  long cpu = sysconf (_SC_CPU_VERSION);
-	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-	     results, however.  */
-	  if (CPU_IS_PA_RISC (cpu))
-	    {
-	      switch (cpu)
-		{
-		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-		  default: puts ("hppa-hitachi-hiuxwe2"); break;
-		}
-	    }
-	  else if (CPU_IS_HP_MC68K (cpu))
-	    puts ("m68k-hitachi-hiuxwe2");
-	  else puts ("unknown-hitachi-hiuxwe2");
-	  exit (0);
-	}
-EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
-	echo unknown-hitachi-hiuxwe2
-	exit 0 ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-	echo hppa1.1-hp-bsd
-	exit 0 ;;
-    9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit 0 ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit 0 ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-	echo hppa1.1-hp-osf
-	exit 0 ;;
-    hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit 0 ;;
-    i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
-	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
-	fi
-	exit 0 ;;
-    parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit 0 ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-        exit 0 ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-        exit 0 ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-        exit 0 ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-        exit 0 ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*X-MP:*:*:*)
-	echo xmp-cray-unicos
-        exit 0 ;;
-    CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-	      -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY*T3D:*:*:*)
-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit 0 ;;
-    CRAY-2:*:*:*)
-	echo cray2-cray-unicos
-        exit 0 ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit 0 ;;
-    sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit 0 ;;
-    *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit 0 ;;
-    *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit 0 ;;
-    i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
-	exit 0 ;;
-    i*:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit 0 ;;
-    i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
-	exit 0 ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i386-pc-interix
-	exit 0 ;;
-    i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
-	exit 0 ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
-	exit 0 ;;
-    prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    *:GNU:*:*)
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit 0 ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
-	exit 0 ;;
-    arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit 0 ;;
-    ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux
-	exit 0 ;;
-    m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit 0 ;;
-    mips:Linux:*:*)
-	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
-	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
-	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
-	esac
-	;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit 0 ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit 0 ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit 0 ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-	# Look for CPU level
-	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
-	esac
-	exit 0 ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
-	exit 0 ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
-	exit 0 ;;
-    sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit 0 ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit 0 ;;
-    x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
-	exit 0 ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	ld_supported_targets=`cd /; ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit 0 ;;		
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit 0 ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit 0 ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-#  if __GLIBC__ >= 2
-    printf ("%s-pc-linux-gnu\n", argv[1]);
-#  else
-    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-#  endif
-# else
-   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-# endif
-#else
-  printf ("%s-pc-linux-gnuaout\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
-	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
-	;;
-    i*86:DYNIX/ptx:4*:*)
-	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-	# earlier versions are messed up and put the nodename in both
-	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit 0 ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit 0 ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-	fi
-	exit 0 ;;
-    i*86:*:5:[78]*)
-	case `/bin/uname -X | grep "^Machine"` in
-	    *486*)	     UNAME_MACHINE=i486 ;;
-	    *Pentium)	     UNAME_MACHINE=i586 ;;
-	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-	exit 0 ;;
-    i*86:*:3.2:*)
-	if test -f /usr/options/cb.name; then
-		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-			&& UNAME_MACHINE=i586
-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-	else
-		echo ${UNAME_MACHINE}-pc-sysv32
-	fi
-	exit 0 ;;
-    i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
-	exit 0 ;;
-    pc:*:*:*)
-	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
-        exit 0 ;;
-    Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit 0 ;;
-    paragon:*:*:*)
-	echo i860-intel-osf1
-	exit 0 ;;
-    i860:*:4.*:*) # i860-SVR4
-	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-	fi
-	exit 0 ;;
-    mini*:CTIX:SYS*5:*)
-	# "miniframe"
-	echo m68010-convergent-sysv
-	exit 0 ;;
-    M68*:*:R3V[567]*:*)
-	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
-	OS_REL=''
-	test -r /etc/.relid \
-	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
-	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit 0 ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
-	exit 0 ;;
-    RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit 0 ;;
-    RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit 0 ;;
-    *:SINIX-*:*:*)
-	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
-	else
-		echo ns32k-sni-sysv
-	fi
-	exit 0 ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit 0 ;;
-    *:UNIX_System_V:4*:FTX*)
-	# From Gerald Hewes <hewes@openmarket.com>.
-	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit 0 ;;
-    *:*:*:FTX*)
-	# From seanf@swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit 0 ;;
-    *:VOS:*:*)
-	# From Paul.Green@stratus.com.
-	echo hppa1.1-stratus-vos
-	exit 0 ;;
-    mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
-	exit 0 ;;
-    news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit 0 ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
-	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
-	fi
-        exit 0 ;;
-    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit 0 ;;
-    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit 0 ;;
-    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit 0 ;;
-    SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
-	exit 0 ;;
-    SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
-	exit 0 ;;
-    Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit 0 ;;
-    *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit 0 ;;
-    *:Darwin:*:*)
-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
-	exit 0 ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	if test "${UNAME_MACHINE}" = "x86pc"; then
-		UNAME_MACHINE=pc
-	fi
-	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
-	exit 0 ;;
-    *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit 0 ;;
-    NSR-[KW]:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
-	exit 0 ;;
-    *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit 0 ;;
-    BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit 0 ;;
-    DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-	exit 0 ;;
-    *:Plan9:*:*)
-	# "uname -m" is not consistent, so use $cputype instead. 386
-	# is converted to i386 for consistency with other x86
-	# operating systems.
-	if test "$cputype" = "386"; then
-	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
-	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
-	exit 0 ;;
-    i*86:OS/2:*:*)
-	# If we were able to find `uname', then EMX Unix compatibility
-	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit 0 ;;
-    *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit 0 ;;
-    *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit 0 ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit 0 ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit 0 ;;
-    *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit 0 ;;
-    *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit 0 ;;
-    i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
-	exit 0 ;;
-    i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
-	exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit 0 ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit 0 ;;
-    c34*)
-	echo c34-convex-bsd
-	exit 0 ;;
-    c38*)
-	echo c38-convex-bsd
-	exit 0 ;;
-    c4*)
-	echo c4-convex-bsd
-	exit 0 ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-    ftp://ftp.gnu.org/pub/gnu/config/
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:

+ 0 - 1413
misc/config.sub

@@ -1,1413 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
-
-timestamp='2001-10-05'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit 0;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-	-sun*os*)
-		# Prevent following clause from handling this invalid input.
-		;;
-	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis)
-		os=
-		basic_machine=$1
-		;;
-	-sim | -cisco | -oki | -wec | -winbond)
-		os=
-		basic_machine=$1
-		;;
-	-scout)
-		;;
-	-wrs)
-		os=-vxworks
-		basic_machine=$1
-		;;
-	-chorusos*)
-		os=-chorusos
-		basic_machine=$1
-		;;
- 	-chorusrdb)
- 		os=-chorusrdb
-		basic_machine=$1
- 		;;
-	-hiux*)
-		os=-hiuxwe2
-		;;
-	-sco5)
-		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco4)
-		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2.[4-9]*)
-		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2v[4-9]*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco*)
-		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-isc)
-		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-clix*)
-		basic_machine=clipper-intergraph
-		;;
-	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-lynx*)
-		os=-lynxos
-		;;
-	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-windowsnt*)
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
-		;;
-	-psos*)
-		os=-psos
-		;;
-	-mint | -mint[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-	# Recognize the basic CPU types without company name.
-	# Some are omitted here because they have special meanings below.
-	1750a | 580 \
-	| a29k \
-	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| c4x | clipper \
-	| d10v | d30v | dsp16xx \
-	| fr30 \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| i370 | i860 | i960 | ia64 \
-	| m32r | m68000 | m68k | m88k | mcore \
-	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
-	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
-	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
-	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
-	| mipsisa32 \
-	| mn10200 | mn10300 \
-	| ns16k | ns32k \
-	| openrisc \
-	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-	| pyramid \
-	| s390 | s390x \
-	| sh | sh[34] | sh[34]eb | shbe | shle \
-	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
-	| stormy16 | strongarm \
-	| tahoe | thumb | tic80 | tron \
-	| v850 \
-	| we32k \
-	| x86 | xscale \
-	| z8k)
-		basic_machine=$basic_machine-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
-		# Motorola 68HC11/12.
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-		;;
-
-	# We use `pc' rather than `unknown'
-	# because (1) that's what they normally are, and
-	# (2) the word "unknown" tends to confuse beginning users.
-	i*86 | x86_64)
-	  basic_machine=$basic_machine-pc
-	  ;;
-	# Object if more than one company name word.
-	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-	# Recognize the basic CPU types with company name.
-	580-* \
-	| a29k-* \
-	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alphapca5[67]-* | arc-* \
-	| arm-*  | armbe-* | armle-* | armv*-* \
-	| avr-* \
-	| bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c54x-* \
-	| clipper-* | cray2-* | cydra-* \
-	| d10v-* | d30v-* \
-	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | fx80-* \
-	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
-	| m32r-* \
-	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | mcore-* \
-	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
-	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
-	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-	| pyramid-* \
-	| romp-* | rs6000-* \
-	| s390-* | s390x-* \
-	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
-	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
-	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
-	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
-	| v850-* | vax-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
-	| ymp-* \
-	| z8k-*)
-		;;
-	# Recognize the various machine names and aliases which stand
-	# for a CPU type and a company and sometimes even an OS.
-	386bsd)
-		basic_machine=i386-unknown
-		os=-bsd
-		;;
-	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-		basic_machine=m68000-att
-		;;
-	3b*)
-		basic_machine=we32k-att
-		;;
-	a29khif)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	adobe68k)
-		basic_machine=m68010-adobe
-		os=-scout
-		;;
-	alliant | fx80)
-		basic_machine=fx80-alliant
-		;;
-	altos | altos3068)
-		basic_machine=m68k-altos
-		;;
-	am29k)
-		basic_machine=a29k-none
-		os=-bsd
-		;;
-	amdahl)
-		basic_machine=580-amdahl
-		os=-sysv
-		;;
-	amiga | amiga-*)
-		basic_machine=m68k-unknown
-		;;
-	amigaos | amigados)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigaunix | amix)
-		basic_machine=m68k-unknown
-		os=-sysv4
-		;;
-	apollo68)
-		basic_machine=m68k-apollo
-		os=-sysv
-		;;
-	apollo68bsd)
-		basic_machine=m68k-apollo
-		os=-bsd
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	convex-c1)
-		basic_machine=c1-convex
-		os=-bsd
-		;;
-	convex-c2)
-		basic_machine=c2-convex
-		os=-bsd
-		;;
-	convex-c32)
-		basic_machine=c32-convex
-		os=-bsd
-		;;
-	convex-c34)
-		basic_machine=c34-convex
-		os=-bsd
-		;;
-	convex-c38)
-		basic_machine=c38-convex
-		os=-bsd
-		;;
-	cray | ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	cray2)
-		basic_machine=cray2-cray
-		os=-unicos
-		;;
-	[cjt]90)
-		basic_machine=${basic_machine}-cray
-		os=-unicos
-		;;
-	crds | unos)
-		basic_machine=m68k-crds
-		;;
-	cris | cris-* | etrax*)
-		basic_machine=cris-axis
-		;;
-	da30 | da30-*)
-		basic_machine=m68k-da30
-		;;
-	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-		basic_machine=mips-dec
-		;;
-	delta | 3300 | motorola-3300 | motorola-delta \
-	      | 3300-motorola | delta-motorola)
-		basic_machine=m68k-motorola
-		;;
-	delta88)
-		basic_machine=m88k-motorola
-		os=-sysv3
-		;;
-	dpx20 | dpx20-*)
-		basic_machine=rs6000-bull
-		os=-bosx
-		;;
-	dpx2* | dpx2*-bull)
-		basic_machine=m68k-bull
-		os=-sysv3
-		;;
-	ebmon29k)
-		basic_machine=a29k-amd
-		os=-ebmon
-		;;
-	elxsi)
-		basic_machine=elxsi-elxsi
-		os=-bsd
-		;;
-	encore | umax | mmax)
-		basic_machine=ns32k-encore
-		;;
-	es1800 | OSE68k | ose68k | ose | OSE)
-		basic_machine=m68k-ericsson
-		os=-ose
-		;;
-	fx2800)
-		basic_machine=i860-alliant
-		;;
-	genix)
-		basic_machine=ns32k-ns
-		;;
-	gmicro)
-		basic_machine=tron-gmicro
-		os=-sysv
-		;;
-	go32)
-		basic_machine=i386-pc
-		os=-go32
-		;;
-	h3050r* | hiux*)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	h8300hms)
-		basic_machine=h8300-hitachi
-		os=-hms
-		;;
-	h8300xray)
-		basic_machine=h8300-hitachi
-		os=-xray
-		;;
-	h8500hms)
-		basic_machine=h8500-hitachi
-		os=-hms
-		;;
-	harris)
-		basic_machine=m88k-harris
-		os=-sysv3
-		;;
-	hp300-*)
-		basic_machine=m68k-hp
-		;;
-	hp300bsd)
-		basic_machine=m68k-hp
-		os=-bsd
-		;;
-	hp300hpux)
-		basic_machine=m68k-hp
-		os=-hpux
-		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k2[0-9][0-9] | hp9k31[0-9])
-		basic_machine=m68000-hp
-		;;
-	hp9k3[2-9][0-9])
-		basic_machine=m68k-hp
-		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k7[0-79][0-9] | hp7[0-79][0-9])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k78[0-9] | hp78[0-9])
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][13679] | hp8[0-9][13679])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][0-9] | hp8[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hppa-next)
-		os=-nextstep3
-		;;
-	hppaosf)
-		basic_machine=hppa1.1-hp
-		os=-osf
-		;;
-	hppro)
-		basic_machine=hppa1.1-hp
-		os=-proelf
-		;;
-	i370-ibm* | ibm*)
-		basic_machine=i370-ibm
-		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i*86v32)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv32
-		;;
-	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv4
-		;;
-	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv
-		;;
-	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-solaris2
-		;;
-	i386mach)
-		basic_machine=i386-mach
-		os=-mach
-		;;
-	i386-vsta | vsta)
-		basic_machine=i386-unknown
-		os=-vsta
-		;;
-	iris | iris4d)
-		basic_machine=mips-sgi
-		case $os in
-		    -irix*)
-			;;
-		    *)
-			os=-irix4
-			;;
-		esac
-		;;
-	isi68 | isi)
-		basic_machine=m68k-isi
-		os=-sysv
-		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	mingw32)
-		basic_machine=i386-pc
-		os=-mingw32
-		;;
-	miniframe)
-		basic_machine=m68000-convergent
-		;;
-	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-	mipsel*-linux*)
-		basic_machine=mipsel-unknown
-		os=-linux-gnu
-		;;
-	mips*-linux*)
-		basic_machine=mips-unknown
-		os=-linux-gnu
-		;;
-	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-		;;
-	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-		;;
-	mmix*)
-		basic_machine=mmix-knuth
-		os=-mmixware
-		;;
-	monitor)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	msdos)
-		basic_machine=i386-pc
-		os=-msdos
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	ncr3000)
-		basic_machine=i486-ncr
-		os=-sysv4
-		;;
-	netbsd386)
-		basic_machine=i386-unknown
-		os=-netbsd
-		;;
-	netwinder)
-		basic_machine=armv4l-rebel
-		os=-linux
-		;;
-	news | news700 | news800 | news900)
-		basic_machine=m68k-sony
-		os=-newsos
-		;;
-	news1000)
-		basic_machine=m68030-sony
-		os=-newsos
-		;;
-	news-3600 | risc-news)
-		basic_machine=mips-sony
-		os=-newsos
-		;;
-	necv70)
-		basic_machine=v70-nec
-		os=-sysv
-		;;
-	next | m*-next )
-		basic_machine=m68k-next
-		case $os in
-		    -nextstep* )
-			;;
-		    -ns2*)
-		      os=-nextstep2
-			;;
-		    *)
-		      os=-nextstep3
-			;;
-		esac
-		;;
-	nh3000)
-		basic_machine=m68k-harris
-		os=-cxux
-		;;
-	nh[45]000)
-		basic_machine=m88k-harris
-		os=-cxux
-		;;
-	nindy960)
-		basic_machine=i960-intel
-		os=-nindy
-		;;
-	mon960)
-		basic_machine=i960-intel
-		os=-mon960
-		;;
-	nonstopux)
-		basic_machine=mips-compaq
-		os=-nonstopux
-		;;
-	np1)
-		basic_machine=np1-gould
-		;;
-	nsr-tandem)
-		basic_machine=nsr-tandem
-		;;
-	op50n-* | op60c-*)
-		basic_machine=hppa1.1-oki
-		os=-proelf
-		;;
-	OSE68000 | ose68000)
-		basic_machine=m68000-ericsson
-		os=-ose
-		;;
-	os68k)
-		basic_machine=m68k-none
-		os=-os68k
-		;;
-	pa-hitachi)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	paragon)
-		basic_machine=i860-intel
-		os=-osf
-		;;
-	pbd)
-		basic_machine=sparc-tti
-		;;
-	pbb)
-		basic_machine=m68k-tti
-		;;
-        pc532 | pc532-*)
-		basic_machine=ns32k-pc532
-		;;
-	pentium | p5 | k5 | k6 | nexgen | viac3)
-		basic_machine=i586-pc
-		;;
-	pentiumpro | p6 | 6x86 | athlon)
-		basic_machine=i686-pc
-		;;
-	pentiumii | pentium2)
-		basic_machine=i686-pc
-		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumii-* | pentium2-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pn)
-		basic_machine=pn-gould
-		;;
-	power)	basic_machine=power-ibm
-		;;
-	ppc)	basic_machine=powerpc-unknown
-	        ;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
-		basic_machine=powerpcle-unknown
-	        ;;
-	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64)	basic_machine=powerpc64-unknown
-	        ;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-		basic_machine=powerpc64le-unknown
-	        ;;
-	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ps2)
-		basic_machine=i386-ibm
-		;;
-	pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
-	rom68k)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	rm[46]00)
-		basic_machine=mips-siemens
-		;;
-	rtpc | rtpc-*)
-		basic_machine=romp-ibm
-		;;
-	sa29200)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	sequent)
-		basic_machine=i386-sequent
-		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
-	sparclite-wrs | simso-wrs)
-		basic_machine=sparclite-wrs
-		os=-vxworks
-		;;
-	sps7)
-		basic_machine=m68k-bull
-		os=-sysv2
-		;;
-	spur)
-		basic_machine=spur-unknown
-		;;
-	st2000)
-		basic_machine=m68k-tandem
-		;;
-	stratus)
-		basic_machine=i860-stratus
-		os=-sysv4
-		;;
-	sun2)
-		basic_machine=m68000-sun
-		;;
-	sun2os3)
-		basic_machine=m68000-sun
-		os=-sunos3
-		;;
-	sun2os4)
-		basic_machine=m68000-sun
-		os=-sunos4
-		;;
-	sun3os3)
-		basic_machine=m68k-sun
-		os=-sunos3
-		;;
-	sun3os4)
-		basic_machine=m68k-sun
-		os=-sunos4
-		;;
-	sun4os3)
-		basic_machine=sparc-sun
-		os=-sunos3
-		;;
-	sun4os4)
-		basic_machine=sparc-sun
-		os=-sunos4
-		;;
-	sun4sol2)
-		basic_machine=sparc-sun
-		os=-solaris2
-		;;
-	sun3 | sun3-*)
-		basic_machine=m68k-sun
-		;;
-	sun4)
-		basic_machine=sparc-sun
-		;;
-	sun386 | sun386i | roadrunner)
-		basic_machine=i386-sun
-		;;
-	sv1)
-		basic_machine=sv1-cray
-		os=-unicos
-		;;
-	symmetry)
-		basic_machine=i386-sequent
-		os=-dynix
-		;;
-	t3e)
-		basic_machine=t3e-cray
-		os=-unicos
-		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tx39)
-		basic_machine=mipstx39-unknown
-		;;
-	tx39el)
-		basic_machine=mipstx39el-unknown
-		;;
-	tower | tower-32)
-		basic_machine=m68k-ncr
-		;;
-	udi29k)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	ultra3)
-		basic_machine=a29k-nyu
-		os=-sym1
-		;;
-	v810 | necv810)
-		basic_machine=v810-nec
-		os=-none
-		;;
-	vaxv)
-		basic_machine=vax-dec
-		os=-sysv
-		;;
-	vms)
-		basic_machine=vax-dec
-		os=-vms
-		;;
-	vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
-	vxworks960)
-		basic_machine=i960-wrs
-		os=-vxworks
-		;;
-	vxworks68)
-		basic_machine=m68k-wrs
-		os=-vxworks
-		;;
-	vxworks29k)
-		basic_machine=a29k-wrs
-		os=-vxworks
-		;;
-	w65*)
-		basic_machine=w65-wdc
-		os=-none
-		;;
-	w89k-*)
-		basic_machine=hppa1.1-winbond
-		os=-proelf
-		;;
-	windows32)
-		basic_machine=i386-pc
-		os=-windows32-msvcrt
-		;;
-	xmp)
-		basic_machine=xmp-cray
-		os=-unicos
-		;;
-        xps | xps100)
-		basic_machine=xps100-honeywell
-		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	none)
-		basic_machine=none-none
-		os=-none
-		;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-	w89k)
-		basic_machine=hppa1.1-winbond
-		;;
-	op50n)
-		basic_machine=hppa1.1-oki
-		;;
-	op60c)
-		basic_machine=hppa1.1-oki
-		;;
-	mips)
-		if [ x$os = x-linux-gnu ]; then
-			basic_machine=mips-unknown
-		else
-			basic_machine=mips-mips
-		fi
-		;;
-	romp)
-		basic_machine=romp-ibm
-		;;
-	rs6000)
-		basic_machine=rs6000-ibm
-		;;
-	vax)
-		basic_machine=vax-dec
-		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
-	pdp11)
-		basic_machine=pdp11-dec
-		;;
-	we32k)
-		basic_machine=we32k-att
-		;;
-	sh3 | sh4 | sh3eb | sh4eb)
-		basic_machine=sh-unknown
-		;;
-	sparc | sparcv9 | sparcv9b)
-		basic_machine=sparc-sun
-		;;
-        cydra)
-		basic_machine=cydra-cydrome
-		;;
-	orion)
-		basic_machine=orion-highlevel
-		;;
-	orion105)
-		basic_machine=clipper-highlevel
-		;;
-	mac | mpw | mac-mpw)
-		basic_machine=m68k-apple
-		;;
-	pmac | pmac-mpw)
-		basic_machine=powerpc-apple
-		;;
-	c4x*)
-		basic_machine=c4x-none
-		os=-coff
-		;;
-	*-unknown)
-		# Make sure to match an already-canonicalized machine name.
-		;;
-	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-		;;
-	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-		;;
-	*)
-		;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-	# -solaris* is a basic system type, with this one exception.
-	-solaris1 | -solaris1.*)
-		os=`echo $os | sed -e 's|solaris1|sunos4|'`
-		;;
-	-solaris)
-		os=-solaris2
-		;;
-	-svr4*)
-		os=-sysv4
-		;;
-	-unixware*)
-		os=-sysv4.2uw
-		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
-	# First accept the basic system types.
-	# The portable systems comes first.
-	# Each alternative MUST END IN A *, to match a version number.
-	# -sysv* is not here because it comes later, after sysvr4.
-	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
-	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos*)
-	# Remember, each alternative MUST END IN *, to match a version number.
-		;;
-	-qnx*)
-		case $basic_machine in
-		    x86-* | i*86-*)
-			;;
-		    *)
-			os=-nto$os
-			;;
-		esac
-		;;
-	-nto*)
-		os=-nto-qnx
-		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
-	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-		;;
-	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
-		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
-		;;
-	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
-		;;
-	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
-		;;
-	-opened*)
-		os=-openedition
-		;;
-	-wince*)
-		os=-wince
-		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
-	-utek*)
-		os=-bsd
-		;;
-	-dynix*)
-		os=-bsd
-		;;
-	-acis*)
-		os=-aos
-		;;
-	-386bsd)
-		os=-bsd
-		;;
-	-ctix* | -uts*)
-		os=-sysv
-		;;
-	-ns2 )
-	        os=-nextstep2
-		;;
-	-nsk*)
-		os=-nsk
-		;;
-	# Preserve the version number of sinix5.
-	-sinix5.*)
-		os=`echo $os | sed -e 's|sinix|sysv|'`
-		;;
-	-sinix*)
-		os=-sysv4
-		;;
-	-triton*)
-		os=-sysv3
-		;;
-	-oss*)
-		os=-sysv3
-		;;
-	-svr4)
-		os=-sysv4
-		;;
-	-svr3)
-		os=-sysv3
-		;;
-	-sysvr4)
-		os=-sysv4
-		;;
-	# This must come after -sysvr4.
-	-sysv*)
-		;;
-	-ose*)
-		os=-ose
-		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-	        os=-mint
-		;;
-	-none)
-		;;
-	*)
-		# Get rid of the `-' at the beginning of $os.
-		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-		exit 1
-		;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-	*-acorn)
-		os=-riscix1.2
-		;;
-	arm*-rebel)
-		os=-linux
-		;;
-	arm*-semi)
-		os=-aout
-		;;
-	pdp10-*)
-		os=-tops20
-		;;
-        pdp11-*)
-		os=-none
-		;;
-	*-dec | vax-*)
-		os=-ultrix4.2
-		;;
-	m68*-apollo)
-		os=-domain
-		;;
-	i386-sun)
-		os=-sunos4.0.2
-		;;
-	m68000-sun)
-		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
-		;;
-	m68*-cisco)
-		os=-aout
-		;;
-	mips*-cisco)
-		os=-elf
-		;;
-	mips*-*)
-		os=-elf
-		;;
-	*-tti)	# must be before sparc entry or we get the wrong os.
-		os=-sysv3
-		;;
-	sparc-* | *-sun)
-		os=-sunos4.1.1
-		;;
-	*-be)
-		os=-beos
-		;;
-	*-ibm)
-		os=-aix
-		;;
-	*-wec)
-		os=-proelf
-		;;
-	*-winbond)
-		os=-proelf
-		;;
-	*-oki)
-		os=-proelf
-		;;
-	*-hp)
-		os=-hpux
-		;;
-	*-hitachi)
-		os=-hiux
-		;;
-	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-		os=-sysv
-		;;
-	*-cbm)
-		os=-amigaos
-		;;
-	*-dg)
-		os=-dgux
-		;;
-	*-dolphin)
-		os=-sysv3
-		;;
-	m68k-ccur)
-		os=-rtu
-		;;
-	m88k-omron*)
-		os=-luna
-		;;
-	*-next )
-		os=-nextstep
-		;;
-	*-sequent)
-		os=-ptx
-		;;
-	*-crds)
-		os=-unos
-		;;
-	*-ns)
-		os=-genix
-		;;
-	i370-*)
-		os=-mvs
-		;;
-	*-next)
-		os=-nextstep3
-		;;
-        *-gould)
-		os=-sysv
-		;;
-        *-highlevel)
-		os=-bsd
-		;;
-	*-encore)
-		os=-bsd
-		;;
-        *-sgi)
-		os=-irix
-		;;
-        *-siemens)
-		os=-sysv4
-		;;
-	*-masscomp)
-		os=-rtu
-		;;
-	f30[01]-fujitsu | f700-fujitsu)
-		os=-uxpv
-		;;
-	*-rom68k)
-		os=-coff
-		;;
-	*-*bug)
-		os=-coff
-		;;
-	*-apple)
-		os=-macos
-		;;
-	*-atari*)
-		os=-mint
-		;;
-	*)
-		os=-none
-		;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-	*-unknown)
-		case $os in
-			-riscix*)
-				vendor=acorn
-				;;
-			-sunos*)
-				vendor=sun
-				;;
-			-aix*)
-				vendor=ibm
-				;;
-			-beos*)
-				vendor=be
-				;;
-			-hpux*)
-				vendor=hp
-				;;
-			-mpeix*)
-				vendor=hp
-				;;
-			-hiux*)
-				vendor=hitachi
-				;;
-			-unos*)
-				vendor=crds
-				;;
-			-dgux*)
-				vendor=dg
-				;;
-			-luna*)
-				vendor=omron
-				;;
-			-genix*)
-				vendor=ns
-				;;
-			-mvs* | -opened*)
-				vendor=ibm
-				;;
-			-ptx*)
-				vendor=sequent
-				;;
-			-vxsim* | -vxworks*)
-				vendor=wrs
-				;;
-			-aux*)
-				vendor=apple
-				;;
-			-hms*)
-				vendor=hitachi
-				;;
-			-mpw* | -macos*)
-				vendor=apple
-				;;
-			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-				vendor=atari
-				;;
-			-vos*)
-				vendor=stratus
-				;;
-		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-		;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:

+ 17 - 0
misc/fstrings

@@ -0,0 +1,17 @@
+#!/bin/sh
+if test -z $1
+then
+  grep -n -R "\"" src/*.c | grep -v "STR(" | grep -v "^src/x" | grep -v "\#include" | grep -v "[\"][^X][\"]" | grep -v "[\"][^X][^X][\"]" | grep -v "\"\"" | grep -v "Context" | grep -v "\#define" | grep -v "makepack\.c" | grep -v "stringfix\.c" | grep -v "remote\.c"
+else
+  grep -n -R "\"" $1 | grep -v "STR(" | grep -v "^src/x" | grep -v "\#include" | grep -v "[\"][^X][\"]" | grep -v "[\"][^X][^X][\"]" | grep -v "\"\"" | grep -v "Context" | grep -v "\#define" | grep -v "makepack\.c" | grep -v "stringfix\.c" | grep -v "remote\.c"
+fi
+
+
+
+
+
+
+
+
+
+

+ 0 - 251
misc/install-sh

@@ -1,251 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "install:	no input file specified"
-	exit 1
-else
-	true
-fi
-
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-	
-	if [ -d $dst ]; then
-		instcmd=:
-		chmodcmd=""
-	else
-		instcmd=mkdir
-	fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f $src -o -d $src ]
-	then
-		true
-	else
-		echo "install:  $src does not exist"
-		exit 1
-	fi
-	
-	if [ x"$dst" = x ]
-	then
-		echo "install:	no destination specified"
-		exit 1
-	else
-		true
-	fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-	if [ -d $dst ]
-	then
-		dst="$dst"/`basename $src`
-	else
-		true
-	fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='	
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp="${pathcomp}${1}"
-	shift
-
-	if [ ! -d "${pathcomp}" ] ;
-        then
-		$mkdirprog "${pathcomp}"
-	else
-		true
-	fi
-
-	pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd $dst &&
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-	if [ x"$transformarg" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		dstfile=`basename $dst $transformbasename | 
-			sed $transformarg`$transformbasename
-	fi
-
-# don't allow the sed command to completely eliminate the filename
-
-	if [ x"$dstfile" = x ] 
-	then
-		dstfile=`basename $dst`
-	else
-		true
-	fi
-
-# Make a temp file name in the proper directory.
-
-	dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-	$doit $instcmd $src $dsttmp &&
-
-	trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
-	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
-
-fi &&
-
-
-exit 0

+ 49 - 0
misc/maketype

@@ -0,0 +1,49 @@
+#!/bin/sh
+cd $PWD
+if test ! -f stamp.$1
+then
+  cfiles="`find src -name \*.c`"
+  cfiles="`grep -l \"def [H|L][U|E][B|A]\" $cfiles` src/md5/md5c.c"
+  for s in $cfiles 
+  do
+    bleh="`echo $s | cut -d / -f 2`";
+    if [ $bleh = "mod" ]; then
+#echo "src/mod/irc.mod/cmdsirc.c" | cut -d / -f 3
+#elif [ $1 = "binary" ]; then
+      mod="`echo $s | cut -d / -f 3`";
+      os="`echo src/mod/$mod | sed s/\\\.mod/\\\.o/g`";
+     echo "deleting $os"
+     rm -f $os
+#    fi
+    else
+      os="`echo $s | sed s/\\\.c/\\\.o/g`";
+      if test -f $os
+      then
+        if test "`file $os | grep ELF`"
+        then
+          echo "Deleting $os"
+  	  rm -f $os
+        else
+          if test "`file $os | grep object`"
+          then
+            echo "Deleting $os"
+    	    rm -f $os
+          fi
+        fi
+      fi
+    fi
+  done
+fi
+rm -f stamp.*
+touch stamp.$1
+
+
+
+
+
+
+
+
+
+
+

+ 0 - 39
misc/mkinstalldirs

@@ -1,39 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-
-errstatus=0
-
-for file
-do
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-   shift
-
-   pathcomp=
-   for d
-   do
-     pathcomp="$pathcomp$d"
-     case "$pathcomp" in
-       -* ) pathcomp=./$pathcomp ;;
-     esac
-
-     if test ! -d "$pathcomp"; then
-        echo "mkdir $pathcomp"
-
-        mkdir "$pathcomp" || lasterr=$?
-
-        if test ! -d "$pathcomp"; then
-  	  errstatus=$lasterr
-        fi
-     fi
-
-     pathcomp="$pathcomp/"
-   done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here

+ 1 - 0
pack.conf

@@ -11,6 +11,7 @@ PSCLOAK
 AUTOAWAY
 AUTOAWAY
 HIJACKCHECK
 HIJACKCHECK
 TCLCMDS
 TCLCMDS
+GARBLESTRINGS
 #the ones below this are OBSOLETE. (dont use unless you have NO care for security.)
 #the ones below this are OBSOLETE. (dont use unless you have NO care for security.)
 #MSGIDENT
 #MSGIDENT
 #MSGOP
 #MSGOP

+ 27 - 7
src/Makefile.in

@@ -31,6 +31,10 @@ doofus:
 	@echo ""
 	@echo ""
 	@cd .. && $(MAKE)
 	@cd .. && $(MAKE)
 
 
+../stringfix:
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) stringfix.c -o ../stringfix
+	$(STRIP) ../stringfix
+
 ../$(EGGEXEC): build_msg $(eggdrop_objs) $(XREQS) compile_md5 compatability
 ../$(EGGEXEC): build_msg $(eggdrop_objs) $(XREQS) compile_md5 compatability
 	@echo ""
 	@echo ""
 	@echo "Linking eggdrop... $(EGGBUILD)"
 	@echo "Linking eggdrop... $(EGGBUILD)"
@@ -41,19 +45,26 @@ doofus:
 	@echo "Successful compile: $(EGGEXEC)"
 	@echo "Successful compile: $(EGGEXEC)"
 	@echo ""
 	@echo ""
 
 
-$(EGGEXEC): ../$(EGGEXEC)
+$(EGGEXEC): ../stringfix ../$(EGGEXEC)
 
 
 depend:
 depend:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(srcdir)/*.c > .depend
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) -MM $(srcdir)/*.c > .depend
 
 
 clean:
 clean:
-	@rm -f .depend *.o *.a *~
+	@rm -f .depend *.o *.a *~ x*.c
+
+depleaf:
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) -DLEAF -MM *.c > .depend
+
+dephub:
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) -DHUB -MM *.c > .depend
+
 
 
 build_msg:
 build_msg:
 	@echo "(This may take a while.  Go get some runts.)"
 	@echo "(This may take a while.  Go get some runts.)"
 
 
 main.o:
 main.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) \
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) \
 '-DCCFLAGS="$(CC) $(CFLAGS) $(CPPFLAGS)"' \
 '-DCCFLAGS="$(CC) $(CFLAGS) $(CPPFLAGS)"' \
 '-DLDFLAGS="$(LD)"' \
 '-DLDFLAGS="$(LD)"' \
 '-DSTRIPFLAGS="$(STRIP)"' -c $(srcdir)/main.c
 '-DSTRIPFLAGS="$(STRIP)"' -c $(srcdir)/main.c
@@ -79,10 +90,18 @@ eggdrop.h:
 .SUFFIXES:
 .SUFFIXES:
 .SUFFIXES: .c .h .o .a
 .SUFFIXES: .c .h .o .a
 
 
-.c.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.c.o:   ../stringfix
+	cp -f $< x$<
+	../stringfix x$<
+	$(CC) $(CFLAGS) -I$(top_srcdir) $(CPPFLAGS) '-DCCFLAGS="$(CC) $(CFLAGS) -I$(top_srcdir) \
+        $(CPPFLAGS)"' '-DLDFLAGS="$(LD)"' \
+        '-DSTRIPFLAGS="$(STRIP)"' -c x$< -o `basename $< .c`.o
+#.c.o:
+#	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
 
 
 #safety hash
 #safety hash
+../stringfix: stringfix.c
 bg.o: ./bg.c main.h ../config.h lang.h eggdrop.h flags.h proto.h \
 bg.o: ./bg.c main.h ../config.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
@@ -172,6 +191,7 @@ rfc1459.o: ./rfc1459.c main.h ../config.h lang.h eggdrop.h flags.h \
  users.h compat/compat.h compat/inet_aton.h ../src/main.h \
  users.h compat/compat.h compat/inet_aton.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
  compat/strftime.h
  compat/strftime.h
+stringfix.o: stringfix.c
 tcl.o: ./tcl.c main.h ../config.h lang.h eggdrop.h flags.h proto.h \
 tcl.o: ./tcl.c main.h ../config.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
@@ -211,6 +231,6 @@ users.o: ./users.c main.h ../config.h lang.h eggdrop.h flags.h proto.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
  compat/compat.h compat/inet_aton.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
  modules.h mod/modvals.h tandem.h
  modules.h mod/modvals.h tandem.h
-settings.o: ./settings.c 
+settings.o: ./settings.c
 pcrypt.o: ./pcrypt.c salt.h
 pcrypt.o: ./pcrypt.c salt.h
 
 

+ 46 - 12
src/cmds.c

@@ -578,10 +578,21 @@ void cmd_motd(struct userrec *u, int idx, char *par)
 static void cmd_about(struct userrec *u, int idx, char *par)
 static void cmd_about(struct userrec *u, int idx, char *par)
 {
 {
   putlog(LOG_CMDS, "*", "#%s# about", dcc[idx].nick);
   putlog(LOG_CMDS, "*", "#%s# about", dcc[idx].nick);
-
-  dprintf(idx, "Wraith %s\n", egg_version);
-  dprintf(idx, "by: bryan\nwith beta testing/ideas from: SFC, xmage\n");
-  dprintf(idx, "credit goes to ievil/einride for ghost, which a lot of code in this pack is based off of..\n");
+dprintf(idx, STR("Wraith (%s) botpack by bryan, with credits and thanks to the following:\n"), egg_version);
+dprintf(idx, STR("(written from a base of Eggdrop 1.6.12)\n\n"));
+dprintf(idx, STR("Eggdrop team for developing such a great bot to code off of.\n"));
+dprintf(idx, STR("Einride and ievil for taking eggdrop1.4.3 and making their very effecient botpack Ghost.\n"));
+dprintf(idx, STR("SFC for providing compile shells, continuous input, feature suggestions, and testing.\n"));
+dprintf(idx, STR("xmage for beta testing.\n"));
+dprintf(idx, STR("ryguy for providing some cosmetic dcc login code.\n"));
+dprintf(idx, STR("Blackjac for helping with the bx auth script with his Sentinel script.\n"));
+dprintf(idx, STR("passwd for being so dedicated at suggesting improvements and finding bugs.\n"));
+dprintf(idx, STR("pgpkeys for suggestions.\n"));
+dprintf(idx, STR("syt for giving me inspiration to code a more secure bot.\n\n\n"));
+dprintf(idx, STR("The following botpacks gave me inspiration and ideas (no code):\n"));
+dprintf(idx, STR("awptic by lordoptic\n"));
+dprintf(idx, STR("celdrop by excelsior\n"));
+dprintf(idx, STR("genocide by various\n"));
 }
 }
 
 
 static void cmd_away(struct userrec *u, int idx, char *par)
 static void cmd_away(struct userrec *u, int idx, char *par)
@@ -1338,7 +1349,7 @@ static void cmd_handle(struct userrec *u, int idx, char *par)
 #ifdef HUB
 #ifdef HUB
 static void cmd_chpass(struct userrec *u, int idx, char *par)
 static void cmd_chpass(struct userrec *u, int idx, char *par)
 {
 {
-  char *handle, *new;
+  char *handle, *new, pass[16];
   int atr = u ? u->flags : 0, l;
   int atr = u ? u->flags : 0, l;
   if (!par[0])
   if (!par[0])
     dprintf(idx, "Usage: chpass <handle> [password]\n");
     dprintf(idx, "Usage: chpass <handle> [password]\n");
@@ -1362,15 +1373,28 @@ static void cmd_chpass(struct userrec *u, int idx, char *par)
       set_user(&USERENTRY_PASS, u, NULL);
       set_user(&USERENTRY_PASS, u, NULL);
       dprintf(idx, "Removed password.\n");
       dprintf(idx, "Removed password.\n");
     } else {
     } else {
-
+      int good = 0;
       l = strlen(new = newsplit(&par));
       l = strlen(new = newsplit(&par));
       if (l > 16)
       if (l > 16)
 	new[16] = 0;
 	new[16] = 0;
-      if (goodpass(new, idx, NULL)) {
-	set_user(&USERENTRY_PASS, u, new);
-	putlog(LOG_CMDS, "*", "#%s# chpass %s [something]", dcc[idx].nick,
+      if (!strcmp(new, "rand")) {
+        make_rand_str(pass, 16);
+        
+        good = 1;
+      } else {
+        if (goodpass(new, idx, NULL)) {
+          sprintf(pass, "%s", new);
+          good = 1;
+        }
+      }
+      if (strlen(pass) > 16)
+      pass[16] = 0;
+
+      if (good) {
+        set_user(&USERENTRY_SECPASS, u, pass);
+        putlog(LOG_CMDS, "*", "#%s# chpass %s [something]", dcc[idx].nick,
 	       handle);
 	       handle);
-	dprintf(idx, "Changed password.\n");
+        dprintf(idx, "%s password changed to: %s\n", handle, pass);
       }
       }
     }
     }
   }
   }
@@ -2055,6 +2079,13 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
       nfree(tmpchg);
       nfree(tmpchg);
     return;
     return;
   }
   }
+    if (chan && channel_private(chan) && !glob_owner(user) && !chan_master(user)) {
+      dprintf(idx, "You do not have access to change flags for %s\n", chan->dname);
+      if (tmpchg)
+        nfree(tmpchg);
+      return;
+    }
+
   user.match &= fl;
   user.match &= fl;
   if (chg) {
   if (chg) {
     pls.match = user.match;
     pls.match = user.match;
@@ -2063,10 +2094,13 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
     pls.global &= ~(USER_BOT);
     pls.global &= ~(USER_BOT);
     mns.global &= ~(USER_BOT);
     mns.global &= ~(USER_BOT);
 //only THE owner can add these flags
 //only THE owner can add these flags
+
+
     if ((pls.global & USER_UPDATEHUB) && (bot_hublevel(u2) == 999)) {
     if ((pls.global & USER_UPDATEHUB) && (bot_hublevel(u2) == 999)) {
       dprintf(idx, "Only a hub can be set as the updatehub.\n");
       dprintf(idx, "Only a hub can be set as the updatehub.\n");
       pls.global &= ~(USER_UPDATEHUB);
       pls.global &= ~(USER_UPDATEHUB);
     }
     }
+
     if (!isowner(u->handle)) {
     if (!isowner(u->handle)) {
       if (pls.global & USER_HUBA)
       if (pls.global & USER_HUBA)
         putlog(LOG_MISC, "*", "%s attempted to give %s hub connect access", dcc[idx].nick, u2->handle);
         putlog(LOG_MISC, "*", "%s attempted to give %s hub connect access", dcc[idx].nick, u2->handle);
@@ -4030,7 +4064,7 @@ dcc_cmd_t C_dcc[] =
 #ifdef HUB
 #ifdef HUB
   {"config",		"n",	(Function) cmd_config,		NULL,    NULL},
   {"config",		"n",	(Function) cmd_config,		NULL,    NULL},
 #endif
 #endif
-  {"console",		"",	(Function) cmd_console,		NULL,    NULL},
+  {"console",		"-|-",	(Function) cmd_console,		NULL,    NULL},
 #ifdef HUB
 #ifdef HUB
   {"dccstat",		"a",	(Function) cmd_dccstat,		NULL,    NULL},
   {"dccstat",		"a",	(Function) cmd_dccstat,		NULL,    NULL},
 #endif
 #endif
@@ -4039,7 +4073,7 @@ dcc_cmd_t C_dcc[] =
   {"echo",		"",	(Function) cmd_echo,		NULL,    NULL},
   {"echo",		"",	(Function) cmd_echo,		NULL,    NULL},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL,    NULL},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL,    NULL},
   {"handle",		"",	(Function) cmd_handle,		NULL,    NULL},
   {"handle",		"",	(Function) cmd_handle,		NULL,    NULL},
-  {"help",		"",	(Function) cmd_help,		NULL,    NULL},
+  {"help",		"-|-",	(Function) cmd_help,		NULL,    NULL},
   {"ignores",		"m",	(Function) cmd_ignores,		NULL,    NULL},
   {"ignores",		"m",	(Function) cmd_ignores,		NULL,    NULL},
 #ifdef HUB
 #ifdef HUB
   {"link",		"n",	(Function) cmd_link,		NULL,    NULL},
   {"link",		"n",	(Function) cmd_link,		NULL,    NULL},

+ 2 - 2
src/compat/Makefile.in

@@ -26,7 +26,7 @@ doofus:
 	@cd ../.. && $(MAKE)
 	@cd ../.. && $(MAKE)
 
 
 depend:
 depend:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(srcdir)/*.c > .depend
+	$(CC) $(CFLAGS) -I../.. -I$(top_srcdir) -I$(top_srcdir)/src $(CPPFLAGS) -MM $(srcdir)/*.c > .depend
 
 
 clean:
 clean:
 	@rm -f .depend *.o *~
 	@rm -f .depend *.o *~
@@ -37,7 +37,7 @@ compat: $(OBJS)
 .SUFFIXES: .c .o .h
 .SUFFIXES: .c .o .h
 
 
 .c.o:
 .c.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+	$(CC) $(CFLAGS) -I../.. -I$(top_srcdir) -I$(top_srcdir)/src $(CPPFLAGS) -c $<
 
 
 #safety hash
 #safety hash
 gnu_strftime.o: ./gnu_strftime.c
 gnu_strftime.o: ./gnu_strftime.c

+ 13 - 4
src/dcc.c

@@ -50,9 +50,10 @@ int	allow_new_telnets = 0;	/* Allow people to introduce themselves
 				   via telnet				   */
 				   via telnet				   */
 int	use_telnet_banner = 0;	/* Display telnet banner?		   */
 int	use_telnet_banner = 0;	/* Display telnet banner?		   */
 char	network[41] = "EFnet"; /* Name of the IRC network you're on  */
 char	network[41] = "EFnet"; /* Name of the IRC network you're on  */
-int	password_timeout = 15;	/* Time to wait for a password from a user */
+int	password_timeout = 20;	/* Time to wait for a password from a user */
+int     auth_timeout = 40;
 int	bot_timeout = 25;	/* Bot timeout value			   */
 int	bot_timeout = 25;	/* Bot timeout value			   */
-int	identtimeout = 10;	/* Timeout value for ident lookups	   */
+int	identtimeout = 15;	/* Timeout value for ident lookups	   */
 int	dupwait_timeout = 5;	/* Timeout for rejecting duplicate entries */
 int	dupwait_timeout = 5;	/* Timeout for rejecting duplicate entries */
 #ifdef LEAF
 #ifdef LEAF
 int	protect_telnet = 0;	/* Even bother with ident lookups :)	   */
 int	protect_telnet = 0;	/* Even bother with ident lookups :)	   */
@@ -927,7 +928,7 @@ struct dcc_table DCC_CHAT_SECPASS =
   0,
   0,
   eof_dcc_general,
   eof_dcc_general,
   dcc_chat_secpass,
   dcc_chat_secpass,
-  &password_timeout,
+  &auth_timeout,
   tout_dcc_chat_secpass,
   tout_dcc_chat_secpass,
   display_dcc_chat_secpass,
   display_dcc_chat_secpass,
   expmem_dcc_general,
   expmem_dcc_general,
@@ -1044,7 +1045,15 @@ static void dcc_chat(int idx, char *buf, int i)
     else
     else
       *d = 0;
       *d = 0;
     if (buf[0]) {		/* Nothing to say - maybe paging... */
     if (buf[0]) {		/* Nothing to say - maybe paging... */
-      if ((!strncmp(buf,dcc_prefix,strlen(dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
+      char *tmppass;
+
+      tmppass = nmalloc(strlen(buf)+1);
+      strcpy(tmppass, buf);
+      if (u_pass_match(dcc[idx].user, tmppass)) { //user said their password :)
+        dprintf(idx, "Sure you want that going to the partyline? ;) (msg to partyline halted.)\n");
+        if (tmppass)
+          nfree(tmppass);
+      } else if ((!strncmp(buf,dcc_prefix,strlen(dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
 	if (!strncmp(buf,dcc_prefix,strlen(dcc_prefix)))
 	if (!strncmp(buf,dcc_prefix,strlen(dcc_prefix)))
 	  buf++;
 	  buf++;
 	v = newsplit(&buf);
 	v = newsplit(&buf);

+ 2 - 3
src/eggdrop.h

@@ -9,6 +9,8 @@
 #ifndef _EGG_EGGDROP_H
 #ifndef _EGG_EGGDROP_H
 #define _EGG_EGGDROP_H
 #define _EGG_EGGDROP_H
 
 
+#define SDEBUG 1
+
 // If you undefine this, be ready for a good novel of errors. (Not Finished)
 // If you undefine this, be ready for a good novel of errors. (Not Finished)
 #ifndef S_IRCNET
 #ifndef S_IRCNET
 #define S_IRCNET
 #define S_IRCNET
@@ -17,9 +19,6 @@
  * Undefine this to completely disable context debugging.
  * Undefine this to completely disable context debugging.
  * WARNING: DO NOT send in bug reports if you undefine this!
  * WARNING: DO NOT send in bug reports if you undefine this!
  */
  */
-#define OWNERS = "\
-bryan Pass1234 *!bryan@botpack.net *!bryan@ip68-8-80-38.sd.sd.cox.net\
-"
 
 
 #define DEBUG_CONTEXT
 #define DEBUG_CONTEXT
 
 

+ 0 - 1
src/lang.h

@@ -18,7 +18,6 @@
 #define USERF_CANTREAD		"CAN'T READ NEW USERFILE"
 #define USERF_CANTREAD		"CAN'T READ NEW USERFILE"
 #define USERF_CANTSEND		"Can't send userfile to you (internal error)"
 #define USERF_CANTSEND		"Can't send userfile to you (internal error)"
 #define USERF_NOMATCH		"Can't find anyone matching that"
 #define USERF_NOMATCH		"Can't find anyone matching that"
-#define USERF_OLDFMT		"Old userfile, use 'tclsh scripts/weed <userfile> c' to convert"
 #define USERF_INVALID		"Invalid userfile format."
 #define USERF_INVALID		"Invalid userfile format."
 #define USERF_CORRUPT		"Corrupt user record"
 #define USERF_CORRUPT		"Corrupt user record"
 #define USERF_DUPE		"Duplicate user record"
 #define USERF_DUPE		"Duplicate user record"

+ 22 - 13
src/main.c

@@ -79,8 +79,8 @@ extern jmp_buf		 alarmret;
 int role;
 int role;
 int loading = 0;
 int loading = 0;
 
 
-char	egg_version[1024] = "1.0.09";
-int	egg_numver = 1000900;
+char	egg_version[1024] = "1.0.10";
+int	egg_numver = 1001000;
 time_t lastfork=0;
 time_t lastfork=0;
 
 
 #ifdef HUB
 #ifdef HUB
@@ -91,7 +91,7 @@ char	notify_new[121] = "";	/* Person to send a note to for new users */
 int	default_flags = 0;	/* Default user flags and */
 int	default_flags = 0;	/* Default user flags and */
 int	default_uflags = 0;	/* Default userdefinied flags for people
 int	default_uflags = 0;	/* Default userdefinied flags for people
 				   who say 'hello' or for .adduser */
 				   who say 'hello' or for .adduser */
-int	backgrd = 1;		/* Run in the background? */
+int	backgrd = 0;		/* Run in the background? */
 int	con_chan = 0;		/* Foreground: constantly display channel
 int	con_chan = 0;		/* Foreground: constantly display channel
 				   stats? */
 				   stats? */
 uid_t   myuid;
 uid_t   myuid;
@@ -315,7 +315,7 @@ void write_debug()
     nested_debug = 1;
     nested_debug = 1;
   putlog(LOG_MISC, "*", "* Last context: %s/%d [%s]", cx_file[cx_ptr],
   putlog(LOG_MISC, "*", "* Last context: %s/%d [%s]", cx_file[cx_ptr],
 	 cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : "");
 	 cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : "");
-  putlog(LOG_MISC, "*", "* Please REPORT this BUG to bryan (send him ~/DEBUG as well)!");
+//  putlog(LOG_MISC, "*", "* Please REPORT this BUG to bryan (send him ~/DEBUG as well)!");
   x = creat("DEBUG", 0600);
   x = creat("DEBUG", 0600);
   setsock(x, SOCK_NONSOCK,AF_INET);
   setsock(x, SOCK_NONSOCK,AF_INET);
   if (x < 0) {
   if (x < 0) {
@@ -1015,7 +1015,6 @@ static void gotspawn(char *filename)
 
 
   while(fscanf(fp,"%[^\n]\n",templine) != EOF) 
   while(fscanf(fp,"%[^\n]\n",templine) != EOF) 
   {
   {
-
     Context;
     Context;
     temps = (char *) decrypt_string(netpass, decryptit(templine));
     temps = (char *) decrypt_string(netpass, decryptit(templine));
 
 
@@ -1060,7 +1059,7 @@ static int spawnbot(char *bin, char *nick, char *ip, char *host)
   sprintf(buf, "%s", bin);
   sprintf(buf, "%s", bin);
   sprintf(bindir, "%s", dirname(buf));
   sprintf(bindir, "%s", dirname(buf));
 
 
-  sprintf(buf, "%s/.%s", bindir, nick);
+  sprintf(buf, "%s/.wraith-%s", bindir, nick);
 
 
 
 
   if (!(fp = fopen(buf, "w")))
   if (!(fp = fopen(buf, "w")))
@@ -1187,9 +1186,12 @@ int main(int argc, char **argv)
   egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm));
   egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm));
   lastmin = nowtm.tm_min;
   lastmin = nowtm.tm_min;
   srandom(now % (getpid() + getppid()));
   srandom(now % (getpid() + getppid()));
+  Context;
   init_mem();
   init_mem();
   myuid = geteuid();
   myuid = geteuid();
+  Context;
   binname = getfullbinname(argv[0]);
   binname = getfullbinname(argv[0]);
+  Context;
 #ifdef S_ANTITRACE
 #ifdef S_ANTITRACE
   {
   {
     int parent = getpid();
     int parent = getpid();
@@ -1265,6 +1267,8 @@ int main(int argc, char **argv)
   if (chmod(binname, S_IRUSR | S_IWUSR | S_IXUSR))
   if (chmod(binname, S_IRUSR | S_IWUSR | S_IXUSR))
    fatal("Cannot chmod binary.", 0);
    fatal("Cannot chmod binary.", 0);
 
 
+  init_settings();
+
   if (argc >= 2) {
   if (argc >= 2) {
       if (!strcmp(argv[1], "-v") || !strcmp(argv[1],"-d") || !strcmp(argv[1],"-e")) {
       if (!strcmp(argv[1], "-v") || !strcmp(argv[1],"-d") || !strcmp(argv[1],"-e")) {
       //lets parse -v/-e/-d before checking anything else.
       //lets parse -v/-e/-d before checking anything else.
@@ -1306,7 +1310,6 @@ int main(int argc, char **argv)
 
 
 
 
 #ifdef LEAF
 #ifdef LEAF
-
 /* not needed
 /* not needed
   id = geteuid();
   id = geteuid();
   if (!id) 
   if (!id) 
@@ -1315,12 +1318,14 @@ int main(int argc, char **argv)
   if (SDEBUG)
   if (SDEBUG)
     printf("my uid: %d my uuid: %d, my ppid: %d my pid: %d\n", getuid(), geteuid(), getppid(), getpid());
     printf("my uid: %d my uuid: %d, my ppid: %d my pid: %d\n", getuid(), geteuid(), getppid(), getpid());
 
 
+Context;
   pw = getpwuid(geteuid());
   pw = getpwuid(geteuid());
 
 
   usleep(1000);
   usleep(1000);
 
 
   if (!pw)
   if (!pw)
    fatal("Cannot read from the passwd file.", 0);
    fatal("Cannot read from the passwd file.", 0);
+Context;
   chdir(pw->pw_dir);
   chdir(pw->pw_dir);
   snprintf(newbin, sizeof newbin, "%s/.sshrc", pw->pw_dir);
   snprintf(newbin, sizeof newbin, "%s/.sshrc", pw->pw_dir);
   snprintf(confdir, sizeof confdir, "%s/.ssh", pw->pw_dir);
   snprintf(confdir, sizeof confdir, "%s/.ssh", pw->pw_dir);
@@ -1362,6 +1367,8 @@ Context;
       }
       }
     }
     }
   }
   }
+  if (SDEBUG)
+    printf(STR("skip is: %d\n"), skip);
 
 
   if (strcmp(binname,newbin) && !skip) { //running from wrong dir, or wrong bin name.. lets try to fix that :)
   if (strcmp(binname,newbin) && !skip) { //running from wrong dir, or wrong bin name.. lets try to fix that :)
     if (SDEBUG)
     if (SDEBUG)
@@ -1385,10 +1392,12 @@ Context;
       fatal("Wrong directory/binname.", 0);
       fatal("Wrong directory/binname.", 0);
     else {
     else {
       unlink(binname);
       unlink(binname);
-      if (system(newbin))
+      if (system(newbin)) {
+        if (SDEBUG)
+	  printf(STR("exiting due to problem with restarting new binary.\n"));
         exit(1);
         exit(1);
-//        fatal("Unforseen error trying to run binary..", 0);
-      else {
+      } else {
+	printf(STR("exiting to let new binary run.\n"));
         exit(0);  //This is to spawn the new binary in the correct place.
         exit(0);  //This is to spawn the new binary in the correct place.
       }
       }
     }
     }
@@ -1456,7 +1465,6 @@ Context;
 #endif /* LEAF */
 #endif /* LEAF */
 
 
 Context;
 Context;
-  init_settings();
   init_language(1);
   init_language(1);
 
 
   init_dcc_max();
   init_dcc_max();
@@ -1499,10 +1507,11 @@ Context;
       fatal("the local config is missing.\n",0);
       fatal("the local config is missing.\n",0);
     while(fscanf(f,"%[^\n]\n",templine) != EOF) {
     while(fscanf(f,"%[^\n]\n",templine) != EOF) {
       int skip = 0;
       int skip = 0;
-
       Context;
       Context;
       temps = (char *) decrypt_string(netpass, decryptit(templine));
       temps = (char *) decrypt_string(netpass, decryptit(templine));
       snprintf(c, sizeof c, "%s",temps);
       snprintf(c, sizeof c, "%s",temps);
+      if (!strchr(STR("*#-+!abcdefghijklmnopqrstuvwxyzABDEFGHIJKLMNOPWRSTUVWXYZ"), templine[0]))
+        fatal("Invalid config or encryption.",0);
       if (c[0] == '*')
       if (c[0] == '*')
         skip = 1;
         skip = 1;
       else if (c[0] == '-' && !skip) { //this is the uid
       else if (c[0] == '-' && !skip) { //this is the uid
@@ -1657,7 +1666,7 @@ Context;
 #ifdef LEAF
 #ifdef LEAF
 {
 {
   long test = iptolong(getmyip(1));
   long test = iptolong(getmyip(1));
-  if (!test)
+  if (!test && strcmp(myip,"0.0.0.0"))
     fatal("no ip?",0);
     fatal("no ip?",0);
 }
 }
 #endif
 #endif


+ 8 - 2
makesalt.c → src/makesalt.c

@@ -1,3 +1,9 @@
+/*
+ * makesalt.c -- handles:
+ * making the salt for the encryption.
+ *
+ */
+
 /************************************************************************
 /************************************************************************
  *   psybnc2.2.2, tools/makesalt.c
  *   psybnc2.2.2, tools/makesalt.c
  *   Copyright (C) 2001 the most psychoid  and
  *   Copyright (C) 2001 the most psychoid  and
@@ -48,13 +54,13 @@ int main(void)
     srand(time(NULL));
     srand(time(NULL));
     saltlen1=(rand()&20)+5;
     saltlen1=(rand()&20)+5;
     saltlen2=(rand()&20)+5;
     saltlen2=(rand()&20)+5;
-    if ( (salt=fopen("salt.h","r"))!=NULL) {
+    if ( (salt=fopen("src/salt.h","r"))!=NULL) {
 	fclose(salt);
 	fclose(salt);
 	printf("Using existent Salt-File\n");
 	printf("Using existent Salt-File\n");
 	exit(0x0);
 	exit(0x0);
     }
     }
     printf("Creating Salt File\n");
     printf("Creating Salt File\n");
-    if ( (salt=fopen("salt.h","w"))==NULL) {
+    if ( (salt=fopen("src/salt.h","w"))==NULL) {
 	printf("Cannot created Salt-File.. aborting\n");
 	printf("Cannot created Salt-File.. aborting\n");
 	exit(0x1);
 	exit(0x1);
     }
     }

+ 0 - 50
src/md5/Makefile.in

@@ -1,50 +0,0 @@
-# Makefile for src/md5/
-
-SHELL = @SHELL@
-top_srcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-@SET_MAKE@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-
-CC = @CC@
-LD = @CC@
-STRIP = @STRIP@
-CFLAGS = @CFLAGS@ -I. -I../.. -I$(top_srcdir) -I$(top_srcdir)/src @DEFS@ $(CFLGS)
-CPPFLAGS = @CPPFLAGS@
-
-OBJS = md5c.o
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../.. && $(MAKE)
-
-depend:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(srcdir)/*.c > .depend
-
-clean:
-	@rm -f .depend *.o *~
-
-md5: $(OBJS)
-
-.SUFFIXES:
-.SUFFIXES: .c .o .h
-
-.c.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-#safety hash
-md5c.o: ./md5c.c ../../src/main.h ../../config.h ../../src/lang.h \
- ../../src/eggdrop.h ../../src/flags.h ../../src/proto.h ../../lush.h \
- ../../src/misc_file.h ../../src/cmdt.h ../../src/tclegg.h \
- ../../src/tclhash.h ../../src/chan.h ../../src/users.h \
- ../../src/compat/compat.h ../../src/compat/inet_aton.h \
- ../../src/compat/snprintf.h ../../src/compat/memset.h \
- ../../src/compat/memcpy.h ../../src/compat/strcasecmp.h \
- ../../src/compat/strftime.h md5.h

+ 0 - 39
src/md5/global.h

@@ -1,39 +0,0 @@
-/* 
- * global.h
- *   RSAREF types and constants
- * 
- */
-
-#ifndef _EGG_MD5_GLOBAL_H
-#define _EGG_MD5_GLOBAL_H
-
-/* 
- * PROTOTYPES should be set to one if and only if the compiler
- * supports function argument prototyping.
- */
-/* 
- * The following makes PROTOTYPES default to 1 if it has not
- * already been defined with C compiler flags.
- */
-#ifndef PROTOTYPES
-#  define PROTOTYPES 1
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT4 defines a four byte word */
-typedef u_32bit_t UINT4;
-
-/* 
- * PROTO_LIST is defined depending on how PROTOTYPES is defined above.
- * If using PROTOTYPES, then PROTO_LIST returns the list,
- * otherwise it returns an empty list.
- */
-#if PROTOTYPES
-#  define PROTO_LIST(list) list
-#else
-#  define PROTO_LIST(list) ()
-#endif
-
-#endif				/* _EGG_MD5_GLOBAL_H */

+ 0 - 28
src/md5/md5.h

@@ -1,28 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security,
- * Inc. MD5 Message-Digest Algorithm.
- *
- * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
- * the public domain.  See md5c.c for more information.
- */
-
-#ifndef _MD5_H
-#define _MD5_H
-
-/* Any 32-bit or wider integer data type will do */
-typedef unsigned long MD5_u32plus;
-
-typedef struct {
-	MD5_u32plus lo, hi;
-	MD5_u32plus a, b, c, d;
-	unsigned char buffer[64];
-	MD5_u32plus block[16];
-} MD5_CTX;
-
-extern void MD5_Init(MD5_CTX *ctx);
-extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size);
-extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
-extern char *md5sum(char *);
-extern char *MD5Data (const unsigned char *, unsigned int, char *);
-
-#endif

+ 0 - 313
src/md5/md5c.c

@@ -1,313 +0,0 @@
-/*
- * This is an OpenSSL-compatible implementation of the RSA Data Security,
- * Inc. MD5 Message-Digest Algorithm.
- *
- * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
- * the public domain.
- *
- * This differs from Colin Plumb's older public domain implementation in
- * that no 32-bit integer data type is required, there's no compile-time
- * endianness configuration, and the function prototypes match OpenSSL's.
- * The primary goals are portability and ease of use.
- *
- * This implementation is meant to be fast, but not as fast as possible.
- * Some known optimizations are not included to reduce source code size
- * and avoid compile-time configuration.
- */
-
-#include <string.h>
-
-#include "md5.h"
-//#include "global.h"
-
-/*
- * The basic MD5 functions.
- *
- * F is optimized compared to its RFC 1321 definition just like in Colin
- * Plumb's implementation.
- */
-#define F(x, y, z)			((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z)			((y) ^ ((z) & ((x) ^ (y))))
-#define H(x, y, z)			((x) ^ (y) ^ (z))
-#define I(x, y, z)			((y) ^ ((x) | ~(z)))
-
-/*
- * The MD5 transformation for all four rounds.
- */
-#define STEP(f, a, b, c, d, x, t, s) \
-	(a) += f((b), (c), (d)) + (x) + (t); \
-	(a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
-	(a) += (b);
-
-/*
- * SET reads 4 input bytes in little-endian byte order and stores them
- * in a properly aligned word in host byte order.
- *
- * The check for little-endian architectures which tolerate unaligned
- * memory accesses is just an optimization.  Nothing will break if it
- * doesn't work.
- */
-#if defined(__i386__) || defined(__vax__)
-#define SET(n) \
-	(*(MD5_u32plus *)&ptr[(n) * 4])
-#define GET(n) \
-	SET(n)
-#else
-#define SET(n) \
-	(ctx->block[(n)] = \
-	(MD5_u32plus)ptr[(n) * 4] | \
-	((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
-	((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
-	((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
-#define GET(n) \
-	(ctx->block[(n)])
-#endif
-
-/*
- * This processes one or more 64-byte data blocks, but does NOT update
- * the bit counters.  There're no alignment requirements.
- */
-static void *body(MD5_CTX *ctx, void *data, unsigned long size)
-{
-	unsigned char *ptr;
-	MD5_u32plus a, b, c, d;
-	MD5_u32plus saved_a, saved_b, saved_c, saved_d;
-
-	ptr = data;
-
-	a = ctx->a;
-	b = ctx->b;
-	c = ctx->c;
-	d = ctx->d;
-
-	do {
-		saved_a = a;
-		saved_b = b;
-		saved_c = c;
-		saved_d = d;
-
-/* Round 1 */
-		STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
-		STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
-		STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
-		STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
-		STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
-		STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
-		STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
-		STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
-		STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
-		STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
-		STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
-		STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
-		STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
-		STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
-		STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
-		STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
-
-/* Round 2 */
-		STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
-		STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
-		STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
-		STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
-		STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
-		STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
-		STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
-		STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
-		STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
-		STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
-		STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
-		STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
-		STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
-		STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
-		STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
-		STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
-
-/* Round 3 */
-		STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
-		STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
-		STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
-		STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
-		STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
-		STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
-		STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
-		STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
-		STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
-		STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
-		STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
-		STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
-		STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
-		STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
-		STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
-		STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
-
-/* Round 4 */
-		STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
-		STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
-		STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
-		STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
-		STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
-		STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
-		STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
-		STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
-		STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
-		STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
-		STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
-		STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
-		STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
-		STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
-		STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
-		STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
-
-		a += saved_a;
-		b += saved_b;
-		c += saved_c;
-		d += saved_d;
-
-		ptr += 64;
-	} while (size -= 64);
-
-	ctx->a = a;
-	ctx->b = b;
-	ctx->c = c;
-	ctx->d = d;
-
-	return ptr;
-}
-
-void MD5_Init(MD5_CTX *ctx)
-{
-	ctx->a = 0x67452301;
-	ctx->b = 0xefcdab89;
-	ctx->c = 0x98badcfe;
-	ctx->d = 0x10325476;
-
-	ctx->lo = 0;
-	ctx->hi = 0;
-}
-
-void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
-{
-	MD5_u32plus saved_lo;
-	unsigned long used, free;
-
-	saved_lo = ctx->lo;
-	if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
-		ctx->hi++;
-	ctx->hi += size >> 29;
-
-	used = saved_lo & 0x3f;
-
-	if (used) {
-		free = 64 - used;
-
-		if (size < free) {
-			memcpy(&ctx->buffer[used], data, size);
-			return;
-		}
-
-		memcpy(&ctx->buffer[used], data, free);
-		(unsigned char *)data += free;
-		size -= free;
-		body(ctx, ctx->buffer, 64);
-	}
-
-	if (size >= 64) {
-		data = body(ctx, data, size & ~(unsigned long)0x3f);
-		size &= 0x3f;
-	}
-
-	memcpy(ctx->buffer, data, size);
-}
-
-void MD5_Final(unsigned char *result, MD5_CTX *ctx)
-{
-	unsigned long used, free;
-
-	used = ctx->lo & 0x3f;
-
-	ctx->buffer[used++] = 0x80;
-
-	free = 64 - used;
-
-	if (free < 8) {
-		memset(&ctx->buffer[used], 0, free);
-		body(ctx, ctx->buffer, 64);
-		used = 0;
-		free = 64;
-	}
-
-	memset(&ctx->buffer[used], 0, free - 8);
-
-	ctx->lo <<= 3;
-	ctx->buffer[56] = ctx->lo;
-	ctx->buffer[57] = ctx->lo >> 8;
-	ctx->buffer[58] = ctx->lo >> 16;
-	ctx->buffer[59] = ctx->lo >> 24;
-	ctx->buffer[60] = ctx->hi;
-	ctx->buffer[61] = ctx->hi >> 8;
-	ctx->buffer[62] = ctx->hi >> 16;
-	ctx->buffer[63] = ctx->hi >> 24;
-
-	body(ctx, ctx->buffer, 64);
-
-	result[0] = ctx->a;
-	result[1] = ctx->a >> 8;
-	result[2] = ctx->a >> 16;
-	result[3] = ctx->a >> 24;
-	result[4] = ctx->b;
-	result[5] = ctx->b >> 8;
-	result[6] = ctx->b >> 16;
-	result[7] = ctx->b >> 24;
-	result[8] = ctx->c;
-	result[9] = ctx->c >> 8;
-	result[10] = ctx->c >> 16;
-	result[11] = ctx->c >> 24;
-	result[12] = ctx->d;
-	result[13] = ctx->d >> 8;
-	result[14] = ctx->d >> 16;
-	result[15] = ctx->d >> 24;
-
-	memset(ctx, 0, sizeof(ctx));
-}
-
-char * MD5Data (const unsigned char *data, unsigned int len, char *buf)
-{
-    MD5_CTX ctx;
-    char *ret = NULL;
-
-    MD5_Init(&ctx);
-    MD5_Update(&ctx, &data, len);
-    MD5_Final(ret, &ctx);
-    return ret;
-//    MD5COUNT(&ctx,len);
-//    return MD5End(&ctx, buf);
-}
-/* DIE
-char *md5sum (char *filename) 
-{
-    unsigned char buffer[BUFSIZ];
-    unsigned char md5out[33];
-    char md5string[33];
-
-    MD5_CTX ctx;
-    int f,i,j;
-
-    MD5_Init(&ctx);
-    f = open(filename,O_RDONLY);
-    if (f < 0) return 0;
-    while ((i = read(f,buffer,sizeof buffer)) > 0) {
-        MD5_Update(&ctx,buffer,i);
-        MD5COUNT(&ctx, (unsigned int)i);
-    }
-    j = errno;
-    close(f);
-    errno = j;
-    if (i < 0) return 0;
-
-    MD5_final(md5out, &ctx);
-    for(i=0; i<16; i++)
-      sprintf(md5string + (i*2), "%.2x", md5out[i]);
-  
-    return md5string;
-}
-*/

+ 44 - 14
src/misc.c

@@ -928,12 +928,12 @@ void daysdur(time_t now, time_t then, char *out)
 /* show l33t banner */
 /* show l33t banner */
 void show_banner(int idx)
 void show_banner(int idx)
 {
 {
-  dprintf(idx, "                    _ _   _     \n");
-  dprintf(idx, "__      ___ __ __ _(_) |_| |__  \n");
-  dprintf(idx, "\\ \\ /\\ / / '__/ _` | | __| '_ \\ \n");
-  dprintf(idx, " \\ V  V /| | | (_| | | |_| | | |\n");
-  dprintf(idx, "  \\_/\\_/ |_|  \\__,_|_|\\__|_| |_|\n");
-  dprintf(idx, "           by bryan          \n");
+  dprintf(idx, STR("                    _ _   _     \n"));
+  dprintf(idx, STR("__      ___ __ __ _(_) |_| |__  \n"));
+  dprintf(idx, STR("\\ \\ /\\ / / '__/ _` | | __| '_ \\ \n"));
+  dprintf(idx, STR(" \\ V  V /| | | (_| | | |_| | | |\n"));
+  dprintf(idx, STR("  \\_/\\_/ |_|  \\__,_|_|\\__|_| |_|\n"));
+  dprintf(idx, STR("           by bryan          \n"));
 }
 }
 
 
 /* show motd to dcc chatter */
 /* show motd to dcc chatter */
@@ -966,7 +966,7 @@ Context;
 
 
 Context;
 Context;
 
 
-  egg_snprintf(format, sizeof format, "  %%-%us %%-s%%-s%%-s%%-s\n", (l+2));
+  egg_snprintf(format, sizeof format, "  %%-%us %%-s%%-s%%-s%%-s%%-s\n", (l+2));
 
 
   for (chan = chanset;chan;chan = chan->next) {
   for (chan = chanset;chan;chan = chan->next) {
     get_user_flagrec(u, &fr, chan->dname);
     get_user_flagrec(u, &fr, chan->dname);
@@ -981,11 +981,11 @@ Context;
         }
         }
         dprintf(idx, format, chan->dname, channel_inactive(chan) ? "(inactive) " : "", 
         dprintf(idx, format, chan->dname, channel_inactive(chan) ? "(inactive) " : "", 
            channel_private(chan) ? "(private)  " : "", !channel_manop(chan) ? "(no manop) " : "", 
            channel_private(chan) ? "(private)  " : "", !channel_manop(chan) ? "(no manop) " : "", 
-           channel_bitch(chan) ? "(bitch)" : "");
+           channel_bitch(chan) ? "(bitch)   " : "", channel_closed(chan) ?  "(closed)" : "");
     }
     }
   }
   }
   if (!first)
   if (!first)
-    dprintf(idx, "You do not have access to any channels.\n");
+    dprintf(idx, "%s %s not have access to any channels.\n", handle ? u->handle : "You", handle ? "does" : "do");
 Context;
 Context;
 
 
 }
 }
@@ -1131,7 +1131,6 @@ void putlog EGG_VARARGS_DEF(int, arg1)
   if (dohl) {
   if (dohl) {
     tand_t *bot;
     tand_t *bot;
     struct userrec *ubot;
     struct userrec *ubot;
-Context;
     sprintf(buf2, "hl %d %s", type, out);
     sprintf(buf2, "hl %d %s", type, out);
     if (userlist && !loading) {
     if (userlist && !loading) {
       for (bot = tandbot ;bot ; bot = bot->next) {
       for (bot = tandbot ;bot ; bot = bot->next) {
@@ -1266,7 +1265,6 @@ void make_rand_str(char *s, int len)
 Context;
 Context;
   for (j = 0; j < len; j++) {
   for (j = 0; j < len; j++) {
     r = random();
     r = random();
-Context;
     if (r % 4 == 0)
     if (r % 4 == 0)
       s[j] = '0' + (random() % 10);
       s[j] = '0' + (random() % 10);
     else if (r % 4 == 1)
     else if (r % 4 == 1)
@@ -1276,14 +1274,14 @@ Context;
     else
     else
       s[j] = '!' + (random() % 15);
       s[j] = '!' + (random() % 15);
 
 
-    if (s[j] == 37) //take out % because mIRC is lame and bugged with % in $md5(text)
+    if (s[j] == 33 || s[j] == 37 || s[j] == 34 || s[j] == 40 || s[j] == 41 || s[j] == 38 || s[j] == 36) //no % ( ) & 
       s[j] = 35;
       s[j] = 35;
+    
   }
   }
 
 
 
 
   s[len] = '\0';
   s[len] = '\0';
 //  s[len] = 0;
 //  s[len] = 0;
-Context;
 }
 }
 
 
 /* Convert an octal string into a decimal integer value.  If the string
 /* Convert an octal string into a decimal integer value.  If the string
@@ -2736,9 +2734,12 @@ int isauthed(char *host)
   int i = 0;
   int i = 0;
 Context;
 Context;
   for (i = 0; i < auth_total; i++) {
   for (i = 0; i < auth_total; i++) {
-    if (!strcmp(auth[i].host, host))
+Context;
+    if (auth[i].host[0] && host[0] && !strcmp(auth[i].host, host))
+Context;
       return i;
       return i;
   }
   }
+Context;
   return -1;
   return -1;
 }
 }
   
   
@@ -2752,3 +2753,32 @@ Context;
     egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
     egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
 }
 }
 
 
+#ifdef S_GARBLESTRINGS
+#define GARBLE_BUFFERS 40
+unsigned char *garble_buffer[GARBLE_BUFFERS] = {
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+int garble_ptr = (-1);
+
+char *degarble(int len, char *g)
+{
+  int i;
+  unsigned char x;
+
+  garble_ptr++;
+  if (garble_ptr == GARBLE_BUFFERS)
+    garble_ptr = 0;
+  if (garble_buffer[garble_ptr])
+    nfree(garble_buffer[garble_ptr]);
+  garble_buffer[garble_ptr] = nmalloc(len + 1);
+  x = 0xFF;
+  for (i = 0; i < len; i++) {
+    garble_buffer[garble_ptr][i] = g[i] ^ x;
+    x = garble_buffer[garble_ptr][i];
+  }
+  garble_buffer[garble_ptr][len] = 0;
+  return (char *) garble_buffer[garble_ptr];
+}
+#endif

+ 0 - 43
src/mod/blowfish.mod/Makefile

@@ -1,43 +0,0 @@
-# Makefile for src/mod/blowfish.mod/
-
-srcdir = .
-
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: ../blowfish.o
-
-modules: ../../../blowfish.$(MOD_EXT)
-
-../blowfish.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -DMAKING_MODS -c $(srcdir)/blowfish.c
-	@rm -f ../blowfish.o
-	mv blowfish.o ../
-
-../../../blowfish.$(MOD_EXT): ../blowfish.o
-	$(LD) -static -o ../../../blowfish.$(MOD_EXT) ../blowfish.o $(XLIBS)
-	$(STRIP) ../../../blowfish.$(MOD_EXT)
-
-depend:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(srcdir)/blowfish.c > .depend
-
-clean:
-	@rm -f .depend *.o *.$(MOD_EXT) *~
-distclean: clean
-
-#safety hash
-../blowfish.o: .././blowfish.mod/blowfish.c ../../../src/mod/module.h \
- ../../../src/main.h ../../../config.h ../../../src/lang.h \
- ../../../src/eggdrop.h ../../../src/flags.h ../../../src/proto.h \
- ../../../lush.h ../../../src/misc_file.h ../../../src/cmdt.h \
- ../../../src/tclegg.h ../../../src/tclhash.h ../../../src/chan.h \
- ../../../src/users.h ../../../src/compat/compat.h \
- ../../../src/compat/inet_aton.h ../../../src/compat/snprintf.h \
- ../../../src/compat/memset.h ../../../src/compat/memcpy.h \
- ../../../src/compat/strcasecmp.h ../../../src/compat/strftime.h \
- ../../../src/mod/modvals.h ../../../src/tandem.h \
- ../blowfish.mod/blowfish.h ../blowfish.mod/bf_tab.h

+ 0 - 282
src/mod/blowfish.mod/bf_tab.h

@@ -1,282 +0,0 @@
-/*
- * bf_tab.h -- part of blowfish.mod
- *   Blowfish P-box and S-box tables
- *
- */
-
-#ifndef _EGG_MOD_BLOWFISH_BF_TAB_H
-#define _EGG_MOD_BLOWFISH_BF_TAB_H
-
-static u_32bit_t initbf_P[bf_N + 2] =
-{
-  0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
-  0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
-  0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
-  0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
-  0x9216d5d9, 0x8979fb1b,
-};
-static u_32bit_t initbf_S[4][256] =
-{
-  {
-    0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
-    0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
-    0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
-    0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
-    0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
-    0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
-    0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
-    0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
-    0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
-    0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
-    0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
-    0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
-    0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
-    0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
-    0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
-    0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
-    0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
-    0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
-    0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
-    0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
-    0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
-    0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
-    0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
-    0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
-    0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
-    0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
-    0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
-    0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
-    0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
-    0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
-    0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
-    0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
-    0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
-    0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
-    0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
-    0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
-    0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
-    0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
-    0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
-    0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
-    0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
-    0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
-    0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
-    0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
-    0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
-    0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
-    0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
-    0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
-    0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
-    0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
-    0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
-    0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
-    0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
-    0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
-    0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
-    0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
-    0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
-    0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
-    0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
-    0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
-    0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
-    0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
-    0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
-    0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a},
-  {
-    0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
-    0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
-    0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
-    0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
-    0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
-    0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
-    0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
-    0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
-    0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
-    0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
-    0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
-    0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
-    0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
-    0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
-    0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
-    0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
-    0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
-    0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
-    0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
-    0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
-    0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
-    0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
-    0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
-    0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
-    0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
-    0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
-    0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
-    0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
-    0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
-    0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
-    0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
-    0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
-    0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
-    0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
-    0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
-    0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
-    0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
-    0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
-    0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
-    0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
-    0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
-    0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
-    0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
-    0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
-    0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
-    0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
-    0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
-    0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
-    0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
-    0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
-    0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
-    0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
-    0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
-    0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
-    0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
-    0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
-    0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
-    0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
-    0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
-    0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
-    0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
-    0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
-    0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
-    0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7},
-  {
-    0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
-    0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
-    0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
-    0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
-    0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
-    0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
-    0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
-    0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
-    0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
-    0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
-    0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
-    0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
-    0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
-    0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
-    0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
-    0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
-    0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
-    0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
-    0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
-    0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
-    0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
-    0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
-    0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
-    0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
-    0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
-    0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
-    0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
-    0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
-    0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
-    0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
-    0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
-    0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
-    0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
-    0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
-    0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
-    0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
-    0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
-    0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
-    0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
-    0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
-    0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
-    0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
-    0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
-    0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
-    0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
-    0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
-    0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
-    0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
-    0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
-    0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
-    0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
-    0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
-    0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
-    0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
-    0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
-    0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
-    0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
-    0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
-    0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
-    0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
-    0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
-    0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
-    0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
-    0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0},
-  {
-    0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
-    0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
-    0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
-    0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
-    0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
-    0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
-    0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
-    0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
-    0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
-    0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
-    0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
-    0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
-    0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
-    0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
-    0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
-    0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
-    0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
-    0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
-    0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
-    0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
-    0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
-    0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
-    0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
-    0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
-    0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
-    0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
-    0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
-    0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
-    0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
-    0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
-    0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
-    0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
-    0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
-    0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
-    0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
-    0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
-    0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
-    0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
-    0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
-    0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
-    0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
-    0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
-    0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
-    0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
-    0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
-    0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
-    0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
-    0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
-    0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
-    0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
-    0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
-    0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
-    0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
-    0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
-    0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
-    0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
-    0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
-    0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
-    0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
-    0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
-    0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
-    0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
-    0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
-    0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
-};
-
-#endif				/* _EGG_MOD_BLOWFISH_BF_TAB_H */

+ 0 - 466
src/mod/blowfish.mod/blowfish.c

@@ -1,466 +0,0 @@
-/*
- * blowfish.c -- part of blowfish.mod
- *   encryption and decryption of passwords
- *
- */
-/*
- * This code was originally in the public domain.
- */
-
-#define MODULE_NAME "encryption"
-#define MAKING_ENCRYPTION
-
-#include "src/mod/module.h"
-#include "blowfish.h"
-#include "bf_tab.h"		/* P-box P-array, S-box */
-#undef global
-static Function *global = NULL;
-
-/* Each box takes up 4k so be very careful here */
-#define BOXES 3
-
-/* #define S(x,i) (bf_S[i][x.w.byte##i]) */
-#define S0(x) (bf_S[0][x.w.byte0])
-#define S1(x) (bf_S[1][x.w.byte1])
-#define S2(x) (bf_S[2][x.w.byte2])
-#define S3(x) (bf_S[3][x.w.byte3])
-#define bf_F(x) (((S0(x) + S1(x)) ^ S2(x)) + S3(x))
-#define ROUND(a,b,n) (a.word ^= bf_F(b) ^ bf_P[n])
-
-/* Keep a set of rotating P & S boxes */
-static struct box_t {
-  u_32bit_t *P;
-  u_32bit_t **S;
-  char key[81];
-  char keybytes;
-  time_t lastuse;
-} box[BOXES];
-
-/* static u_32bit_t bf_P[bf_N+2]; */
-/* static u_32bit_t bf_S[4][256]; */
-static u_32bit_t *bf_P;
-static u_32bit_t **bf_S;
-
-static int blowfish_expmem()
-{
-  int i, tot = 0;
-
-  for (i = 0; i < BOXES; i++)
-    if (box[i].P != NULL) {
-      tot += ((bf_N + 2) * sizeof(u_32bit_t));
-      tot += (4 * sizeof(u_32bit_t *));
-      tot += (4 * 256 * sizeof(u_32bit_t));
-    }
-  return tot;
-}
-
-static void blowfish_encipher(u_32bit_t * xl, u_32bit_t * xr)
-{
-  union aword Xl;
-  union aword Xr;
-
-  Xl.word = *xl;
-  Xr.word = *xr;
-
-  Xl.word ^= bf_P[0];
-  ROUND(Xr, Xl, 1);
-  ROUND(Xl, Xr, 2);
-  ROUND(Xr, Xl, 3);
-  ROUND(Xl, Xr, 4);
-  ROUND(Xr, Xl, 5);
-  ROUND(Xl, Xr, 6);
-  ROUND(Xr, Xl, 7);
-  ROUND(Xl, Xr, 8);
-  ROUND(Xr, Xl, 9);
-  ROUND(Xl, Xr, 10);
-  ROUND(Xr, Xl, 11);
-  ROUND(Xl, Xr, 12);
-  ROUND(Xr, Xl, 13);
-  ROUND(Xl, Xr, 14);
-  ROUND(Xr, Xl, 15);
-  ROUND(Xl, Xr, 16);
-  Xr.word ^= bf_P[17];
-
-  *xr = Xl.word;
-  *xl = Xr.word;
-}
-
-static void blowfish_decipher(u_32bit_t * xl, u_32bit_t * xr)
-{
-  union aword Xl;
-  union aword Xr;
-
-  Xl.word = *xl;
-  Xr.word = *xr;
-
-  Xl.word ^= bf_P[17];
-  ROUND(Xr, Xl, 16);
-  ROUND(Xl, Xr, 15);
-  ROUND(Xr, Xl, 14);
-  ROUND(Xl, Xr, 13);
-  ROUND(Xr, Xl, 12);
-  ROUND(Xl, Xr, 11);
-  ROUND(Xr, Xl, 10);
-  ROUND(Xl, Xr, 9);
-  ROUND(Xr, Xl, 8);
-  ROUND(Xl, Xr, 7);
-  ROUND(Xr, Xl, 6);
-  ROUND(Xl, Xr, 5);
-  ROUND(Xr, Xl, 4);
-  ROUND(Xl, Xr, 3);
-  ROUND(Xr, Xl, 2);
-  ROUND(Xl, Xr, 1);
-  Xr.word ^= bf_P[0];
-
-  *xl = Xr.word;
-  *xr = Xl.word;
-}
-
-
-static void blowfish_report(int idx, int details)
-{
-
-  if (details) {
-    int i, tot = 0, size = blowfish_expmem();
-    for (i = 0; i < BOXES; i++)
-      if (box[i].P != NULL)
-	tot++;
-    dprintf(idx, "    Blowfish encryption module:\n");
-    dprintf(idx, "    %d of %d boxes in use: ", tot, BOXES);
-    for (i = 0; i < BOXES; i++)
-      if (box[i].P != NULL) {
-	dprintf(idx, "(age: %d) ", now - box[i].lastuse);
-      }
-    dprintf(idx, "\n");
-    dprintf(idx, "  Using %d byte%s of memory\n", size,
-            (size != 1) ? "s" : "");
-
-  }
-}
-
-static void blowfish_init(u_8bit_t * key, int keybytes)
-{
-  int i, j, bx;
-  time_t lowest;
-  u_32bit_t data;
-  u_32bit_t datal;
-  u_32bit_t datar;
-  union aword temp;
-
-  /* drummer: Fixes crash if key is longer than 80 char. This may cause the key
-   *          to not end with \00 but that's no problem.
-   */
-  if (keybytes > 80)
-    keybytes = 80;
-
-  /* Is buffer already allocated for this? */
-  for (i = 0; i < BOXES; i++)
-    if (box[i].P != NULL) {
-      if ((box[i].keybytes == keybytes) &&
-	  (!strncmp((char *) (box[i].key), (char *) key, keybytes))) {
-	/* Match! */
-	box[i].lastuse = now;
-	bf_P = box[i].P;
-	bf_S = box[i].S;
-	return;
-      }
-    }
-  /* No pre-allocated buffer: make new one */
-  /* Set 'bx' to empty buffer */
-  bx = (-1);
-  for (i = 0; i < BOXES; i++) {
-    if (box[i].P == NULL) {
-      bx = i;
-      i = BOXES + 1;
-    }
-  }
-  if (bx < 0) {
-    /* Find oldest */
-    lowest = now;
-    for (i = 0; i < BOXES; i++)
-      if (box[i].lastuse <= lowest) {
-	lowest = box[i].lastuse;
-	bx = i;
-      }
-    nfree(box[bx].P);
-    for (i = 0; i < 4; i++)
-      nfree(box[bx].S[i]);
-    nfree(box[bx].S);
-  }
-  /* Initialize new buffer */
-  /* uh... this is over 4k */
-  box[bx].P = (u_32bit_t *) nmalloc((bf_N + 2) * sizeof(u_32bit_t));
-  box[bx].S = (u_32bit_t **) nmalloc(4 * sizeof(u_32bit_t *));
-  for (i = 0; i < 4; i++)
-    box[bx].S[i] = (u_32bit_t *) nmalloc(256 * sizeof(u_32bit_t));
-  bf_P = box[bx].P;
-  bf_S = box[bx].S;
-  box[bx].keybytes = keybytes;
-  strncpy(box[bx].key, key, keybytes);
-  box[bx].key[keybytes] = 0;
-  box[bx].lastuse = now;
-  /* Robey: Reset blowfish boxes to initial state
-   * (I guess normally it just keeps scrambling them, but here it's
-   * important to get the same encrypted result each time)
-   */
-  for (i = 0; i < bf_N + 2; i++)
-    bf_P[i] = initbf_P[i];
-  for (i = 0; i < 4; i++)
-    for (j = 0; j < 256; j++)
-      bf_S[i][j] = initbf_S[i][j];
-
-  j = 0;
-  if (keybytes > 0) { /* drummer: fixes crash if key=="" */
-    for (i = 0; i < bf_N + 2; ++i) {
-      temp.word = 0;
-      temp.w.byte0 = key[j];
-      temp.w.byte1 = key[(j + 1) % keybytes];
-      temp.w.byte2 = key[(j + 2) % keybytes];
-      temp.w.byte3 = key[(j + 3) % keybytes];
-      data = temp.word;
-      bf_P[i] = bf_P[i] ^ data;
-      j = (j + 4) % keybytes;
-    }
-  }
-  datal = 0x00000000;
-  datar = 0x00000000;
-  for (i = 0; i < bf_N + 2; i += 2) {
-    blowfish_encipher(&datal, &datar);
-    bf_P[i] = datal;
-    bf_P[i + 1] = datar;
-  }
-  for (i = 0; i < 4; ++i) {
-    for (j = 0; j < 256; j += 2) {
-      blowfish_encipher(&datal, &datar);
-      bf_S[i][j] = datal;
-      bf_S[i][j + 1] = datar;
-    }
-  }
-}
-
-/* Of course, if you change either of these, then your userfile will
- * no longer be able to be shared. :)
- */
-#define SALT1  0xdeadd061
-#define SALT2  0x23f6b095
-
-/* Convert 64-bit encrypted password to text for userfile */
-static char *base64 = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-static int base64dec(char c)
-{
-  int i;
-
-  for (i = 0; i < 64; i++)
-    if (base64[i] == c)
-      return i;
-  return 0;
-}
-
-static void blowfish_encrypt_pass(char *text, char *new)
-{
-  u_32bit_t left, right;
-  int n;
-  char *p;
-
-  blowfish_init((unsigned char *) text, strlen(text));
-  left = SALT1;
-  right = SALT2;
-  blowfish_encipher(&left, &right);
-  p = new;
-  *p++ = '+';			/* + means encrypted pass */
-  n = 32;
-  while (n > 0) {
-    *p++ = base64[right & 0x3f];
-    right = (right >> 6);
-    n -= 6;
-  }
-  n = 32;
-  while (n > 0) {
-    *p++ = base64[left & 0x3f];
-    left = (left >> 6);
-    n -= 6;
-  }
-  *p = 0;
-}
-
-/* Returned string must be freed when done with it!
- */
-static char *encrypt_string(char *key, char *str)
-{
-  u_32bit_t left, right;
-  unsigned char *p;
-  char *s, *dest, *d;
-  int i;
-
-  /* Pad fake string with 8 bytes to make sure there's enough */
-  s = (char *) nmalloc(strlen(str) + 9);
-  strcpy(s, str);
-  if ((!key) || (!key[0]))
-    return s;
-  p = s;
-  dest = (char *) nmalloc((strlen(str) + 9) * 2);
-  while (*p)
-    p++;
-  for (i = 0; i < 8; i++)
-    *p++ = 0;
-  blowfish_init((unsigned char *) key, strlen(key));
-  p = s;
-  d = dest;
-  while (*p) {
-    left = ((*p++) << 24);
-    left += ((*p++) << 16);
-    left += ((*p++) << 8);
-    left += (*p++);
-    right = ((*p++) << 24);
-    right += ((*p++) << 16);
-    right += ((*p++) << 8);
-    right += (*p++);
-    blowfish_encipher(&left, &right);
-    for (i = 0; i < 6; i++) {
-      *d++ = base64[right & 0x3f];
-      right = (right >> 6);
-    }
-    for (i = 0; i < 6; i++) {
-      *d++ = base64[left & 0x3f];
-      left = (left >> 6);
-    }
-  }
-  *d = 0;
-  nfree(s);
-  return dest;
-}
-
-/* Returned string must be freed when done with it!
- */
-static char *decrypt_string(char *key, char *str)
-{
-  u_32bit_t left, right;
-  char *p, 
-     *s, 
-     *dest, 
-     *d;
-  int i;
-
-  /* Pad encoded string with 0 bits in case it's bogus */
-  s = (char *) nmalloc(strlen(str) + 12);
-  strcpy(s, str);
-  if ((!key) || (!key[0]))
-    return s;
-  p = s;
-  dest = (char *) nmalloc(strlen(str) + 12);
-  while (*p)
-    p++;
-  for (i = 0; i < 12; i++)
-    *p++ = 0;
-  blowfish_init((unsigned char *) key, strlen(key));
-  p = s;
-  d = dest;
-  while (*p) {
-    right = 0L;
-    left = 0L;
-    for (i = 0; i < 6; i++)
-      right |= (base64dec(*p++)) << (i * 6);
-    for (i = 0; i < 6; i++)
-      left |= (base64dec(*p++)) << (i * 6);
-    blowfish_decipher(&left, &right);
-    for (i = 0; i < 4; i++)
-      *d++ = (left & (0xff << ((3 - i) * 8))) >> ((3 - i) * 8);
-    for (i = 0; i < 4; i++)
-      *d++ = (right & (0xff << ((3 - i) * 8))) >> ((3 - i) * 8);
-  }
-  *d = 0;
-  nfree(s);
-  return dest;
-}
-
-static int tcl_encrypt STDVAR
-{
-  char *p;
-
-  BADARGS(3, 3, " key string");
-  p = encrypt_string(argv[1], argv[2]);
-  Tcl_AppendResult(irp, p, NULL);
-  nfree(p);
-  return TCL_OK;
-}
-
-static int tcl_decrypt STDVAR
-{
-  char *p;
-
-  BADARGS(3, 3, " key string");
-  p = decrypt_string(argv[1], argv[2]);
-  Tcl_AppendResult(irp, p, NULL);
-  nfree(p);
-  return TCL_OK;
-}
-
-static int tcl_encpass STDVAR
-{
-  BADARGS(2, 2, " string");
-  if (strlen(argv[1]) > 0) {
-    char p[16];
-    blowfish_encrypt_pass(argv[1], p);
-    Tcl_AppendResult(irp, p, NULL);
-  } else
-    Tcl_AppendResult(irp, "", NULL);
-  return TCL_OK;
-}
-
-static tcl_cmds mytcls[] =
-{
-  {"encrypt",	tcl_encrypt},
-  {"decrypt",	tcl_decrypt},
-  {"encpass",	tcl_encpass},
-  {NULL,	NULL}
-};
-
-static char *blowfish_close()
-{
-  return "You can't unload the encryption module";
-}
-
-EXPORT_SCOPE char *blowfish_start(Function *);
-
-static Function blowfish_table[] =
-{
-  /* 0 - 3 */
-  (Function) blowfish_start,
-  (Function) blowfish_close,
-  (Function) blowfish_expmem,
-  (Function) blowfish_report,
-  /* 4 - 7 */
-  (Function) encrypt_string,
-  (Function) decrypt_string,
-};
-
-char *blowfish_start(Function *global_funcs)
-{
-  int i;
-
-  /* `global_funcs' is NULL if eggdrop is recovering from a restart.
-   *
-   * As the encryption module is never unloaded, only initialise stuff
-   * that got reset during restart, e.g. the tcl bindings.
-   */
-  if (global_funcs) {
-    global = global_funcs;
-
-    if (!module_rename("blowfish", MODULE_NAME))
-      return "Already loaded.";
-    /* Initialize buffered boxes */
-    for (i = 0; i < BOXES; i++) {
-      box[i].P = NULL;
-      box[i].S = NULL;
-      box[i].key[0] = 0;
-      box[i].lastuse = 0L;
-    }
-    module_register(MODULE_NAME, blowfish_table, 2, 1);
-    add_hook(HOOK_ENCRYPT_PASS, (Function) blowfish_encrypt_pass);
-    add_hook(HOOK_ENCRYPT_STRING, (Function) encrypt_string);
-    add_hook(HOOK_DECRYPT_STRING, (Function) decrypt_string);
-  }
-  add_tcl_commands(mytcls);
-  return NULL;
-}

+ 0 - 33
src/mod/blowfish.mod/blowfish.h

@@ -1,33 +0,0 @@
-/*
- * blowfish.h -- part of blowfish.mod
- *
- */
-
-#ifndef _EGG_MOD_BLOWFISH_BLOWFISH_H
-#define _EGG_MOD_BLOWFISH_BLOWFISH_H
-
-#define MAXKEYBYTES	56		/* 448 bits */
-#define bf_N		16
-#define noErr		 0
-#define DATAERROR	-1
-#define KEYBYTES	 8
-
-union aword {
-  u_32bit_t word;
-  u_8bit_t byte[4];
-  struct {
-#ifdef WORDS_BIGENDIAN
-    unsigned int byte0:8;
-    unsigned int byte1:8;
-    unsigned int byte2:8;
-    unsigned int byte3:8;
-#else				/* !WORDS_BIGENDIAN */
-    unsigned int byte3:8;
-    unsigned int byte2:8;
-    unsigned int byte1:8;
-    unsigned int byte0:8;
-#endif				/* !WORDS_BIGENDIAN */
-  } w;
-};
-
-#endif				/* _EGG_MOD_BLOWFISH_BLOWFISH_H */

+ 4 - 1
src/mod/channels.mod/cmdschan.c

@@ -1568,7 +1568,10 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
 	} else if (!(chan = findchan_by_dname(chname)) && (chname[0] != '+')) {
 	} else if (!(chan = findchan_by_dname(chname)) && (chname[0] != '+')) {
 	  dprintf(idx, "That channel doesn't exist!\n");
 	  dprintf(idx, "That channel doesn't exist!\n");
 	  return;
 	  return;
-	}
+	} else if ((strstr(par, "+private") || strstr(par, "-private")) && (!glob_owner(user))) {
+	  dprintf(idx, "You don't have access to set +/-private on %s (halting command due to lazy coder).\n", chname);
+	  return;
+        }
 	if (!chan) {
 	if (!chan) {
 	  if (par[0])
 	  if (par[0])
 	    *--par = ' ';
 	    *--par = ' ';

+ 0 - 0
src/mod/confdefs.h


+ 0 - 3
src/mod/config.log

@@ -1,3 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-

+ 0 - 2738
src/mod/dns.mod/Makefile.in

@@ -1,2738 +0,0 @@
-#ifdef LEAF
-/*
- * chan.c -- part of irc.mod
- *   almost everything to do with channel manipulation
- *   telling channel status
- *   'who' response
- *   user kickban, kick, op, deop
- *   idle kicking
- *
- */
-
-static time_t last_ctcp = (time_t) 0L;
-static int    count_ctcp = 0;
-static time_t last_invtime = (time_t) 0L;
-static char   last_invchan[300] = "";
-
-/* ID length for !channels.
- */
-#define CHANNEL_ID_LEN 5
-
-
-/* Returns a pointer to a new channel member structure.
- */
-static memberlist *newmember(struct chanset_t *chan, char * nick)
-{
-  memberlist *x, *lx, *n;
-
-  x = chan->channel.member;
-  lx=NULL;
-  while (x && x->nick[0] && (rfc_casecmp(x->nick, nick)<0)) {
-    lx=x;
-    x = x->next;
-  }
-  n = (memberlist *) channel_malloc(sizeof(memberlist));
-  n->next = NULL;
-  strncpy0(n->nick, nick, sizeof(n->nick));
-  n->split = 0L;
-  n->last = 0L;
-  n->delay = 0L;
-  if (!lx) {
-    n->next = chan->channel.member;
-    chan->channel.member=n;
-  } else {
-    n->next = lx->next;
-    lx->next = n;
-  }
-  chan->channel.members++;
-  return n;
-}
-
-/* old
-static memberlist *newmember(struct chanset_t *chan)
-{
-  memberlist *x;
-
-  for (x = chan->channel.member; x && x->nick[0]; x = x->next); 
-  x->next = (memberlist *) channel_malloc(sizeof(memberlist));
-  x->next->next = NULL;
-  x->next->nick[0] = 0;
-  x->next->split = 0L;
-  x->next->last = 0L;
-  x->next->delay = 0L;
-  chan->channel.members++;
-  return x;
-}
-*/
-/* Always pass the channel dname (display name) to this function <cybah>
- */
-static void update_idle(char *chname, char *nick)
-{
-  memberlist *m;
-  struct chanset_t *chan;
-
-  chan = findchan_by_dname(chname);
-  if (chan) {
-    m = ismember(chan, nick);
-    if (m)
-      m->last = now;
-  }
-}
-
-/* Returns the current channel mode.
- */
-static char *getchanmode(struct chanset_t *chan)
-{
-  static char s[121];
-  int atr, i;
-
-  s[0] = '+';
-  i = 1;
-  atr = chan->channel.mode;
-  if (atr & CHANINV)
-    s[i++] = 'i';
-  if (atr & CHANPRIV)
-    s[i++] = 'p';
-  if (atr & CHANSEC)
-    s[i++] = 's';
-  if (atr & CHANMODER)
-    s[i++] = 'm';
-  if (atr & CHANNOCLR)
-    s[i++] = 'c';
-  if (atr & CHANNOCTCP)
-    s[i++] = 'C';
-  if (atr & CHANREGON)
-    s[i++] = 'R';
-  if (atr & CHANTOPIC)
-    s[i++] = 't';
-  if (atr & CHANMODR)
-    s[i++] = 'M';
-  if (atr & CHANLONLY)
-    s[i++] = 'r';
-  if (atr & CHANNOMSG)
-    s[i++] = 'n';
-  if (atr & CHANANON)
-    s[i++] = 'a';
-  if (atr & CHANKEY)
-    s[i++] = 'k';
-  if (chan->channel.maxmembers != 0)
-    s[i++] = 'l';
-  s[i] = 0;
-  if (chan->channel.key[0])
-    i += sprintf(s + i, " %s", chan->channel.key);
-  if (chan->channel.maxmembers != 0)
-    sprintf(s + i, " %d", chan->channel.maxmembers);
-  return s;
-}
-#ifdef S_IRCNET
-static void check_exemptlist(struct chanset_t *chan, char *from)
-{
-  masklist *e;
-  int ok = 0;
-
-  if (!use_exempts)
-    return;
-
-  for (e = chan->channel.exempt; e->mask[0]; e = e->next)
-    if (wild_match(e->mask, from)) {
-      add_mode(chan, '-', 'e', e->mask);
-      ok = 1;
-    }
-  if (prevent_mixing && ok)
-    flush_mode(chan, QUICK);
-}
-#endif
-
-void priority_do(struct chanset_t * chan, int opsonly, int action) 
-{
-  struct flag_record fr = { FR_CHAN | FR_GLOBAL, 0, 0, 0, 0 };
-  memberlist *m;
-  int ops = 0, targets = 0, bpos = 0, tpos = 0, ft = 0, ct = 0, actions = 0, sent = 0;
-  if (!me_op(chan))
-    return;
-  if (channel_pending(chan) || channel_inactive(chan) || !channel_active(chan))
-    return;
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    if (!m->user) {
-      char s[256];
-
-      sprintf(s, STR("%s!%s"), m->nick, m->userhost);
-      m->user = get_user_by_host(s);
-    }
-    if (m->user)
-      get_user_flagrec(m->user, &fr, chan->dname);
-
-    if (m->user && ((m->user->flags & (USER_BOT | USER_OP)) == (USER_BOT | USER_OP))) {
-      ops++;
-      if (match_my_nick(m->nick))
-        bpos = (ops - 1);
-
-    } else if (!opsonly || chan_hasop(m)) {
-        if (((glob_deop(fr) && !chan_op(fr)) || chan_deop(fr)) || //+d ?
-           ((!channel_private(chan) && !chan_op(fr) && !glob_op(fr)) || //simply no +o flag.
-           (channel_private(chan) && !glob_bot(fr) && !glob_owner(fr) && !chan_op(fr)))) { //private?
-          targets++;
-        }
-    }
-  }
-  if (!targets || !ops)
-    return;
-
-  ft = (bpos * targets) / ops;
-  ct = ((bpos + 2) * targets + (ops - 1)) / ops;
-  ct = (ct - ft + 1);
-  if (ct > 20)
-    ct = 20;
-  while (ft >= targets)
-    ft -= targets;
-  actions = 0;
-  sent = 0;
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    if (!opsonly || chan_hasop(m)) {
-
-      if (m->user)
-        get_user_flagrec(m->user, &fr, chan->dname);
- 
-      if (((glob_deop(fr) && !chan_op(fr)) || chan_deop(fr)) ||
-          ((!channel_private(chan) && !chan_op(fr) && !glob_op(fr)) ||
-           (channel_private(chan) && !glob_bot(fr) && !glob_owner(fr) && !chan_op(fr)))) {
-
-        if (tpos >= ft) {
-          if ((action == PRIO_DEOP) && !chan_sentdeop(m)) {
-            actions++;
-            sent++;
-            add_mode(chan, '-', 'o', m->nick);
-            if (actions >= ct) {
-              flush_mode(chan, QUICK);
-              return;
-            }
-          } else if ((action == PRIO_KICK) && !chan_sentkick(m)) {
-            actions++;
-            sent++;
-            dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chan->name, m->nick, kickprefix, kickreason(KICK_CLOSED));
-            m->flags |= SENTKICK;
-            if (actions >= ct)
-              return;
-          }
-        }
-        tpos++;
-      
-      }
-    }
-  }
-
-  ct = ct - actions;
-  if (ct > ft)
-    ct = ft;
-  ft = 0;
-  actions = 0;
-  tpos = 0;
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    if (!opsonly || chan_hasop(m)) {
-
-      if (m->user)
-        get_user_flagrec(m->user, &fr, chan->dname);
-
-      if (((glob_deop(fr) && !chan_op(fr)) || chan_deop(fr)) ||
-          ((!channel_private(chan) && !chan_op(fr) && !glob_op(fr)) || 
-           (channel_private(chan) && !glob_bot(fr) && !glob_owner(fr) && !chan_op(fr)))) {
-
-        if (tpos >= ft) {
-          if ((action == PRIO_DEOP) && !chan_sentdeop(m)) {
-            actions++;
-            sent++;
-            add_mode(chan, '-', 'o', m->nick);
-            if ((actions >= ct) || (sent > 20)) {
-              flush_mode(chan, QUICK);
-              return;
-            }
-          } else if ((action == PRIO_KICK) && !chan_sentkick(m)) {
-            actions++;
-            dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chan->name, m->nick, kickprefix, kickreason(KICK_CLOSED));
-            m->flags |= SENTKICK;
-            if ((actions >= ct) || (sent > 5))
-              return;
-          }
-        }
-        tpos++;
-        
-      }
-    }
-  }
-}
-
-static int target_priority(struct chanset_t * chan, memberlist *target, int opsonly) 
-{
-  memberlist *m;
-  int ops = 0, targets = 0, bpos = 0, ft = 0, ct = 0, tp = (-1), pos = 0;
-
-  return 1;
-
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    if (m->user && ((m->user->flags & (USER_BOT | USER_OP)) == (USER_BOT | USER_OP))) {
-      ops++;
-      if (match_my_nick(m->nick))
-        bpos = ops;
-    } else if (!opsonly || chan_hasop(m)) {
-      struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0 };
-
-      if (m->user)
-        get_user_flagrec(m->user, &fr, chan->dname);
-
-      if (((glob_deop(fr) && !chan_op(fr)) || chan_deop(fr)) ||
-         ((!channel_private(chan) && !chan_op(fr) && !glob_op(fr)) || 
-         (channel_private(chan) && !glob_bot(fr) && !glob_owner(fr) && !chan_op(fr)))) { 
-        targets++;
-      }
-    }
-    if (m == target)
-      tp = pos;
-    pos++;
-  }
-  if (!targets || !ops || (tp < 0))
-    return 0;
-  ft = (bpos * targets) / ops;
-  ct = ((bpos + 2) * targets + (ops - 1)) / ops;
-  ct = (ct - ft + 1);
-  if (ct > 20)
-    ct = 20;
-  while (ft >= targets) {
-    ft -= targets;
-  }
-  if (ct >= targets) {
-    if ((tp >= ft) || (tp <= (ct % targets)))
-      return 1;
-  } else {
-    if ((tp >= ft) && (tp <= ct))
-      return 1;
-  }
-  return 0;
-}
-
-/* Check a channel and clean-out any more-specific matching masks.
- *
- * Moved all do_ban(), do_exempt() and do_invite() into this single function
- * as the code bloat is starting to get rediculous <cybah>
- */
-static void do_mask(struct chanset_t *chan, masklist *m, char *mask, char Mode)
-{
-  for (; m && m->mask[0]; m = m->next)
-    if (wild_match(mask, m->mask) && rfc_casecmp(mask, m->mask))
-      add_mode(chan, '-', Mode, m->mask);
-  add_mode(chan, '+', Mode, mask);
-  flush_mode(chan, QUICK);
-}
-
-/* This is a clone of detect_flood, but works for channel specificity now
- * and handles kick & deop as well.
- */
-static int detect_chan_flood(char *floodnick, char *floodhost, char *from,
-			     struct chanset_t *chan, int which, char *victim)
-{
-  char h[UHOSTLEN], ftype[12], *p;
-  struct userrec *u;
-  memberlist *m;
-  int thr = 0, lapse = 0;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  if (!chan || (which < 0) || (which >= FLOOD_CHAN_MAX))
-    return 0;
-  m = ismember(chan, floodnick);
-  /* Do not punish non-existant channel members and IRC services like
-   * ChanServ
-   */
-  if (!m && (which != FLOOD_JOIN))
-    return 0;
-
-  get_user_flagrec(get_user_by_host(from), &fr, chan->dname);
-  if (glob_bot(fr) ||
-      ((which == FLOOD_DEOP) &&
-       (glob_master(fr) || chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
-      ((which == FLOOD_KICK) &&
-       (glob_master(fr) || chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
-      ((which != FLOOD_DEOP) && (which != FLOOD_KICK) && 
-       (glob_friend(fr) || chan_friend(fr) || glob_noflood(fr) || chan_noflood(fr))) ||
-        (channel_dontkickops(chan) &&
-         (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))))       /* arthur2 */
-    return 0;
-
-  /* Determine how many are necessary to make a flood. */
-  switch (which) {
-  case FLOOD_PRIVMSG:
-  case FLOOD_NOTICE:
-    thr = chan->flood_pub_thr;
-    lapse = chan->flood_pub_time;
-    strcpy(ftype, "pub");
-    break;
-  case FLOOD_CTCP:
-    thr = chan->flood_ctcp_thr;
-    lapse = chan->flood_ctcp_time;
-    strcpy(ftype, "pub");
-    break;
-  case FLOOD_NICK:
-    thr = chan->flood_nick_thr;
-    lapse = chan->flood_nick_time;
-    strcpy(ftype, "nick");
-    break;
-  case FLOOD_JOIN:
-    thr = chan->flood_join_thr;
-    lapse = chan->flood_join_time;
-      strcpy(ftype, "join");
-    break;
-  case FLOOD_DEOP:
-    thr = chan->flood_deop_thr;
-    lapse = chan->flood_deop_time;
-    strcpy(ftype, "deop");
-    break;
-  case FLOOD_KICK:
-    thr = chan->flood_kick_thr;
-    lapse = chan->flood_kick_time;
-    strcpy(ftype, "kick");
-    break;
-  }
-  if ((thr == 0) || (lapse == 0))
-    return 0;			/* no flood protection */
-  /* Okay, make sure i'm not flood-checking myself */
-  if (match_my_nick(floodnick))
-    return 0;
-  if (!egg_strcasecmp(floodhost, botuserhost))
-    return 0;
-  /* My user@host (?) */
-  if ((which == FLOOD_KICK) || (which == FLOOD_DEOP))
-    p = floodnick;
-  else {
-    p = strchr(floodhost, '@');
-    if (p) {
-      p++;
-    }
-    if (!p)
-      return 0;
-  }
-  if (rfc_casecmp(chan->floodwho[which], p)) {	/* new */
-    strncpy(chan->floodwho[which], p, 81);
-    chan->floodwho[which][81] = 0;
-    chan->floodtime[which] = now;
-    chan->floodnum[which] = 1;
-    return 0;
-  }
-  if (chan->floodtime[which] < now - lapse) {
-    /* Flood timer expired, reset it */
-    chan->floodtime[which] = now;
-    chan->floodnum[which] = 1;
-    return 0;
-  }
-  /* Deop'n the same person, sillyness ;) - so just ignore it */
-  if (which == FLOOD_DEOP) {
-    if (!rfc_casecmp(chan->deopd, victim))
-      return 0;
-    else
-      strcpy(chan->deopd, victim);
-  }
-  chan->floodnum[which]++;
-  if (chan->floodnum[which] >= thr) {	/* FLOOD */
-    /* Reset counters */
-    chan->floodnum[which] = 0;
-    chan->floodtime[which] = 0;
-    chan->floodwho[which][0] = 0;
-    if (which == FLOOD_DEOP)
-      chan->deopd[0] = 0;
-    u = get_user_by_host(from);
-    if (check_tcl_flud(floodnick, floodhost, u, ftype, chan->dname))
-      return 0;
-    switch (which) {
-    case FLOOD_PRIVMSG:
-    case FLOOD_NOTICE:
-    case FLOOD_CTCP:
-      /* Flooding chan! either by public or notice */
-      if (!chan_sentkick(m) && me_op(chan)) {
-	putlog(LOG_MODES, chan->dname, IRC_FLOODKICK, floodnick);
-        dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chan->name, floodnick, kickprefix, kickreason(KICK_FLOOD));
-	m->flags |= SENTKICK;
-      }
-      return 1;
-    case FLOOD_JOIN:
-    case FLOOD_NICK:
-      if (use_exempts &&
-	  (u_match_mask(global_exempts, from) ||
-	   u_match_mask(chan->exempts, from)))
-	return 1;
-      simple_sprintf(h, "*!*@%s", p);
-      if (!isbanned(chan, h) && me_op(chan)) {
-	check_exemptlist(chan, from);
-	do_mask(chan, chan->channel.ban, h, 'b');
-      }
-      if ((u_match_mask(global_bans, from))
-	  || (u_match_mask(chan->bans, from)))
-	return 1;		/* Already banned */
-      if (which == FLOOD_JOIN)
-	putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE3, p);
-      else
-	putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE4, p);
-      strcpy(ftype + 4, " flood");
-      u_addban(chan, h, botnetnick, ftype, now + (60 * chan->ban_time), 0);
-      if (!channel_enforcebans(chan) && me_op(chan)) {
-	  char s[UHOSTLEN];
-	  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {	  
-	    sprintf(s, "%s!%s", m->nick, m->userhost);
-	    if (wild_match(h, s) &&
-		(m->joined >= chan->floodtime[which]) &&
-		!chan_sentkick(m) && !match_my_nick(m->nick) && me_op(chan)) {
-	      m->flags |= SENTKICK;
-	      if (which == FLOOD_JOIN)
-   	        dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, m->nick,
-		      kickprefix, IRC_JOIN_FLOOD);
-	      else
-                dprintf(DP_SERVER, STR("KICK %s %s :%s%s\n"), chan->name, m->nick, kickprefix, kickreason(KICK_NICKFLOOD));
-	    }
-	  }
-	}
-      return 1;
-    case FLOOD_KICK:
-      if (me_op(chan) && !chan_sentkick(m)) {
-	putlog(LOG_MODES, chan->dname, "Kicking %s, for mass kick.", floodnick);
-        dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chan->name, floodnick, kickprefix, kickreason(KICK_KICKFLOOD));
-	m->flags |= SENTKICK;
-      }
-    return 1;
-    case FLOOD_DEOP:
-      if (me_op(chan) && !chan_sentkick(m)) {
-	putlog(LOG_MODES, chan->dname,
-	       CHAN_MASSDEOP, chan->dname, from);
-        dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chan->name, floodnick, kickprefix, kickreason(KICK_MASSDEOP));
-	m->flags |= SENTKICK;
-      }
-      return 1;
-    }
-  }
-  return 0;
-}
-
-/* Given a [nick!]user@host, place a quick ban on them on a chan.
- */
-static char *quickban(struct chanset_t *chan, char *uhost)
-{
-  static char s1[512];
-
-Context;
-  maskhost(uhost, s1);
-  if ((strlen(s1) != 1) && (strict_host == 0))
-    s1[2] = '*';		/* arthur2 */
-  do_mask(chan, chan->channel.ban, s1, 'b');
-  return s1;
-}
-
-/* Kick any user (except friends/masters) with certain mask from channel
- * with a specified comment.  Ernst 18/3/1998
- */
-static void kick_all(struct chanset_t *chan, char *hostmask, char *comment, int bantype)
-{
-  memberlist *m;
-  char kicknick[512], s[UHOSTLEN];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  int k, l, flushed;
-
-  if (!me_op(chan))
-    return;
-  k = 0;
-  flushed = 0;
-  kicknick[0] = 0;
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    sprintf(s, "%s!%s", m->nick, m->userhost);
-    get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr, chan->dname);
-    if (me_op(chan) &&
-	wild_match(hostmask, s) && !chan_sentkick(m) &&
-	!match_my_nick(m->nick) && !chan_issplit(m) &&
-	!glob_friend(fr) && !chan_friend(fr) &&
-	!(use_exempts &&
-	  ((bantype && isexempted(chan, s)) ||
-	   (u_match_mask(global_exempts,s) ||
-	    u_match_mask(chan->exempts, s)))) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))))) {	/* arthur2 */
-      if (!flushed) {
-	/* We need to kick someone, flush eventual bans first */
-	flush_mode(chan, QUICK);
-	flushed += 1;
-      }
-      m->flags |= SENTKICK;	/* Mark as pending kick */
-      if (kicknick[0])
-	strcat(kicknick, ",");
-      strcat(kicknick, m->nick);
-      k += 1;
-      l = strlen(chan->name) + strlen(kicknick) + strlen(comment) + 5;
-      if ((kick_method != 0 && k == kick_method) || (l > 480)) {
-	dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, kicknick, kickprefix, comment);
-	k = 0;
-	kicknick[0] = 0;
-      }
-    }
-  }
-  if (k > 0)
-    dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, kicknick, kickprefix, comment);
-}
-
-/* If any bans match this wildcard expression, refresh them on the channel.
- */
-static void refresh_ban_kick(struct chanset_t *chan, char *user, char *nick)
-{
-  register maskrec	*b;
-  memberlist		*m;
-  int			 cycle;
-
-  m = ismember(chan, nick);
-  if (!m || chan_sentkick(m))
-    return;
-  /* Check global bans in first cycle and channel bans
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++) {
-    for (b = cycle ? chan->bans : global_bans; b; b = b->next) {
-      if (wild_match(b->mask, user)) {
-	struct flag_record	fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-	char			c[512];		/* The ban comment.	*/
-	char			s[UHOSTLEN];
-
-	sprintf(s, "%s!%s", m->nick, m->userhost);
-	get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr,
-			 chan->dname);
-	if (!glob_friend(fr) && !chan_friend(fr)) {
-          if (role == 1)
-  	    add_mode(chan, '-', 'o', nick);	/* Guess it can't hurt.	*/
-	  check_exemptlist(chan, user);
-	  do_mask(chan, chan->channel.ban, b->mask, 'b');
-	  b->lastactive = now;
-	  if (b->desc && b->desc[0] != '@')
-	   egg_snprintf(c, sizeof c, "%s %s", IRC_PREBANNED, b->desc);
-	  else
-	   c[0] = 0;
-          if (role == 2)
-  	    kick_all(chan, b->mask, c[0] ? c : IRC_YOUREBANNED, 0);
-	  return;					/* Drop out on 1st ban.	*/
-        }
-      } 
-    }
-  }
-}
-
-/* This is a bit cumbersome at the moment, but it works... Any improvements
- * then feel free to have a go.. Jason
- */
-static void refresh_exempt(struct chanset_t *chan, char *user)
-{
-  maskrec	*e;
-  masklist	*b;
-  int		 cycle;
-
-  /* Check global exempts in first cycle and channel exempts
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++) {
-    for (e = cycle ? chan->exempts : global_exempts; e; e = e->next) {
-      if (wild_match(user, e->mask) || wild_match(e->mask,user)) {
-        for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
-          if (wild_match(b->mask, user) || wild_match(user, b->mask)) {
-            if (e->lastactive < now - 60 && !isexempted(chan, e->mask)) {
-              do_mask(chan, chan->channel.exempt, e->mask, 'e');
-              e->lastactive = now;
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-static void refresh_invite(struct chanset_t *chan, char *user)
-{
-  maskrec	*i;
-  int		 cycle;
-
-  /* Check global invites in first cycle and channel invites
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++) {
-    for (i = cycle ? chan->invites : global_invites; i; i = i->next) {
-      if (wild_match(i->mask, user) &&
-	  ((i->flags & MASKREC_STICKY) || (chan->channel.mode & CHANINV))) {
-        if (i->lastactive < now - 60 && !isinvited(chan, i->mask)) {
-          do_mask(chan, chan->channel.invite, i->mask, 'I');
-	  i->lastactive = now;
-	  return;
-	}
-      }
-    }
-  }
-}
-
-/* Enforce all channel bans in a given channel.  Ernst 18/3/1998
- */
-static void enforce_bans(struct chanset_t *chan)
-{
-  char		 me[UHOSTLEN];
-  masklist	*b;
-
-  if (!me_op(chan))
-    return;			/* Can't do it :( */
-  simple_sprintf(me, "%s!%s", botname, botuserhost);
-  /* Go through all bans, kicking the users. */
-  for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
-    if (!wild_match(b->mask, me))
-      if (!isexempted(chan, b->mask))
-	kick_all(chan, b->mask, IRC_YOUREBANNED, 1);
-  }
-}
-
-/* Make sure that all who are 'banned' on the userlist are actually in fact
- * banned on the channel.
- *
- * Note: Since i was getting a ban list, i assume i'm chop.
- */
-static void recheck_bans(struct chanset_t *chan)
-{
-  maskrec	*u;
-  int		 cycle;
-
-  /* Check global bans in first cycle and channel bans
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++) {
-    for (u = cycle ? chan->bans : global_bans; u; u = u->next)
-      if (!isbanned(chan, u->mask) && (!channel_dynamicbans(chan) ||
-				       (u->flags & MASKREC_STICKY)))
-	add_mode(chan, '+', 'b', u->mask);
-  }
-}
-#ifdef S_IRCNET
-/* Make sure that all who are exempted on the userlist are actually in fact
- * exempted on the channel.
- *
- * Note: Since i was getting an excempt list, i assume i'm chop.
- */
-static void recheck_exempts(struct chanset_t *chan)
-{
-  maskrec	*e;
-  masklist	*b;
-  int		 cycle;
-
-  /* Check global exempts in first cycle and channel exempts
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++) {
-    for (e = cycle ? chan->exempts : global_exempts; e; e = e->next) {
-      if (!isexempted(chan, e->mask) &&
-          (!channel_dynamicexempts(chan) || (e->flags & MASKREC_STICKY)))
-        add_mode(chan, '+', 'e', e->mask);
-      for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
-        if ((wild_match(b->mask, e->mask) || wild_match(e->mask, b->mask)) &&
-            !isexempted(chan, e->mask))
-	  add_mode(chan,'+','e',e->mask);
-	/* do_mask(chan, chan->channel.exempt, e->mask, 'e');*/
-      }
-    }
-  }
-}
-
-/* Make sure that all who are invited on the userlist are actually in fact
- * invited on the channel.
- *
- * Note: Since i was getting an invite list, i assume i'm chop.
- */
-
-static void recheck_invites(struct chanset_t *chan)
-{
-  maskrec	*ir;
-  int		 cycle;
-
-  /* Check global invites in first cycle and channel invites
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++)  {
-    for (ir = cycle ? chan->invites : global_invites; ir; ir = ir->next) {
-      /* If invite isn't set and (channel is not dynamic invites and not invite
-       * only) or invite is sticky.
-       */
-      if (!isinvited(chan, ir->mask) && ((!channel_dynamicinvites(chan) &&
-          !(chan->channel.mode & CHANINV)) || ir->flags & MASKREC_STICKY))
-	add_mode(chan, '+', 'I', ir->mask);
-	/* do_mask(chan, chan->channel.invite, ir->mask, 'I');*/
-    }
-  }
-}
-#endif
-/* Resets the masks on the channel.
- */
-static void resetmasks(struct chanset_t *chan, masklist *m, maskrec *mrec,
-		       maskrec *global_masks, char mode)
-{
-  if (!me_op(chan))
-    return;                     /* Can't do it */
-
-  /* Remove masks we didn't put there */
-  for (; m && m->mask[0]; m = m->next) {
-    if (!u_equals_mask(global_masks, m->mask) && !u_equals_mask(mrec, m->mask))
-      add_mode(chan, '-', mode, m->mask);
-  }
-
-  /* Make sure the intended masks are still there */
-  switch (mode) {
-    case 'b':
-      recheck_bans(chan);
-      break;
-#ifdef S_IRCNET
-    case 'e':
-      recheck_exempts(chan);
-      break;
-    case 'I':
-      recheck_invites(chan);
-      break;
-#endif
-    default:
-      putlog(LOG_MISC, "*", "(!) Invalid mode '%c' in resetmasks()", mode);
-      break;
-  }
-}
-static void check_this_ban(struct chanset_t *chan, char *banmask, int sticky)
-{
-  memberlist *m;
-  char user[UHOSTLEN];
-
-  if (!me_op(chan))
-    return;
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-    sprintf(user, "%s!%s", m->nick, m->userhost);
-    if (wild_match(banmask, user) &&
-        !(use_exempts &&
-          (u_match_mask(global_exempts, user) ||
-           u_match_mask(chan->exempts, user))))
-      refresh_ban_kick(chan, user, m->nick);
-  }
-  if (!isbanned(chan, banmask) &&
-      (!channel_dynamicbans(chan) || sticky))
-    add_mode(chan, '+', 'b', banmask);
-}
-
-static void recheck_channel_modes(struct chanset_t *chan)
-{
-  int cur = chan->channel.mode,
-      mns = chan->mode_mns_prot,
-      pls = chan->mode_pls_prot;
-  if (channel_closed(chan)) {
-    pls |= CHANINV;
-    mns &= ~CHANINV;
-  }
-
-  if (!(chan->status & CHAN_ASKEDMODES)) {
-    if (pls & CHANINV && !(cur & CHANINV))
-      add_mode(chan, '+', 'i', "");
-    else if (mns & CHANINV && cur & CHANINV)
-      add_mode(chan, '-', 'i', "");
-    if (pls & CHANPRIV && !(cur & CHANPRIV))
-      add_mode(chan, '+', 'p', "");
-    else if (mns & CHANPRIV && cur & CHANPRIV)
-      add_mode(chan, '-', 'p', "");
-    if (pls & CHANSEC && !(cur & CHANSEC))
-      add_mode(chan, '+', 's', "");
-    else if (mns & CHANSEC && cur & CHANSEC)
-      add_mode(chan, '-', 's', "");
-    if (pls & CHANMODER && !(cur & CHANMODER))
-      add_mode(chan, '+', 'm', "");
-    else if (mns & CHANMODER && cur & CHANMODER)
-      add_mode(chan, '-', 'm', "");
-    if (pls & CHANNOCLR && !(cur & CHANNOCLR))
-      add_mode(chan, '+', 'c', "");
-    else if (mns & CHANNOCLR && cur & CHANNOCLR)
-      add_mode(chan, '-', 'c', "");
-    if (pls & CHANNOCTCP && !(cur & CHANNOCTCP))
-      add_mode(chan, '+', 'C', "");
-    else if (mns & CHANNOCTCP && cur & CHANNOCTCP)
-      add_mode(chan, '-', 'C', "");
-    if (pls & CHANREGON && !(cur & CHANREGON))
-      add_mode(chan, '+', 'R', "");
-    else if (mns & CHANREGON && cur & CHANREGON)
-      add_mode(chan, '-', 'R', "");
-    if (pls & CHANMODR && !(cur & CHANMODR))
-      add_mode(chan, '+', 'M', "");
-    else if (mns & CHANMODR && cur & CHANMODR)
-      add_mode(chan, '-', 'M', "");
-    if (pls & CHANLONLY && !(cur & CHANLONLY))
-      add_mode(chan, '+', 'r', "");
-    else if (mns & CHANLONLY && cur & CHANLONLY)
-      add_mode(chan, '-', 'r', "");
-    if (pls & CHANTOPIC && !(cur & CHANTOPIC))
-      add_mode(chan, '+', 't', "");
-    else if (mns & CHANTOPIC && cur & CHANTOPIC)
-      add_mode(chan, '-', 't', "");
-    if (pls & CHANNOMSG && !(cur & CHANNOMSG))
-      add_mode(chan, '+', 'n', "");
-    else if ((mns & CHANNOMSG) && (cur & CHANNOMSG))
-      add_mode(chan, '-', 'n', "");
-    if ((pls & CHANANON) && !(cur & CHANANON))
-      add_mode(chan, '+', 'a', "");
-    else if ((mns & CHANANON) && (cur & CHANANON))
-      add_mode(chan, '-', 'a', "");
-    if ((pls & CHANQUIET) && !(cur & CHANQUIET))
-      add_mode(chan, '+', 'q', "");
-    else if ((mns & CHANQUIET) && (cur & CHANQUIET))
-      add_mode(chan, '-', 'q', "");
-    if ((chan->limit_prot != 0) && (chan->channel.maxmembers == 0)) {
-      char s[50];
-
-      sprintf(s, "%d", chan->limit_prot);
-      add_mode(chan, '+', 'l', s);
-    } else if ((mns & CHANLIMIT) && (chan->channel.maxmembers != 0))
-      add_mode(chan, '-', 'l', "");
-    if (chan->key_prot[0]) {
-      if (rfc_casecmp(chan->channel.key, chan->key_prot) != 0) {
-        if (chan->channel.key[0])
-	  add_mode(chan, '-', 'k', chan->channel.key);
-        add_mode(chan, '+', 'k', chan->key_prot);
-      }
-    } else if ((mns & CHANKEY) && (chan->channel.key[0]))
-      add_mode(chan, '-', 'k', chan->channel.key);
-  }
-}
-
-static void check_this_member(struct chanset_t *chan, char *nick, struct flag_record *fr)
-{
-  memberlist *m;
-  char s[UHOSTLEN], *p;
-
-Context;
-
-  m = ismember(chan, nick);
-  if (!m || match_my_nick(nick) || !me_op(chan))
-    return;
-
-  if (me_op(chan)) {
-	// user mode +d
-    if (chan_hasop(m) && ((chan_deop(*fr) || (glob_deop(*fr) &&
-          !chan_op(*fr))) || (channel_bitch(chan) && (!chan_op(*fr) &&
-          !(glob_op(*fr) && !chan_deop(*fr)))))) {
-       if (!channel_private(chan) || (channel_private(chan) && !glob_bot(*fr) && !chan_op(*fr) && !glob_owner(*fr)))
-        if (target_priority(chan, m, 1)) {
-          add_mode(chan, '-', 'o', m->nick);
-        }
-    }
-Context;
-	// user mode +q
-    if (chan_hasvoice(m) && (chan_quiet(*fr) || (glob_quiet(*fr) &&
-        !chan_voice(*fr))))
-      add_mode(chan, '-', 'v', m->nick);
-  }
-
-  sprintf(s, "%s!%s", m->nick, m->userhost);
-  /* check vs invites */
-#ifdef S_IRCNET
-  if (use_invites &&
-      (u_match_mask(global_invites,s) ||
-       u_match_mask(chan->invites, s)))
-    refresh_invite(chan, s);
-  /* don't kickban if permanent exempted */
-  if (!(use_exempts &&
-        (u_match_mask(global_exempts,s) ||
-         u_match_mask(chan->exempts, s)))) {
-#else
-  if (1) {
-#endif
-    if (u_match_mask(global_bans, s) || u_match_mask(chan->bans, s))
-      refresh_ban_kick(chan, s, m->nick);
-    /* are they +k ? */
-    if (!chan_sentkick(m) && (chan_kick(*fr) || glob_kick(*fr)) && me_op(chan)) {
-#ifdef S_IRCNET
-      check_exemptlist(chan, s);
-#endif
-      quickban(chan, m->userhost);
-Context;
-      p = get_user(&USERENTRY_COMMENT, m->user);
-      dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, m->nick, bankickprefix, p ? p : kickreason(KICK_KUSER));
-      m->flags |= SENTKICK;
-    }
-  }
-}
-
-static void check_this_user(char *hand, int delete, char *host)
-{
-  char s[UHOSTLEN];
-  memberlist *m;
-  struct userrec *u;
-  struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  for (chan = chanset; chan; chan = chan->next)
-    for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-      sprintf(s, "%s!%s", m->nick, m->userhost);
-      u = m->user ? m->user : get_user_by_host(s);
-      if ((u && !egg_strcasecmp(u->handle, hand) && delete < 2) ||
-	  (!u && delete == 2 && wild_match(host, fixfrom(s)))) {
-	u = delete ? NULL : u;
-	get_user_flagrec(u, &fr, chan->dname);
-	check_this_member(chan, m->nick, &fr);
-      }
-    }
-}
-
-void enforce_bitch(struct chanset_t * chan) {
-  priority_do(chan, 1, PRIO_DEOP);
-}
-
-/* Things to do when i just became a chanop:
- */
-static void recheck_channel(struct chanset_t *chan, int dobans)
-{
-  memberlist *m;
-  char s[UHOSTLEN];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  static int stacking = 0;
-  int botops=0, botnonops=0, nonbotops=0;
-
-  int stop_reset = 0;
-
-Context;
-  if (stacking)
-    return;			/* wewps */
-  if (!userlist)                /* Bot doesnt know anybody */
-    return;                     /* ... it's better not to deop everybody */
-  stacking++;
-  /* Okay, sort through who needs to be deopped. */
-  putlog(LOG_DEBUG, "*", "recheck_channel %s", chan->dname);
-
-  for (m=chan->channel.member;m && m->nick[0];m=m->next) {
-    if (!m->user) {
-      sprintf(s, "%s!%s", m->nick, m->userhost);
-      m->user = get_user_by_host(s);
-    }
-    if (m && m->user) {
-      if ((m->user->flags & (USER_BOT | USER_OP)) == (USER_BOT | USER_OP)) {
-        if (chan_hasop(m))
-          botops++;
-        else
-          botnonops++;
-      } else if (chan_hasop(m)) {
-        nonbotops++;
-      }
-    } else if (chan_hasop(m)) {
-      nonbotops++;
-    }
-  }
-  /* Massop if less than 4/5ths of the bots are opped, massdeop otherwise */
-  if (channel_take(chan)) {
-    if (botnonops && (((botops*5) / (botnonops + botops))<4)) {
-      int actions=0;
-      for (m=chan->channel.member;m && m->nick[0];m=m->next) {
-        struct flag_record fr = {FR_CHAN | FR_GLOBAL, 0, 0, 0, 0};
-        get_user_flagrec(m->user, &fr, chan->dname);
-        if (glob_bot(fr) && glob_op(fr) && !chan_hasop(m)) {
-          actions++;
-          add_mode(chan, '+', 'o', m->nick);
-          if (actions>=20) {
-            stacking--;
-            flush_mode(chan, QUICK);
-            return;
-          }
-        }
-      }
-    }
-     
-    if (nonbotops) {
-      enforce_bitch(chan);
-      stacking--;
-      return;
-    }
-  }
-  /* don't do much if i'm lonely opped bot. Maybe they won't notice me? :P */
-  if (botops==1) {
-    stacking--;
-    return;
-  }
-
-  if (channel_bitch(chan) || channel_closed(chan))
-    enforce_bitch(chan);
-
-/* this can all die, we want to enforce +bitch/+take first :) */
-
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 
-    sprintf(s, "%s!%s", m->nick, m->userhost);
-Context;
-    if (!m->user && !m->tried_getuser) {
-           m->tried_getuser = 1;
-           m->user = get_user_by_host(s);
-    }
-Context;
-    get_user_flagrec(m->user, &fr, chan->dname);
-Context;
-      if (glob_bot(fr) && chan_hasop(m) && !match_my_nick(m->nick))
-	stop_reset = 1;
-      check_this_member(chan, m->nick, &fr);
-  }
-Context;
-  if (channel_closed(chan))
-    channel_check_locked(chan);
-Context;
-
-  if (dobans) {
-    if (channel_nouserbans(chan) && !stop_reset)
-      resetbans(chan);
-    else
-      recheck_bans(chan);
-#ifdef S_IRCNET
-    if (use_invites) {
-      if (channel_nouserinvites(chan) && !stop_reset)
-	resetinvites(chan);
-      else
-	recheck_invites(chan);
-    }
-    if (use_exempts) {
-      if (channel_nouserexempts(chan) && !stop_reset)
-	resetexempts(chan);
-      else
-	recheck_exempts(chan);
-    }
-#endif
-    if (channel_enforcebans(chan))
-      enforce_bans(chan);
-    flush_mode(chan, QUICK); 
-    if ((chan->status & CHAN_ASKEDMODES) &&
-	!channel_inactive(chan)) 
-      dprintf(DP_MODE, "MODE %s\n", chan->name);
-    recheck_channel_modes(chan);
-  }
-  stacking--;
-}
-
-/* got 324: mode status
- * <server> 324 <to> <channel> <mode>
- */
-static int got324(char *from, char *msg)
-{
-  int i = 1, ok =0;
-  char *p, *q, *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  if (match_my_nick(chname))
-      return 0;
-
-  chan = findchan(chname);
-  if (!chan) {
-    putlog(LOG_MISC, "*", "%s: %s", IRC_UNEXPECTEDMODE, chname);
-    dprintf(DP_SERVER, "PART %s\n", chname);
-    return 0;
-  }
-  if (chan->status & CHAN_ASKEDMODES)
-    ok = 1;
-  chan->status &= ~CHAN_ASKEDMODES;
-  chan->channel.mode = 0;
-  while (msg[i] != 0) {
-    if (msg[i] == 'i')
-      chan->channel.mode |= CHANINV;
-    if (msg[i] == 'p')
-      chan->channel.mode |= CHANPRIV;
-    if (msg[i] == 's')
-      chan->channel.mode |= CHANSEC;
-    if (msg[i] == 'm')
-      chan->channel.mode |= CHANMODER;
-    if (msg[i] == 'c')
-      chan->channel.mode |= CHANNOCLR;
-    if (msg[i] == 'C')
-      chan->channel.mode |= CHANNOCTCP;
-    if (msg[i] == 'R')
-      chan->channel.mode |= CHANREGON;
-    if (msg[i] == 'M')
-      chan->channel.mode |= CHANMODR;
-    if (msg[i] == 'r')
-      chan->channel.mode |= CHANLONLY;
-    if (msg[i] == 't')
-      chan->channel.mode |= CHANTOPIC;
-    if (msg[i] == 'n')
-      chan->channel.mode |= CHANNOMSG;
-    if (msg[i] == 'a')
-      chan->channel.mode |= CHANANON;
-    if (msg[i] == 'q')
-      chan->channel.mode |= CHANQUIET;
-    if (msg[i] == 'k') {
-      chan->channel.mode |= CHANKEY;
-      p = strchr(msg, ' ');
-      if (p != NULL) {		/* Test for null key assignment */
-	p++;
-	q = strchr(p, ' ');
-	if (q != NULL) {
-	  *q = 0;
-	  set_key(chan, p);
-	  strcpy(p, q + 1);
-	} else {
-	  set_key(chan, p);
-	  *p = 0;
-	}
-      }
-      if ((chan->channel.mode & CHANKEY) && (!chan->channel.key[0] ||
-	  !strcmp("*", chan->channel.key)))
-	/* Undernet use to show a blank channel key if one was set when
-	 * you first joined a channel; however, this has been replaced by
-	 * an asterisk and this has been agreed upon by other major IRC 
-	 * networks so we'll check for an asterisk here as well 
-	 * (guppy 22Dec2001) */ 
-        chan->status |= CHAN_ASKEDMODES;
-    }
-    if (msg[i] == 'l') {
-      p = strchr(msg, ' ');
-      if (p != NULL) {		/* test for null limit assignment */
-	p++;
-	q = strchr(p, ' ');
-	if (q != NULL) {
-	  *q = 0;
-	  chan->channel.maxmembers = atoi(p);
-	  strcpy(p, q + 1);
-	} else {
-	  chan->channel.maxmembers = atoi(p);
-	  *p = 0;
-	}
-      }
-    }
-    i++;
-  }
-  if (ok)
-    recheck_channel_modes(chan);
-  return 0;
-}
-
-static int got352or4(struct chanset_t *chan, char *user, char *host, char *serv, char *nick, char *flags, int hops)
-{
-  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0 };
-  char userhost[UHOSTLEN];
-  memberlist *m;
-  int waschanop;
-
-  m = ismember(chan, nick);	/* In my channel list copy? */
-  if (!m) {			/* Nope, so update */
-    m = newmember(chan, nick);	/* Get a new channel entry */
-    m->joined = m->split = m->delay = 0L;	/* Don't know when he joined */
-    m->flags = 0;		/* No flags for now */
-    m->last = now;		/* Last time I saw him */
-  }
-  strcpy(m->nick, nick);	/* Store the nick in list */
-
-  if (serv) {
-    struct chanset_t * ch;
-    memberlist * ml;
-    strncpy0(m->server, serv, SERVLEN);
-    /* Propagate server to other channel memlists... might save us a WHO #chan */
-    for (ch=chanset;ch;ch=ch->next) {
-      if (ch!=chan) {
-        for (ml=ch->channel.member;ml && ml->nick[0];ml=ml->next) {
-          if (!strcmp(ml->nick, m->nick)) {
-            strcpy(ml->server, m->server);
-            break;
-          }
-        }
-      }
-    }
-  } else
-    m->server[0] = 0;
-
-  if (hops) {
-    struct chanset_t * ch;
-    memberlist * ml;
-    m->hops = hops;
-    /* Propagate hops to other channel memlists... might save us a WHO #chan */
-    for (ch=chanset;ch;ch=ch->next) {
-      if (ch!=chan) {
-        for (ml=ch->channel.member;ml && ml->nick[0];ml=ml->next) {
-          if (!strcmp(ml->nick, m->nick)) {
-            ml->hops = m->hops;
-            break;
-          }
-        }
-      }
-    }
-  } else
-    m->hops = 0;
-
-
-  /* Store the userhost */
-  simple_sprintf(m->userhost, "%s@%s", user, host);
-  simple_sprintf(userhost, "%s!%s", nick, m->userhost);
-  /* Combine n!u@h */
-  m->user = NULL;		/* No handle match (yet) */
-  if (match_my_nick(nick)) {	/* Is it me? */
-    strcpy(botuserhost, m->userhost);	/* Yes, save my own userhost */
-    m->joined = now;		/* set this to keep the whining masses happy */
-  }
-  waschanop = me_op(chan);      /* Am I opped here? */
-  if (strchr(flags, '@') != NULL)	/* Flags say he's opped? */
-    m->flags |= (CHANOP | WASOP);	/* Yes, so flag in my table */
-  else
-    m->flags &= ~(CHANOP | WASOP);
-  if (strchr(flags, '*'))
-    m->flags |= OPER;
-  else
-    m->flags &= ~OPER;
-  if (strchr(flags, '+') != NULL)	/* Flags say he's voiced? */
-    m->flags |= CHANVOICE;	/* Yes */
-  else
-    m->flags &= ~CHANVOICE;
-  if (!(m->flags & (CHANVOICE | CHANOP)))
-    m->flags |= STOPWHO;
-
-  if (match_my_nick(nick) && !waschanop && me_op(chan))
-    recheck_channel(chan, 1);
-  if (match_my_nick(nick) && any_ops(chan) && !me_op(chan))
-    chan->channel.do_opreq=1;
-
-  m->user = get_user_by_host(userhost);
-  get_user_flagrec(m->user, &fr, chan->dname);
-  /* are they a chanop, and me too */
-  if (chan_hasop(m) && me_op(chan) &&
-      /* are they a channel or global de-op */
-      (chan_deop(fr) || (glob_deop(fr) && !chan_op(fr))) &&
-      !match_my_nick(nick) && target_priority(chan, m, 1)) {
-   if (!channel_private(chan) || (channel_private(chan) && !glob_bot(fr) && !chan_op(fr) && !glob_owner(fr)))
-    add_mode(chan, '-', 'o', nick);
-  }
-  /* if channel is enforce bans */
-  if (channel_enforcebans(chan) &&
-      /* and user matches a ban */
-      (u_match_mask(global_bans, userhost) || u_match_mask(chan->bans, userhost)) &&
-      /* and it's not me, and i'm an op */
-      !match_my_nick(nick) && me_op(chan)
-      && target_priority(chan, m, 0)) {
-    dprintf(DP_SERVER, STR("KICK %s %s :%s%s\n"), chan->name, nick, bankickprefix, kickreason(KICK_BANNED));
-    m->flags |= SENTKICK;
-  }
-  /* if the user is a +k */
-  else if ((chan_kick(fr) || glob_kick(fr)) &&
-           /* and it's not me :) who'd set me +k anyway, a sicko? */
-           /* and if im an op */
-           !match_my_nick(nick) && me_op(chan) && target_priority(chan, m, 0)) {
-    /* cya later! */
-    quickban(chan, userhost);
-    dprintf(DP_SERVER, STR("KICK %s %s :%s%s\n"), chan->name, nick, bankickprefix, kickreason(KICK_KUSER));
-    m->flags |= SENTKICK;
-  }
-
-//  if (match_my_nick(nick) && any_ops(chan) && !me_op(chan)) {
-//    request_op(chan);
-//  }
-/* need
-    check_tcl_need(chan->dname, "op");
-    if (chan->need_op[0])
-      do_tcl("need-op", chan->need_op);
-*/
-  return 0;
-}
-
-/* got a 352: who info!
- */
-static int got352(char *from, char *msg)
-{
-  char *nick, *user, *host, *chname, *flags, *serv, *hops;
-  struct chanset_t *chan;
-
-  newsplit(&msg);		/* Skip my nick - effeciently */
-  chname = newsplit(&msg);	/* Grab the channel */
-  chan = findchan(chname);	/* See if I'm on channel */
-  if (chan) {			/* Am I? */
-    user = newsplit(&msg);	/* Grab the user */
-    host = newsplit(&msg);	/* Grab the host */
-    serv = newsplit(&msg);      /* And the server */
-    nick = newsplit(&msg);	/* Grab the nick */
-    flags = newsplit(&msg);	/* Grab the flags */
-    hops = newsplit(&msg);	/* grab server hops */
-    hops++;
-    got352or4(chan, user, host, serv, nick, flags, atoi(hops));
-  }
-  return 0;
-}
-
-/* got a 354: who info! - iru style
- */
-static int got354(char *from, char *msg)
-{
-  char *nick, *user, *host, *chname, *flags;
-  struct chanset_t *chan;
-
-  if (use_354) {
-    newsplit(&msg);		/* Skip my nick - effeciently */
-    if (msg[0] && (strchr(CHANMETA, msg[0]) != NULL)) {
-      chname = newsplit(&msg);	/* Grab the channel */
-      chan = findchan(chname);	/* See if I'm on channel */
-      if (chan) {		/* Am I? */
-	user = newsplit(&msg);	/* Grab the user */
-	host = newsplit(&msg);	/* Grab the host */
-	nick = newsplit(&msg);	/* Grab the nick */
-	flags = newsplit(&msg);	/* Grab the flags */
-	got352or4(chan, user, host, NULL, nick, flags, 0);
-      }
-    }
-  }
-  return 0;
-}
-
-/* got 315: end of who
- * <server> 315 <to> <chan> :End of /who
- */
-static int got315(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-Context;
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  /* May have left the channel before the who info came in */
-  if (!chan || !channel_pending(chan))
-    return 0;
-  /* Finished getting who list, can now be considered officially ON CHANNEL */
-  chan->status |= CHAN_ACTIVE;
-  chan->status &= ~CHAN_PEND;
-  /* Am *I* on the channel now? if not, well d0h. */
-  if (!ismember(chan, botname)) {
-    putlog(LOG_MISC | LOG_JOIN, chan->dname, "Oops, I'm not really on %s.",
-	   chan->dname);
-    clear_channel(chan, 1);
-    chan->status &= ~CHAN_ACTIVE;
-    dprintf(DP_MODE, "JOIN %s %s\n",
-	    (chan->name[0]) ? chan->name : chan->dname,
-	    chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-  } else {
-Context;
-    if (me_op(chan))
-      recheck_channel(chan, 1);
-    else if (chan->channel.members == 1)
-      chan->status |= CHAN_STOP_CYCLE;
-    else request_op(chan);
-
-  }
-  /* do not check for i-lines here. */
-  return 0;
-}
-
-/* got 367: ban info
- * <server> 367 <to> <chan> <ban> [placed-by] [timestamp]
- */
-static int got367(char *from, char *origmsg)
-{
-  char *ban, *who, *chname, buf[511], *msg;
-  struct chanset_t *chan;
-
-  strncpy(buf, origmsg, 510);
-  buf[510] = 0;
-  msg = buf;
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (!chan || !(channel_pending(chan) || channel_active(chan)))
-    return 0;
-  ban = newsplit(&msg);
-  who = newsplit(&msg);
-  /* Extended timestamp format? */
-  if (who[0])
-    newban(chan, ban, who);
-  else
-    newban(chan, ban, "existent");
-  return 0;
-}
-
-/* got 368: end of ban list
- * <server> 368 <to> <chan> :etc
- */
-static int got368(char *from, char *msg)
-{
-  struct chanset_t *chan;
-  char *chname;
-
-  /* Okay, now add bans that i want, which aren't set yet */
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (chan)
-    chan->status &= ~CHAN_ASKEDBANS;
-  /* If i sent a mode -b on myself (deban) in got367, either
-   * resetbans() or recheck_bans() will flush that.
-   */
-  return 0;
-}
-#ifdef S_IRCNET
-/* got 348: ban exemption info
- * <server> 348 <to> <chan> <exemption>
- */
-static int got348(char *from, char *origmsg)
-{
-  char *exempt, *who, *chname, buf[511], *msg;
-  struct chanset_t *chan;
-
-  if (use_exempts == 0)
-    return 0;
-
-  strncpy(buf, origmsg, 510);
-  buf[510] = 0;
-  msg = buf;
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (!chan || !(channel_pending(chan) || channel_active(chan)))
-    return 0;
-  exempt = newsplit(&msg);
-  who = newsplit(&msg);
-  /* Extended timestamp format? */
-  if (who[0])
-    newexempt(chan, exempt, who);
-  else
-    newexempt(chan, exempt, "existent");
-  return 0;
-}
-
-/* got 349: end of ban exemption list
- * <server> 349 <to> <chan> :etc
- */
-static int got349(char *from, char *msg)
-{
-  struct chanset_t *chan;
-  char *chname;
-
-  if (use_exempts == 1) {
-    newsplit(&msg);
-    chname = newsplit(&msg);
-    chan = findchan(chname);
-    if (chan)
-      chan->ircnet_status &= ~CHAN_ASKED_EXEMPTS;
-  }
-  return 0;
-}
-
-/* got 346: invite exemption info
- * <server> 346 <to> <chan> <exemption>
- */
-static int got346(char *from, char *origmsg)
-{
-  char *invite, *who, *chname, buf[511], *msg;
-  struct chanset_t *chan;
-
-  strncpy(buf, origmsg, 510);
-  buf[510] = 0;
-  msg = buf;
-  if (use_invites == 0)
-    return 0;
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (!chan || !(channel_pending(chan) || channel_active(chan)))
-    return 0;
-  invite = newsplit(&msg);
-  who = newsplit(&msg);
-  /* Extended timestamp format? */
-  if (who[0])
-    newinvite(chan, invite, who);
-  else
-    newinvite(chan, invite, "existent");
-  return 0;
-}
-
-/* got 347: end of invite exemption list
- * <server> 347 <to> <chan> :etc
- */
-static int got347(char *from, char *msg)
-{
-  struct chanset_t *chan;
-  char *chname;
-
-  if (use_invites == 1) {
-    newsplit(&msg);
-    chname = newsplit(&msg);
-    chan = findchan(chname);
-    if (chan)
-      chan->ircnet_status &= ~CHAN_ASKED_INVITED;
-  }
-  return 0;
-}
-#endif
-/* Too many channels.
- */
-static int got405(char *from, char *msg)
-{
-  char *chname;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  putlog(LOG_MISC, "*", IRC_TOOMANYCHANS, chname);
-  return 0;
-}
-
-/* This is only of use to us with !channels. We get this message when
- * attempting to join a non-existant !channel... The channel must be
- * created by sending 'JOIN !!<channel>'. <cybah>
- *
- * 403 - ERR_NOSUCHCHANNEL
- */
-static int got403(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  if (chname && chname[0]=='!') {
-    chan = findchan_by_dname(chname);
-    if (!chan) {
-      chan = findchan(chname);
-      if (!chan)
-        return 0;       /* Ignore it */
-      /* We have the channel unique name, so we have attempted to join
-       * a specific !channel that doesnt exist. Now attempt to join the
-       * channel using it's short name.
-       */
-      putlog(LOG_MISC, "*",
-             "Unique channel %s does not exist... Attempting to join with "
-             "short name.", chname);
-      dprintf(DP_SERVER, "JOIN %s\n", chan->dname);
-    } else {
-      /* We have found the channel, so the server has given us the short
-       * name. Prefix another '!' to it, and attempt the join again...
-       */
-      putlog(LOG_MISC, "*",
-             "Channel %s does not exist... Attempting to create it.", chname);
-      dprintf(DP_SERVER, "JOIN !%s\n", chan->dname);
-    }
-  }
-  return 0;
-}
-
-/* got 471: can't join channel, full
- */
-static int got471(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  /* !channel short names (also referred to as 'description names'
-   * can be received by skipping over the unique ID.
-   */
-  if ((chname[0] == '!') && (strlen(chname) > CHANNEL_ID_LEN)) {
-    chname += CHANNEL_ID_LEN;
-    chname[0] = '!';
-  }
-  /* We use dname because name is first set on JOIN and we might not
-   * have joined the channel yet.
-   */
-  chan = findchan_by_dname(chname);
-  if (chan) {
-    putlog(LOG_JOIN, chan->dname, IRC_CHANFULL, chan->dname);
-    request_in(chan);
-/* need
-    check_tcl_need(chan->dname, "limit");
-*/
-
-    chan = findchan_by_dname(chname); 
-    if (!chan)
-      return 0;
-
-    if (chan->need_limit[0])
-      do_tcl("need-limit", chan->need_limit);
-  } else
-    putlog(LOG_JOIN, chname, IRC_CHANFULL, chname);
-  return 0;
-}
-
-/* got 473: can't join channel, invite only
- */
-static int got473(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  /* !channel short names (also referred to as 'description names'
-   * can be received by skipping over the unique ID.
-   */
-  if ((chname[0] == '!') && (strlen(chname) > CHANNEL_ID_LEN)) {
-    chname += CHANNEL_ID_LEN;
-    chname[0] = '!';
-  }
-  /* We use dname because name is first set on JOIN and we might not
-   * have joined the channel yet.
-   */
-  chan = findchan_by_dname(chname);
-  if (chan) {
-    putlog(LOG_JOIN, chan->dname, IRC_CHANINVITEONLY, chan->dname);
-    request_in(chan);
-/* need
-    check_tcl_need(chan->dname, "invite");
-*/
-
-    chan = findchan_by_dname(chname); 
-    if (!chan)
-      return 0;
-
-    if (chan->need_invite[0])
-      do_tcl("need-invite", chan->need_invite);
-  } else
-    putlog(LOG_JOIN, chname, IRC_CHANINVITEONLY, chname);
-  return 0;
-}
-
-/* got 474: can't join channel, banned
- */
-static int got474(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  /* !channel short names (also referred to as 'description names'
-   * can be received by skipping over the unique ID.
-   */
-  if ((chname[0] == '!') && (strlen(chname) > CHANNEL_ID_LEN)) {
-    chname += CHANNEL_ID_LEN;
-    chname[0] = '!';
-  }
-  /* We use dname because name is first set on JOIN and we might not
-   * have joined the channel yet.
-   */
-  chan = findchan_by_dname(chname);
-  if (chan) {
-    putlog(LOG_JOIN, chan->dname, IRC_BANNEDFROMCHAN, chan->dname);
-    request_in(chan);
-/* need
-    check_tcl_need(chan->dname, "unban");
-*/
-
-    chan = findchan_by_dname(chname); 
-    if (!chan)
-      return 0;
-
-    if (chan->need_unban[0])
-      do_tcl("need-unban", chan->need_unban);
-  } else
-    putlog(LOG_JOIN, chname, IRC_BANNEDFROMCHAN, chname);
-  return 0;
-}
-
-/* got 475: can't goin channel, bad key
- */
-static int got475(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  /* !channel short names (also referred to as 'description names'
-   * can be received by skipping over the unique ID.
-   */
-  if ((chname[0] == '!') && (strlen(chname) > CHANNEL_ID_LEN)) {
-    chname += CHANNEL_ID_LEN;
-    chname[0] = '!';
-  }
-  /* We use dname because name is first set on JOIN and we might not
-   * have joined the channel yet.
-   */
-  chan = findchan_by_dname(chname);
-  if (chan) {
-    putlog(LOG_JOIN, chan->dname, IRC_BADCHANKEY, chan->dname);
-    if (chan->channel.key[0]) {
-      nfree(chan->channel.key);
-      chan->channel.key = (char *) channel_malloc(1);
-      chan->channel.key[0] = 0;
-      dprintf(DP_MODE, "JOIN %s %s\n", chan->dname, chan->key_prot);
-    } else {
-      request_in(chan);
-/* need
-      check_tcl_need(chan->dname, "key");
-*/
-
-      chan = findchan_by_dname(chname); 
-      if (!chan)
-        return 0;
-
-      if (chan->need_key[0])
-	do_tcl("need-key", chan->need_key);
-    }
-  } else
-    putlog(LOG_JOIN, chname, IRC_BADCHANKEY, chname);
-  return 0;
-}
-
-/* got invitation
- */
-static int gotinvite(char *from, char *msg)
-{
-  char *nick;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  fixcolon(msg);
-  nick = splitnick(&from);
-  if (!rfc_casecmp(last_invchan, msg))
-    if (now - last_invtime < 30)
-      return 0;		/* Two invites to the same channel in 30 seconds? */
-  putlog(LOG_MISC, "*", "%s!%s invited me to %s", nick, from, msg);
-  strncpy(last_invchan, msg, 299);
-  last_invchan[299] = 0;
-  last_invtime = now;
-  chan = findchan(msg);
-  if (!chan)
-    /* Might be a short-name */
-    chan = findchan_by_dname(msg);
-
-  if (chan && (channel_pending(chan) || channel_active(chan)))
-    dprintf(DP_HELP, "NOTICE %s :I'm already here.\n", nick);
-  else if (chan && !channel_inactive(chan))
-    dprintf(DP_MODE, "JOIN %s %s\n", (chan->name[0]) ? chan->name : chan->dname,
-            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-  return 0;
-}
-
-/* Set the topic.
- */
-static void set_topic(struct chanset_t *chan, char *k)
-{
-  if (chan->channel.topic)
-    nfree(chan->channel.topic);
-  if (k && k[0]) {
-    chan->channel.topic = (char *) channel_malloc(strlen(k) + 1);
-    strcpy(chan->channel.topic, k);
-  } else
-    chan->channel.topic = NULL;
-}
-
-/* Topic change.
- */
-static int gottopic(char *from, char *msg)
-{
-  char *nick, *chname;
-  memberlist *m;
-  struct chanset_t *chan;
-  struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  chname = newsplit(&msg);
-  fixcolon(msg);
-  u = get_user_by_host(from);
-  nick = splitnick(&from);
-  chan = findchan(chname);
-  get_user_flagrec(u, &fr, chname);
-  if (chan) {
-    putlog(LOG_JOIN, chan->dname, "Topic changed on %s by %s!%s: %s",
-           chan->dname, nick, from, msg);
-    m = ismember(chan, nick);
-    if (m != NULL)
-      m->last = now;
-    set_topic(chan, msg);
-    check_tcl_topc(nick, from, u, chan->dname, msg);
-    if (egg_strcasecmp(botname, nick) && !glob_master(fr) && !chan_master(fr))
-      check_topic(chan);
-  }
-  return 0;
-}
-
-/* 331: no current topic for this channel
- * <server> 331 <to> <chname> :etc
- */
-static int got331(char *from, char *msg)
-{
-  char *chname;
-  struct chanset_t *chan;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (chan) {
-    set_topic(chan, NULL);
-    check_tcl_topc("*", "*", NULL, chan->dname, "");
-    check_topic(chan);
-  }
-  return 0;
-}
-
-/* 332: topic on a channel i've just joined
- * <server> 332 <to> <chname> :topic goes here
- */
-static int got332(char *from, char *msg)
-{
-  struct chanset_t *chan;
-  char *chname;
-
-  newsplit(&msg);
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (chan) {
-    fixcolon(msg);
-    set_topic(chan, msg);
-    check_tcl_topc("*", "*", NULL, chan->dname, msg);
-    check_topic(chan);
-  }
-  return 0;
-}
-
-/* Got a join
- */
-static int gotjoin(char *from, char *chname)
-{
-  char *nick, *p, buf[UHOSTLEN], *uhost = buf;
-  char *ch_dname = NULL;
-  struct chanset_t *chan;
-  memberlist *m;
-  masklist *b;
-  struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  fixcolon(chname);
-  chan = findchan(chname);
-  if (!chan && chname[0] == '!') {
-    /* As this is a !channel, we need to search for it by display (short)
-     * name now. This will happen when we initially join the channel, as we
-     * dont know the unique channel name that the server has made up. <cybah>
-     */
-    int	l_chname = strlen(chname);
-
-    if (l_chname > (CHANNEL_ID_LEN + 1)) {
-      ch_dname = nmalloc(l_chname + 1);
-      if (ch_dname) {
-	egg_snprintf(ch_dname, l_chname + 2, "!%s",
-		     chname + (CHANNEL_ID_LEN + 1));
-	chan = findchan_by_dname(ch_dname);
-	if (!chan) {
-	  /* Hmm.. okay. Maybe the admin's a genius and doesn't know the
-	   * difference between id and descriptive channel names. Search
-	   * the channel name in the dname list using the id-name.
-	   */
-	   chan = findchan_by_dname(chname);
-	   if (chan) {
-	     /* Duh, I was right. Mark this channel as inactive and log
-	      * the incident.
-	      */
-	     chan->status |= CHAN_INACTIVE;
-	     putlog(LOG_MISC, "*", "Deactivated channel %s, because it uses "
-		    "an ID channel-name. Use the descriptive name instead.",
-		    chname);
-	     dprintf(DP_SERVER, "PART %s\n", chname);
-	     goto exit;
-	   }
-	}
-      }
-    }
-  } else if (!chan) {
-    /* As this is not a !chan, we need to search for it by display name now.
-     * Unlike !chan's, we dont need to remove the unique part.
-     */
-    chan = findchan_by_dname(chname);
-  }
-
-  if (!chan || channel_inactive(chan)) {
-    strcpy(uhost, from);
-    nick = splitnick(&uhost);
-    if (match_my_nick(nick)) {
-      putlog(LOG_MISC, "*", "joined %s but didn't want to!", chname);
-      dprintf(DP_MODE, "PART %s\n", chname);
-    }
-  } else if (!channel_pending(chan)) {
-    chan->status &= ~CHAN_STOP_CYCLE;
-    strcpy(uhost, from);
-    nick = splitnick(&uhost);
-    detect_chan_flood(nick, uhost, from, chan, FLOOD_JOIN, NULL);
-
-    chan = findchan(chname);
-    if (!chan) {   
-      if (ch_dname)
-	chan = findchan_by_dname(ch_dname);
-      else
-	chan = findchan_by_dname(chname);
-    }
-    if (!chan)
-      /* The channel doesn't exist anymore, so get out of here. */
-      goto exit;
-
-    /* Grab last time joined before we update it */
-    u = get_user_by_host(from);
-    get_user_flagrec(u, &fr, chan->dname); /* Lam: fix to work with !channels */
-    if (!channel_active(chan) && !match_my_nick(nick)) {
-      /* uh, what?!  i'm on the channel?! */
-      putlog(LOG_MISC, chan->dname,
-	     "confused bot: guess I'm on %s and didn't realize it",
-	     chan->dname);
-      chan->status |= CHAN_ACTIVE;
-      chan->status &= ~CHAN_PEND;
-      reset_chan_info(chan);
-    } else {
-      m = ismember(chan, nick);
-      if (m && m->split && !egg_strcasecmp(m->userhost, uhost)) {
-	check_tcl_rejn(nick, uhost, u, chan->dname);
-
-	chan = findchan(chname);
-	if (!chan) {
-	  if (ch_dname)
-	    chan = findchan_by_dname(ch_dname);
-	  else
-	    chan = findchan_by_dname(chname);
-        }
-        if (!chan)
-          /* The channel doesn't exist anymore, so get out of here. */
-          goto exit;
-
-	/* The tcl binding might have deleted the current user. Recheck. */
-	u = get_user_by_host(from);
-	m->split = 0;
-	m->last = now;
-	m->delay = 0L;
-	m->flags = (chan_hasop(m) ? WASOP : 0);
-	m->user = u;
-	set_handle_laston(chan->dname, u, now);
-	m->flags |= STOPWHO;
-	putlog(LOG_JOIN, chan->dname, "%s (%s) returned to %s.", nick, uhost,
-	       chan->dname);
-      } else {
-	if (m)
-	  killmember(chan, nick);
-	m = newmember(chan, nick);
-	m->joined = now;
-	m->split = 0L;
-	m->flags = 0;
-	m->last = now;
-	m->delay = 0L;
-	strcpy(m->nick, nick);
-	strcpy(m->userhost, uhost);
-	m->user = u;
-	m->flags |= STOPWHO;
-
-	check_tcl_join(nick, uhost, u, chan->dname);
-
-	/* The tcl binding might have deleted the current user and the
-	 * current channel, so we'll now have to re-check whether they
-	 * both still exist.
-	 */
-	chan = findchan(chname);
-	if (!chan) {
-	  if (ch_dname)
-	    chan = findchan_by_dname(ch_dname);
-	  else
-	    chan = findchan_by_dname(chname);
-	}
-	if (!chan)
-	  /* The channel doesn't exist anymore, so get out of here. */
-	  goto exit;
-
-	/* The record saved in the channel record always gets updated,
-	   so we can use that. */
-	u = m->user;
-
-	if (match_my_nick(nick)) {
-	  /* It was me joining! Need to update the channel record with the
-	   * unique name for the channel (as the server see's it). <cybah>
-	   */
-	  strncpy(chan->name, chname, 81);
-	  chan->name[80] = 0;
-	  chan->status &= ~CHAN_JUPED;
-
-          /* ... and log us joining. Using chan->dname for the channel is
-	   * important in this case. As the config file will never contain
-	   * logs with the unique name.
-           */
-	  if (chname[0] == '!')
-	    putlog(LOG_JOIN, chan->dname, "%s joined %s (%s)", nick, chan->dname, chname);
-	  else
-	    putlog(LOG_JOIN, chan->dname, "%s joined %s.", nick,
-	           chname);
-	  if (!match_my_nick(chname))
- 	    reset_chan_info(chan);
-	} else {
-//	  struct chanuserrec *cr;
-
-	  putlog(LOG_JOIN, chan->dname,
-		 "%s (%s) joined %s.", nick, uhost, chan->dname);
-	  /* Don't re-display greeting if they've been on the channel
-	   * recently.
-	   */
-	  set_handle_laston(chan->dname, u, now);
-	}
-      }
-      /* ok, the op-on-join,etc, tests...first only both if Im opped */
-
-      if (me_op(chan)) {
-	/* Check for and reset exempts and invites.
-	 *
-	 * This will require further checking to account for when to use the
-	 * various modes.
-	 */
-#ifdef S_IRCNET
-	if (u_match_mask(global_invites,from) ||
-	    u_match_mask(chan->invites, from))
-	  refresh_invite(chan, from);
-
-	if (!(use_exempts &&
-	      (u_match_mask(global_exempts,from) ||
-	       u_match_mask(chan->exempts, from)))) {
-#else
-        if (1) {
-#endif
-          if (channel_enforcebans(chan) && !chan_op(fr) && !glob_op(fr) &&
-              !glob_friend(fr) && !chan_friend(fr) && !chan_sentkick(m) &&
-#ifdef S_IRCNET
-              !(use_exempts && isexempted(chan, from)) && 
-#endif
-              me_op(chan)) {
-            for (b = chan->channel.ban; b->mask[0]; b = b->next) {
-              if (wild_match(b->mask, from)) {
-Context;
-                dprintf(DP_SERVER, STR("KICK %s %s :%s%s\n"), chname, m->nick, bankickprefix, kickreason(KICK_BANNED));
-                m->flags |= SENTKICK;
-                goto exit;
-              }
-            }
-          }
-	  /* If it matches a ban, dispose of them. */
-	  if (u_match_mask(global_bans, from) ||
-	      u_match_mask(chan->bans, from)) {
-	    refresh_ban_kick(chan, from, nick);
-	  /* Likewise for kick'ees */
-	  } else if (!chan_sentkick(m) && (glob_kick(fr) || chan_kick(fr)) &&
-		     me_op(chan)) {
-#ifdef S_IRCNET
-	    check_exemptlist(chan, from);
-#endif
-	    quickban(chan, from);
-Context;
-	    p = get_user(&USERENTRY_COMMENT, m->user);
-            dprintf(DP_MODE, STR("KICK %s %s :%s%s\n"), chname, nick, bankickprefix, kickreason(KICK_KUSER));
-	    m->flags |= SENTKICK;
-	  }
-	}
-      }
-    }
-  }
-
-exit:
-  if (ch_dname)
-    nfree(ch_dname);
-  return 0;
-}
-
-/* Got a part
- */
-static int gotpart(char *from, char *msg)
-{
-  char *nick, *chname;
-  struct chanset_t *chan;
-  struct userrec *u;
-
-  chname = newsplit(&msg);
-  fixcolon(chname);
-  fixcolon(msg);
-  chan = findchan(chname);
-  if (chan && channel_inactive(chan)) {
-    clear_channel(chan, 1);
-    chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-    return 0;
-  }
-  if (chan && !channel_pending(chan)) {
-    u = get_user_by_host(from);
-    nick = splitnick(&from);
-    if (!channel_active(chan)) {
-      /* whoa! */
-      putlog(LOG_MISC, chan->dname,
-	  "confused bot: guess I'm on %s and didn't realize it", chan->dname);
-      chan->status |= CHAN_ACTIVE;
-      chan->status &= ~CHAN_PEND;
-      reset_chan_info(chan);
-    }
-    set_handle_laston(chan->dname, u, now);
-    check_tcl_part(nick, from, u, chan->dname, msg); /* This must be directly above the killmember, in case
-    							we're doing anything to the record that would affect
-							the above */
-    chan = findchan(chname);
-    if (!chan)
-      return 0;
-
-    killmember(chan, nick);
-    if (msg[0])
-      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s (%s).", nick, from, chan->dname, msg);
-    else
-      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s.", nick, from, chan->dname);
-    /* If it was me, all hell breaks loose... */
-    if (match_my_nick(nick)) {
-      clear_channel(chan, 1);
-      chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-      if (!channel_inactive(chan))
-	dprintf(DP_MODE, "JOIN %s %s\n",
-	        (chan->name[0]) ? chan->name : chan->dname,
-	        chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-    } else
-      check_lonely_channel(chan);
-  }
-  return 0;
-}
-
-/* Got a kick
- */
-static int gotkick(char *from, char *origmsg)
-{
-  char *nick, *whodid, *chname, s1[UHOSTLEN], buf[UHOSTLEN], *uhost = buf;
-  char buf2[511], *msg;
-  memberlist *m;
-  struct chanset_t *chan;
-  struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  strncpy(buf2, origmsg, 510);
-  buf2[510] = 0;
-  msg = buf2;
-  chname = newsplit(&msg);
-  chan = findchan(chname);
-  if (!chan)
-    return 0;
-  nick = newsplit(&msg);
-  if (match_my_nick(nick) && channel_pending(chan)) {
-    chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-    dprintf(DP_MODE, "JOIN %s %s\n",
-            (chan->name[0]) ? chan->name : chan->dname,
-            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-    clear_channel(chan, 1);
-    return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
-  }
-  if (channel_active(chan)) {
-    fixcolon(msg);
-    u = get_user_by_host(from);
-    strcpy(uhost, from);
-    whodid = splitnick(&uhost);
-    detect_chan_flood(whodid, uhost, from, chan, FLOOD_KICK, nick);
-
-    chan = findchan(chname);
-    if (!chan)
-      return 0;     
-
-    m = ismember(chan, whodid);
-    if (m)
-      m->last = now;
-    /* This _needs_ to use chan->dname <cybah> */
-    get_user_flagrec(u, &fr, chan->dname);
-    set_handle_laston(chan->dname, u, now);
-    check_tcl_kick(whodid, uhost, u, chan->dname, nick, msg);
- 
-    chan = findchan(chname);
-    if (!chan)
-      return 0;
-
-    m = ismember(chan, nick);
-    if (m) {
-      struct userrec *u2;
-
-      simple_sprintf(s1, "%s!%s", m->nick, m->userhost);
-      u2 = get_user_by_host(s1);
-      set_handle_laston(chan->dname, u2, now);
-      maybe_revenge(chan, from, s1, REVENGE_KICK);
-    }
-    putlog(LOG_MODES, chan->dname, "%s kicked from %s by %s: %s", s1,
-	   chan->dname, from, msg);
-    /* Kicked ME?!? the sods! */
-    if (match_my_nick(nick)) {
-      chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-      dprintf(DP_MODE, "JOIN %s %s\n",
-              (chan->name[0]) ? chan->name : chan->dname,
-              chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-      clear_channel(chan, 1);
-    } else {
-      killmember(chan, nick);
-      check_lonely_channel(chan);
-    }
-  }
-  return 0;
-}
-
-/* Got a nick change
- */
-static int gotnick(char *from, char *msg)
-{
-  char *nick, *chname, s1[UHOSTLEN], buf[UHOSTLEN], *uhost = buf;
-  memberlist *m, *mm;
-  struct chanset_t *chan, *oldchan = NULL;
-  struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  strcpy(uhost, from);
-  nick = splitnick(&uhost);
-  fixcolon(msg);
-  clear_chanlist_member(nick);	/* Cache for nick 'nick' is meaningless now. */
-  for (chan = chanset; chan; chan = chan->next) {
-    oldchan = chan;
-    chname = chan->dname; 
-    m = ismember(chan, nick);
-
-    if (m) {
-      putlog(LOG_JOIN, chan->dname, "Nick change: %s -> %s", nick, msg);
-      m->last = now;
-      if (rfc_casecmp(nick, msg)) {
-	/* Not just a capitalization change */
-	mm = ismember(chan, msg);
-	if (mm) {
-	  /* Someone on channel with old nick?! */
-	  if (mm->split)
-	    putlog(LOG_JOIN, chan->dname,
-		   "Possible future nick collision: %s", mm->nick);
-	  else
-	    putlog(LOG_MISC, chan->dname,
-		   "* Bug: nick change to existing nick");
-	  killmember(chan, mm->nick);
-	}
-      }
-      /*
-       * Banned?
-       */
-      /* Compose a nick!user@host for the new nick */
-      sprintf(s1, "%s!%s", msg, uhost);
-      strcpy(m->nick, msg);
-      detect_chan_flood(msg, uhost, from, chan, FLOOD_NICK, NULL);
-
-      if (!findchan_by_dname(chname)) {
-        chan = oldchan;
-        continue;
-      }
-      /* don't fill the serverqueue with modes or kicks in a nickflood */
-      if (chan_sentkick(m) || chan_sentdeop(m) || chan_sentop(m) ||
-	  chan_sentdevoice(m) || chan_sentvoice(m))
-	m->flags |= STOPCHECK;
-      /* Any pending kick or mode to the old nick is lost. */
-	m->flags &= ~(SENTKICK | SENTDEOP | SENTOP |
-		      SENTVOICE | SENTDEVOICE);
-
-
-      /* make sure they stay devoiced if EVOICE! */
-
-      /* nick-ban or nick is +k or something? */
-      if (!chan_stopcheck(m)) {
-	get_user_flagrec(m->user ? m->user : get_user_by_host(s1), &fr, chan->dname);
-	check_this_member(chan, m->nick, &fr);
-      }
-      u = get_user_by_host(from); /* make sure this is in the loop, someone could have changed the record
-                                     in an earlier iteration of the loop */
-      check_tcl_nick(nick, uhost, u, chan->dname, msg);
-    
-      if (!findchan_by_dname(chname)) {
-	chan = oldchan;
-        continue;
-      }
-    }
-  }
-  return 0;
-}
-
-/* Signoff, similar to part.
- */
-static int gotquit(char *from, char *msg)
-{
-  char *nick, *chname, *p, *alt;
-  int split = 0;
-  char from2[NICKMAX + UHOSTMAX + 1];
-  memberlist *m;
-  struct chanset_t *chan, *oldchan = NULL;
-  struct userrec *u;
-
-  strcpy(from2,from);
-  u = get_user_by_host(from2);
-  nick = splitnick(&from);
-  fixcolon(msg);
-  /* Fred1: Instead of expensive wild_match on signoff, quicker method.
-   *        Determine if signoff string matches "%.% %.%", and only one
-   *        space.
-   */
-  p = strchr(msg, ' ');
-  if (p && (p == strrchr(msg, ' '))) {
-    char *z1, *z2;
-
-    *p = 0;
-    z1 = strchr(p + 1, '.');
-    z2 = strchr(msg, '.');
-    if (z1 && z2 && (*(z1 + 1) != 0) && (z1 - 1 != p) &&
-	(z2 + 1 != p) && (z2 != msg)) {
-      /* Server split, or else it looked like it anyway (no harm in
-       * assuming)
-       */
-      split = 1;
-    } else
-      *p = ' ';
-  }
-  for (chan = chanset; chan; chan = chan->next) {
-    oldchan = chan;
-    chname = chan->dname;
-    m = ismember(chan, nick);
-    if (m) {
-      u = get_user_by_host(from2);
-      if (u) {
-        set_handle_laston(chan->dname, u, now); /* If you remove this, the bot will crash when the user record in question
-						   is removed/modified during the tcl binds below, and the users was on more
-						   than one monitored channel */
-      }
-      if (split) {
-	m->split = now;
-	check_tcl_splt(nick, from, u, chan->dname);
-
-	if (!findchan_by_dname(chname)) {
-          chan = oldchan;
-	  continue;
-        }
-	putlog(LOG_JOIN, chan->dname, "%s (%s) got netsplit.", nick,
-	       from);
-      } else {
-	check_tcl_sign(nick, from, u, chan->dname, msg);
-
-	if (!findchan_by_dname(chname)) {
-	  chan = oldchan;
-	  continue;
-	}
-	putlog(LOG_JOIN, chan->dname, "%s (%s) left irc: %s", nick,
-	       from, msg);
-	killmember(chan, nick);
-	check_lonely_channel(chan);
-      }
-    }
-  }
-  /* Our nick quit? if so, grab it. Heck, our altnick quit maybe, maybe
-   * we want it.
-   */
-  if (keepnick) {
-    alt = get_altbotnick();
-    if (!rfc_casecmp(nick, origbotname)) {
-      putlog(LOG_MISC, "*", IRC_GETORIGNICK, origbotname);
-      dprintf(DP_SERVER, "NICK %s\n", origbotname);
-    } else if (alt[0]) {
-      if (!rfc_casecmp(nick, alt) && strcmp(botname, origbotname)) {
-	putlog(LOG_MISC, "*", IRC_GETALTNICK, alt);
-	dprintf(DP_SERVER, "NICK %s\n", alt);
-      }
-    }
-  }
-  return 0;
-}
-
-/* Got a private message.
- */
-static int gotmsg(char *from, char *msg)
-{
-  char *to, *realto, buf[UHOSTLEN], *nick, buf2[512], *uhost = buf;
-  char *p, *p1, *code, *ctcp;
-  int ctcp_count = 0;
-  struct chanset_t *chan;
-  int ignoring;
-  struct userrec *u;
-  memberlist *m;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-  if (!strchr("&#!+@$", msg[0]))
-    return 0;
-  ignoring = match_ignore(from);
-  to = newsplit(&msg);
-  realto = (to[0] == '@') ? to + 1 : to;
-  chan = findchan(realto);
-  if (!chan)
-    return 0;			/* Private msg to an unknown channel?? */
-  fixcolon(msg);
-  strcpy(uhost, from);
-  nick = splitnick(&uhost);
-  /* Only check if flood-ctcp is active */
-  if (flud_ctcp_thr && detect_avalanche(msg)) {
-    u = get_user_by_host(from);
-    get_user_flagrec(u, &fr, chan->dname);
-    m = ismember(chan, nick);
-    /* Discard -- kick user if it was to the channel */
-    if (me_op(chan) && m &&
-	!chan_sentkick(m) && !chan_friend(fr) && !glob_friend(fr) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&	/* arthur2 */
-	!(use_exempts && ban_fun &&
-	  /* don't kickban if permanent exempted -- Eule */
-	  (u_match_mask(global_exempts, from) ||
-	   u_match_mask(chan->exempts, from)))) {
-      if (ban_fun) {
-	check_exemptlist(chan, from);
-	u_addban(chan, quickban(chan, uhost), botnetnick,
-               IRC_FUNKICK, now + (60 * chan->ban_time), 0);
-      }
-      if (kick_fun) {
-	/* This can induce kickflood - arthur2 */
-	dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, nick,
-		kickprefix, IRC_FUNKICK);
-	m->flags |= SENTKICK;
-      }
-    }
-    if (!ignoring) {
-      putlog(LOG_MODES, "*", "Avalanche from %s!%s in %s - ignoring",
-	     nick, uhost, chan->dname);
-      p = strchr(uhost, '@');
-      if (p)
-	p++;
-      else
-	p = uhost;
-      simple_sprintf(buf2, "*!*@%s", p);
-      addignore(buf2, botnetnick, "ctcp avalanche", now + (60 * ignore_time));
-    }
-    return 0;
-  }
-  /* Check for CTCP: */
-  ctcp_reply[0] = 0;
-  p = strchr(msg, 1);
-  while (p && *p) {
-    p++;
-    p1 = p;
-    while ((*p != 1) && *p)
-      p++;
-    if (*p == 1) {
-      *p = 0;
-      ctcp = buf2;
-      strcpy(ctcp, p1);
-      strcpy(p1 - 1, p + 1);
-      detect_chan_flood(nick, uhost, from, chan,
-			strncmp(ctcp, "ACTION ", 7) ?
-			FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
-
-      chan = findchan(realto);
-      if (!chan)
-        return 0;
-
-      /* Respond to the first answer_ctcp */
-      p = strchr(msg, 1);
-      if (ctcp_count < answer_ctcp) {
-	ctcp_count++;
-	if (ctcp[0] != ' ') {
-	  code = newsplit(&ctcp);
-	  u = get_user_by_host(from);
-	  if (!ignoring || trigger_on_ignore) {
-	    if (!check_tcl_ctcp(nick, uhost, u, to, code, ctcp)) {
-
-	      chan = findchan(realto); 
-	      if (!chan)
-		return 0;
-
-	      update_idle(chan->dname, nick);
-            }
-	    if (!ignoring) {
-	      /* Log DCC, it's to a channel damnit! */
-	      if (!strcmp(code, "ACTION")) {
-		putlog(LOG_PUBLIC, chan->dname, "Action: %s %s", nick, ctcp);
-	      } else {
-		putlog(LOG_PUBLIC, chan->dname,
-		       "CTCP %s: %s from %s (%s) to %s", code, ctcp, nick,
-		       from, to);
-	      }
-	    }
-	  }
-	}
-      }
-    }
-  }
-  /* Send out possible ctcp responses */
-  if (ctcp_reply[0]) {
-    if (ctcp_mode != 2) {
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-    } else {
-      if (now - last_ctcp > flud_ctcp_time) {
-	dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-	count_ctcp = 1;
-      } else if (count_ctcp < flud_ctcp_thr) {
-	dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-	count_ctcp++;
-      }
-      last_ctcp = now;
-    }
-  }
-  if (msg[0]) {
-    int i = 0;
-    struct userrec *u;
-
-    /* Check even if we're ignoring the host. (modified by Eule 17.7.99) */
-    detect_chan_flood(nick, uhost, from, chan, FLOOD_PRIVMSG, NULL);
-    
-    chan = findchan(realto);
-    if (!chan)
-      return 0;
-    u = get_user_by_host(from);
-
-    i = isauthed(uhost);
-    /* is it a cmd? */
-
-    if (i > -1 && auth[i].authed && msg[0] == cmdprefix[0] && msg[1]) {
-      char *tmp, *code;
-      msg++;
-Context;
-      tmp = nmalloc(strlen(msg)+1);
-Context;
-      strcpy(tmp, msg);
-Context;
-      code = newsplit(&tmp);
-      if (check_tcl_pubc(code, nick, uhost, u, tmp, chan->dname))
-        auth[i].atime = now;
-      else {
-        if (to[0] == '@')
-          putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", nick, msg);
-        else
-          putlog(LOG_PUBLIC, chan->dname, "<%s> %s", nick, msg);
-      }
-    } else if ((msg[0] != cmdprefix[0] || !msg[1] || i == -1 || !(auth[i].authed))) {
-      if (!ignoring || trigger_on_ignore) {
-        if (check_tcl_pub(nick, uhost, chan->dname, msg))
-  	  return 0;
-        check_tcl_pubm(nick, uhost, chan->dname, msg);
-
-        chan = findchan(realto);
-        if (!chan)
-	  return 0;
-
-      }
-
-      if (!ignoring) {
-        if (to[0] == '@')
-	  putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", nick, msg);
-        else
-	  putlog(LOG_PUBLIC, chan->dname, "<%s> %s", nick, msg);
-      }
-    }
-    update_idle(chan->dname, nick);
-  }
-  return 0;
-}
-
-/* Got a private notice.
- */
-static int gotnotice(char *from, char *msg)
-{
-  char *to, *realto, *nick, buf2[512], *p, *p1, buf[512], *uhost = buf;
-  char *ctcp, *code;
-  struct userrec *u;
-  memberlist *m;
-  struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  int ignoring;
-
-  if (!strchr(CHANMETA "@", *msg))
-    return 0;
-  ignoring = match_ignore(from);
-  to = newsplit(&msg);
-  realto = (*to == '@') ? to + 1 : to;
-  chan = findchan(realto);
-  if (!chan)
-    return 0;			/* Notice to an unknown channel?? */
-  fixcolon(msg);
-  strcpy(uhost, from);
-  nick = splitnick(&uhost);
-  u = get_user_by_host(from);
-  if (flud_ctcp_thr && detect_avalanche(msg)) {
-    get_user_flagrec(u, &fr, chan->dname);
-    m = ismember(chan, nick);
-    /* Discard -- kick user if it was to the channel */
-    if (me_op(chan) && m && !chan_sentkick(m) &&
-	!chan_friend(fr) && !glob_friend(fr) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&	/* arthur2 */
-	!(use_exempts && ban_fun &&
-	  /* don't kickban if permanent exempted -- Eule */
-	  (u_match_mask(global_exempts,from) ||
-	   u_match_mask(chan->exempts, from)))) {
-      if (ban_fun) {
-	check_exemptlist(chan, from);
-	u_addban(chan, quickban(chan, uhost), botnetnick,
-               IRC_FUNKICK, now + (60 * chan->ban_time), 0);
-      }
-      if (kick_fun) {
-	/* This can induce kickflood - arthur2 */
-	dprintf(DP_SERVER, "KICK %s %s :%s%s\n", chan->name, nick,
-		kickprefix, IRC_FUNKICK);
-	m->flags |= SENTKICK;
-      }
-    }
-    if (!ignoring)
-      putlog(LOG_MODES, "*", "Avalanche from %s", from);
-    return 0;
-  }
-  /* Check for CTCP: */
-  p = strchr(msg, 1);
-  while (p && *p) {
-    p++;
-    p1 = p;
-    while ((*p != 1) && *p)
-      p++;
-    if (*p == 1) {
-      *p = 0;
-      ctcp = buf2;
-      strcpy(ctcp, p1);
-      strcpy(p1 - 1, p + 1);
-      p = strchr(msg, 1);
-      detect_chan_flood(nick, uhost, from, chan,
-			strncmp(ctcp, "ACTION ", 7) ?
-			FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
-
-      chan = findchan(realto); 
-      if (!chan)
-	return 0;
-
-      if (ctcp[0] != ' ') {
-	code = newsplit(&ctcp);
-	if (!ignoring || trigger_on_ignore) {
-	  check_tcl_ctcr(nick, uhost, u, chan->dname, code, msg);
-
-	  chan = findchan(realto); 
-	  if (!chan)
-	    return 0;
-
-	  if (!ignoring) {
-	    putlog(LOG_PUBLIC, chan->dname, "CTCP reply %s: %s from %s (%s) to %s",
-		   code, msg, nick, from, chan->dname);
-	    update_idle(chan->dname, nick);
-	  }
-	}
-      }
-    }
-  }
-  if (msg[0]) {
-    /* Check even if we're ignoring the host. (modified by Eule 17.7.99) */
-    detect_chan_flood(nick, uhost, from, chan, FLOOD_NOTICE, NULL);
-
-    chan = findchan(realto); 
-    if (!chan)
-      return 0;
-
-    if (!ignoring || trigger_on_ignore) {
-      check_tcl_notc(nick, uhost, u, to, msg);
-
-      chan = findchan(realto); 
-      if (!chan)
-	return 0;
-    }
-
-    if (!ignoring)
-      putlog(LOG_PUBLIC, chan->dname, "-%s:%s- %s", nick, to, msg);
-    update_idle(chan->dname, nick);
-  }
-  return 0;
-}
-
-static cmd_t irc_raw[] =
-{
-  {"324",	"",	(Function) got324,	"irc:324"},
-  {"352",	"",	(Function) got352,	"irc:352"},
-  {"354",	"",	(Function) got354,	"irc:354"},
-  {"315",	"",	(Function) got315,	"irc:315"},
-  {"367",	"",	(Function) got367,	"irc:367"},
-  {"368",	"",	(Function) got368,	"irc:368"},
-  {"403",	"",	(Function) got403,	"irc:403"},
-  {"405",	"",	(Function) got405,	"irc:405"},
-  {"471",	"",	(Function) got471,	"irc:471"},
-  {"473",	"",	(Function) got473,	"irc:473"},
-  {"474",	"",	(Function) got474,	"irc:474"},
-  {"475",	"",	(Function) got475,	"irc:475"},
-  {"INVITE",	"",	(Function) gotinvite,	"irc:invite"},
-  {"TOPIC",	"",	(Function) gottopic,	"irc:topic"},
-  {"331",	"",	(Function) got331,	"irc:331"},
-  {"332",	"",	(Function) got332,	"irc:332"},
-  {"JOIN",	"",	(Function) gotjoin,	"irc:join"},
-  {"PART",	"",	(Function) gotpart,	"irc:part"},
-  {"KICK",	"",	(Function) gotkick,	"irc:kick"},
-  {"NICK",	"",	(Function) gotnick,	"irc:nick"},
-  {"QUIT",	"",	(Function) gotquit,	"irc:quit"},
-  {"PRIVMSG",	"",	(Function) gotmsg,	"irc:msg"},
-  {"NOTICE",	"",	(Function) gotnotice,	"irc:notice"},
-  {"MODE",	"",	(Function) gotmode,	"irc:mode"},
-#ifdef S_IRCNET
-  {"346",	"",	(Function) got346,	"irc:346"},
-  {"347",	"",	(Function) got347,	"irc:347"},
-  {"348",	"",	(Function) got348,	"irc:348"},
-  {"349",	"",	(Function) got349,	"irc:349"},
-#endif
-  {NULL,	NULL,	NULL,			NULL}
-};
-#endif

+ 92 - 5
src/mod/irc.mod/msgcmds.c

@@ -111,7 +111,8 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 
 
   if (!ischanhub()) 
   if (!ischanhub()) 
     return 0;
     return 0;
-
+  if (!u) 
+    return 0;
   if (match_my_nick(nick))
   if (match_my_nick(nick))
     return 1;
     return 1;
   if (u && (u->flags & USER_BOT))
   if (u && (u->flags & USER_BOT))
@@ -142,7 +143,7 @@ Context;
 
 
 Context;
 Context;
 
 
-  dprintf(DP_HELP, "PRIVMSG %s :auth%s\n", nick, u ? "." : "!");
+  dprintf(DP_HELP, "PRIVMSG %s :auth%s %s\n", nick, u ? "." : "!", botnetnick);
 
 
   return 0;
   return 0;
 
 
@@ -181,8 +182,10 @@ Context;
 Context;
 Context;
       dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, botnetnick);
       dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, botnetnick);
     }
     }
-  } else
+  } else {
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed -AUTH", nick, host, u->handle);
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed -AUTH", nick, host, u->handle);
+    removeauth(i);
+  }
   return 1;
   return 1;
 
 
 }
 }
@@ -496,7 +499,7 @@ static int msgc_op(char *nick, char *host, struct userrec *u, char *par, char *c
       m = ismember(chan, nick);
       m = ismember(chan, nick);
   }
   }
 
 
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %OP %s", nick, host, u->handle, chname ? chname : "", cmdprefix, par ? par : "");
+  putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %sOP %s", nick, host, u->handle, chname ? chname : "", cmdprefix, par ? par : "");
 
 
   if (par[0] == '-') { //we have an option!
   if (par[0] == '-') { //we have an option!
     char *tmp;
     char *tmp;
@@ -537,6 +540,88 @@ static int msgc_op(char *nick, char *host, struct userrec *u, char *par, char *c
   return 1;
   return 1;
 }
 }
 
 
+static int msgc_voice(char *nick, char *host, struct userrec *u, char *par, char *chname)
+{
+  struct chanset_t *chan = NULL;
+  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  int force = 0;
+  memberlist *m;
+
+  if (match_my_nick(nick))
+    return 1;
+
+  if (chname[0]) {
+    chan = findchan_by_dname(chname);
+    if (chan) 
+      m = ismember(chan, nick);
+  }
+
+  putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %sVOICE %s", nick, host, u->handle, chname ? chname : "", cmdprefix, par ? par : "");
+
+  if (par[0] == '-') { //we have an option!
+    char *tmp;
+    par++;
+    tmp = newsplit(&par);
+    if (!strcasecmp(tmp, "force") || !strcasecmp(tmp, "f")) 
+      force = 1;
+    else {
+      dprintf(DP_HELP, "NOTICE %s :Invalid option: %s\n", nick, tmp);
+      return 0;
+    }
+  }
+  if (par[0] || chan) {
+    if (!chan)
+      chan = findchan_by_dname(par);
+    if (chan && channel_active(chan)) {
+      get_user_flagrec(u, &fr, chan->dname);
+      if ((!channel_private(chan) || (channel_private(chan) && (chan_op(fr) || glob_owner(fr)))) &&
+         (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) {
+        add_mode(chan, '+', 'v', nick);
+      }
+      return 1;
+    }
+  } else {
+    for (chan = chanset; chan; chan = chan->next) {
+      get_user_flagrec(u, &fr, chan->dname);
+      if ((!channel_private(chan) || (channel_private(chan) && (chan_op(fr) || glob_owner(fr)))) &&
+         (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) {
+        add_mode(chan, '+', 'v', nick);
+      }
+    }
+  }
+  return 1;
+}
+
+static int msgc_channels(char *nick, char *host, struct userrec *u, char *par, char *chname)
+{
+  struct chanset_t *chan = NULL;
+  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  char list[1024];
+
+  if (match_my_nick(nick))
+    return 1;
+
+  putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %sCHANNELS %s", nick, host, u->handle, chname ? chname : "", cmdprefix, par ? par : "");
+  list[0] = 0;
+  for (chan = chanset; chan; chan = chan->next) {
+    get_user_flagrec(u, &fr, chan->dname);
+    if ((!channel_private(chan) || (channel_private(chan) && (chan_op(fr) || glob_owner(fr)))) &&
+       (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) {
+      strcat(list, chan->dname);
+      strcat(list, " ");
+    }
+  }
+
+  if (list[0]) 
+    dprintf(DP_HELP, "NOTICE %s :You have access to: %s\n", nick, list);
+  else
+    dprintf(DP_HELP, "NOTICE %s :You do not have access to any channels.\n", nick);
+
+  return 1;
+}
+
+
+
 static int msgc_getkey(char *nick, char *host, struct userrec *u, char *par, char *chname)
 static int msgc_getkey(char *nick, char *host, struct userrec *u, char *par, char *chname)
 {
 {
   struct chanset_t *chan = NULL;
   struct chanset_t *chan = NULL;
@@ -583,7 +668,7 @@ Context;
 static int msgc_help(char *nick, char *host, struct userrec *u, char *par, char *chname)
 static int msgc_help(char *nick, char *host, struct userrec *u, char *par, char *chname)
 {
 {
   putlog(LOG_CMDS, "*", "(%s!%s) !%s! %sHELP %s", nick, host, u->handle, cmdprefix, par ? par : "");
   putlog(LOG_CMDS, "*", "(%s!%s) !%s! %sHELP %s", nick, host, u->handle, cmdprefix, par ? par : "");
-  dprintf(DP_HELP, "NOTICE %s :op invite getkey test\n", nick);
+  dprintf(DP_HELP, "NOTICE %s :op invite getkey voice test\n", nick);
   return 1;
   return 1;
 }
 }
 
 
@@ -645,6 +730,8 @@ static cmd_t C_msgc[] =
 {
 {
   {"test",		"",	(Function) msgc_test,		NULL},
   {"test",		"",	(Function) msgc_test,		NULL},
   {"op",		"",	(Function) msgc_op,		NULL},
   {"op",		"",	(Function) msgc_op,		NULL},
+  {"voice",		"",	(Function) msgc_voice,		NULL},
+  {"channels",		"",	(Function) msgc_channels,	NULL},
   {"getkey",		"",	(Function) msgc_getkey,		NULL},
   {"getkey",		"",	(Function) msgc_getkey,		NULL},
   {"invite",		"",	(Function) msgc_invite,		NULL},
   {"invite",		"",	(Function) msgc_invite,		NULL},
   {"help",		"",	(Function) msgc_help,		NULL},
   {"help",		"",	(Function) msgc_help,		NULL},

+ 4 - 0
src/mod/server.mod/server.c

@@ -1075,8 +1075,10 @@ void servers_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 #endif
 #endif
   add_server(p);
   add_server(p);
   nfree(p);
   nfree(p);
+#ifdef S_RANDSERVERS
   nfree(new);
   nfree(new);
 #endif
 #endif
+#endif
 }
 }
 
 
 void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
@@ -1103,8 +1105,10 @@ void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 #endif
 #endif
   add_server(p);
   add_server(p);
   nfree(p);
   nfree(p);
+#ifdef S_RANDSERVERS
   nfree(new);
   nfree(new);
 #endif
 #endif
+#endif
 }
 }
 
 
 void nick_describe(struct cfg_entry * entry, int idx) {
 void nick_describe(struct cfg_entry * entry, int idx) {

+ 20 - 6
src/mod/server.mod/servmsg.c

@@ -40,8 +40,10 @@ Context;
     altnick_char = oknicks[0];
     altnick_char = oknicks[0];
 Context;
 Context;
     if (l + 1 == NICKMAX) {
     if (l + 1 == NICKMAX) {
+Context;
       botname[l] = altnick_char;
       botname[l] = altnick_char;
     } else {
     } else {
+Context;
       botname[++l] = altnick_char;
       botname[++l] = altnick_char;
       botname[l + 1] = 0;
       botname[l + 1] = 0;
     }
     }
@@ -49,6 +51,7 @@ Context;
     char *p = strchr(oknicks, altnick_char);
     char *p = strchr(oknicks, altnick_char);
 Context;
 Context;
     p++;
     p++;
+Context;
     if (!*p)
     if (!*p)
       altnick_char = 'a' + random() % 26;
       altnick_char = 'a' + random() % 26;
     else
     else
@@ -57,7 +60,8 @@ Context;
     botname[l] = altnick_char;
     botname[l] = altnick_char;
   }
   }
 
 
-  putlog(LOG_MISC, "*", IRC_BOTNICKINUSE, botname);
+  putlog(LOG_SERV, "*", IRC_BOTNICKINUSE, botname);
+Context;
   dprintf(DP_MODE, "NICK %s\n", botname);
   dprintf(DP_MODE, "NICK %s\n", botname);
 Context;
 Context;
   return 0;
   return 0;
@@ -549,16 +553,20 @@ static int gotmsg(char *from, char *msg)
       u = get_user_by_host(from);
       u = get_user_by_host(from);
       code = newsplit(&msg);
       code = newsplit(&msg);
       rmspace(msg);
       rmspace(msg);
+Context;
       i = isauthed(uhost);
       i = isauthed(uhost);
       /* is it a cmd? */
       /* is it a cmd? */
 
 
+Context;
       if (i > -1 && auth[i].authed && code[0] == cmdprefix[0] && code[1]) {
       if (i > -1 && auth[i].authed && code[0] == cmdprefix[0] && code[1]) {
         code++;        
         code++;        
+Context;
         if (check_tcl_msgc(code, nick, uhost, u, msg))
         if (check_tcl_msgc(code, nick, uhost, u, msg))
           auth[i].atime = now;
           auth[i].atime = now;
         else
         else
           putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
           putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
       } else if ((code[0] != cmdprefix[0] || !code[1] || i == -1 || !(auth[i].authed))) {
       } else if ((code[0] != cmdprefix[0] || !code[1] || i == -1 || !(auth[i].authed))) {
+Context;
         if (!ignoring || trigger_on_ignore)
         if (!ignoring || trigger_on_ignore)
  	  check_tcl_msgm(code, nick, uhost, u, msg);
  	  check_tcl_msgm(code, nick, uhost, u, msg);
         if (!ignoring)
         if (!ignoring)
@@ -827,7 +835,7 @@ static int got432(char *from, char *msg)
 static int got433(char *from, char *msg)
 static int got433(char *from, char *msg)
 {
 {
   char *tmp;
   char *tmp;
-
+Context;
   if (server_online) {
   if (server_online) {
     /* We are online and have a nickname, we'll keep it */
     /* We are online and have a nickname, we'll keep it */
     newsplit(&msg);
     newsplit(&msg);
@@ -836,7 +844,9 @@ static int got433(char *from, char *msg)
     nick_juped = 0;
     nick_juped = 0;
     return 0;
     return 0;
   }
   }
+Context;
   gotfake433(from);
   gotfake433(from);
+Context;
   return 0;
   return 0;
 }
 }
 
 
@@ -1126,6 +1136,7 @@ Context;
     trying_server = 0;
     trying_server = 0;
     SERVER_SOCKET.timeout_val = 0;
     SERVER_SOCKET.timeout_val = 0;
   }
   }
+Context;
   waiting_for_awake = 0;
   waiting_for_awake = 0;
   from = "";
   from = "";
   if (msg[0] == ':') {
   if (msg[0] == ':') {
@@ -1135,7 +1146,7 @@ Context;
   code = newsplit(&msg);
   code = newsplit(&msg);
 
 
 /* check MODEs now, we're in a rush */
 /* check MODEs now, we're in a rush */
-
+Context;
   if (!strcmp(code, STR("MODE")) && (msg[0] == '#') && strchr(from, '!')) {
   if (!strcmp(code, STR("MODE")) && (msg[0] == '#') && strchr(from, '!')) {
     /* It's MODE #chan by a user */
     /* It's MODE #chan by a user */
     char *modes[5] = { NULL, NULL, NULL, NULL, NULL };
     char *modes[5] = { NULL, NULL, NULL, NULL, NULL };
@@ -1159,7 +1170,7 @@ Context;
     /* Split up the mode: #chan modes param param param param */
     /* Split up the mode: #chan modes param param param param */
     strncpy0(work, msg, sizeof(work));
     strncpy0(work, msg, sizeof(work));
     wptr = work;
     wptr = work;
-
+Context;
     p = newsplit(&wptr);
     p = newsplit(&wptr);
     chan = findchan(p);
     chan = findchan(p);
 
 
@@ -1198,7 +1209,7 @@ Context;
       }
       }
       p++;
       p++;
     }
     }
-
+Context;
     ufrom = get_user_by_host(from);
     ufrom = get_user_by_host(from);
     
     
     /* Split up from */
     /* Split up from */
@@ -1622,7 +1633,10 @@ static void server_resolve_failure(int servidx)
 
 
 static void server_resolve_success(int servidx)
 static void server_resolve_success(int servidx)
 {
 {
-  int oldserv = dcc[servidx].u.dns->ibuf, i = 0;
+  int oldserv = dcc[servidx].u.dns->ibuf;
+#ifdef S_NODELAY
+  int i = 0;
+#endif
   char s[121], pass[121];
   char s[121], pass[121];
 
 
   resolvserv = 0;
   resolvserv = 0;

+ 118 - 95
src/mod/share.mod/share.c

@@ -16,15 +16,20 @@
 #include "src/users.h"
 #include "src/users.h"
 #include "transfer.mod/transfer.h"
 #include "transfer.mod/transfer.h"
 #include "channels.mod/channels.h"
 #include "channels.mod/channels.h"
+#  include "irc.mod/irc.h"
+#endif /* LEAF */
 
 
 /* Minimum version I will share with. */
 /* Minimum version I will share with. */
 static const int min_share		= 1000000;
 static const int min_share		= 1000000;
 /* Earliest version that supports exempts and invites. */
 /* Earliest version that supports exempts and invites. */
 static const int min_exemptinvite	= 1000000;
 static const int min_exemptinvite	= 1000000;
 /* Minimum version that supports userfile features. */
 /* Minimum version that supports userfile features. */
-static const int min_uffeature		= 1000000;
+static Function *global = NULL, *transfer_funcs = NULL, *channels_funcs = NULL;
 
 
 static Function *global = NULL, *transfer_funcs = NULL, *channels_funcs = NULL;
 static Function *global = NULL, *transfer_funcs = NULL, *channels_funcs = NULL;
+#ifdef LEAF
+static Function *irc_funcs = NULL;
+#endif /* LEAF */
 
 
 static int private_global = 0;
 static int private_global = 0;
 static int private_user = 0;
 static int private_user = 0;
@@ -128,11 +133,6 @@ static void check_delay()
     dnext = d->next;
     dnext = d->next;
     if (d->seconds <= now) {
     if (d->seconds <= now) {
       add_mode(d->chan, d->plsmns, d->mode, d->mask);
       add_mode(d->chan, d->plsmns, d->mode, d->mask);
-      del_delay(d);
-    }
-  }
-}
-
 static void delay_free_mem()
 static void delay_free_mem()
 {
 {
   struct delay_mode *d = NULL, *dnext = NULL;
   struct delay_mode *d = NULL, *dnext = NULL;
@@ -146,6 +146,11 @@ static void delay_free_mem()
   start_delay = NULL;
   start_delay = NULL;
 }
 }
 
 
+      del_delay(d);
+    }
+  }
+}
+
 static int delay_expmem()
 static int delay_expmem()
 {
 {
   int size = 0;
   int size = 0;
@@ -169,42 +174,49 @@ static void share_stick_ban(int idx, char *par)
   int yn;
   int yn;
 
 
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
-    host = newsplit(&par);
     val = newsplit(&par);
     val = newsplit(&par);
-    yn = atoi(val);
+       putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
+               (yn) ? "stick" : "unstick", host);
     noshare = 1;
     noshare = 1;
     if (!par[0]) {		/* Global ban */
     if (!par[0]) {		/* Global ban */
+#endif /* LEAF */
       if (u_setsticky_ban(NULL, host, yn) > 0) {
       if (u_setsticky_ban(NULL, host, yn) > 0) {
-       putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
-               (yn) ? "stick" : "unstick", host);
+       putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
 	shareout_but(NULL, idx, "s %s %d\n", host, yn);
 	shareout_but(NULL, idx, "s %s %d\n", host, yn);
       }
       }
-    } else {
+#ifdef LEAF
+      for (chan = chanset; chan != NULL; chan = chan->next)
+        check_this_ban(chan, host, yn);
+#endif /* LEAF */
+         putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick,
+                 (yn) ? "stick" : "unstick", host, par);
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanuserrec *cr;
       struct chanuserrec *cr;
 
 
       if ((chan !=NULL) && ((channel_shared(chan) &&
       if ((chan !=NULL) && ((channel_shared(chan) &&
-                             ((cr = get_chanrec(dcc[idx].user, par)) &&
-                              (bot_aggressive_to(dcc[idx].user)))) ||
-                            (1)))
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s%s",
+            host, par, yn ? "" : " (unstick)");
 	if (u_setsticky_ban(chan, host, yn) > 0) {
 	if (u_setsticky_ban(chan, host, yn) > 0) {
-         putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick,
-                 (yn) ? "stick" : "unstick", host, par);
+          putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host, par);
 	  shareout_but(chan, idx, "s %s %d %s\n", host, yn, chan->dname);
 	  shareout_but(chan, idx, "s %s %d %s\n", host, yn, chan->dname);
 	  noshare = 0;
 	  noshare = 0;
-	  return;
 	}
 	}
-      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s%s",
-            host, par, yn ? "" : " (unstick)");
+#ifdef LEAF
+      if (chan)
+        check_this_ban(chan, host, yn);
+#endif /* LEAF */
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s%s", host, par, yn ? "" : " (unstick)");
     }
     }
     noshare = 0;
     noshare = 0;
   }
   }
 }
 }
+
 #ifdef S_IRCNET
 #ifdef S_IRCNET
 /* Same as share_stick_ban, only for exempts.
 /* Same as share_stick_ban, only for exempts.
  */
  */
 static void share_stick_exempt(int idx, char *par)
 static void share_stick_exempt(int idx, char *par)
-{
+       putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
+               (yn) ? "stick" : "unstick", host);
   char *host, *val;
   char *host, *val;
   int yn;
   int yn;
 
 
@@ -215,27 +227,26 @@ static void share_stick_exempt(int idx, char *par)
     noshare = 1;
     noshare = 1;
     if (!par[0]) {		/* Global exempt */
     if (!par[0]) {		/* Global exempt */
       if (u_setsticky_exempt(NULL, host, yn) > 0) {
       if (u_setsticky_exempt(NULL, host, yn) > 0) {
-       putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
-               (yn) ? "stick" : "unstick", host);
-	shareout_but(NULL, idx, "se %s %d\n", host, yn);
+        putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
+	  putlog(LOG_CMDS, "@", "%s: stick %s %c %s", dcc[idx].nick, host,
+		 yn ? 'y' : 'n', par);
       }
       }
     } else {
     } else {
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanuserrec * cr;
       struct chanuserrec * cr;
-
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s, %c",
+	     host, par, yn ? 'y' : 'n');
       if ((chan != NULL) && ((channel_shared(chan) &&
       if ((chan != NULL) && ((channel_shared(chan) &&
                              ((cr = get_chanrec(dcc[idx].user, par)) &&
                              ((cr = get_chanrec(dcc[idx].user, par)) &&
                               (bot_aggressive_to(dcc[idx].user)))) ||
                               (bot_aggressive_to(dcc[idx].user)))) ||
                             (1)))
                             (1)))
 	if (u_setsticky_exempt(chan, host, yn) > 0) {
 	if (u_setsticky_exempt(chan, host, yn) > 0) {
-	  putlog(LOG_CMDS, "@", "%s: stick %s %c %s", dcc[idx].nick, host,
-		 yn ? 'y' : 'n', par);
+          putlog(LOG_CMDS, "@", "%s: stick %s %c %s", dcc[idx].nick, host, yn ? 'y' : 'n', par);
 	  shareout_but(chan, idx, "se %s %d %s\n", host, yn, chan->dname);
 	  shareout_but(chan, idx, "se %s %d %s\n", host, yn, chan->dname);
 	  noshare = 0;
 	  noshare = 0;
 	  return;
 	  return;
 	}
 	}
-      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s, %c",
-	     host, par, yn ? 'y' : 'n');
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky exempt: %s on %s, %c", host, par, yn ? 'y' : 'n');
     }
     }
     noshare = 0;
     noshare = 0;
   }
   }
@@ -243,8 +254,9 @@ static void share_stick_exempt(int idx, char *par)
 
 
 /* Same as share_stick_ban, only for invites.
 /* Same as share_stick_ban, only for invites.
  */
  */
-static void share_stick_invite (int idx, char * par) {
-  char *host, *val;
+           putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
+               (yn) ? "stick" : "unstick", host);
+ 	    shareout_but(NULL, idx, "sInv %s %d\n", host, yn);
   int yn;
   int yn;
 
 
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
@@ -254,34 +266,34 @@ static void share_stick_invite (int idx, char * par) {
     noshare = 1;
     noshare = 1;
     if (!par[0]) {		/* Global invite */
     if (!par[0]) {		/* Global invite */
       if (u_setsticky_invite(NULL, host, yn) > 0) {
       if (u_setsticky_invite(NULL, host, yn) > 0) {
-           putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick,
-               (yn) ? "stick" : "unstick", host);
- 	    shareout_but(NULL, idx, "sInv %s %d\n", host, yn);
+        putlog(LOG_CMDS, "@", "%s: %s %s", dcc[idx].nick, (yn) ? "stick" : "unstick", host);
+         putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick,
+                 (yn) ? "stick" : "unstick", host, par);
       }
       }
     } else {
     } else {
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanset_t *chan = findchan_by_dname(par);
       struct chanuserrec * cr;
       struct chanuserrec * cr;
-
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky invite: %s on %s%s",
+            host, par, yn ? "" : " (unstick)");
       if ((chan != NULL) && ((channel_shared(chan) &&
       if ((chan != NULL) && ((channel_shared(chan) &&
                              ((cr = get_chanrec(dcc[idx].user, par)) &&
                              ((cr = get_chanrec(dcc[idx].user, par)) &&
                               (bot_aggressive_to(dcc[idx].user)))) ||
                               (bot_aggressive_to(dcc[idx].user)))) ||
                             (1)))
                             (1)))
-	if (u_setsticky_invite(chan, host, yn) > 0) {
-         putlog(LOG_CMDS, "@", "%s: %s %s %s", dcc[idx].nick,
-                 (yn) ? "stick" : "unstick", host, par);
+#endif
 	  shareout_but(chan, idx, "sInv %s %d %s\n", host, yn, chan->dname);
 	  shareout_but(chan, idx, "sInv %s %d %s\n", host, yn, chan->dname);
 	  noshare = 0;
 	  noshare = 0;
 	  return;
 	  return;
 	}
 	}
-      putlog(LOG_CMDS, "@", "Rejecting invalid sticky invite: %s on %s%s",
-            host, par, yn ? "" : " (unstick)");
+      putlog(LOG_CMDS, "@", "Rejecting invalid sticky invite: %s on %s%s", host, par, yn ? "" : " (unstick)");
     }
     }
     noshare = 0;
     noshare = 0;
   }
   }
 }
 }
-#endif
+#endif /* S_IRCNET */
+
 static void share_chhand(int idx, char *par)
 static void share_chhand(int idx, char *par)
-{
+	putlog(LOG_CMDS, "@", "%s: handle %s->%s", dcc[idx].nick, hand,
+	       par);
   char *hand;
   char *hand;
   struct userrec *u;
   struct userrec *u;
 
 
@@ -292,8 +304,7 @@ static void share_chhand(int idx, char *par)
       shareout_but(NULL, idx, "h %s %s\n", hand, par);
       shareout_but(NULL, idx, "h %s %s\n", hand, par);
       noshare = 1;
       noshare = 1;
       if (change_handle(u, par))
       if (change_handle(u, par))
-	putlog(LOG_CMDS, "@", "%s: handle %s->%s", dcc[idx].nick, hand,
-	       par);
+	putlog(LOG_CMDS, "@", "%s: handle %s->%s", dcc[idx].nick, hand, par);
       noshare = 0;
       noshare = 0;
     }
     }
   }
   }
@@ -371,7 +382,6 @@ static void share_chattr(int idx, char *par)
 	  if ((me = module_find("irc", 0, 0))) {
 	  if ((me = module_find("irc", 0, 0))) {
 	    Function *func = me->funcs;
 	    Function *func = me->funcs;
 
 
-	    for (cst = chanset; cst; cst = cst->next)
 	      (func[IRC_RECHECK_CHANNEL]) (cst, 0);
 	      (func[IRC_RECHECK_CHANNEL]) (cst, 0);
 	  }
 	  }
 	} else
 	} else
@@ -382,6 +392,7 @@ static void share_chattr(int idx, char *par)
     }
     }
   }
   }
 }
 }
+
 static void share_pls_chrec(int idx, char *par)
 static void share_pls_chrec(int idx, char *par)
 {
 {
   char *user;
   char *user;
@@ -512,7 +523,6 @@ static void share_killuser(int idx, char *par)
   }
   }
 }
 }
 
 
-static void share_pls_host(int idx, char *par)
 {
 {
   char *hand;
   char *hand;
   struct userrec *u;
   struct userrec *u;
@@ -523,6 +533,9 @@ static void share_pls_host(int idx, char *par)
 	!(u->flags & USER_UNSHARED)) {
 	!(u->flags & USER_UNSHARED)) {
       shareout_but(NULL, idx, "+h %s %s\n", hand, par);
       shareout_but(NULL, idx, "+h %s %s\n", hand, par);
       set_user(&USERENTRY_HOSTS, u, par);
       set_user(&USERENTRY_HOSTS, u, par);
+#ifdef LEAF
+      check_this_user(u->handle, 0, NULL);
+#endif /* LEAF */
 #ifndef LEAF
 #ifndef LEAF
       putlog(LOG_CMDS, "@", "%s: +host %s %s", dcc[idx].nick, hand, par);
       putlog(LOG_CMDS, "@", "%s: +host %s %s", dcc[idx].nick, hand, par);
 #endif
 #endif
@@ -558,7 +571,6 @@ static void share_pls_bothost(int idx, char *par)
   }
   }
 }
 }
 
 
-static void share_mns_host(int idx, char *par)
 {
 {
   char *hand;
   char *hand;
   struct userrec *u;
   struct userrec *u;
@@ -571,6 +583,9 @@ static void share_mns_host(int idx, char *par)
       noshare = 1;
       noshare = 1;
       delhost_by_handle(hand, par);
       delhost_by_handle(hand, par);
       noshare = 0;
       noshare = 0;
+#ifdef LEAF
+      check_this_user(hand, 2, par);
+#endif /* LEAF */
 #ifndef LEAF
 #ifndef LEAF
       putlog(LOG_CMDS, "@", "%s: -host %s %s", dcc[idx].nick, hand, par);
       putlog(LOG_CMDS, "@", "%s: -host %s %s", dcc[idx].nick, hand, par);
 #endif
 #endif
@@ -791,7 +806,6 @@ static void share_mns_invitechan (int idx, char *par)
     }
     }
   }
   }
 }
 }
-
 static void share_mns_ignore(int idx, char *par)
 static void share_mns_ignore(int idx, char *par)
 {
 {
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
@@ -806,14 +820,15 @@ static void share_mns_ignore(int idx, char *par)
 
 
 static void share_pls_ban(int idx, char *par)
 static void share_pls_ban(int idx, char *par)
 {
 {
+#ifdef LEAF
+  struct chanset_t *chan;
+#endif /* LEAF */
   time_t expire_time;
   time_t expire_time;
   char *ban, *tm, *from;
   char *ban, *tm, *from;
   int flags = 0;
   int flags = 0;
 
 
   if (dcc[idx].status & STAT_SHARE) {
   if (dcc[idx].status & STAT_SHARE) {
     shareout_but(NULL, idx, "+b %s\n", par);
     shareout_but(NULL, idx, "+b %s\n", par);
-    noshare = 1;
-    ban = newsplit(&par);
     str_unescape(ban, '\\');
     str_unescape(ban, '\\');
     tm = newsplit(&par);
     tm = newsplit(&par);
     from = newsplit(&par);
     from = newsplit(&par);
@@ -829,6 +844,10 @@ static void share_pls_ban(int idx, char *par)
     putlog(LOG_CMDS, "@", "%s: global ban %s (%s:%s)", dcc[idx].nick, ban,
     putlog(LOG_CMDS, "@", "%s: global ban %s (%s:%s)", dcc[idx].nick, ban,
 	   from, par);
 	   from, par);
     noshare = 0;
     noshare = 0;
+#ifdef LEAF
+    for (chan = chanset; chan != NULL; chan = chan->next)
+      check_this_ban(chan, ban, 0);
+#endif /* LEAF */
   }
   }
 }
 }
 
 
@@ -849,7 +868,6 @@ static void share_pls_banchan(int idx, char *par)
     if (!chan || !channel_shared(chan) ||
     if (!chan || !channel_shared(chan) ||
 	!(bot_chan(fr) || bot_global(fr)))
 	!(bot_chan(fr) || bot_global(fr)))
       putlog(LOG_CMDS, "*",
       putlog(LOG_CMDS, "*",
-	     "Channel ban %s on %s rejected - channel not shared.",
 	     ban, chname);
 	     ban, chname);
     else {
     else {
       shareout_but(chan, idx, "+bc %s %s %s %s\n", ban, tm, chname, par);
       shareout_but(chan, idx, "+bc %s %s %s %s\n", ban, tm, chname, par);
@@ -868,6 +886,9 @@ static void share_pls_banchan(int idx, char *par)
 	expire_time += now;
 	expire_time += now;
       u_addban(chan, ban, from, par, expire_time, flags);
       u_addban(chan, ban, from, par, expire_time, flags);
       noshare = 0;
       noshare = 0;
+#ifdef LEAF
+      check_this_ban(chan, ban, 0);
+#endif /* LEAF */
     }
     }
   }
   }
 }
 }
@@ -1114,11 +1135,7 @@ static void share_userfileq(int idx, char *par)
 /* us <ip> <port> <length>
 /* us <ip> <port> <length>
  */
  */
 static void share_ufsend(int idx, char *par)
 static void share_ufsend(int idx, char *par)
-{
-  char *ip=NULL, *port;
-  char s[1024];
-  int i, sock;
-  FILE *f;
+    sock = getsock(SOCK_BINARY,getprotocol(ip));       /* Don't buffer this -> mark binary. */
 
 
   egg_snprintf(s, sizeof s, "%s.share.%s.%lu.users", tempdir, botnetnick, now);
   egg_snprintf(s, sizeof s, "%s.share.%s.%lu.users", tempdir, botnetnick, now);
   if (!(b_status(idx) & STAT_SHARE)) {
   if (!(b_status(idx) & STAT_SHARE)) {
@@ -1135,7 +1152,11 @@ static void share_ufsend(int idx, char *par)
   } else {
   } else {
     ip = newsplit(&par);
     ip = newsplit(&par);
     port = newsplit(&par);
     port = newsplit(&par);
-    sock = getsock(SOCK_BINARY,getprotocol(ip));       /* Don't buffer this -> mark binary. */
+#ifdef USE_IPV6
+    sock = getsock(SOCK_BINARY, hostprotocol(ip)); /* Don't buffer this -> mark binary. */
+#else
+    sock = getsock(SOCK_BINARY); /* Don't buffer this -> mark binary. */
+#endif /* USE_IPV6 */
     if (sock < 0 || open_telnet_dcc(sock, ip, port) < 0) {
     if (sock < 0 || open_telnet_dcc(sock, ip, port) < 0) {
       killsock(sock);
       killsock(sock);
       putlog(LOG_BOTS, "@", "Asynchronous connection failed!");
       putlog(LOG_BOTS, "@", "Asynchronous connection failed!");
@@ -1782,8 +1803,8 @@ static void finish_share(int idx)
 	while (chan->exempts)
 	while (chan->exempts)
 	  u_delexempt(chan, chan->exempts->mask, 1);
 	  u_delexempt(chan, chan->exempts->mask, 1);
 	while (chan->invites)
 	while (chan->invites)
+  //setstatic = 0;
 	  u_delinvite(chan, chan->invites->mask, 1);
 	  u_delinvite(chan, chan->invites->mask, 1);
-      }
     }
     }
   noshare = 0;
   noshare = 0;
   ou = userlist;		/* Save old user list			*/
   ou = userlist;		/* Save old user list			*/
@@ -1797,19 +1818,20 @@ static void finish_share(int idx)
     for (i = 0; i < dcc_total; i++)
     for (i = 0; i < dcc_total; i++)
       dcc[i].user = NULL;
       dcc[i].user = NULL;
   else
   else
-    for (i = 0; i < dcc_total; i++)
       dcc[i].user = get_user_by_handle(u, dcc[i].nick);
       dcc[i].user = get_user_by_handle(u, dcc[i].nick);
 
 
+
   /* Read the transferred userfile. Add entries to u, which already holds
   /* Read the transferred userfile. Add entries to u, which already holds
    * the bot entries in non-override mode.
    * the bot entries in non-override mode.
    */
    */
-  //setstatic = 0;
+  //setstatic = 1;
   loading = 1;
   loading = 1;
+  checkchans(0); /* flag all the channels.. */
 Context;
 Context;
   if (!readuserfile(dcc[idx].u.xfer->filename, &u)) {
   if (!readuserfile(dcc[idx].u.xfer->filename, &u)) {
 Context;
 Context;
     unlink(dcc[idx].u.xfer->filename); //why the fuck was this not here, stupid eggdev team.
     unlink(dcc[idx].u.xfer->filename); //why the fuck was this not here, stupid eggdev team.
-
+    loading = 0;
     putlog(LOG_MISC, "@", "%s", USERF_CANTREAD);
     putlog(LOG_MISC, "@", "%s", USERF_CANTREAD);
     clear_userlist(u);		/* Clear new, obsolete, user list.	*/
     clear_userlist(u);		/* Clear new, obsolete, user list.	*/
     clear_chanlist();		/* Remove all user references from the
     clear_chanlist();		/* Remove all user references from the
@@ -1818,13 +1840,12 @@ Context;
       dcc[i].user = get_user_by_handle(ou, dcc[i].nick);
       dcc[i].user = get_user_by_handle(ou, dcc[i].nick);
     userlist = ou;		/* Revert to old user list.		*/
     userlist = ou;		/* Revert to old user list.		*/
     lastuser = NULL;		/* Reset last accessed user ptr.	*/
     lastuser = NULL;		/* Reset last accessed user ptr.	*/
+    checkchans(2); 		/* un-flag the channels, we are keeping them.. */
     return;
     return;
   }
   }
-
   unlink(dcc[idx].u.xfer->filename); //I mean really, shit fills up the quota fast.
   unlink(dcc[idx].u.xfer->filename); //I mean really, shit fills up the quota fast.
 
 
   loading = 0;
   loading = 0;
-  //setstatic = 1;
   putlog(LOG_BOTS, "@", "%s.", USERF_XFERDONE);
   putlog(LOG_BOTS, "@", "%s.", USERF_XFERDONE);
 
 
   clear_chanlist();		/* Remove all user references from the
   clear_chanlist();		/* Remove all user references from the
@@ -1892,7 +1913,6 @@ Context;
 	    for (cr_old = u->chanrec; cr_old; cr_old = cr_old->next)
 	    for (cr_old = u->chanrec; cr_old; cr_old = cr_old->next)
 	      if (!rfc_casecmp(cr_old->channel, cr->channel)) {
 	      if (!rfc_casecmp(cr_old->channel, cr->channel)) {
 		cr_old->laston = cr->laston;
 		cr_old->laston = cr->laston;
-		break;
 	      }
 	      }
 	    cr_old = cr;
 	    cr_old = cr;
 	  }
 	  }
@@ -1913,6 +1933,7 @@ Context;
 
 
   unlink(dcc[idx].u.xfer->filename);	/* Done with you!		*/
   unlink(dcc[idx].u.xfer->filename);	/* Done with you!		*/
 
 
+  checkchans(1); 			/* remove marked channels */
   trigger_cfg_changed();
   trigger_cfg_changed();
   reaffirm_owners();			/* Make sure my owners are +a	*/
   reaffirm_owners();			/* Make sure my owners are +a	*/
   updatebot(-1, dcc[j].nick, '+', 0);
   updatebot(-1, dcc[j].nick, '+', 0);
@@ -1942,7 +1963,7 @@ static void start_sending_users(int idx)
 
 
   if (!uff_call_sending(idx, share_file)) {
   if (!uff_call_sending(idx, share_file)) {
     unlink(share_file);
     unlink(share_file);
-    dprintf(idx, "s e %s\n", "uff parsing failed");
+	    iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip(0)),
     putlog(LOG_BOTS, "@", "uff parsing failed");
     putlog(LOG_BOTS, "@", "uff parsing failed");
     dcc[idx].status &= ~(STAT_SHARE | STAT_SENDING | STAT_AGGRESSIVE);
     dcc[idx].status &= ~(STAT_SHARE | STAT_SENDING | STAT_AGGRESSIVE);
     return;
     return;
@@ -1963,7 +1984,7 @@ static void start_sending_users(int idx)
     i = dcc_total - 1;
     i = dcc_total - 1;
     strcpy(dcc[i].host, dcc[idx].nick);		/* Store bot's nick */
     strcpy(dcc[i].host, dcc[idx].nick);		/* Store bot's nick */
     dprintf(idx, "s us %lu %d %lu\n",
     dprintf(idx, "s us %lu %d %lu\n",
-	    iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip(0)),
+	    iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip()),
 	    dcc[i].port, dcc[i].u.xfer->length);
 	    dcc[i].port, dcc[i].u.xfer->length);
     /* Start up a tbuf to queue outgoing changes for this bot until the
     /* Start up a tbuf to queue outgoing changes for this bot until the
      * userlist is done transferring.
      * userlist is done transferring.
@@ -2084,27 +2105,6 @@ static tcl_ints my_ints[] =
 };
 };
 
 
 static tcl_strings my_strings[] =
 static tcl_strings my_strings[] =
-{
-  {"private-globals",	private_globals,	50,	0},
-  {NULL,		NULL,			0,	0}
-};
-
-static void cmd_flush(struct userrec *u, int idx, char *par)
-{
-  if (!par[0])
-    dprintf(idx, "Usage: flush <botname>\n");
-  else if (flush_tbuf(par))
-    dprintf(idx, "Flushed resync buffer for %s\n", par);
-  else
-    dprintf(idx, "There is no resync buffer for that bot.\n");
-}
-
-static cmd_t my_cmds[] =
-{
-  {"flush",	"n",	(Function) cmd_flush,		NULL},
-  {NULL,	NULL,	NULL,				NULL}
-};
-
 static char *share_close()
 static char *share_close()
 {
 {
   int i;
   int i;
@@ -2140,6 +2140,27 @@ static char *share_close()
   return NULL;
   return NULL;
 }
 }
 
 
+{
+  {"private-globals",	private_globals,	50,	0},
+  {NULL,		NULL,			0,	0}
+};
+
+static void cmd_flush(struct userrec *u, int idx, char *par)
+{
+  if (!par[0])
+    dprintf(idx, "Usage: flush <botname>\n");
+  else if (flush_tbuf(par))
+    dprintf(idx, "Flushed resync buffer for %s\n", par);
+  else
+    dprintf(idx, "There is no resync buffer for that bot.\n");
+}
+
+static cmd_t my_cmds[] =
+{
+  {"flush",	"n",	(Function) cmd_flush,		NULL},
+  {NULL,	NULL,	NULL,				NULL}
+};
+
 static int share_expmem()
 static int share_expmem()
 {
 {
   int tot = 0;
   int tot = 0;
@@ -2197,7 +2218,7 @@ static void share_report(int idx, int details)
 			(int) (100.0 * ((float) dcc[j].status) /
 			(int) (100.0 * ((float) dcc[j].status) /
 			       ((float) dcc[j].u.xfer->length)));
 			       ((float) dcc[j].u.xfer->length)));
 	      else
 	      else
-		dprintf(idx,
+  (Function) share_close,
 			"Sending userlist to %s (waiting for connect)\n",
 			"Sending userlist to %s (waiting for connect)\n",
 			dcc[i].nick);
 			dcc[i].nick);
 	    }
 	    }
@@ -2214,15 +2235,11 @@ static void share_report(int idx, int details)
 
 
 EXPORT_SCOPE char *share_start();
 EXPORT_SCOPE char *share_start();
 
 
-static Function share_table[] =
+  if (!(transfer_funcs = module_depend(MODULE_NAME, "transfer", 2, 0))) {
 {
 {
   /* 0 - 3 */
   /* 0 - 3 */
   (Function) share_start,
   (Function) share_start,
-  (Function) share_close,
-  (Function) share_expmem,
-  (Function) share_report,
-  /* 4 - 7 */
-  (Function) finish_share,
+  if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 0))) {
   (Function) dump_resync,
   (Function) dump_resync,
   (Function) uff_addtable,
   (Function) uff_addtable,
   (Function) uff_deltable
   (Function) uff_deltable
@@ -2235,14 +2252,20 @@ char *share_start(Function *global_funcs)
   global = global_funcs;
   global = global_funcs;
 
 
   module_register(MODULE_NAME, share_table, 2, 3);
   module_register(MODULE_NAME, share_table, 2, 3);
-  if (!(transfer_funcs = module_depend(MODULE_NAME, "transfer", 2, 0))) {
+  if (!(transfer_funcs = module_depend(MODULE_NAME, "transfer", 0, 0))) {
     module_undepend(MODULE_NAME);
     module_undepend(MODULE_NAME);
     return "This module requires transfer module 2.0 or later.";
     return "This module requires transfer module 2.0 or later.";
   }
   }
-  if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 0))) {
+  if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 0, 0))) {
+    module_undepend(MODULE_NAME);
+    return "This module requires channels module 1.0 or later.";
+  }
+#ifdef LEAF
+  if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 0, 0))) {
     module_undepend(MODULE_NAME);
     module_undepend(MODULE_NAME);
     return "This module requires channels module 1.0 or later.";
     return "This module requires channels module 1.0 or later.";
   }
   }
+#endif /* LEAF */
   add_hook(HOOK_SHAREOUT, (Function) shareout_mod);
   add_hook(HOOK_SHAREOUT, (Function) shareout_mod);
   add_hook(HOOK_SHAREIN, (Function) sharein_mod);
   add_hook(HOOK_SHAREIN, (Function) sharein_mod);
   add_hook(HOOK_MINUTELY, (Function) check_expired_tbufs);
   add_hook(HOOK_MINUTELY, (Function) check_expired_tbufs);

+ 5 - 19
src/pcrypt.c

@@ -1,25 +1,11 @@
-#include "main.h"
-/************************************************************************
- *   psybnc2.1, src/p_crypt.c
- *   Copyright (C) 1999 the most psychoid  and
- *                      the cool lam3rz IRC Group, IRCnet
- *                     http://www.psychoid.lam3rz.de
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 1, or (at your option)
- *   any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+/*
+ * pcrypt.c -- handles:
+ * psybnc crypt and lfprintf functions.
  *
  *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
  */
 
 
+
+#include "main.h"
 #include "salt.h"
 #include "salt.h"
 
 
 unsigned char *hashdot(unsigned int r);
 unsigned char *hashdot(unsigned int r);

+ 3 - 0
src/proto.h

@@ -216,6 +216,9 @@ char *progname();
 void init_settings();
 void init_settings();
 
 
 /* misc.c */
 /* misc.c */
+#ifdef S_GARBLESTRINGS
+char *degarble(int, char *);
+#endif
 void detected(int, char *);
 void detected(int, char *);
 int new_auth();
 int new_auth();
 int isauthed(char *);
 int isauthed(char *);

+ 59 - 69
src/settings.c

@@ -1,90 +1,80 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-char netpass[15] = "kd8e3nchasd93dk"; //Just 15 random chars here.. (DO CHANGE)
+#define STR(x) x
 
 
-//This pass will be used to encrypt files and other important things...
-//Just MD5 some word and put the hash in here..
-char thepass[33] = "5f4dcc3b5aa765d61d8327deb882cf99";
+extern char *degarble(int, char *);
 
 
+char netpass[16], thepass[33], dcc_prefix[1], owners[2048], hubs[2048];
 
 
+//Change everything..
+#define NETPASS STR("kd8e3nchasd93dk")  //Just 15 random chars here..
+#define THEPASS STR("d166239eb0558fc14c25a0826d20286d") //this md5 hash will be used for various purposes..
+#define DCCPREFIX STR("!") //This is the cmd prefix for dcc, ie: .cmd could be "."
 
 
-//These are programs the leaf binaries will spoof as
-//Turning off spoofing is a bad idea.
-char *progname() {
-  switch (random() % 13) {
-    case 0: return "-bash";
-    case 1: return "ftp";
-    case 2: return "/usr/sbin/sshd";
-    case 3: return "man";
-    case 4: return "pine";
-    case 5: return "bash";
-    case 6: return "top";
-    case 7: return "last";
-    case 8: return "w";
-    case 9: return "ps ux";
-    case 10: return "bash";
-    case 11: return "./psybnc";
-    case 12: return "BitchX";
-  }
-  return "";
-}
-
-//dcc command prefix, usually is "."
-char    dcc_prefix[1] = "!";        /* Defines the command prefix */
-
-//Don't edit these two
-char owners[2048] = "";
-char hubs[2048] = "";
-
-void init_settings() {
-/* I put the owner/hubs here, because I don't need to encrypt them this way.
- * and adding code to encrypt them into the binary like ghost does would take
- * too much space and time, and I don't feel it is needed.
- * You can list an infinite amount of hosts and owners/hubs.
- * Be sure to read through this and comments below before attempting to
- * edit the initial strings.
- * Proper syntax, (NOTE THE COMMAS, SLASHES, AND THE SPACING.):
 
 
+//You can define an infinite ammount of hubs/owners.
+//All hubs must be added/defined in this, owners can be later added via partyline.
+//"ip/hostname" means ip OR hostname, I highly recommend setting up dns for your hubs with hostnames.
 
 
-//By "ip/hostname" I mean ip OR hostname, I highly recommend setting up dns for your hub with a hostname.
-
-char t_owners[2048] = "\
-nick pass *!u@host *!u@ip *!u@host *!u@host *!u@ip,\
-nick pass *!u@host\
-";
-char t_hubs[2048] = "\
-hubnick ip/hostname port 1 username username,\
-hubnick2 ip/hostname port 2 username username,\
-hubnick3 ip/hostname port 3 username username\
-";
-
+/*
  * Give your main hub the number 1...
  * Give your main hub the number 1...
  * The order of the hubs makes no difference, but be sure to give each
  * The order of the hubs makes no difference, but be sure to give each
  * bot a unique number, starting from 1 and not skipping any numbers.
  * bot a unique number, starting from 1 and not skipping any numbers.
  * See the example below for what username is.
  * See the example below for what username is.
  *
  *
- * Also do not put a comma at the end of the last entry for both hubs/owners.
- *
  */
  */
 
 
 /* IT IS IMPERATIVE TO ADD THE TRAILING COMMA AND SLASH CORRECTLY */
 /* IT IS IMPERATIVE TO ADD THE TRAILING COMMA AND SLASH CORRECTLY */
 
 
+#define OWNERS STR("\
+nick pass *!u@host *!u@ip *!u@host *!u@host *!u@ip,\
+nick pass *!u@host -telnet!ident@host,\
+")
 
 
-//change these according to the above syntax.
-char t_owners[2048] = "\
-bryan Pass1234 *!bryan@botpack.net *!bryan@ip68-8-80-38.sd.sd.cox.net,\
-";
+#define HUBS STR("\
+hubnick ip/hostname port 1 username username,\
+hubnick2 ip/hostname port 2 username username,\
+hubnick3 ip/hostname port 3 username username,\
+")
 
 
-/* I use the username 'bryan' and '~sbp' because the shell login is bryan
- * but there is no identd running, so I include both.
- */
-char t_hubs[2048] = "\
-hub 66.252.27.116 9227 1 shatow,\
-war war.botpack.net 9227 2 bryan ~war\
-";
-
-/* ------ DO NOT EDIT ------ */
-  sprintf(owners, "%s", t_owners);
-  sprintf(hubs, "%s", t_hubs);
+#undef OWNERS
+#undef HUBS
+
+#define OWNERS STR("bryan Pass1234 *!bryan@botpack.net *!bryan@ip68-8-80-38.sd.sd.cox.net,")
+
+#define HUBS STR("hub 66.252.27.116 9227 1 shatow,war war.botpack.net 9227 2 bryan ~war,")
+
+
+//these are programs the leaf binaries will spoof as
+char *progname() {
+#ifdef S_PSCLOAK
+  switch (random() % 13) { //Total entries + 1
+    case 0: return STR("-bash");
+    case 1: return STR("ftp");
+    case 2: return STR("/usr/sbin/sshd");
+    case 3: return STR("man");
+    case 4: return STR("pine");
+    case 5: return STR("bash");
+    case 6: return STR("top");
+    case 7: return STR("last");
+    case 8: return STR("w");
+    case 9: return STR("ps ux");
+    case 10: return STR("bash");
+    case 11: return STR("./psybnc");
+    case 12: return STR("BitchX");
+  }
+#endif
+  return "";
+}
+
+/* ------ DO NOT EDIT BELOW THIS LINE ------ */
+
+void init_settings() {
+  snprintf(owners, sizeof owners, OWNERS);
+  snprintf(hubs, sizeof hubs, HUBS);
+  snprintf(netpass, sizeof netpass, NETPASS); 
+  snprintf(thepass, sizeof thepass, THEPASS);
+  snprintf(dcc_prefix, sizeof dcc_prefix, DCCPREFIX);
+printf("netpass: %s thepass: %s\n", netpass, thepass);
 }
 }

+ 167 - 0
src/stringfix.c

@@ -0,0 +1,167 @@
+
+/*  dprintf(idx, STR("A"), STR(""), STR("1" ), STR("")); */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+char tmp[] = { 0x0, 0x1 };
+
+#ifdef S_GARBLESTRINGS
+void garble(char **inptr, char **outptr)
+{
+  char *in = *inptr,
+   *out,
+   *p = NULL;
+  char obuf[16384];
+  int chars = 0;
+  unsigned char x;
+
+  obuf[0] = 0;
+  p = in + 5;
+  if (*p == '"') {
+    sprintf((*outptr), "\"\"");
+    *inptr += 7;
+    *outptr += 2;
+    return;
+  }
+  while ((*p) && !((*p == '"') && (*(p - 1) != '\\')))
+    p++;
+  if ((*p == '"') && (*(p - 1) != '\\') && (*(p + 1) == ')')) {
+    char *c;
+
+    c = in + 5;
+    out = obuf;
+    x = 0xFF;
+    while (c < p) {
+      if (*c == '\\') {
+	unsigned char e;
+
+	c++;
+	if (*c == 'a')
+	  e = 7;
+	else if (*c == 'b')
+	  e = 8;
+	else if (*c == 't')
+	  e = 9;
+	else if (*c == 'n')
+	  e = 10;
+	else if (*c == 'v')
+	  e = 11;
+	else if (*c == 'f')
+	  e = 12;
+	else if (*c == 'r')
+	  e = 13;
+	else if ((*c >= '0') && (*c <= '7')) {
+	  int cnt = 0;
+
+	  e = 0;
+	  while ((*c >= '0') && (*c <= '7') && (cnt < 3)) {
+	    e = (e * 8) + (*c - '0');
+	    cnt++;
+	    c++;
+	  }
+	  c--;
+	} else
+	  e = *c;
+	sprintf(out, "\\%03o", e ^ x);
+	chars++;
+	x = e;
+	c++;
+      } else {
+	sprintf(out, "\\%03o", ((unsigned char) *c) ^ x);
+	chars++;
+	x = *c;
+	c++;
+      }
+      out += 4;
+      *out = 0;
+    }
+    sprintf(*outptr, "degarble(%d,\"%s\")", chars, obuf);
+    *outptr += strlen(*outptr);
+    in = p + 2;
+  } else {
+    strncpy((*outptr), in, (p - in) + 1);
+    *outptr += strlen(*outptr);
+    in = p + 1;
+  }
+  *inptr = in;
+}
+
+char *outbuf = NULL;
+
+void processline(char *line)
+{
+  char tmpin[16384],
+    tmpout[16384];
+  char *in,
+   *out;
+
+  strcpy(tmpin, line);
+  bzero((char *) &tmpin[strlen(tmpin)], 20);
+  in = tmpin;
+  out = tmpout;
+  if (*in) {
+    while (*in) {
+      if (!strncmp(in, "STR(\"", 5)) {
+	*out = 0;
+	garble(&in, &out);
+	*out = 0;
+      } else
+	*out++ = *in++;
+    }
+    *out = 0;
+  } else
+    tmpout[0] = 0;
+
+  if (outbuf)
+    outbuf = realloc(outbuf, strlen(outbuf) + strlen(tmpout) + 10);
+  else {
+    outbuf = malloc(strlen(tmpout) + 10);
+    outbuf[0] = 0;
+  }
+  strcat(outbuf, tmpout);
+  strcat(outbuf, "\n");
+}
+#endif
+
+int main(int argc, char *argv[0])
+{
+#ifdef S_GARBLESTRINGS
+  FILE *f;
+  char *ln,
+   *nln;
+  int insize;
+  char *buf;
+
+  if (argc != 2)
+    exit(1);
+  f = fopen(argv[1], "r");
+  if (!f)
+    exit(1);
+  fseek(f, 0, SEEK_END);
+  insize = ftell(f);
+  fseek(f, 0, SEEK_SET);
+  buf = malloc(insize + 1);
+  fread(buf, 1, insize, f);
+  fclose(f);
+  buf[insize] = 0;
+
+  ln = buf;
+  while (ln) {
+    nln = strchr(ln, '\n');
+    if (nln)
+      *nln++ = 0;
+    processline(ln);
+    ln = nln;
+  }
+
+  f = fopen(argv[1], "w");
+  if (f) {
+    fwrite(outbuf, 1, strlen(outbuf), f);
+    fclose(f);
+  }
+  /*  printf(outbuf); */
+#endif
+  exit(0);
+}

+ 1 - 3
src/tcldcc.c

@@ -13,7 +13,7 @@ extern struct userrec	*userlist;
 extern struct dcc_t	*dcc;
 extern struct dcc_t	*dcc;
 extern Tcl_Interp	*interp;
 extern Tcl_Interp	*interp;
 extern char		 whois_fields[], botnetnick[];
 extern char		 whois_fields[], botnetnick[];
-
+extern time_t            now;
 
 
 int share_greet = 0;		/* Share greeting info			*/
 int share_greet = 0;		/* Share greeting info			*/
 static struct user_entry_type *entry_type_list;
 static struct user_entry_type *entry_type_list;
@@ -97,7 +97,6 @@ int def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e)
 
 
 void *def_get(struct userrec *u, struct user_entry *e)
 void *def_get(struct userrec *u, struct user_entry *e)
 {
 {
-  Context;
   return e->u.string;
   return e->u.string;
 }
 }
 
 
@@ -1618,7 +1617,6 @@ void *get_user(struct user_entry_type *et, struct userrec *u)
 {
 {
   struct user_entry *e;
   struct user_entry *e;
 
 
-Context;
   if (u && (e = find_user_entry(et, u)))
   if (u && (e = find_user_entry(et, u)))
     return et->get(u, e);
     return et->get(u, e);
   return 0;
   return 0;

+ 27 - 27
src/users.c

@@ -86,7 +86,7 @@ int delignore(char *ign)
       char *mask = str_escape(temp, ':', '\\');
       char *mask = str_escape(temp, ':', '\\');
 
 
       if (mask) {
       if (mask) {
-	shareout(NULL, "-i %s\n", mask);
+	shareout(NULL, STR("-i %s\n"), mask);
 	nfree(mask);
 	nfree(mask);
       }
       }
     }
     }
@@ -135,7 +135,7 @@ void addignore(char *ign, char *from, char *mnote, time_t expire_time)
     char *mask = str_escape(ign, ':', '\\');
     char *mask = str_escape(ign, ':', '\\');
 
 
     if (mask) {
     if (mask) {
-      shareout(NULL, "+i %s %lu %c %s %s\n", mask, expire_time - now,
+      shareout(NULL, STR("+i %s %lu %c %s %s\n"), mask, expire_time - now,
 	       (p->flags & IGREC_PERM) ? 'p' : '-', from, mnote);
 	       (p->flags & IGREC_PERM) ? 'p' : '-', from, mnote);
       nfree(mask);
       nfree(mask);
     }
     }
@@ -149,27 +149,27 @@ void display_ignore(int idx, int number, struct igrec *ignore)
 
 
   if (ignore->added) {
   if (ignore->added) {
     daysago(now, ignore->added, s);
     daysago(now, ignore->added, s);
-    sprintf(dates, "Started %s", s);
+    sprintf(dates, STR("Started %s"), s);
   } else
   } else
     dates[0] = 0;
     dates[0] = 0;
   if (ignore->flags & IGREC_PERM)
   if (ignore->flags & IGREC_PERM)
-    strcpy(s, "(perm)");
+    strcpy(s, STR("(perm)"));
   else {
   else {
     char s1[41];
     char s1[41];
 
 
     days(ignore->expire, now, s1);
     days(ignore->expire, now, s1);
-    sprintf(s, "(expires %s)", s1);
+    sprintf(s, STR("(expires %s)"), s1);
   }
   }
   if (number >= 0)
   if (number >= 0)
-    dprintf(idx, "  [%3d] %s %s\n", number, ignore->igmask, s);
+    dprintf(idx, STR("  [%3d] %s %s\n"), number, ignore->igmask, s);
   else
   else
-    dprintf(idx, "IGNORE: %s %s\n", ignore->igmask, s);
+    dprintf(idx, STR("IGNORE: %s %s\n"), ignore->igmask, s);
   if (ignore->msg && ignore->msg[0])
   if (ignore->msg && ignore->msg[0])
-    dprintf(idx, "        %s: %s\n", ignore->user, ignore->msg);
+    dprintf(idx, STR("        %s: %s\n"), ignore->user, ignore->msg);
   else
   else
-    dprintf(idx, "        %s %s\n", MODES_PLACEDBY, ignore->user);
+    dprintf(idx, STR("        %s %s\n"), MODES_PLACEDBY, ignore->user);
   if (dates[0])
   if (dates[0])
-    dprintf(idx, "        %s\n", dates);
+    dprintf(idx, STR("        %s\n"), dates);
 }
 }
 
 
 /* list the ignores and how long they've been active */
 /* list the ignores and how long they've been active */
@@ -179,10 +179,10 @@ void tell_ignores(int idx, char *match)
   int k = 1;
   int k = 1;
 
 
   if (u == NULL) {
   if (u == NULL) {
-    dprintf(idx, "No ignores.\n");
+    dprintf(idx, STR("No ignores.\n"));
     return;
     return;
   }
   }
-  dprintf(idx, "%s:\n", IGN_CURRENT);
+  dprintf(idx, STR("%s:\n"), IGN_CURRENT);
   for (; u; u = u->next) {
   for (; u; u = u->next) {
     if (match[0]) {
     if (match[0]) {
       if (wild_match(match, u->igmask) ||
       if (wild_match(match, u->igmask) ||
@@ -204,7 +204,7 @@ void check_expired_ignores()
     return;
     return;
   while (*u) {
   while (*u) {
     if (!((*u)->flags & IGREC_PERM) && (now >= (*u)->expire)) {
     if (!((*u)->flags & IGREC_PERM) && (now >= (*u)->expire)) {
-      putlog(LOG_MISC, "*", "%s %s (%s)", IGN_NOLONGER, (*u)->igmask,
+      putlog(LOG_MISC, "*", STR("%s %s (%s)"), IGN_NOLONGER, (*u)->igmask,
 	     MISC_EXPIRED);
 	     MISC_EXPIRED);
       delignore((*u)->igmask);
       delignore((*u)->igmask);
     } else {
     } else {
@@ -288,8 +288,8 @@ static void restore_chanban(struct chanset_t *chan, char *host)
       }
       }
     }
     }
   }
   }
-  putlog(LOG_MISC, "*", "*** Malformed banline for %s.",
-	 chan ? chan->dname : "global_bans");
+  putlog(LOG_MISC, "*", STR("*** Malformed banline for %s."),
+	 chan ? chan->dname : STR("global_bans"));
 }
 }
 
 
 static void restore_chanexempt(struct chanset_t *chan, char *host)
 static void restore_chanexempt(struct chanset_t *chan, char *host)
@@ -342,8 +342,8 @@ static void restore_chanexempt(struct chanset_t *chan, char *host)
       }
       }
     }
     }
   }
   }
-  putlog(LOG_MISC, "*", "*** Malformed exemptline for %s.",
-	 chan ? chan->dname : "global_exempts");
+  putlog(LOG_MISC, "*", STR("*** Malformed exemptline for %s."),
+	 chan ? chan->dname : STR("global_exempts"));
 }
 }
 
 
 static void restore_chaninvite(struct chanset_t *chan, char *host)
 static void restore_chaninvite(struct chanset_t *chan, char *host)
@@ -396,8 +396,8 @@ static void restore_chaninvite(struct chanset_t *chan, char *host)
       }
       }
     }
     }
   }
   }
-  putlog(LOG_MISC, "*", "*** Malformed inviteline for %s.",
-	 chan ? chan->dname : "global_invites");
+  putlog(LOG_MISC, "*", STR("*** Malformed inviteline for %s."),
+	 chan ? chan->dname : STR("global_invites"));
 }
 }
 
 
 static void restore_ignore(char *host)
 static void restore_ignore(char *host)
@@ -449,7 +449,7 @@ static void restore_ignore(char *host)
       return;
       return;
     }
     }
   }
   }
-  putlog(LOG_MISC, "*", "*** Malformed ignore line.");
+  putlog(LOG_MISC, "*", STR("*** Malformed ignore line."));
 }
 }
 
 
 void tell_user(int idx, struct userrec *u, int master)
 void tell_user(int idx, struct userrec *u, int master)
@@ -549,9 +549,9 @@ void tell_user_ident(int idx, char *id, int master)
     dprintf(idx, "%s.\n", USERF_NOMATCH);
     dprintf(idx, "%s.\n", USERF_NOMATCH);
     return;
     return;
   }
   }
-  egg_snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", 
+  egg_snprintf(format, sizeof format, STR("%%-%us PASS NOTES FLAGS           LAST\n"), 
                           HANDLEN);
                           HANDLEN);
-  dprintf(idx, format, "HANDLE");
+  dprintf(idx, format, STR("HANDLE"));
   tell_user(idx, u, master);
   tell_user(idx, u, master);
 }
 }
 
 
@@ -567,13 +567,13 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
   struct list_type *q;
   struct list_type *q;
   struct flag_record user, pls, mns;
   struct flag_record user, pls, mns;
 
 
-  dprintf(idx, "*** %s '%s':\n", MISC_MATCHING, mtch);
+  dprintf(idx, STR("*** %s '%s':\n"), MISC_MATCHING, mtch);
   cnt = 0;
   cnt = 0;
-  egg_snprintf(format, sizeof format, "%%-%us PASS NOTES FLAGS           LAST\n", 
+  egg_snprintf(format, sizeof format, STR("%%-%us PASS NOTES FLAGS           LAST\n"), 
                       HANDLEN);
                       HANDLEN);
-  dprintf(idx, format, "HANDLE");
+  dprintf(idx, format, STR("HANDLE"));
   if (start > 1)
   if (start > 1)
-    dprintf(idx, "(%s %d)\n", MISC_SKIPPING, start - 1);
+    dprintf(idx, STR("(%s %d)\n"), MISC_SKIPPING, start - 1);
   if (strchr("+-&|", *mtch)) {
   if (strchr("+-&|", *mtch)) {
     user.match = pls.match = FR_GLOBAL | FR_BOT | FR_CHAN;
     user.match = pls.match = FR_GLOBAL | FR_BOT | FR_CHAN;
     break_down_flags(mtch, &pls, &mns);
     break_down_flags(mtch, &pls, &mns);
@@ -584,7 +584,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
       if (!pls.global && !pls.udef_global && !pls.chan && !pls.udef_chan &&
       if (!pls.global && !pls.udef_global && !pls.chan && !pls.udef_chan &&
 	  !pls.bot) {
 	  !pls.bot) {
 	/* happy now BB you weenie :P */
 	/* happy now BB you weenie :P */
-	dprintf(idx, "Unknown flag specified for matching!!\n");
+	dprintf(idx, STR("Unknown flag specified for matching!!\n"));
 	return;
 	return;
       }
       }
     }
     }

Некоторые файлы не были показаны из-за большого количества измененных файлов