]> jfr.im git - irc/quakenet/snircd.git/commitdiff
merge 07 in
authorpaul <redacted>
Thu, 6 Jul 2006 19:02:00 +0000 (20:02 +0100)
committerpaul <redacted>
Thu, 6 Jul 2006 19:02:00 +0000 (20:02 +0100)
71 files changed:
RELEASE.NOTES
config.guess
config.h.in
config.sub
configure
configure.in
doc/Makefile.in
doc/readme.features
include/channel.h
include/check.h [new file with mode: 0644]
include/client.h
include/gline.h
include/handlers.h
include/ircd_defs.h
include/ircd_features.h
include/ircd_log.h
include/msg.h
include/numeric.h
include/s_conf.h
include/s_user.h
include/struct.h
include/supported.h
ircd-patch
ircd/.cvsignore
ircd/IPcheck.c
ircd/Makefile.in
ircd/channel.c
ircd/convert-conf.c
ircd/engine_devpoll.c
ircd/gline.c
ircd/ircd_crypt_native.c
ircd/ircd_features.c
ircd/ircd_lexer.l
ircd/ircd_log.c
ircd/ircd_parser.y
ircd/ircd_relay.c
ircd/ircd_snprintf.c
ircd/m_burst.c
ircd/m_check.c [new file with mode: 0644]
ircd/m_clearmode.c
ircd/m_destruct.c
ircd/m_gline.c
ircd/m_invite.c
ircd/m_join.c
ircd/m_kick.c
ircd/m_kill.c
ircd/m_names.c
ircd/m_nick.c
ircd/m_oper.c
ircd/m_quit.c
ircd/m_sethost.c [new file with mode: 0644]
ircd/m_topic.c
ircd/m_userhost.c
ircd/m_userip.c
ircd/m_wallchops.c
ircd/m_wallvoices.c
ircd/m_who.c
ircd/m_whois.c
ircd/m_whowas.c
ircd/parse.c
ircd/s_auth.c
ircd/s_bsd.c
ircd/s_conf.c
ircd/s_err.c
ircd/s_serv.c
ircd/s_stats.c
ircd/s_user.c
ircd/send.c
ircd/test/.cvsignore
ircd/whocmds.c
tools/convert_slines.sh [new file with mode: 0644]

index 47106bd16a926841dc079ec95283396894e14c0a..199d855620a2c5601c30c32386f33de62365b269 100644 (file)
@@ -123,8 +123,6 @@ HIS_DESYNCS, TIMESEC.
 Deleted features since they are now controlled by other configuration
 entries: VIRTUAL_HOST, oper and locop privilege features.
 
-Deleted feature since it no longer applies: HIS_STATS_h.
-
 Compile Time Options:
 
 A listing of supported compile-time options may be seen by running
index 10a8260177a0616d6b76950ac35e34f037193944..f4f77724bea943bea77639bd20d73b6ff4a96218 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2005-12-23'
+timestamp='2002-03-04'
 
 # 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
@@ -17,15 +17,13 @@ timestamp='2005-12-23'
 #
 # 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., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# 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 <per@bothner.com>.
 # Please send patches to <config-patches@gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
@@ -55,7 +53,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+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
@@ -68,11 +66,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -90,42 +88,30 @@ if test $# != 0; then
   exit 1
 fi
 
-trap 'exit 1' 1 2 15
 
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
+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.
 
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-       for c in cc gcc c89 c99 ; do
-         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+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 ; set_cc_for_build= ;'
+esac'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
@@ -156,7 +142,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
            /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
        case "${UNAME_MACHINE_ARCH}" in
-           armeb) machine=armeb-unknown ;;
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
@@ -182,125 +167,141 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                ;;
        esac
        # The OS release
-       # Debian GNU/NetBSD machines have a different userland, and
-       # thus, need a distinct triplet. However, they do not need
-       # kernel version information, so it can be replaced with a
-       # suitable tag, in the style of linux-gnu.
-       case "${UNAME_VERSION}" in
-           Debian*)
-               release='-gnu'
-               ;;
-           *)
-               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-               ;;
-       esac
+       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 ;;
+       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:*:*)
-       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-       exit ;;
-    *:ekkoBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-       exit ;;
-    macppc:MirBSD:*:*)
-       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
-    *:MirBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
+       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+       exit 0 ;;
     alpha:OSF1:*:*)
-       case $UNAME_RELEASE in
-       *4.0)
+       if test $UNAME_RELEASE = "V4.0"; then
                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-               ;;
-       *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-               ;;
-       esac
-       # According to Compaq, /usr/sbin/psrinfo has been available on
-       # OSF/1 and Tru64 systems produced since 1995.  I hope that
-       # covers most systems running today.  This code pipes the CPU
-       # types through head -n 1, so we only detect the type of CPU 0.
-       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-       case "$ALPHA_CPU_TYPE" in
-           "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
-           "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
-           "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
-           "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
-           "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
-           "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
-           "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
-           "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
-           "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
-           "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
-       esac
-       # A Pn.n version is a patched version.
+       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.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit ;;
+       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 ;;
+       exit ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
-       exit ;;
+       exit ;;
     Amiga*:UNIX_System_V:4.0:*)
        echo m68k-unknown-sysv4
-       exit ;;
+       exit 0;;
     *:[Aa]miga[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-amigaos
-       exit ;;
+       exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-morphos
-       exit ;;
+       exit ;;
     *:OS/390:*:*)
        echo i370-ibm-openedition
-       exit ;;
-    *:z/VM:*:*)
-       echo s390-ibm-zvmoe
-       exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-       exit ;;
+       exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
-       exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-       echo arm-unknown-riscos
-       exit ;;
+       exit 0;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
        echo hppa1.1-hitachi-hiuxmpp
-       exit ;;
+       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
@@ -308,32 +309,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        else
                echo pyramid-pyramid-bsd
        fi
-       exit ;;
+       exit ;;
     NILE*:*:*:dcosx)
        echo pyramid-pyramid-svr4
-       exit ;;
-    DRS?6000:unix:4.0:6*)
-       echo sparc-icl-nx6
-       exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-       case `/usr/bin/uname -p` in
-           sparc) echo sparc-icl-nx7; exit ;;
-       esac ;;
+       exit 0 ;;
     sun4H:SunOS:5.*:*)
        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     i86pc:SunOS:5.*:*)
        echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     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 ;;
+       exit ;;
     sun4*:SunOS:*:*)
        case "`/usr/bin/arch -k`" in
            Series*|S4*)
@@ -342,10 +336,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
        echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit ;;
+       exit ;;
     sun3*:SunOS:*:*)
        echo m68k-sun-sunos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     sun*:*:4.2BSD:*)
        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
        test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -357,10 +351,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                echo sparc-sun-sunos${UNAME_RELEASE}
                ;;
        esac
-       exit ;;
+       exit ;;
     aushp:SunOS:*:*)
        echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     # 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
@@ -371,40 +365,37 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
         echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
         echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-       echo m68k-apple-machten${UNAME_RELEASE}
-       exit ;;
+        exit 0 ;;
     powerpc:machten:*:*)
        echo powerpc-apple-machten${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RISC*:Mach:*:*)
        echo mips-dec-mach_bsd4.3
-       exit ;;
+       exit ;;
     RISC*:ULTRIX:*:*)
        echo mips-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     VAX*:ULTRIX*:*:*)
        echo vax-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
        echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -428,33 +419,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
          exit (-1);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c &&
-         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-         SYSTEM_NAME=`$dummy $dummyarg` &&
-           { echo "$SYSTEM_NAME"; exit; }
+       $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 ;;
+       exit ;;
     Motorola:PowerMAX_OS:*:*)
        echo powerpc-motorola-powermax
-       exit ;;
-    Motorola:*:4.3:PL8-*)
-       echo powerpc-harris-powermax
-       exit ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-       echo powerpc-harris-powermax
-       exit ;;
+       exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
        echo powerpc-harris-powerunix
-       exit ;;
+       exit ;;
     m88k:CX/UX:7*:*)
        echo m88k-harris-cxux7
-       exit ;;
+       exit ;;
     m88k:*:4*:R4*)
        echo m88k-motorola-sysv4
-       exit ;;
+       exit ;;
     m88k:*:3*:R3*)
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -470,29 +455,29 @@ EOF
        else
            echo i586-dg-dgux${UNAME_RELEASE}
        fi
-       exit ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
-       exit ;;
+       exit ;;
     M88*:*:R3*:*)
        # Delta 88k system running SVR3
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
        echo m88k-tektronix-sysv3
-       exit ;;
+       exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
        echo m68k-tektronix-bsd
-       exit ;;
+       exit ;;
     *:IRIX*:*:*)
        echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit ;;
+       exit ;;
     ????????: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 ;;               # Note that: echo "'`uname -s`'" gives '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 ;;
+       exit ;;
     ia64:AIX:*:*)
        if [ -x /usr/bin/oslevel ] ; then
                IBM_REV=`/usr/bin/oslevel`
@@ -500,7 +485,7 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
                eval $set_cc_for_build
@@ -515,18 +500,15 @@ EOF
                        exit(0);
                        }
 EOF
-               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-               then
-                       echo "$SYSTEM_NAME"
-               else
-                       echo rs6000-ibm-aix3.2.5
-               fi
+               $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 ;;
+       exit ;;
     *:AIX:*:[45])
        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -540,28 +522,28 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
-       exit ;;
+       exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
        echo romp-ibm-bsd4.4
-       exit ;;
+       exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
        echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit ;;                             # report: romp-ibm BSD 4.3
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
-       exit ;;
+       exit ;;
     DPX/2?00:B.O.S.:*:*)
        echo m68k-bull-sysv3
-       exit ;;
+       exit ;;
     9000/[34]??:4.3bsd:1.*:*)
        echo m68k-hp-bsd
-       exit ;;
+       exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
        echo m68k-hp-bsd4.4
-       exit ;;
+       exit ;;
     9000/[34678]??:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        case "${UNAME_MACHINE}" in
@@ -617,37 +599,17 @@ EOF
                   exit (0);
               }
 EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-                   test -z "$HP_ARCH" && HP_ARCH=hppa
+                   (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
-       if [ ${HP_ARCH} = "hppa2.0w" ]
-       then
-           eval $set_cc_for_build
-
-           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-           # generating 64-bit code.  GNU and HP use different nomenclature:
-           #
-           # $ CC_FOR_BUILD=cc ./config.guess
-           # => hppa2.0w-hp-hpux11.23
-           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-           # => hppa64-hp-hpux11.23
-
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-               grep __LP64__ >/dev/null
-           then
-               HP_ARCH="hppa2.0w"
-           else
-               HP_ARCH="hppa64"
-           fi
-       fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     ia64:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        echo ia64-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     3050*:HI-UX:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -675,218 +637,160 @@ EOF
          exit (0);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-               { echo "$SYSTEM_NAME"; exit; }
+       $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 ;;
+       exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
        echo hppa1.1-hp-bsd
-       exit ;;
+       exit ;;
     9000/8??:4.3bsd:*:*)
        echo hppa1.0-hp-bsd
-       exit ;;
+       exit ;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
        echo hppa1.0-hp-mpeix
-       exit ;;
+       exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
        echo hppa1.1-hp-osf
-       exit ;;
+       exit ;;
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
-       exit ;;
+       exit ;;
     i*86:OSF1:*:*)
        if [ -x /usr/sbin/sysversion ] ; then
            echo ${UNAME_MACHINE}-unknown-osf1mk
        else
            echo ${UNAME_MACHINE}-unknown-osf1
        fi
-       exit ;;
+       exit ;;
     parisc*:Lites*:*:*)
        echo hppa1.1-hp-lites
-       exit ;;
+       exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     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 ;;
+       exit ;;
     CRAY*TS:*:*:*)
        echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       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 ;;
+       exit ;;
     CRAY*SV1:*:*:*)
        echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    *:UNICOS/mp:*:*)
-       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       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 ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-       exit ;;
+        exit 0 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     sparc*:BSD/OS:*:*)
        echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:BSD/OS:*:*)
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:FreeBSD:*:*)
-       case ${UNAME_MACHINE} in
-           pc98)
-               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-           *)
-               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-       esac
-       exit ;;
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit 0 ;;
     i*:CYGWIN*:*)
        echo ${UNAME_MACHINE}-pc-cygwin
-       exit ;;
+       exit ;;
     i*:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
-       exit ;;
-    i*:windows32*:*)
-       # uname -m includes "-pc" on this system.
-       echo ${UNAME_MACHINE}-mingw32
-       exit ;;
+       exit 0 ;;
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
-       exit ;;
-    x86:Interix*:[345]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-       exit ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-       echo i${UNAME_MACHINE}-pc-mks
-       exit ;;
+       exit 0 ;;
+    x86:Interix*:3*)
+       echo i386-pc-interix3
+       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 i586-pc-interix
-       exit ;;
+       echo i386-pc-interix
+       exit ;;
     i*:UWIN*:*)
        echo ${UNAME_MACHINE}-pc-uwin
-       exit ;;
-    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-       echo x86_64-unknown-cygwin
-       exit ;;
+       exit 0 ;;
     p*:CYGWIN*:*)
        echo powerpcle-unknown-cygwin
-       exit ;;
+       exit ;;
     prep*:SunOS:5.*:*)
        echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     *:GNU:*:*)
-       # the GNU system
        echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit ;;
-    *:GNU/*:*:*)
-       # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
-       exit ;;
+       exit 0 ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
-       exit ;;
+       exit ;;
     arm*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    cris:Linux:*:*)
-       echo cris-axis-linux-gnu
-       exit ;;
-    crisv32:Linux:*:*)
-       echo crisv32-axis-linux-gnu
-       exit ;;
-    frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
-       exit ;;
+       exit 0 ;;
     ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       echo ${UNAME_MACHINE}-unknown-linux
+       exit 0 ;;
     m68*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     mips:Linux:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
        #undef CPU
        #undef mips
        #undef mipsel
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 
+       CPU=mipsel 
        #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 
        CPU=mips
        #else
        CPU=
        #endif
-       #endif
+       #endif 
 EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       rm -f $dummy.c
+       test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
        ;;
-    mips64:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #undef CPU
-       #undef mips64
-       #undef mips64el
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mips64el
-       #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips64
-       #else
-       CPU=
-       #endif
-       #endif
-EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-       ;;
-    or32:Linux:*:*)
-       echo or32-unknown-linux-gnu
-       exit ;;
     ppc:Linux:*:*)
        echo powerpc-unknown-linux-gnu
-       exit ;;
+       exit ;;
     ppc64:Linux:*:*)
        echo powerpc64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     alpha:Linux:*:*)
        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
          EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -900,7 +804,7 @@ EOF
        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 ;;
+       exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -908,28 +812,22 @@ EOF
          PA8*) echo hppa2.0-unknown-linux-gnu ;;
          *)    echo hppa-unknown-linux-gnu ;;
        esac
-       exit ;;
+       exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
        echo hppa64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux
-       exit ;;
-    sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit 0 ;;
     sh*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    vax:Linux:*:*)
-       echo ${UNAME_MACHINE}-dec-linux-gnu
-       exit ;;
+       exit 0 ;;
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
-       exit ;;
+       exit ;;
     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
@@ -947,15 +845,15 @@ EOF
                ;;
          a.out-i386-linux)
                echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-               exit ;;
+               exit 0 ;;               
          coff-i386)
                echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit ;;
+               exit ;;
          "")
                # 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 ;;
+               exit ;;
        esac
        # Determine whether the default compiler is a.out or elf
        eval $set_cc_for_build
@@ -972,29 +870,24 @@ EOF
        LIBC=gnulibc1
        # endif
        #else
-       #if defined(__INTEL_COMPILER) || defined(__PGI)
+       #ifdef __INTEL_COMPILER
        LIBC=gnu
        #else
        LIBC=gnuaout
        #endif
        #endif
-       #ifdef __dietlibc__
-       LIBC=dietlibc
-       #endif
 EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
-       test x"${LIBC}" != x && {
-               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-               exit
-       }
-       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       rm -f $dummy.c
+       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+       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 ;;
+       exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
@@ -1002,27 +895,7 @@ EOF
        # I just have to hope.  -- rms.
         # Use sysv4.2uw... so that sysv4* matches it.
        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit ;;
-    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 ;;
-    i*86:XTS-300:*:STOP)
-       echo ${UNAME_MACHINE}-unknown-stop
-       exit ;;
-    i*86:atheos:*:*)
-       echo ${UNAME_MACHINE}-unknown-atheos
-       exit ;;
-    i*86:syllable:*:*)
-       echo ${UNAME_MACHINE}-pc-syllable
-       exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    i*86:*DOS:*:*)
-       echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit ;;
+       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
@@ -1030,100 +903,99 @@ EOF
        else
                echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
        fi
-       exit ;;
-    i*86:*:5:[678]*)
-       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       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 ;;
+       exit ;;
     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|grep Release|sed -e 's/.*= //')`
-               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+               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|grep '^Machine.*Pent *II' >/dev/null) \
+               (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
                        && UNAME_MACHINE=i686
-               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+               (/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 ;;
+       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 ;;
+        exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
-       exit ;;
+       exit ;;
     paragon:*:*:*)
        echo i860-intel-osf1
-       exit ;;
+       exit ;;
     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 ;;
+       exit ;;
     mini*:CTIX:SYS*5:*)
        # "miniframe"
        echo m68010-convergent-sysv
-       exit ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-       echo m68k-convergent-sysv
-       exit ;;
-    M680?0:D-NIX:5.3:*)
-       echo m68k-diab-dnix
-       exit ;;
-    M68*:*:R3V[5678]*:*)
-       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       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 | 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; }
+         && 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; } ;;
+         && 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; } ;;
+          && echo i486-ncr-sysv4 && exit 0 ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mc68030:UNIX_System_V:4.*:*)
        echo m68k-atari-sysv4
-       exit ;;
+       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 ;;
+       exit ;;
     rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
        echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SM[BE]S:UNIX_SV:*:*)
        echo mips-dde-sysv${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RM*:ReliantUNIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     RM*:SINIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
                UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1131,98 +1003,84 @@ EOF
        else
                echo ns32k-sni-sysv
        fi
-       exit ;;
+       exit ;;
     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                       # says <Richard.M.Bartel@ccMail.Census.GOV>
         echo i586-unisys-sysv4
-        exit ;;
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
        # From Gerald Hewes <hewes@openmarket.com>.
        # How about differentiating between stratus architectures? -djm
        echo hppa1.1-stratus-sysv4
-       exit ;;
+       exit ;;
     *:*:*:FTX*)
        # From seanf@swdc.stratus.com.
        echo i860-stratus-sysv4
-       exit ;;
-    i*86:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo ${UNAME_MACHINE}-stratus-vos
-       exit ;;
+       exit 0 ;;
     *:VOS:*:*)
        # From Paul.Green@stratus.com.
        echo hppa1.1-stratus-vos
-       exit ;;
+       exit ;;
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     news*:NEWS-OS:6*:*)
        echo mips-sony-newsos6
-       exit ;;
+       exit ;;
     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 ;;
+        exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
        echo powerpc-be-beos
-       exit ;;
+       exit ;;
     BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
        echo powerpc-apple-beos
-       exit ;;
+       exit ;;
     BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
        echo i586-pc-beos
-       exit ;;
+       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SX-5:SUPER-UX:*:*)
        echo sx5-nec-superux${UNAME_RELEASE}
-       exit ;;
-    SX-6:SUPER-UX:*:*)
-       echo sx6-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit 0 ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Rhapsody:*:*)
        echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Darwin:*:*)
-       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       case $UNAME_PROCESSOR in
-           unknown) UNAME_PROCESSOR=powerpc ;;
-       esac
-       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-       exit ;;
+       echo `uname -p`-apple-darwin${UNAME_RELEASE}
+       exit 0 ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
-               UNAME_PROCESSOR=i386
+       if test "${UNAME_MACHINE}" = "x86pc"; then
                UNAME_MACHINE=pc
+               echo i386-${UNAME_MACHINE}-nto-qnx
+       else
+               echo `uname -p`-${UNAME_MACHINE}-nto-qnx
        fi
-       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit ;;
+       exit 0 ;;
     *:QNX:*:4*)
        echo i386-pc-qnx
-       exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-       echo nse-tandem-nsk${UNAME_RELEASE}
-       exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
+       exit 0 ;;
+    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:NonStop-UX:*:*)
        echo mips-compaq-nonstopux
-       exit ;;
+       exit ;;
     BS2000:POSIX*:*:*)
        echo bs2000-siemens-sysv
-       exit ;;
+       exit ;;
     DS/*:UNIX_System_V:*:*)
        echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Plan9:*:*)
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
@@ -1233,47 +1091,36 @@ EOF
            UNAME_MACHINE="$cputype"
        fi
        echo ${UNAME_MACHINE}-unknown-plan9
-       exit ;;
+       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 ;;
+       exit ;;
     *:TENEX:*:*)
        echo pdp10-unknown-tenex
-       exit ;;
+       exit ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
        echo pdp10-dec-tops20
-       exit ;;
+       exit ;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
        echo pdp10-xkl-tops20
-       exit ;;
+       exit ;;
     *:TOPS-20:*:*)
        echo pdp10-unknown-tops20
-       exit ;;
+       exit ;;
     *:ITS:*:*)
        echo pdp10-unknown-its
-       exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-       exit ;;
-    *:DragonFly:*:*)
-       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit ;;
-    *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
-       case "${UNAME_MACHINE}" in
-           A*) echo alpha-dec-vms ; exit ;;
-           I*) echo ia64-dec-vms ; exit ;;
-           V*) echo vax-dec-vms ; exit ;;
-       esac ;;
-    *:XENIX:*:SysV)
-       echo i386-pc-xenix
-       exit ;;
-    i*86:skyos:*:*)
-       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-       exit ;;
-    i*86:rdos:*:*)
-       echo ${UNAME_MACHINE}-pc-rdos
-       exit ;;
+       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
@@ -1305,7 +1152,7 @@ main ()
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
+  printf ("arm-acorn-riscix"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -1394,12 +1241,12 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-       { echo "$SYSTEM_NAME"; exit; }
+$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; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1408,22 +1255,22 @@ then
     case `getsysinfo -f cpu_type` in
     c1*)
        echo c1-convex-bsd
-       exit ;;
+       exit ;;
     c2*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-       exit ;;
+       exit ;;
     c34*)
        echo c34-convex-bsd
-       exit ;;
+       exit ;;
     c38*)
        echo c38-convex-bsd
-       exit ;;
+       exit ;;
     c4*)
        echo c4-convex-bsd
-       exit ;;
+       exit ;;
     esac
 fi
 
@@ -1434,9 +1281,7 @@ 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
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+    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
index 7c2c7892b271a6a77a8521831e6033cb86c4b419..fbfebc6c89ef32c9ceff7bc81ad9ad46af6bb4c9 100644 (file)
 /* Enable IPv6 support */
 #undef IPV6
 
-/* Define if building on Solaris */
-#undef IRCU_SOLARIS
-
 /* Path to debugging log file */
 #undef LPATH
 
 /* Define to `unsigned' if <sys/types.h> does not define. */
 #undef size_t
 
-/* type to use in place of socklen_t if not defined */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef socklen_t
 
 /* Define to `int' if <sys/types.h> doesn't define. */
index 8f7b7381c47128859b9986ed1f6db1ed5307af27..0c49007815a4469ce15296a9647a615a74799e85 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2005-12-23'
+timestamp='2002-03-04'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,15 +21,14 @@ timestamp='2005-12-23'
 #
 # 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., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
+# 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.
 #
@@ -71,7 +70,7 @@ 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, 2002, 2003, 2004, 2005
+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
@@ -84,11 +83,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -100,7 +99,7 @@ while test $# -gt 0 ; do
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit ;;
+       exit 0;;
 
     * )
        break ;;
@@ -119,9 +118,7 @@ esac
 # 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* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -147,7 +144,7 @@ case $os in
        -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 | -knuth | -cray)
+       -apple | -axis)
                os=
                basic_machine=$1
                ;;
@@ -172,10 +169,6 @@ case $os in
        -hiux*)
                os=-hiuxwe2
                ;;
-       -sco6)
-               os=-sco5v6
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
        -sco5)
                os=-sco3.2v5
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -192,10 +185,6 @@ case $os in
                # Don't forget version if it is 3.2v4 or newer.
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
-       -sco5v6*)
-               # 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/'`
@@ -239,55 +228,34 @@ case $basic_machine in
        | a29k \
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-       | am33_2.0 \
        | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-       | bfin \
        | c4x | clipper \
-       | d10v | d30v | dlx | dsp16xx \
-       | fr30 | frv \
+       | d10v | d30v | dsp16xx \
+       | fr30 \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | i370 | i860 | i960 | ia64 \
-       | ip2k | iq2000 \
-       | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
-       | mips | mipsbe | mipseb | mipsel | mipsle \
-       | mips16 \
-       | mips64 | mips64el \
-       | mips64vr | mips64vrel \
-       | mips64orion | mips64orionel \
-       | mips64vr4100 | mips64vr4100el \
-       | mips64vr4300 | mips64vr4300el \
-       | mips64vr5000 | mips64vr5000el \
-       | mips64vr5900 | mips64vr5900el \
-       | mipsisa32 | mipsisa32el \
-       | mipsisa32r2 | mipsisa32r2el \
-       | mipsisa64 | mipsisa64el \
-       | mipsisa64r2 | mipsisa64r2el \
-       | mipsisa64sb1 | mipsisa64sb1el \
-       | mipsisa64sr71k | mipsisa64sr71kel \
-       | mipstx39 | mipstx39el \
+       | m32r | m68000 | m68k | m88k | mcore \
+       | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el | mips64vr4300 \
+       | mips64vr4300el | mips64vr5000 | mips64vr5000el \
+       | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
+       | mipsisa32 \
        | mn10200 | mn10300 \
-       | mt \
-       | msp430 \
        | ns16k | ns32k \
-       | or32 \
+       | openrisc | or32 \
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
-       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
-       | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-       | sparcv8 | sparcv9 | sparcv9b \
+       | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
+       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
        | strongarm \
-       | tahoe | thumb | tic4x | tic80 | tron \
+       | tahoe | thumb | tic80 | tron \
        | v850 | v850e \
        | we32k \
-       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | x86 | xscale | xstormy16 | xtensa \
        | z8k)
                basic_machine=$basic_machine-unknown
                ;;
-       m32c)
-               basic_machine=$basic_machine-unknown
-               ;;
        m6811 | m68hc11 | m6812 | m68hc12)
                # Motorola 68HC11/12.
                basic_machine=$basic_machine-unknown
@@ -295,9 +263,6 @@ case $basic_machine in
                ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
                ;;
-       ms1)
-               basic_machine=mt-unknown
-               ;;
 
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
@@ -316,63 +281,41 @@ case $basic_machine in
        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | arm-*  | armbe-* | armle-* | armv*-* \
        | avr-* \
-       | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-       | clipper-* | craynv-* | cydra-* \
-       | d10v-* | d30v-* | dlx-* \
+       | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c54x-* \
+       | clipper-* | cydra-* \
+       | d10v-* | d30v-* \
        | elxsi-* \
-       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | f30[01]-* | f700-* | fr30-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | i*86-* | i860-* | i960-* | ia64-* \
-       | ip2k-* | iq2000-* \
-       | m32r-* | m32rle-* \
+       | m32r-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* \
-       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-       | mips16-* \
-       | mips64-* | mips64el-* \
-       | mips64vr-* | mips64vrel-* \
-       | mips64orion-* | mips64orionel-* \
-       | mips64vr4100-* | mips64vr4100el-* \
-       | mips64vr4300-* | mips64vr4300el-* \
-       | mips64vr5000-* | mips64vr5000el-* \
-       | mips64vr5900-* | mips64vr5900el-* \
-       | mipsisa32-* | mipsisa32el-* \
-       | mipsisa32r2-* | mipsisa32r2el-* \
-       | mipsisa64-* | mipsisa64el-* \
-       | mipsisa64r2-* | mipsisa64r2el-* \
-       | mipsisa64sb1-* | mipsisa64sb1el-* \
-       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
-       | mipstx39-* | mipstx39el-* \
-       | mmix-* \
-       | mt-* \
-       | msp430-* \
+       | 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-* \
-       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
-       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
-       | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tron-* \
+       | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
+       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+       | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+       | xtensa-* \
        | ymp-* \
        | z8k-*)
                ;;
-       m32c-*)
-               ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
        386bsd)
@@ -389,9 +332,6 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
-       abacus)
-               basic_machine=abacus-unknown
-               ;;
        adobe68k)
                basic_machine=m68010-adobe
                os=-scout
@@ -406,12 +346,6 @@ case $basic_machine in
                basic_machine=a29k-none
                os=-bsd
                ;;
-       amd64)
-               basic_machine=x86_64-pc
-               ;;
-       amd64-*)
-               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
        amdahl)
                basic_machine=580-amdahl
                os=-sysv
@@ -471,27 +405,12 @@ case $basic_machine in
                basic_machine=j90-cray
                os=-unicos
                ;;
-       craynv)
-               basic_machine=craynv-cray
-               os=-unicosmp
-               ;;
-       cr16c)
-               basic_machine=cr16c-unknown
-               os=-elf
-               ;;
        crds | unos)
                basic_machine=m68k-crds
                ;;
-       crisv32 | crisv32-* | etraxfs*)
-               basic_machine=crisv32-axis
-               ;;
        cris | cris-* | etrax*)
                basic_machine=cris-axis
                ;;
-       crx)
-               basic_machine=crx-unknown
-               os=-elf
-               ;;
        da30 | da30-*)
                basic_machine=m68k-da30
                ;;
@@ -514,10 +433,6 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
-       djgpp)
-               basic_machine=i586-pc
-               os=-msdosdjgpp
-               ;;
        dpx20 | dpx20-*)
                basic_machine=rs6000-bull
                os=-bosx
@@ -696,6 +611,10 @@ case $basic_machine in
        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
@@ -708,9 +627,6 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-msdos
                ;;
-       ms1-*)
-               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-               ;;
        mvs)
                basic_machine=i370-ibm
                os=-mvs
@@ -786,12 +702,9 @@ case $basic_machine in
                basic_machine=hppa1.1-oki
                os=-proelf
                ;;
-       openrisc | openrisc-*)
+       or32 | or32-*)
                basic_machine=or32-unknown
-               ;;
-       os400)
-               basic_machine=powerpc-ibm
-               os=-os400
+               os=-coff
                ;;
        OSE68000 | ose68000)
                basic_machine=m68000-ericsson
@@ -815,61 +728,49 @@ case $basic_machine in
        pbb)
                basic_machine=m68k-tti
                ;;
-       pc532 | pc532-*)
+        pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
-       pc98)
-               basic_machine=i386-pc
-               ;;
-       pc98-*)
-               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
        pentium | p5 | k5 | k6 | nexgen | viac3)
                basic_machine=i586-pc
                ;;
-       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+       pentiumpro | p6 | 6x86 | athlon)
                basic_machine=i686-pc
                ;;
-       pentiumii | pentium2 | pentiumiii | pentium3)
+       pentiumii | pentium2)
                basic_machine=i686-pc
                ;;
-       pentium4)
-               basic_machine=i786-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-* | pentiumiii-* | pentium3-*)
+       pentiumii-* | pentium2-*)
                basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       pentium4-*)
-               basic_machine=i786-`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/^[^-]*-//'`
                ;;
@@ -880,10 +781,6 @@ case $basic_machine in
                basic_machine=i586-unknown
                os=-pw32
                ;;
-       rdos)
-               basic_machine=i386-pc
-               os=-rdos
-               ;;
        rom68k)
                basic_machine=m68k-rom68k
                os=-coff
@@ -904,16 +801,6 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
-       sb1)
-               basic_machine=mipsisa64sb1-unknown
-               ;;
-       sb1el)
-               basic_machine=mipsisa64sb1el-unknown
-               ;;
-       sei)
-               basic_machine=mips-sei
-               os=-seiux
-               ;;
        sequent)
                basic_machine=i386-sequent
                ;;
@@ -921,9 +808,6 @@ case $basic_machine in
                basic_machine=sh-hitachi
                os=-hms
                ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
        sparclite-wrs | simso-wrs)
                basic_machine=sparclite-wrs
                os=-vxworks
@@ -982,7 +866,7 @@ case $basic_machine in
        sun386 | sun386i | roadrunner)
                basic_machine=i386-sun
                ;;
-       sv1)
+        sv1)
                basic_machine=sv1-cray
                os=-unicos
                ;;
@@ -990,6 +874,10 @@ case $basic_machine in
                basic_machine=i386-sequent
                os=-dynix
                ;;
+       t3d)
+               basic_machine=alpha-cray
+               os=-unicos
+               ;;
        t3e)
                basic_machine=alphaev5-cray
                os=-unicos
@@ -1002,14 +890,6 @@ case $basic_machine in
                basic_machine=tic54x-unknown
                os=-coff
                ;;
-       tic55x | c55x*)
-               basic_machine=tic55x-unknown
-               os=-coff
-               ;;
-       tic6x | c6x*)
-               basic_machine=tic6x-unknown
-               os=-coff
-               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
@@ -1023,10 +903,6 @@ case $basic_machine in
        tower | tower-32)
                basic_machine=m68k-ncr
                ;;
-       tpf)
-               basic_machine=s390x-ibm
-               os=-tpf
-               ;;
        udi29k)
                basic_machine=a29k-amd
                os=-udi
@@ -1048,8 +924,8 @@ case $basic_machine in
                os=-vms
                ;;
        vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
+               basic_machine=f301-fujitsu
+               ;;
        vxworks960)
                basic_machine=i960-wrs
                os=-vxworks
@@ -1070,11 +946,11 @@ case $basic_machine in
                basic_machine=hppa1.1-winbond
                os=-proelf
                ;;
-       xbox)
-               basic_machine=i686-pc
-               os=-mingw32
+       windows32)
+               basic_machine=i386-pc
+               os=-windows32-msvcrt
                ;;
-       xps | xps100)
+        xps | xps100)
                basic_machine=xps100-honeywell
                ;;
        ymp)
@@ -1104,9 +980,6 @@ case $basic_machine in
        romp)
                basic_machine=romp-ibm
                ;;
-       mmix)
-               basic_machine=mmix-knuth
-               ;;
        rs6000)
                basic_machine=rs6000-ibm
                ;;
@@ -1123,13 +996,16 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+       sh3 | sh4 | sh3eb | sh4eb)
                basic_machine=sh-unknown
                ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b)
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparc | sparcv9 | sparcv9b)
                basic_machine=sparc-sun
                ;;
-       cydra)
+        cydra)
                basic_machine=cydra-cydrome
                ;;
        orion)
@@ -1144,6 +1020,10 @@ case $basic_machine in
        pmac | pmac-mpw)
                basic_machine=powerpc-apple
                ;;
+       c4x*)
+               basic_machine=c4x-none
+               os=-coff
+               ;;
        *-unknown)
                # Make sure to match an already-canonicalized machine name.
                ;;
@@ -1199,22 +1079,18 @@ case $os in
              | -aos* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
-             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -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* | -linux-newlib* | -linux-uclibc* \
-             | -uxpv* | -beos* | -mpeix* | -udk* \
-             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -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* | -palmos* | -uclinux* | -nucleus* \
-             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos*)
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1226,21 +1102,16 @@ case $os in
                        ;;
                esac
                ;;
-       -nto-qnx*)
-               ;;
        -nto*)
-               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               os=-nto-qnx
                ;;
        -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
              | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
                ;;
        -mac*)
                os=`echo $os | sed -e 's|mac|macos|'`
                ;;
-       -linux-dietlibc)
-               os=-linux-dietlibc
-               ;;
        -linux*)
                os=`echo $os | sed -e 's|linux|linux-gnu|'`
                ;;
@@ -1253,9 +1124,6 @@ case $os in
        -opened*)
                os=-openedition
                ;;
-        -os400*)
-               os=-os400
-               ;;
        -wince*)
                os=-wince
                ;;
@@ -1277,9 +1145,6 @@ case $os in
        -atheos*)
                os=-atheos
                ;;
-       -syllable*)
-               os=-syllable
-               ;;
        -386bsd)
                os=-bsd
                ;;
@@ -1290,7 +1155,7 @@ case $os in
                os=-rtmk-nova
                ;;
        -ns2 )
-               os=-nextstep2
+               os=-nextstep2
                ;;
        -nsk*)
                os=-nsk
@@ -1302,9 +1167,6 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
-        -tpf*)
-               os=-tpf
-               ;;
        -triton*)
                os=-sysv3
                ;;
@@ -1332,17 +1194,8 @@ case $os in
        -xenix)
                os=-xenix
                ;;
-       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-               os=-mint
-               ;;
-       -aros*)
-               os=-aros
-               ;;
-       -kaos*)
-               os=-kaos
-               ;;
-       -zvmoe)
-               os=-zvmoe
+        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
                ;;
        -none)
                ;;
@@ -1375,14 +1228,11 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
        # This must come before the *-dec entry.
        pdp10-*)
                os=-tops20
                ;;
-       pdp11-*)
+        pdp11-*)
                os=-none
                ;;
        *-dec | vax-*)
@@ -1421,15 +1271,9 @@ case $basic_machine in
        *-be)
                os=-beos
                ;;
-       *-haiku)
-               os=-haiku
-               ;;
        *-ibm)
                os=-aix
                ;;
-       *-knuth)
-               os=-mmixware
-               ;;
        *-wec)
                os=-proelf
                ;;
@@ -1481,19 +1325,19 @@ case $basic_machine in
        *-next)
                os=-nextstep3
                ;;
-       *-gould)
+        *-gould)
                os=-sysv
                ;;
-       *-highlevel)
+        *-highlevel)
                os=-bsd
                ;;
        *-encore)
                os=-bsd
                ;;
-       *-sgi)
+        *-sgi)
                os=-irix
                ;;
-       *-siemens)
+        *-siemens)
                os=-sysv4
                ;;
        *-masscomp)
@@ -1562,16 +1406,10 @@ case $basic_machine in
                        -mvs* | -opened*)
                                vendor=ibm
                                ;;
-                       -os400*)
-                               vendor=ibm
-                               ;;
                        -ptx*)
                                vendor=sequent
                                ;;
-                       -tpf*)
-                               vendor=ibm
-                               ;;
-                       -vxsim* | -vxworks* | -windiss*)
+                       -vxsim* | -vxworks*)
                                vendor=wrs
                                ;;
                        -aux*)
@@ -1595,7 +1433,7 @@ case $basic_machine in
 esac
 
 echo $basic_machine$os
-exit
+exit 0
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
index e074b316bcbbaae5ff227a587f82aa8834c43924..150fa76a0524741adcba28ac8adc984c17a8ce23 100755 (executable)
--- a/configure
+++ b/configure
@@ -9814,11 +9814,6 @@ echo "${ECHO_T}Solaris ($host) found." >&6
        else
            unet_poll_syscall=no
        fi
-
-cat >>confdefs.h <<\_ACEOF
-#define IRCU_SOLARIS 1
-_ACEOF
-
        ;;
 
     *-sunos*)
index 025a7b6e4d0febbd6c65910b9cbfc4f467ac5cd6..cece8246d4537be9968522a9905ccadbd6f21191 100644 (file)
@@ -19,7 +19,7 @@ dnl You should have received a copy of the GNU General Public License
 dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 dnl
-dnl $Id: configure.in,v 1.34.2.1 2005/12/14 03:01:38 entrope Exp $
+dnl $Id: configure.in,v 1.34 2005/07/17 00:18:58 entrope Exp $
 
 dnl Make sure we are in the correct directory (someone could have run
 dnl 'configure' with a wrong '--srcdir').
@@ -171,7 +171,6 @@ case "$host" in
        else
            unet_poll_syscall=no
        fi
-        AC_DEFINE([IRCU_SOLARIS], 1, [Define if building on Solaris])
        ;;
 
     *-sunos*)
index eb4f719171f627aad41cb3963ff2f6ef26338e6e..c4f7c8f8b7078f111028d78f53c82ace6a249bbd 100644 (file)
@@ -45,8 +45,7 @@ maintainer-clean: distclean
 depend:
 
 install:
-       test -d ${MANDIR}/man8 || mkdir ${MANDIR}/man8 || mkdir -p ${MANDIR}/man8
-       ${INSTALL} -m 644 ${srcdir}/ircd.8 ${MANDIR}/man8
+       cd ${srcdir} && (test -d ${MANDIR}/man8 || mkdir ${MANDIR}/man8 || mkdir -p ${MANDIR}/man8) 2> /dev/null && ${INSTALL} -m 644 ircd.8 ${MANDIR}/man8
 
 uninstall:
        ${RM} -f ${MANDIR}/man8/ircd.8
index 07a405c6a785b5b5a7a7aecacad385e3e9310545..d6ebc5a0d4faa8c7f8beffab104d98a584b06526 100644 (file)
@@ -686,13 +686,6 @@ HIS_WHO_HOPCOUNT
 As per UnderNet CFV-165, this replaces hopcount to a static 3 in
 replies to /WHO.
 
-HIS_MODEWHO
- * Type: boolean
- * Default: TRUE
-
-As per UnderNet CFV-165, this doesn't show which server performed a channel
-mode change.
-
 HIS_BANWHO
  * Type: boolean
  * Default: TRUE
@@ -867,22 +860,3 @@ CHANNELLEN
 This is the allowed length of locally created channels.  It may not be
 larger than the CHANNELLEN #define.  Like the NICKLEN feature, this is
 intended to ease changes in channel name length across a network.
-
-OPLEVELS
- * Type: boolean
- * Default: TRUE
-
-This allows local users to set the +A and +U modes (admin and user
-passwords, respectively) on channels where they are marked as channel
-managers.  This feature must be disabled until all servers on the
-network are able to interpret and handle these modes correctly.
-
-ZANNELS
- * Type: boolean
- * Default: TRUE
-
-This preserves empty channels with no admin password so that it is
-impractical to become the channel manager by clearing out the channel.
-It must be set to FALSE if there are both 2.10.11.x servers and
-2.10.12.y servers on the network where y < 4.  It should be set to
-TRUE whenever the OPLEVELS features is TRUE.
index 1e7858276f156e5332cb0da281ded906c4496dba..1df17de362dc2f33f3db78e2586833519e9fac27 100644 (file)
@@ -101,6 +101,9 @@ struct Client;
 #define MODE_LIMIT      0x0400         /**< +l Limit */
 #define MODE_REGONLY    0x0800         /**< Only +r users may join */
 #define MODE_DELJOINS   0x1000         /**< New join messages are delayed */
+#define MODE_NOCOLOUR   0x2000          /**< No mIRC/ANSI colors/bold */
+#define MODE_NOCTCP     0x4000          /**< No channel CTCPs */
+#define MODE_NONOTICE   0x8000          /**< No channel notices */
 #define MODE_SAVE      0x20000         /**< save this mode-with-arg 'til 
                                         * later */
 #define MODE_FREE      0x40000         /**< string needs to be passed to 
@@ -110,6 +113,8 @@ struct Client;
 #define MODE_APASS     0x200000
 #define MODE_WASDELJOINS 0x400000      /**< Not DELJOINS, but some joins 
                                         * pending */
+#define MODE_NOQUITPARTS 0x800000
+
 /** mode flags which take another parameter (With PARAmeterS)
  */
 #define MODE_WPARAS     (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS)
@@ -367,6 +372,7 @@ extern void send_hack_notice(struct Client *cptr, struct Client *sptr,
                              int parc, char *parv[], int badop, int mtype);
 extern struct Channel *get_channel(struct Client *cptr,
                                    char *chname, ChannelGetType flag);
+extern int SetAutoChanModes(struct Channel *chptr);
 extern struct Membership* find_member_link(struct Channel * chptr,
                                            const struct Client* cptr);
 extern int sub1_from_channel(struct Channel* chptr);
diff --git a/include/check.h b/include/check.h
new file mode 100644 (file)
index 0000000..97366d5
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * IRC - Internet Relay Chat, ircd/check.h
+ * Copyright (C) 1990 University of Oulu, Computing Center
+ *
+ * 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.
+ */
+
+/*
+ * - ASUKA ---------------------------------------------------------------------
+ * These are the declarations of the CHECK functions for Asuka.
+ * Some of this code is from previous QuakeNet ircds, and some of it is my own.
+ * The old code was written by Durzel (durzel@quakenet.org).
+ * 
+ * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+ * -----------------------------------------------------------------------------
+ */
+
+#ifndef INCLUDED_check_h
+#define INCLUDED_check_h
+
+#define HEADERLINE "--------------------------------------------------------------------"
+#define COLOR_OFF  '\017'
+
+extern void checkChannel(struct Client *sptr, struct Channel *chptr);
+extern void checkUsers(struct Client *sptr, struct Channel *chptr, int flags);
+extern void checkClient(struct Client *sptr, struct Client *acptr);
+extern void checkServer(struct Client *sptr, struct Client *acptr);
+extern signed int checkHostmask(struct Client *sptr, char *hoststr, int flags);
+
+#endif /* INCLUDED_check_h */
index 6818522bfa938e13be13e385dae96893ac044132..3ac890fd37969355dae75dcc8418df001f943d18 100644 (file)
@@ -90,7 +90,7 @@ typedef unsigned long flagpage_t;
 #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
 
 /** String containing valid user modes, in no particular order. */
-#define infousermodes "dioswkgx"
+#define infousermodes "dioswkgxRXInP"
 
 /** Operator privileges. */
 enum Priv
@@ -165,7 +165,15 @@ enum Flag
                                        don't display channels in /whois */
     FLAG_DEBUG,                     /**< send global debug/anti-hack info */
     FLAG_ACCOUNT,                   /**< account name has been set */
+    FLAG_ACCOUNTONLY,               /**< ASUKA_R: hide privmsgs/notices if
+                                     user is not authed or opered */
+    FLAG_PARANOID,                  /**< ASUKA_P: sends notices on whois */
     FLAG_HIDDENHOST,                /**< user's host is hidden */
+    FLAG_SETHOST,                   /**< ASUKA_h: oper's host is changed */
+    FLAG_NOCHAN,                    /**< user's channels are hidden */
+    FLAG_NOIDLE,                    /**< user's idletime is hidden */
+    FLAG_XTRAOP,                    /**< oper has special powers */
+
     FLAG_LAST_FLAG,                 /**< number of flags */
     FLAG_LOCAL_UMODES = FLAG_LOCOP, /**< First local mode flag */
     FLAG_GLOBAL_UMODES = FLAG_OPER  /**< First global mode flag */
@@ -579,13 +587,28 @@ struct Client {
 #define IsAccount(x)            HasFlag(x, FLAG_ACCOUNT)
 /** Return non-zero if the client has set mode +x (hidden host). */
 #define IsHiddenHost(x)         HasFlag(x, FLAG_HIDDENHOST)
+/** Return non-zero if the client has set mode +X (xtraop) */
+#define IsXtraOp(x)             HasFlag(x, FLAG_XTRAOP)
+/** Return non-zero if the client has set mode +n (hide channels) */
+#define IsNoChan(x)             HasFlag(x, FLAG_NOCHAN)
+/** Return non-zero if the client has set mode +I (hide idletime) */
+#define IsNoIdle(x)             HasFlag(x, FLAG_NOIDLE)
 /** Return non-zero if the client has an active PING request. */
 #define IsPingSent(x)           HasFlag(x, FLAG_PINGSENT)
+/** Return non-zero if the client should not receive privmsgs/notices
+ * from unauthed users */
+#define IsAccountOnly(x)        HasFlag(x, FLAG_ACCOUNTONLY)
+/** Return non-zero if the client should receive notices when someone
+ * does a whois on it. */
+#define IsParanoid(x)           HasFlag(x, FLAG_PARANOID)
 
 /** Return non-zero if the client has operator or server privileges. */
 #define IsPrivileged(x)         (IsAnOper(x) || IsServer(x))
 /** Return non-zero if the client's host is hidden. */
 #define HasHiddenHost(x)        (IsHiddenHost(x) && IsAccount(x))
+/** Return non-zero if the client is using a spoofhost */
+#define IsSetHost(x)            HasFlag(x, FLAG_SETHOST)
+#define HasSetHost(x)           (IsSetHost(x))
 
 /** Mark a client as having an in-progress net.burst. */
 #define SetBurst(x)             SetFlag(x, FLAG_BURST)
@@ -625,8 +648,20 @@ struct Client {
 #define SetAccount(x)           SetFlag(x, FLAG_ACCOUNT)
 /** Mark a client as having mode +x (hidden host). */
 #define SetHiddenHost(x)        SetFlag(x, FLAG_HIDDENHOST)
+/** Mark a client as having mode +h (spoofhost). */
+#define SetSetHost(x)           SetFlag(x, FLAG_SETHOST)
+/** Mark a client as having mode +X (xtraop). */
+#define SetXtraOp(x)            SetFlag(x, FLAG_XTRAOP)
+/** Mark a client as having mode +n (hide channels). */
+#define SetNoChan(x)            SetFlag(x, FLAG_NOCHAN)
+/** Mark a client as having mode +I (hide idletime). */
+#define SetNoIdle(x)            SetFlag(x, FLAG_NOIDLE)
 /** Mark a client as having a pending PING. */
 #define SetPingSent(x)          SetFlag(x, FLAG_PINGSENT)
+/** Mark a client as having mode +R (account only). */
+#define SetAccountOnly(x)       SetFlag(x, FLAG_ACCOUNTONLY)
+/** Mark a client as having mode +P (paranoid). */
+#define SetParanoid(x)          SetFlag(x, FLAG_PARANOID)
 
 /** Return non-zero if \a sptr sees \a acptr as an operator. */
 #define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
@@ -658,8 +693,20 @@ struct Client {
 #define ClearServNotice(x)      ClrFlag(x, FLAG_SERVNOTICE)
 /** Remove mode +x (hidden host) from the client. */
 #define ClearHiddenHost(x)      ClrFlag(x, FLAG_HIDDENHOST)
+/** Remove mode +h (spoofhost) from a client. */
+#define ClearSetHost(x)         ClrFlag(x, FLAG_SETHOST)
+/** Remove mode +X (xtraop) from a client. */
+#define ClearXtraOp(x)          ClrFlag(x, FLAG_XTRAOP)
+/** Remove mode +n (hide channels) from a client. */
+#define ClearNoChan(x)          ClrFlag(x, FLAG_NOCHAN)
+/** Remove mode +I (hide idletime) from a client. */
+#define ClearNoIdle(x)          ClrFlag(x, FLAG_NOIDLE)
 /** Clear the client's pending PING flag. */
 #define ClearPingSent(x)        ClrFlag(x, FLAG_PINGSENT)
+/** Remove mode +R (account only) from a client */
+#define ClearAccountOnly(x)     ClrFlag(x, FLAG_ACCOUNTONLY)
+/** Remove mode +P (paranoid) from a client */
+#define ClearParanoid(x)        ClrFlag(x, FLAG_PARANOID)
 
 /* free flags */
 #define FREEFLAG_SOCKET        0x0001  /**< socket needs to be freed */
@@ -704,7 +751,7 @@ struct Client {
 /** Server notice bits enabled by default for normal users. */
 #define SNO_DEFAULT (SNO_NETWORK|SNO_OPERKILL|SNO_GLINE)
 /** Server notice bits enabled by default for IRC operators. */
-#define SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_HACK4|SNO_THROTTLE|SNO_OLDSNO)
+#define SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_THROTTLE|SNO_OLDSNO)
 /** Server notice bits reserved to IRC operators. */
 #define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP|SNO_AUTH)
 /** Noisy server notice bits that cause other bits to be cleared during connect. */
index 245cd9c460196da86ee96504426a05ed4c8a6de6..0129b7a276bac188f88fc99fd63bc567de8d278b 100644 (file)
 struct Client;
 struct StatDesc;
 
-#define GLINE_MAX_EXPIRE 604800        /**< max expire: 7 days */
+#define GLINE_MAX_EXPIRE 31536000      /**< max expire: 1 year */
 
 /** Description of a G-line. */
 struct Gline {
   struct Gline *gl_next;      /**< Next G-line in linked list. */
   struct Gline**gl_prev_p;    /**< Previous pointer to this G-line. */
+  char        *gl_nick;      /**< Nickname mask. */
   char        *gl_user;      /**< Username mask (or channel/realname mask). */
   char        *gl_host;      /**< Host prtion of mask. */
   char        *gl_reason;    /**< Reason for G-line. */
@@ -84,6 +85,8 @@ struct Gline {
 /** Test whether \a g is local to this server. */
 #define GlineIsLocal(g)                ((g)->gl_flags & GLINE_LOCAL)
 
+/** Return nick mask of a G-line. */
+#define GlineNick(g)           ((g)->gl_nick)
 /** Return user mask of a G-line. */
 #define GlineUser(g)           ((g)->gl_user)
 /** Return host mask of a G-line. */
@@ -113,5 +116,6 @@ extern int gline_list(struct Client *sptr, char *userhost);
 extern void gline_stats(struct Client *sptr, const struct StatDesc *sd,
                         char *param);
 extern int gline_memory_count(size_t *gl_size);
+extern struct Gline *IsNickGlined(struct Client *cptr, char *nick);
 
 #endif /* INCLUDED_gline_h */
index 36c80fb2b8e87a3aeef611124cfe39003236d4df..16d8926dc3df2fee259e254d2e883db590f40553 100644 (file)
@@ -88,6 +88,19 @@ struct Client;
 
 extern int m_admin(struct Client*, struct Client*, int, char*[]);
 extern int m_away(struct Client*, struct Client*, int, char*[]);
+
+/*
+  * - ASUKA ---------------------------------------------------------------------
+  * Add the command for CHECK.
+  * This was adapted from Lain for use in Asuka.
+  * Original code by Durzel (durzel@quakenet.org).
+  *
+  * qoreQ (qoreQ@quakenet.org) - 08/30/2002
+  * -----------------------------------------------------------------------------
+  */
+
+extern int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]);
+
 extern int m_cap(struct Client*, struct Client*, int, char*[]);
 extern int m_cnotice(struct Client*, struct Client*, int, char*[]);
 extern int m_cprivmsg(struct Client*, struct Client*, int, char*[]);
@@ -124,6 +137,7 @@ extern int m_proto(struct Client*, struct Client*, int, char*[]);
 extern int m_pseudo(struct Client*, struct Client*, int, char*[]);
 extern int m_quit(struct Client*, struct Client*, int, char*[]);
 extern int m_registered(struct Client*, struct Client*, int, char*[]);
+extern int m_sethost(struct Client*, struct Client*, int, char*[]);
 extern int m_silence(struct Client*, struct Client*, int, char*[]);
 extern int m_stats(struct Client*, struct Client*, int, char*[]);
 extern int m_time(struct Client*, struct Client*, int, char*[]);
index 7d95540a75540e45d099949bb9361dff5bc21a15..e1816a12d95e10f35ba4bcde9bab4f1b9a37fe73 100644 (file)
@@ -68,7 +68,7 @@
  * with the ACCOUNT (AC) command.  This is used for keeping track of who's
  * logged into which account, for the benefit of irc services.
  */
-#define ACCOUNTLEN      12
+#define ACCOUNTLEN      15
 /** Maximum length for user supplied information about a client
  * connection (gcos). This information is set at client/server registration
  * time.
@@ -83,7 +83,7 @@
 #define SOCKIPLEN 45
 /** Maximum length for channel topics and kill comments.
  */
-#define TOPICLEN        160
+#define TOPICLEN        250
 /** Maximum length for away messages.
  */
 #define AWAYLEN                160
@@ -95,7 +95,7 @@
 /** Maximum available targets for a user. */
 #define MAXTARGETS      20
 /** Starting free targets for a user. */
-#define STARTTARGETS    10
+#define STARTTARGETS    20
 /** Target number to start assigning new targets. */
 #define RESERVEDTARGETS 12
 
index 4436fd74cb6922a90580481972a74aba9ade0063..953b9437b6cd20cc0f7533c90e199329a659ffd2 100644 (file)
@@ -54,11 +54,15 @@ enum Feature {
   FEAT_HOST_HIDING,
   FEAT_HIDDEN_HOST,
   FEAT_HIDDEN_IP,
+  FEAT_AUTOINVISIBLE,
   FEAT_CONNEXIT_NOTICES,
+  FEAT_USER_HIDECHANS,
   FEAT_OPLEVELS,
   FEAT_ZANNELS,
   FEAT_LOCAL_CHANNELS,
   FEAT_TOPIC_BURST,
+  FEAT_AUTOCHANMODES,
+  FEAT_AUTOCHANMODES_LIST,
 
   /* features that probably should not be touched */
   FEAT_KILLCHASETIMELIMIT,
@@ -97,7 +101,12 @@ enum Feature {
   FEAT_ANNOUNCE_INVITES,
 
   /* features that affect all operators */
+  FEAT_EXTENDED_CHECKCMD,
   FEAT_CONFIG_OPERCMDS,
+  FEAT_SETHOST,
+  FEAT_SETHOST_FREEFORM,
+  FEAT_SETHOST_USER,
+  FEAT_SETHOST_AUTO,
 
   /* HEAD_IN_SAND Features */
   FEAT_HIS_SNOTICES,
@@ -126,6 +135,7 @@ enum Feature {
   FEAT_HIS_STATS_q,
   FEAT_HIS_STATS_R,
   FEAT_HIS_STATS_r,
+  FEAT_HIS_STATS_s,
   FEAT_HIS_STATS_t,
   FEAT_HIS_STATS_T,
   FEAT_HIS_STATS_u,
@@ -141,15 +151,19 @@ enum Feature {
   FEAT_HIS_WHOIS_LOCALCHAN,
   FEAT_HIS_WHO_SERVERNAME,
   FEAT_HIS_WHO_HOPCOUNT,
+  FEAT_HIS_WHO_FILTERIP,
   FEAT_HIS_MODEWHO,
   FEAT_HIS_BANWHO,
   FEAT_HIS_KILLWHO,
+  /* Asuka - Reimplement HEAD_IN_SAND_GLINE from Lain */
+  FEAT_HIS_GLINE,
   FEAT_HIS_REWRITE,
   FEAT_HIS_REMOTE,
   FEAT_HIS_NETSPLIT,
   FEAT_HIS_SERVERNAME,
   FEAT_HIS_SERVERINFO,
   FEAT_HIS_URLSERVERS,
+  FEAT_HIS_USERGLINE,
 
   /* Misc. random stuff */
   FEAT_NETWORK,
index d50590ec92e2c1bbe5fe22af82671c52304c412b..472ca8b903ae93004ee7db90ed2777f0d3869808 100644 (file)
@@ -65,6 +65,7 @@ enum LogSys {
   LS_SOCKET,     /**< Unexpected socket operation errors. */
   LS_IAUTH,      /**< IAuth status. */
   LS_DEBUG,      /**< Debug messages. */
+  LS_SETHOST,    /**< Usage of the sethost command. */
   LS_LAST_SYSTEM /**< Count of valid LogSys values. */
 };
 
index 212852cc19b84ee126186c364dbabee3531b4021..f0ebe3c944434561af29be82476181f3ea97c29d 100644 (file)
@@ -260,6 +260,9 @@ struct Client;
 #define TOK_SERVSET             "SERVSET"
 #define CMD_SERVSET            MSG_SERVSET, TOK_SERVSET
 
+#define MSG_CHECK       "CHECK"
+#define TOK_CHECK       "CC"
+
 #define MSG_REHASH              "REHASH"        /* REHA */
 #define TOK_REHASH              "REHASH"
 #define CMD_REHASH             MSG_REHASH, TOK_REHASH
@@ -356,6 +359,10 @@ struct Client;
 #define TOK_PRIVS              "PR"
 #define CMD_PRIVS               MSG_PRIVS, TOK_PRIVS
 
+#define MSG_SETHOST            "SETHOST"       /* SETHOST */
+#define TOK_SETHOST            "SH"
+#define CMD_SETHOST            MSG_SETHOST, TOK_SETHOST
+
 #define MSG_CAP                        "CAP"
 #define TOK_CAP                        "CAP"
 #define CMD_CAP                        MSG_CAP, TOK_CAP
index d98e71359ca807e17d6c6f4747d06c1857fee356..3e5fd204ce8b91a902f22e002a4fcb63aac2c59b 100644 (file)
@@ -181,14 +181,14 @@ extern const struct Numeric* get_error_numeric(int err);
 #define RPL_ENDOFGLIST       281        /* Undernet extension */
 #define RPL_JUPELIST         282        /* Undernet extension - jupe -Kev */
 #define RPL_ENDOFJUPELIST    283        /* Undernet extension - jupe -Kev */
-#define RPL_FEATURE         284        /* Undernet extension - features */
-/*      RPL_CHANINFO_HANDLE  285           aircd */
-/*      RPL_CHANINFO_USERS   286           aircd */
-/*      RPL_CHANINFO_CHOPS   287           aircd */
-/*      RPL_CHANINFO_VOICES  288           aircd */
-/*      RPL_CHANINFO_AWAY    289           aircd */
-/*      RPL_CHANINFO_OPERS   290           aircd */
-/*     RPL_HELPHDR          290        Numeric List: Dalnet */
+#define RPL_FEATURE          284        /* QuakeNet - Asuka */
+#define RPL_NEWHOSTIS        285        /* QuakeNet - Asuka */
+#define RPL_CHKHEAD          286        /* QuakeNet - Asuka */
+#define RPL_CHANUSER         287        /* QuakeNet - Asuka */
+#define RPL_PATCHHEAD        288        /* QuakeNet - Asuka */
+#define RPL_PATCHCON         289        /* QuakeNet - Asuka */
+#define RPL_DATASTR          290        /* QuakeNet - Asuka */
+#define RPL_ENDOFCHECK       291        /* QuakeNet - Asuka */
 /*      RPL_CHANINFO_BANNED  291           aircd */
 /*     RPL_HELPOP           291        Numeric List: Dalnet */
 /*      RPL_CHANINFO_BANS    292           aircd */
@@ -207,7 +207,7 @@ extern const struct Numeric* get_error_numeric(int err);
 #define RPL_AWAY             301
 #define RPL_USERHOST         302
 #define RPL_ISON             303
-/*      RPL_TEXT             304       unused */
+#define RPL_TEXT             304       /* unused */
 #define RPL_UNAWAY           305
 #define RPL_NOWAWAY          306
                                         /* NotAway, aircd */
@@ -312,6 +312,8 @@ extern const struct Numeric* get_error_numeric(int err);
 /*      RPL_END_USERS        394        Dalnet/EFnet/IRCnet */
 /*      RPL_NOUSERS          395        Dalnet/EFnet/IRCnet */
 #define RPL_HOSTHIDDEN       396       /* UMODE +x completed succesfuly */
+#define RPL_STATSSLINE       398       /* QuakeNet extension -froo */
+#define RPL_USINGSLINE       399       /* QuakeNet extension -froo */
 
 /*
  * Errors are in the range from 400-599 currently and are grouped by what
@@ -325,6 +327,7 @@ extern const struct Numeric* get_error_numeric(int err);
 #define ERR_TOOMANYCHANNELS  405
 #define ERR_WASNOSUCHNICK    406
 #define ERR_TOOMANYTARGETS   407
+#define ERR_SEARCHNOMATCH    408                /* QuakeNet - Asuka */
 /*      ERR_NOSUCHSERVICE    408  IRCnet */
 /*     ERR_NOCOLORSONCHAN   408  Dalnet */
 #define ERR_NOORIGIN         409
@@ -408,10 +411,12 @@ extern const struct Numeric* get_error_numeric(int err);
 /*     ERR_DESYNC           484         Dalnet,PTlink */
 /*     ERR_ATTACKDENY       484         unreal */
 /*     ERR_RESTRICTED       484           IRCnet extension */
+#define ERR_ISREALSERVICE    485        /* QuakeNet/ASUKA extension */
 /*      ERR_UNIQOPRIVSNEEDED 485           IRCnet extension */
 /*     ERR_KILLDENY         485           unreal */
 /*     ERR_CANTKICKADMIN    485           PTlink */
 /*     ERR_HTMDISABLED      486           unreal */
+#define ERR_ACCOUNTONLY      486       /* QuakeNet/ASUKA extension */
 /*      ERR_CHANTOORECENT    487           IRCnet extension (?) */
 /*      ERR_TSLESSCHAN       488           IRCnet extension (?) */
 #define ERR_VOICENEEDED      489        /* Undernet extension */
@@ -454,7 +459,9 @@ extern const struct Numeric* get_error_numeric(int err);
        ERR_LISTSYNTAX       521        dalnet
        ERR_WHOSYNTAX        522        dalnet
        ERR_WHOLIMEXCEED     523        dalnet */
-#define ERR_QUARANTINED      524       /* Undernet extension -Vampire */
+#define ERR_QUARANTINED      524        /* Undernet extension -Vampire */
+#define ERR_BADHOSTMASK      530       /* QuakeNet extension -froo */
+#define ERR_HOSTUNAVAIL      531       /* QuakeNet extension -froo */
 
 #define ERR_NOTLOWEROPLEVEL  560       /* Undernet extension */
 #define ERR_NOTMANAGER       561       /* Undernet extension */
index 488ba4cd462de0412cd3a76669e28b07cbc650e7..5f119ced35d943a67425ff06e037df42870a4fac 100644 (file)
@@ -80,6 +80,20 @@ struct qline
   char *reason;       /**< Reason for quarantine. */
 };
 
+struct sline {
+  struct sline *next;
+  char *spoofhost;
+  char *passwd;
+  char *realhost;
+  char *username;
+  struct irc_in_addr address;
+  unsigned int flags;
+  char bits; /* Number of bits for CIDR match on realhost */
+};
+
+#define SLINE_FLAGS_HOSTNAME 0x0001 /* S-line by hostname */
+#define SLINE_FLAGS_IP       0x0002 /* S-line by IP address/CIDR */
+
 /** Local K-line structure. */
 struct DenyConf {
   struct DenyConf*    next;     /**< Next DenyConf in #denyConfList. */
@@ -157,6 +171,7 @@ extern struct ConfItem* GlobalConfList;
 extern int              GlobalConfCount;
 extern struct s_map*    GlobalServiceMapList;
 extern struct qline*    GlobalQuarantineList;
+extern struct sline*   GlobalSList;
 
 /*
  * Proto types
@@ -181,13 +196,18 @@ extern struct ConfItem* find_conf_exact(const char* name, struct Client *cptr, i
 extern enum AuthorizationCheckResult conf_check_client(struct Client *cptr);
 extern int  conf_check_server(struct Client *cptr);
 extern int rehash(struct Client *cptr, int sig);
-extern int find_kill(struct Client *cptr);
+extern int find_kill(struct Client *cptr, int glinecheck);
 extern const char *find_quarantine(const char* chname);
 extern void lookup_confhost(struct ConfItem *aconf);
 extern void conf_parse_userhost(struct ConfItem *aconf, char *host);
 extern struct ConfItem *conf_debug_iline(const char *client);
 extern void free_mapping(struct s_map *smap);
 
+extern void conf_add_sline(const char* const* fields, int count);
+extern void clear_slines(void);
+extern int conf_check_slines(struct Client *cptr);
+extern void free_spoofhost(struct sline *spoof);
+
 extern void yyerror(const char *msg);
 
 #endif /* INCLUDED_s_conf_h */
index 6768f68b1c7e48c35e90e65f60d15dd982ca9eb5..4741df64d1c883555ab93767a6d80784d94b6eb9 100644 (file)
@@ -76,6 +76,8 @@ extern void send_user_info(struct Client* to, char* names, int rpl,
                            InfoFormatter fmt);
 
 extern int hide_hostmask(struct Client *cptr, unsigned int flags);
+extern int set_hostmask(struct Client *cptr, char *hostmask, char *password);
+extern int is_hostmask(char *word);
 extern int set_user_mode(struct Client *cptr, struct Client *sptr,
                          int parc, char *parv[]);
 extern int is_silenced(struct Client *sptr, struct Client *acptr);
index 361f1aea410a1da636d8e480b594fff3e456ab54..358336904f4f40022e085629bd6998bf5b678c08 100644 (file)
@@ -79,10 +79,11 @@ struct User {
    * overwritten with the ident response.
    */
   char               username[USERLEN + 1];
-  char               host[HOSTLEN + 1];       /**< displayed hostname */
-  char               realhost[HOSTLEN + 1];   /**< actual hostname */
-  char               account[ACCOUNTLEN + 1]; /**< IRC account name */
-  time_t            acc_create;              /**< IRC account timestamp */
+  char               host[HOSTLEN + 1];         /**< displayed hostname */
+  char               realusername[USERLEN + 1]; /**< actual username */
+  char               realhost[HOSTLEN + 1];     /**< actual hostname */
+  char               account[ACCOUNTLEN + 1];   /**< IRC account name */
+  time_t            acc_create;                /**< IRC account timestamp */
 };
 
 #endif /* INCLUDED_struct_h */
index 0fc1ac10dadd72ccbccd869e4bbb97504c7ae3cc..cd3eab341771385bde68359c087be3da54e9f017 100644 (file)
@@ -64,7 +64,7 @@
                         feature_int(FEAT_CHANNELLEN), CHANNELLEN
 
 #define FEATURESVALUES2 (feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#"), "(ov)@+", "@+", \
-                        (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDd" : "b,k,l,imnpstrDd"), \
+                        (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDducCN" : "b,k,l,imnpstrDducCN"), \
                         "rfc1459", feature_str(FEAT_NETWORK)
 
 #endif /* INCLUDED_supported_h */
index ab1e045fb81dbcf5ecf800e11b27ad85dd972784..f8aecf046a9f4026ed269444cedf700a7e2fe2c0 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
-# $Id: ircd-patch,v 1.5.2.1 2005/12/29 03:41:56 entrope Exp $
+# $Id: ircd-patch,v 1.5 2002/04/12 13:00:35 vampire Exp $
 #
 #
 # Experimental centralized patch system for ircu
@@ -48,15 +48,15 @@ done
 update_patchlist() {
        list=""
        for name in $PLIST ; do
-               test -f $MARKS/$name && list="$list.$name"
+               [ -f $MARKS/$name ] && list="$list.$name"
        done
        echo "/* This file was automatically generated by ircd-patch */" > $PLIST_FILE
        echo "#define PATCHLIST \"$list\"" >> $PLIST_FILE
        echo "Updated $PLIST_FILE"
 }
 
-test -d $DIFFS || (echo "*** Missing $DIFFS, creating it" ; mkdir -p $DIFFS)
-test -d $MARKS || (echo "*** Missing $MARKS, creating it" ; mkdir -p $MARKS)
+[ ! -d $DIFFS ] && (echo "*** Missing $DIFFS, creating it" ; mkdir -p $DIFFS)
+[ ! -d $MARKS ] && (echo "*** Missing $MARKS, creating it" ; mkdir -p $MARKS)
 
 dry_run() {
        rejects=`patch -p0 -N -t --dry-run $2 < $1 | grep "hunk FAILED" | sed -e 's/.*to file /  /;s/\.rej$//'`
@@ -66,7 +66,7 @@ dry_run() {
 patch_list() {
        echo "Available patches (* marks applied patches):"
        for name in $PLIST ; do
-               test -f $MARKS/$name && echo -n " * " || echo -n "   "
+               [ -f $MARKS/$name ] && echo -n " * " || echo -n "   "
                echo $name
        done
        echo "Done."
@@ -75,11 +75,11 @@ patch_list() {
 patch_test() {
        echo "Testing patches:"
        list="$*"
-       test "z$list" = "z" && list=$PLIST
+       [ -z "$list" ] && list=$PLIST
        for name in $list ; do
                fname=$DIFFS/$name.diff
                echo -ne "  $name\t"
-               if test ! -f $MARKS/$name ; then
+               if [ ! -f $MARKS/$name ] ; then
                        if dry_run "$fname" ; then
                                echo -n " OK"
                        else
@@ -103,19 +103,19 @@ patch_test() {
 patch_add() {
        name=$1
        fname="$DIFFS/$name.diff"
-       if test ! -f $fname ; then
+       if [ ! -f $fname ]; then
                echo "Patch $name ($fname) does not exist"
                retcode=3
                return
        fi
 
-       if test $force -lt 2 -a -f $MARKS/$name ; then
+       if [ $force -lt 2 -a -f $MARKS/$name ] ; then
                echo "Patch $name seems already applied"
                retcode=4
                return
        fi
 
-       if test $force -lt 1 ; then
+       if [ $force -lt 1 ]; then
                echo -n "Testing $fname... "
                if ! dry_run $fname ; then
                        echo "Failed (use -f to force)."
@@ -140,19 +140,19 @@ patch_add() {
 patch_del() {
        name=$1
        fname="$DIFFS/$name.diff"
-       if test ! -f $fname ; then
+       if [ ! -f $fname ]; then
                echo "Patch $name ($fname) does not exist"
                retcode=3
                return
        fi
 
-       if test $force -lt 2 -a ! -f $MARKS/$name ; then
+       if [ $force -lt 2 -a ! -f $MARKS/$name ] ; then
                echo "Patch $name doesn't seem to be applied"
                retcode=4
                return
        fi
 
-       if test $force -lt 1 ; then
+       if [ $force -lt 1 ]; then
                echo -n "Testing $fname... "
                if ! dry_run $fname -R ; then
                        echo "Failed (use -f to force)."
@@ -188,8 +188,8 @@ do_help() {
        echo "a patch is already applied."
 }
 
-while test "$1" = "-f" ; do
-       force=`expr $force + 1`
+while [ "$1" == "-f" ]; do
+       force=$[$force + 1]
        shift
 done
 
index 5e6f631c3b36df3ed5bba9e80ccf7534eb09dd72..86e09d92db138c1e640781c74738014c2e395a35 100644 (file)
@@ -5,7 +5,6 @@ ircd
 chkconf
 table_gen
 umkpasswd
-convert-conf
 chattr.tab.c
 lex.yy.c
 y.tab.c
index c3cb5862e6bc1148e99672a7ad42253f300b36c3..a77d69630ed10a9b6ce42877ea0602d04835493e 100644 (file)
@@ -285,9 +285,7 @@ int ip_registry_check_local(const struct irc_in_addr *addr, time_t* next_target_
    */
   if (0 == ++entry->connected)
   {
-    entry->connected--;
-    Debug((DEBUG_DNS, "IPcheck refusing local connection from %s: counter overflow.", ircd_ntoa(&entry->addr)));
-    return 0;
+    ++entry->connected;
   }
 
   if (CONNECTED_SINCE(entry->last_connect) > IPCHECK_CLONE_PERIOD)
index 027fd6e99ab8acbc2740f979d4031d857a1c08f5..01a5ea6b81508f9dfb8807c52450ccc5f8d3bf79 100644 (file)
@@ -119,6 +119,7 @@ IRCD_SRC = \
        m_away.c \
        m_burst.c \
        m_cap.c \
+       m_check.c \
        m_clearmode.c \
        m_close.c \
        m_connect.c \
@@ -167,6 +168,7 @@ IRCD_SRC = \
        m_rpong.c \
        m_server.c \
        m_set.c \
+       m_sethost.c \
        m_settime.c \
        m_silence.c \
        m_squit.c \
index e357f2f26de3486bcb5516f6256495031174e41e..b268b632d37f5f26abdf45728a44eb01062b2245 100644 (file)
@@ -383,7 +383,7 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist)
   ircd_ntoa_r(iphost, &cli_ip(cptr));
   if (!IsAccount(cptr))
     sr = NULL;
-  else if (HasHiddenHost(cptr))
+  else if (HasHiddenHost(cptr) || HasSetHost(cptr))
     sr = cli_user(cptr)->realhost;
   else
   {
@@ -743,7 +743,7 @@ int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int r
   /*
    * Servers can always speak on channels.
    */
-  if (IsServer(cptr))
+  if (IsServer(cptr) || IsXtraOp(cptr))
     return 1;
 
   member = find_channel_member(cptr, chptr);
@@ -828,6 +828,14 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, int buflen,
     *mbuf++ = 'n';
   if (chptr->mode.mode & MODE_REGONLY)
     *mbuf++ = 'r';
+  if (chptr->mode.mode & MODE_NOCOLOUR)
+    *mbuf++ = 'c';
+  if (chptr->mode.mode & MODE_NOCTCP)
+    *mbuf++ = 'C';
+  if (chptr->mode.mode & MODE_NONOTICE)
+    *mbuf++ = 'N';
+  if (chptr->mode.mode & MODE_NOQUITPARTS)
+    *mbuf++ = 'u';
   if (chptr->mode.mode & MODE_DELJOINS)
     *mbuf++ = 'D';
   else if (MyUser(cptr) && (chptr->mode.mode & MODE_WASDELJOINS))
@@ -842,7 +850,7 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, int buflen,
     *mbuf++ = 'k';
     if (previous_parameter)
       strcat(pbuf, " ");
-    if (is_chan_op(cptr, chptr) || IsServer(cptr)) {
+    if (is_chan_op(cptr, chptr) || IsServer(cptr) || IsOper(cptr)) {
       strcat(pbuf, chptr->mode.key);
     } else
       strcat(pbuf, "*");
@@ -1293,6 +1301,53 @@ struct Channel *get_channel(struct Client *cptr, char *chname, ChannelGetType fl
   return chptr;
 }
 
+int SetAutoChanModes(struct Channel *chptr)
+{
+  static int chan_flags[] = {
+    MODE_PRIVATE,       'p',
+    MODE_SECRET,        's',
+    MODE_MODERATED,     'm',
+    MODE_TOPICLIMIT,    't',
+    MODE_INVITEONLY,    'i',
+    MODE_NOPRIVMSGS,    'n',
+    MODE_REGONLY,       'r',
+    MODE_NOCOLOUR,      'c',
+    MODE_NOCTCP,        'C',
+    MODE_NONOTICE,      'N',
+    MODE_DELJOINS,      'D',
+    MODE_NOQUITPARTS,   'u'
+  };
+
+  unsigned int *flag_p;
+  unsigned int t_mode;
+  const char *modestr;
+
+  t_mode = 0;
+
+  assert(0 != chptr);
+
+  if (!feature_bool(FEAT_AUTOCHANMODES) || !feature_str(FEAT_AUTOCHANMODES_LIST) || strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) <= 1)
+    return(-1);
+
+  modestr = feature_str(FEAT_AUTOCHANMODES_LIST);
+
+  for (; *modestr; modestr++) {
+    for (flag_p = chan_flags; flag_p[0]; flag_p += 2) /* look up flag */
+      if (flag_p[1] == *modestr)
+        break;
+
+    if (!flag_p[0]) /* didn't find it */
+      continue;
+
+    t_mode |= flag_p[0]; 
+
+  } /* for (; *modestr; modestr++) { */
+
+  if (t_mode != 0)
+    chptr->mode.mode = t_mode;
+  return(0);
+}
+
 /** invite a user to a channel.
  *
  * Adds an invite for a user to a channel.  Limits the number of invites
@@ -1542,6 +1597,10 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
     MODE_LIMIT,                'l',
 /*  MODE_APASS,                'A', */
 /*  MODE_UPASS,                'U', */
+    MODE_NOQUITPARTS,   'u',
+    MODE_NOCOLOUR,      'c',
+    MODE_NOCTCP,        'C',
+    MODE_NONOTICE,     'N',
     0x0, 0x0
   };
   static int local_flags[] = {
@@ -1950,8 +2009,9 @@ modebuf_mode(struct ModeBuf *mbuf, unsigned int mode)
   assert(0 != (mode & (MODE_ADD | MODE_DEL)));
 
   mode &= (MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | MODE_MODERATED |
-          MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY |
-           MODE_DELJOINS | MODE_WASDELJOINS);
+           MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY |
+           MODE_DELJOINS | MODE_WASDELJOINS | MODE_NOQUITPARTS  | MODE_NOCOLOUR |
+           MODE_NOCTCP | MODE_NONOTICE);
 
   if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */
     return;
@@ -2098,6 +2158,10 @@ modebuf_extract(struct ModeBuf *mbuf, char *buf)
     MODE_LIMIT,                'l',
     MODE_REGONLY,      'r',
     MODE_DELJOINS,      'D',
+    MODE_NOQUITPARTS,   'u',
+    MODE_NOCOLOUR,      'c',
+    MODE_NOCTCP,        'C',
+    MODE_NONOTICE,      'N',
     0x0, 0x0
   };
   unsigned int add;
@@ -3023,17 +3087,29 @@ mode_process_clients(struct ParseState *state)
     if ((state->cli_change[i].flag & (MODE_DEL | MODE_CHANOP)) ==
        (MODE_DEL | MODE_CHANOP)) {
       /* prevent +k users from being deopped */
-      if (IsChannelService(state->cli_change[i].client)) {
+      /*
+       * ASUKA_X:
+       * Allow +X'ed users to mess with +k'ed.
+       * --Bigfoot
+       */
+      if ((IsChannelService(state->cli_change[i].client) && IsService(cli_user(state->cli_change[i].client)->server)) || (IsChannelService(state->cli_change[i].client) && !IsXtraOp(state->sptr))) {
        if (state->flags & MODE_PARSE_FORCE) /* it was forced */
          sendto_opmask_butone(0, SNO_HACK4, "Deop of +k user on %H by %s",
                               state->chptr,
                               (IsServer(state->sptr) ? cli_name(state->sptr) :
                                cli_name((cli_user(state->sptr))->server)));
 
-       else if (MyUser(state->sptr) && state->flags & MODE_PARSE_SET) {
-         send_reply(state->sptr, ERR_ISCHANSERVICE,
-                    cli_name(state->cli_change[i].client),
-                    state->chptr->chname);
+        else if (MyUser(state->sptr) && state->flags & MODE_PARSE_SET && (state->sptr != state->cli_change[i].client)) {
+          if(IsService(cli_user(state->cli_change[i].client)->server) && IsChannelService(state->cli_change[i].client)){
+            send_reply(state->sptr, ERR_ISREALSERVICE,
+                     cli_name(state->cli_change[i].client),
+                     state->chptr->chname);
+          }else{
+            send_reply(state->sptr, ERR_ISCHANSERVICE,
+                     cli_name(state->cli_change[i].client),
+                     state->chptr->chname);
+          }
+
          continue;
        }
       }
@@ -3176,6 +3252,10 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr,
     MODE_LIMIT,                'l',
     MODE_REGONLY,      'r',
     MODE_DELJOINS,      'D',
+    MODE_NOQUITPARTS,   'u',
+    MODE_NOCOLOUR,      'c',
+    MODE_NOCTCP,        'C',
+    MODE_NONOTICE,      'N',
     MODE_ADD,          '+',
     MODE_DEL,          '-',
     0x0, 0x0
@@ -3440,11 +3520,13 @@ joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan, unsigned int flags)
     /* Send notification to channel */
     if (!(flags & (CHFL_ZOMBIE | CHFL_DELAYED)))
       sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_PART, chan, NULL, 0,
-                               (flags & CHFL_BANNED || !jbuf->jb_comment) ?
-                               ":%H" : "%H :%s", chan, jbuf->jb_comment);
+                   ((flags & CHFL_BANNED) || ((chan->mode.mode & MODE_NOQUITPARTS)
+                    && !IsChannelService(member->user)) || !jbuf->jb_comment) ?
+                   "%H" : "%H :%s", chan, jbuf->jb_comment);
     else if (MyUser(jbuf->jb_source))
       sendcmdto_one(jbuf->jb_source, CMD_PART, jbuf->jb_source,
-                   (flags & CHFL_BANNED || !jbuf->jb_comment) ?
+                   ((flags & CHFL_BANNED) || (chan->mode.mode & MODE_NOQUITPARTS)
+                    || !jbuf->jb_comment) ?
                    ":%H" : "%H :%s", chan, jbuf->jb_comment);
     /* XXX: Shouldn't we send a PART here anyway? */
     /* to users on the channel?  Why?  From their POV, the user isn't on
@@ -3537,6 +3619,15 @@ joinbuf_flush(struct JoinBuf *jbuf)
   case JOINBUF_TYPE_CREATE:
     sendcmdto_serv_butone(jbuf->jb_source, CMD_CREATE, jbuf->jb_connect,
                          "%s %Tu", chanlist, jbuf->jb_create);
+    if (MyUser(jbuf->jb_source) && (feature_bool(FEAT_AUTOCHANMODES) && 
+                 feature_str(FEAT_AUTOCHANMODES_LIST) && (strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) > 0))) {
+      char *name;
+      char *p = 0;
+      for (name = ircd_strtok(&p, chanlist, ","); name; name = ircd_strtok(&p, 0, ",")) {
+        sendcmdto_serv_butone(jbuf->jb_source, CMD_MODE, jbuf->jb_connect,
+                         "%s %s%s", name, "+", feature_str(FEAT_AUTOCHANMODES_LIST));
+      }
+    }
     break;
 
   case JOINBUF_TYPE_PART:
index 9aa92575e9136e7ca4cff8b44e9ba41210d2149c..a77714c472e0317f33a33151d6979aa2f5c451e7 100644 (file)
@@ -17,7 +17,7 @@
  * USA.
  */
 
-#include <ctype.h> /* tolower() */
+#include <ctype.h> /* tolower(), toupper(), isdigit() */
 #include <stdio.h> /* *printf(), fgets() */
 #include <stdlib.h> /* free(), strtol() */
 #include <string.h> /* strlen(), memcpy(), strchr(), strspn() */
@@ -30,7 +30,7 @@ const char *admin_names[] = { "location", "contact", "contact", 0 },
     *general_names[] = { "name", "vhost", "description", "", "#numeric", 0 },
     *motd_names[] = { "host", "file", 0 },
     *class_names[] = { "name", "#pingfreq", "#connectfreq", "#maxlinks", "#sendq", 0 },
-    *removed_features[] = { "VIRTUAL_HOST", "TIMESEC", "OPERS_SEE_IN_SECRET_CHANNELS", "LOCOP_SEE_IN_SECRET_CHANNELS", "HIS_STATS_h", "HIS_DESYNCS", "AUTOHIDE", 0 };
+    *removed_features[] = { "VIRTUAL_HOST", "OPERS_SEE_IN_SECRET_CHANNELS", "LOCOP_SEE_IN_SECRET_CHANNELS", 0 };
 char orig_line[512], line[512], dbuf[512];
 char *fields[MAX_FIELDS + 1];
 unsigned int nfields;
@@ -100,7 +100,7 @@ static void simple_line(const char *block, const char **names, const char *extra
     fputs("};\n", stdout);
 }
 
-#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE) + 1; (TARGET) = malloc(len); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
+#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE); (TARGET) = malloc(len+1); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
 
 /*** MANAGING LISTS OF STRINGS ***/
 
@@ -111,14 +111,6 @@ struct string_list {
     char value[1];
 };
 
-/** Find or insert the element from \a list that contains \a value.
- * If an element of \a list already contains \a value, return it.
- * Otherwise, append a new element to \a list containing \a value and
- * return it.
- * @param[in,out] list A list of strings.
- * @param[in] value A string to search for.
- * @return A string list element from \a list containing \a value.
- */
 static struct string_list *string_get(struct string_list **list, const char *value)
 {
     struct string_list *curr;
@@ -159,7 +151,7 @@ static struct connect *get_connect(const char *name)
     nlen = strlen(name);
     for (conn = connects; conn; conn = conn->next)
     {
-        for (ii = 0; tolower(name[ii]) == tolower(conn->name[ii]) && ii < nlen; ++ii) ;
+        for (ii = 0; tolower(name[ii]) == conn->name[ii] && ii < nlen; ++ii) ;
         if (conn->name[ii] == '\0' && name[ii] == '\0')
             break;
     }
@@ -169,7 +161,7 @@ static struct connect *get_connect(const char *name)
     {
         conn = calloc(1, sizeof(*conn) + nlen);
         for (ii = 0; ii < nlen; ++ii)
-            conn->name[ii] = name[ii];
+            conn->name[ii] = tolower(name[ii]);
         conn->next = connects;
         connects = conn;
     }
@@ -213,15 +205,6 @@ static void finish_connects(void)
     {
         for (sl = conn->origins; sl; sl = sl->next)
             fprintf(stdout, "# %s\n", sl->value);
-       if (conn->name == NULL
-            || conn->host == NULL
-            || conn->password == NULL
-            || conn->class == NULL)
-        {
-           fprintf(stderr, "H:line missing C:line for %s\n",sl->value);
-           continue;
-       }
-
         fprintf(stdout,
                 "Connect {\n\tname =\"%s\";\n\thost = \"%s\";\n"
                 "\tpassword = \"%s\";\n\tclass = \"%s\";\n",
@@ -311,7 +294,7 @@ static void do_feature(void)
     ii = strlen(fields[0]);
     feat = calloc(1, sizeof(*feat) + ii);
     while (ii-- > 0)
-        feat->name[ii] = fields[0][ii];
+        feat->name[ii] = toupper(fields[0][ii]);
     feat->next = features;
     features = feat;
     string_get(&feat->origins, orig_line);
@@ -326,15 +309,9 @@ static void finish_features(void)
     struct feature *feat;
     size_t ii;
 
-    fputs("Features {\n", stdout);
-    fputs("\t\"OPLEVELS\" = \"FALSE\";\n", stdout);
-    fputs("\t\"ZANNELS\" = \"FALSE\";\n", stdout);
+    fputs("Features {\n\t\"OPLEVELS\" = \"FALSE\";\n", stdout);
 
     for (feat = features; feat; feat = feat->next) {
-        /* Display the original feature line we are talking about. */
-        for (sl = feat->origins; sl; sl = sl->next)
-            fprintf(stdout, "# %s\n", sl->value);
-
         /* See if the feature was remapped to an oper privilege. */
         for (rmf = remapped_features; rmf->name; rmf++)
             if (0 == strcmp(feat->name, rmf->name))
@@ -438,7 +415,7 @@ static void finish_operators(void)
         }
         for (ii = 0; (remap = &remapped_features[ii++])->name; ) {
             if (!remap->feature || !remap->privilege
-                || !remap->feature->values || !(remap->flags & mask))
+                || !remap->feature->values || !remap->flags & mask)
                 continue;
             fprintf(stdout, "\t%s = %s;\n", remap->privilege,
                     strcmp(remap->feature->values->value, "TRUE") ? "no" : "yes");
@@ -618,10 +595,9 @@ int main(int argc, char *argv[])
             fputs(line, stdout);
             continue;
         }
-        /* Strip trailing whitespace. */
-        while (len > 0 && isspace(line[len-1]))
+        /* Strip EOL character(s) and pass blank lines through. */
+        while (len > 0 && (line[len-1] == '\n' || line[len-1] == '\r'))
             line[--len] = '\0';
-        /* Pass blank lines through. */
         if (len == 0) {
             fputc('\n', stdout);
             continue;
index b3f46f1764047b9377b1d8f9f7fa726b00184b2c..061dee79008120c872204d5ce98ee2ad9957cb7b 100644 (file)
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Solaris /dev/poll event engine.
- * @version $Id: engine_devpoll.c,v 1.6.2.1 2005/12/30 13:28:40 entrope Exp $
+ * @version $Id: engine_devpoll.c,v 1.6 2004/12/11 05:13:44 klmitch Exp $
  */
 #include "config.h"
 
@@ -430,6 +430,8 @@ engine_loop(struct Generators* gen)
        break;
       }
 
+      assert(s_fd(sock) == polls[i].fd);
+
       gen_ref_dec(sock); /* we're done with it */
     }
 
index ffe2c9be7f08bd7929d6a7e4e395e7e7b919dd66..15463e19f7e22c6d2ee93def7c049bc05b27baff 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 
 #include "gline.h"
+#include "channel.h"
 #include "client.h"
 #include "ircd.h"
 #include "ircd_alloc.h"
@@ -44,6 +45,7 @@
 #include "numnicks.h"
 #include "numeric.h"
 #include "whocmds.h"
+#include "hash.h"
 
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <string.h>
@@ -74,32 +76,43 @@ struct Gline* BadChanGlineList = 0;
  * Otherwise, assign \a def_user to *user_p and \a userhost to *host_p.
  *
  * @param[in] userhost Input string from user.
+ * @param[out] nick_p Gets pointer to nick part of hostmask.
  * @param[out] user_p Gets pointer to user (or channel/realname) part of hostmask.
  * @param[out] host_p Gets point to host part of hostmask (may be assigned NULL).
  * @param[in] def_user Default value for user part.
  */
 static void
-canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user)
+canon_userhost(char *userhost, char **nick_p, char **user_p, char **host_p, char *def_user)
 {
-  char *tmp;
+  char *tmp, *s;
 
   if (*userhost == '$') {
     *user_p = userhost;
     *host_p = NULL;
+    *nick_p = NULL;
     return;
   }
 
-  if (!(tmp = strchr(userhost, '@'))) {
-    *user_p = def_user;
-    *host_p = userhost;
-  } else {
-    *user_p = userhost;
+  if ((tmp = strchr(userhost, '!'))) {
+    *nick_p = userhost;
     *(tmp++) = '\0';
+  } else {
+    *nick_p = def_user;
+    tmp = userhost;
+  }
+
+  if (!(s = strchr(tmp, '@'))) {
+    *user_p = def_user;
     *host_p = tmp;
+  } else {
+    *user_p = tmp;
+    *(s++) = '\0';
+    *host_p = s;
   }
 }
 
 /** Create a Gline structure.
+ * @param[in] nick Nick part of mask.
  * @param[in] user User part of mask.
  * @param[in] host Host part of mask (NULL if not applicable).
  * @param[in] reason Reason for G-line.
@@ -109,12 +122,12 @@ canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user)
  * @return Newly allocated G-line.
  */
 static struct Gline *
-make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod,
+make_gline(char *nick, char *user, char *host, char *reason, time_t expire, time_t lastmod,
           unsigned int flags)
 {
   struct Gline *gline, *sgline, *after = 0;
 
-  if (!(flags & GLINE_BADCHAN)) { /* search for overlapping glines first */
+  if (!(flags & (GLINE_BADCHAN|GLINE_REALNAME))) { /* search for overlapping glines first */
 
     for (gline = GlobalGlineList; gline; gline = sgline) {
       sgline = gline->gl_next;
@@ -124,13 +137,15 @@ make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod,
       else if (((gline->gl_flags & GLINE_LOCAL) != (flags & GLINE_LOCAL)) ||
                (gline->gl_host && !host) || (!gline->gl_host && host))
        continue;
-      else if (!mmatch(gline->gl_user, user) /* gline contains new mask */
+      else if (!mmatch(gline->gl_nick, nick) && /* gline contains new mask */
+               !mmatch(gline->gl_user, user)
               && (gline->gl_host == NULL || !mmatch(gline->gl_host, host))) {
        if (expire <= gline->gl_expire) /* will expire before wider gline */
          return 0;
        else
          after = gline; /* stick new gline after this one */
-      } else if (!mmatch(user, gline->gl_user) /* new mask contains gline */
+      } else if (!mmatch(nick, gline->gl_nick) && /* new mask contains gline */
+                 !mmatch(user, gline->gl_user)
                 && (gline->gl_host==NULL || !mmatch(host, gline->gl_host)) 
                 && gline->gl_expire <= expire) /* old expires before new */
        gline_free(gline); /* save some memory */
@@ -155,7 +170,11 @@ make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod,
       BadChanGlineList->gl_prev_p = &gline->gl_next;
     BadChanGlineList = gline;
   } else {
-    DupString(gline->gl_user, user); /* remember them... */
+    if (*user!='$')
+      DupString(gline->gl_nick, nick); /* remember them... */
+    else
+      gline->gl_nick = 0;
+    DupString(gline->gl_user, user);
     if (*user != '$')
       DupString(gline->gl_host, host);
     else
@@ -183,8 +202,8 @@ make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod,
 }
 
 /** Check local clients against a new G-line.
- * If the G-line is inactive or a badchan, return immediately.
- * Otherwise, if any users match it, disconnect them.
+ * If the G-line is inactive, return immediately.
+ * Otherwise, if any users match it, disconnect them or kick them if the G-line is a BADCHAN.
  * @param[in] cptr Peer connect that sent the G-line.
  * @param[in] sptr Client that originated the G-line.
  * @param[in] gline New G-line to check.
@@ -196,52 +215,90 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
   struct Client *acptr;
   int fd, retval = 0, tval;
 
-  if (GlineIsBadChan(gline)) /* no action taken on badchan glines */
-    return 0;
   if (!GlineIsActive(gline)) /* no action taken on inactive glines */
     return 0;
 
-  for (fd = HighestFd; fd >= 0; --fd) {
-    /*
-     * get the users!
-     */
-    if ((acptr = LocalClientArray[fd])) {
-      if (!cli_user(acptr))
-       continue;
-
-      if (GlineIsRealName(gline)) { /* Realname Gline */
-       Debug((DEBUG_DEBUG,"Realname Gline: %s %s",(cli_info(acptr)),
-                                       gline->gl_user+2));
-        if (match(gline->gl_user+2, cli_info(acptr)) != 0)
+  if (GlineIsBadChan(gline)) {
+    /* Handle BADCHAN gline */
+    struct Channel *chptr,*nchptr;
+    struct Membership *member,*nmember;
+
+    if (string_has_wildcards(gline->gl_user)) {
+      for(chptr=GlobalChannelList;chptr;chptr=nchptr) {
+        nchptr=chptr->next;
+        if (match(gline->gl_user, chptr->chname))
+           continue;
+        for (member=chptr->members;member;member=nmember) {
+          nmember=member->next_member;
+          if (!MyUser(member->user) || IsZombie(member) || IsAnOper(member->user))
             continue;
-        Debug((DEBUG_DEBUG,"Matched!"));
-      } else { /* Host/IP gline */
-        if (cli_user(acptr)->username &&
-            match(gline->gl_user, (cli_user(acptr))->username) != 0)
+          sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Badchanneled (%s)", chptr, member->user, gline->gl_reason);
+          sendcmdto_channel_butserv_butone(&me, CMD_KICK, chptr, NULL, 0, "%H %C :Badchanneled (%s)", chptr, member->user, gline->gl_reason);
+          make_zombie(member, member->user, &me, &me, chptr);
+          retval=1;
+        }
+      }      
+    } else {
+      if ((chptr=FindChannel(gline->gl_user))) {
+        for (member=chptr->members;member;member=nmember) {
+          nmember=member->next_member;
+          if (!MyUser(member->user) || IsZombie(member) || IsAnOper(member->user))
+            continue;
+          sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Badchanneled (%s)", chptr, member->user, gline->gl_reason);
+          sendcmdto_channel_butserv_butone(&me, CMD_KICK, chptr, NULL, 0, "%H %C :Badchanneled (%s)", chptr, member->user, gline->gl_reason);
+          make_zombie(member, member->user, &me, &me, chptr);
+          retval=1;
+        }
+      }
+    }
+  } else {
+    for (fd = HighestFd; fd >= 0; --fd) {
+      /*
+       * get the users!
+       */
+      if ((acptr = LocalClientArray[fd])) {
+        if (!cli_user(acptr))
           continue;
 
-        if (GlineIsIpMask(gline)) {
-          if (!ipmask_check(&cli_ip(acptr), &gline->gl_addr, gline->gl_bits))
+        if (GlineIsRealName(gline)) { /* Realname Gline */
+          Debug((DEBUG_DEBUG,"Realname Gline: %s %s",(cli_info(acptr)),
+                                         gline->gl_user+2));
+          if (match(gline->gl_user+2, cli_info(acptr)) != 0)
+              continue;
+          Debug((DEBUG_DEBUG,"Matched!"));
+        } else { /* Host/IP gline */
+          if (cli_name(acptr) &&
+              match(gline->gl_nick, cli_name(acptr)) !=0)
             continue;
-        }
-        else {
-          if (match(gline->gl_host, cli_sockhost(acptr)) != 0)
+
+          if (cli_user(acptr)->username &&
+              match(gline->gl_user, (cli_user(acptr))->realusername) != 0)
             continue;
+
+          if (GlineIsIpMask(gline)) {
+            if (!ipmask_check(&cli_ip(acptr), &gline->gl_addr, gline->gl_bits))
+              continue;
+          }
+          else {
+            if (match(gline->gl_host, cli_sockhost(acptr)) != 0)
+              continue;
+          }
         }
-      }
 
-      /* ok, here's one that got G-lined */
-      send_reply(acptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s",
-          gline->gl_reason);
+        /* ok, here's one that got G-lined */
+        send_reply(acptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s",
+                  gline->gl_reason);
 
-      /* let the ops know about it */
-      sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
-                           get_client_name(acptr, SHOW_IP));
+        /* let the ops know about it */
+        sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
+                             get_client_name(acptr, SHOW_IP));
 
-      /* and get rid of him */
-      if ((tval = exit_client_msg(cptr, acptr, &me, "G-lined (%s)",
-          gline->gl_reason)))
+        /* and get rid of him */
+        /* Asuka - Reimplement HEAD_IN_SAND_GLINE from Lain */
+        if ((tval = exit_client_msg(cptr, acptr, &me, 
+            feature_bool(FEAT_HIS_GLINE) ? "G-lined" : "G-lined (%s)", gline->gl_reason)))
         retval = tval; /* retain killed status */
+      }
     }
   }
   return retval;
@@ -332,16 +389,21 @@ gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline)
     return 0;
 
   if (gline->gl_lastmod)
-    sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
-                         GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
-                         gline->gl_host ? "@" : "",
+    sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu :%s",
+                          GlineIsRemActive(gline) ? '+' : '-', 
+                          GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+                          GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
+                          gline->gl_user,
+                         gline->gl_host ? "@" : "",
                          gline->gl_host ? gline->gl_host : "",
                          gline->gl_expire - CurrentTime, gline->gl_lastmod,
                          gline->gl_reason);
   else
     sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
                          (GlineIsRemActive(gline) ?
-                          "* +%s%s%s %Tu :%s" : "* -%s%s%s"),
+                          "* +%s%s%s%s%s %Tu :%s" : "* -%s%s%s%s%s"),
+                          GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+                          GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
                          gline->gl_user, 
                          gline->gl_host ? "@" : "",
                          gline->gl_host ? gline->gl_host : "",
@@ -371,8 +433,8 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
          char *reason, time_t expire, time_t lastmod, unsigned int flags)
 {
   struct Gline *agline;
-  char uhmask[USERLEN + HOSTLEN + 2];
-  char *user, *host;
+  char uhmask[NICKLEN + USERLEN + HOSTLEN + 3];
+  char *nick, *user, *host;
   int tmp;
 
   assert(0 != userhost);
@@ -403,7 +465,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
      user = (*userhost =='$' ? userhost : userhost+2);
      host = 0;
   } else {
-    canon_userhost(userhost, &user, &host, "*");
+    canon_userhost(userhost, &nick, &user, &host, "*");
     if (sizeof(uhmask) <
        ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host))
       return send_reply(sptr, ERR_LONGMASK);
@@ -438,28 +500,34 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 
   /* Inform ops... */
   sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
-                       SNO_AUTO, "%s adding %s %s for %s%s%s, expiring at "
+                       SNO_AUTO, "%s adding %s %s for %s%s%s%s%s, expiring at "
                        "%Tu: %s",
                        (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
                          cli_name(sptr) :
                          cli_name((cli_user(sptr))->server),
                       (flags & GLINE_LOCAL) ? "local" : "global",
-                      (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE", user,
+                      (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE",
+                       (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : nick,
+                       (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : "!",
+                       user,
                       (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : "@",
                       (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : host,
                       expire + TSoffset, reason);
 
   /* and log it */
   log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
-           "%#C adding %s %s for %s%s%s, expiring at %Tu: %s", sptr,
+           "%#C adding %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
            flags & GLINE_LOCAL ? "local" : "global",
-           flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", user,
+           flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE",
+            flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : nick,
+            flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : "!",
+            user,
            flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : "@",
            flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : host,
            expire + TSoffset, reason);
 
   /* make the gline */
-  agline = make_gline(user, host, reason, expire, lastmod, flags);
+  agline = make_gline(nick, user, host, reason, expire, lastmod, flags);
 
   if (!agline) /* if it overlapped, silently return */
     return 0;
@@ -504,19 +572,24 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
     return 0; /* was active to begin with */
 
   /* Inform ops and log it */
-  sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s, "
+  sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
                        "expiring at %Tu: %s",
                        (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
                          cli_name(sptr) :
                          cli_name((cli_user(sptr))->server),
                        GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+                       GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+                       GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
                        gline->gl_user, gline->gl_host ? "@" : "",
                        gline->gl_host ? gline->gl_host : "",
                        gline->gl_expire + TSoffset, gline->gl_reason);
   
   log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
-           "%#C activating global %s for %s%s%s, expiring at %Tu: %s", sptr,
-           GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
+            "%#C activating global %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
+            GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+            GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+            GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
+            gline->gl_user,
            gline->gl_host ? "@" : "",
            gline->gl_host ? gline->gl_host : "",
            gline->gl_expire + TSoffset, gline->gl_reason);
@@ -572,19 +645,24 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
   }
 
   /* Inform ops and log it */
-  sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s, expiring at %Tu: "
+  sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
                       "%s",
                        (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
                          cli_name(sptr) :
                          cli_name((cli_user(sptr))->server),
                       msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+                       GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+                       GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
                       gline->gl_user, gline->gl_host ? "@" : "",
                        gline->gl_host ? gline->gl_host : "",
                       gline->gl_expire + TSoffset, gline->gl_reason);
 
   log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
-           "%#C %s %s for %s%s%s, expiring at %Tu: %s", sptr, msg,
-           GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
+            "%#C %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr, msg,
+            GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+            GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+            GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
+            gline->gl_user,
            gline->gl_host ? "@" : "",
            gline->gl_host ? gline->gl_host : "",
            gline->gl_expire + TSoffset, gline->gl_reason);
@@ -618,7 +696,7 @@ gline_find(char *userhost, unsigned int flags)
 {
   struct Gline *gline;
   struct Gline *sgline;
-  char *user, *host, *t_uh;
+  char *nick, *user, *host, *t_uh;
 
   if (flags & (GLINE_BADCHAN | GLINE_ANY)) {
     for (gline = BadChanGlineList; gline; gline = sgline) {
@@ -640,7 +718,7 @@ gline_find(char *userhost, unsigned int flags)
     return 0;
 
   DupString(t_uh, userhost);
-  canon_userhost(t_uh, &user, &host, "*");
+  canon_userhost(t_uh, &nick, &user, &host, "*");
 
   for (gline = GlobalGlineList; gline; gline = sgline) {
     sgline = gline->gl_next;
@@ -653,12 +731,18 @@ gline_find(char *userhost, unsigned int flags)
     else if (flags & GLINE_EXACT) {
       if (((gline->gl_host && host && ircd_strcmp(gline->gl_host, host) == 0)
            || (!gline->gl_host && !host)) &&
-          (ircd_strcmp(gline->gl_user, user) == 0))
+            ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
+            (user && ircd_strcmp(gline->gl_user, user) == 0)) &&
+            ((!nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, "*") == 0) ||
+            (nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, nick) == 0) || (!gline->gl_nick && !nick)))
        break;
     } else {
       if (((gline->gl_host && host && match(gline->gl_host, host) == 0)
            || (!gline->gl_host && !host)) &&
-         (match(gline->gl_user, user) == 0))
+            ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
+            (user && match(gline->gl_user, user) == 0)) &&
+            ((!nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, "*") == 0) ||
+            (nick && gline->gl_nick && (match(gline->gl_nick, nick) == 0)) || (!gline->gl_nick && !nick)))
       break;
     }
   }
@@ -698,7 +782,9 @@ gline_lookup(struct Client *cptr, unsigned int flags)
         continue;
     }
     else {
-      if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
+      if (match(gline->gl_nick, cli_name(cptr)) != 0)
+        continue;
+      if (match(gline->gl_user, (cli_user(cptr))->realusername) != 0)
         continue;
 
       if (GlineIsIpMask(gline)) {
@@ -753,8 +839,12 @@ gline_burst(struct Client *cptr)
     if (gline->gl_expire <= CurrentTime) /* expire any that need expiring */
       gline_free(gline);
     else if (!GlineIsLocal(gline) && gline->gl_lastmod)
-      sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
-                   GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
+      sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu :%s",
+                    GlineIsRemActive(gline) ? '+' : '-',
+                    gline->gl_nick ? gline->gl_nick : "",
+                    gline->gl_nick ? "!" : "",
+                    gline->gl_user,
+
                     gline->gl_host ? "@" : "",
                     gline->gl_host ? gline->gl_host : "",
                    gline->gl_expire - CurrentTime, gline->gl_lastmod,
@@ -785,12 +875,15 @@ gline_resend(struct Client *cptr, struct Gline *gline)
   if (GlineIsLocal(gline) || !gline->gl_lastmod)
     return 0;
 
-  sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
-               GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
-               gline->gl_host ? "@" : "",
+  sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu :%s",
+                GlineIsRemActive(gline) ? '+' : '-',
+                GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
+                GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
+                gline->gl_user,
+                gline->gl_host ? "@" : "",
                 gline->gl_host ? gline->gl_host : "",
-               gline->gl_expire - CurrentTime, gline->gl_lastmod,
-               gline->gl_reason);
+                gline->gl_expire - CurrentTime, gline->gl_lastmod,
+                gline->gl_reason);
 
   return 0;
 }
@@ -813,8 +906,10 @@ gline_list(struct Client *sptr, char *userhost)
       return send_reply(sptr, ERR_NOSUCHGLINE, userhost);
 
     /* send gline information along */
-    send_reply(sptr, RPL_GLIST, gline->gl_user,
-               gline->gl_host ? "@" : "",
+    send_reply(sptr, RPL_GLIST,
+               GlineIsBadChan(gline) | GlineIsRealName(gline) ? "" : gline->gl_nick,
+               GlineIsBadChan(gline) | GlineIsRealName(gline) ? "" : "!",
+               gline->gl_user, GlineIsBadChan(gline) || GlineIsRealName(gline) ? "" : "@",
                gline->gl_host ? gline->gl_host : "",
               gline->gl_expire + TSoffset,
               GlineIsLocal(gline) ? cli_name(&me) : "*",
@@ -826,7 +921,10 @@ gline_list(struct Client *sptr, char *userhost)
       if (gline->gl_expire <= CurrentTime)
        gline_free(gline);
       else
-       send_reply(sptr, RPL_GLIST, gline->gl_user,
+       send_reply(sptr, RPL_GLIST,
+                   gline->gl_nick ? gline->gl_nick : "",
+                   gline->gl_nick ? "!" : "",
+                   gline->gl_user,
                    gline->gl_host ? "@" : "",
                    gline->gl_host ? gline->gl_host : "",
                   gline->gl_expire + TSoffset,
@@ -840,7 +938,7 @@ gline_list(struct Client *sptr, char *userhost)
       if (gline->gl_expire <= CurrentTime)
        gline_free(gline);
       else
-       send_reply(sptr, RPL_GLIST, gline->gl_user, "", "",
+       send_reply(sptr, RPL_GLIST, gline->gl_user, "", "", "", "",
                   gline->gl_expire + TSoffset,
                   GlineIsLocal(gline) ? cli_name(&me) : "*",
                   GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
@@ -869,7 +967,10 @@ gline_stats(struct Client *sptr, const struct StatDesc *sd,
     if (gline->gl_expire <= CurrentTime)
       gline_free(gline);
     else
-      send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user,
+      send_reply(sptr, RPL_STATSGLINE, 'G',
+                 gline->gl_nick ? gline->gl_nick : "",
+                 gline->gl_nick ? "!" : "",
+                 gline->gl_user,
                  gline->gl_host ? "@" : "",
                  gline->gl_host ? gline->gl_host : "",
                 gline->gl_expire + TSoffset,
@@ -892,9 +993,53 @@ gline_memory_count(size_t *gl_size)
   {
     gl++;
     *gl_size += sizeof(struct Gline);
+    *gl_size += gline->gl_nick ? (strlen(gline->gl_nick) +1) : 0;
     *gl_size += gline->gl_user ? (strlen(gline->gl_user) + 1) : 0;
     *gl_size += gline->gl_host ? (strlen(gline->gl_host) + 1) : 0;
     *gl_size += gline->gl_reason ? (strlen(gline->gl_reason) + 1) : 0;
   }
   return gl;
 }
+
+struct Gline *
+IsNickGlined(struct Client *cptr, char *nick)
+{
+  struct Gline *gline;
+  struct Gline *sgline;
+
+  for (gline = GlobalGlineList; gline; gline = sgline) {
+    sgline = gline->gl_next;
+
+    if (gline->gl_expire <= CurrentTime) {
+      gline_free(gline);
+      continue;
+    }
+
+    if (GlineIsRealName(gline)) /* skip realname glines */
+      continue;
+
+    if (!ircd_strcmp(gline->gl_nick, "*"))     /* skip glines w. wildcarded nick */
+      continue;
+
+    if (match(gline->gl_nick, nick) != 0)
+      continue;
+
+    if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
+      continue;
+
+    if (GlineIsIpMask(gline)) {
+      if (!ipmask_check(&(cli_ip(cptr)), &gline->gl_addr, gline->gl_bits))
+        continue;
+    }
+    else {
+      if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0)
+        continue;
+    }
+    return gline;
+  }
+  /*
+   * No Glines matched
+   */
+  return 0;
+}
+
index d0a4bb00a77a6fd309b127d3d9a9672c42ba01a9..f6f0d139e1558c29abcb89e283d0b571c0bf4804 100644 (file)
 /**
  * @file
  * @brief Native crypt() function routines
- * @version $Id: ircd_crypt_native.c,v 1.7.2.1 2005/12/14 03:01:38 entrope Exp $
+ * @version $Id: ircd_crypt_native.c,v 1.7 2005/05/13 02:03:33 entrope Exp $
  * 
  * Routines for handling passwords encrypted with the system's native crypt()
  * function (typically a DES encryption routine, but can be anything nowadays).
  * 
  */
-#define _XOPEN_SOURCE 500
+#define _XOPEN_SOURCE 600
 
 #include "config.h"
 #include "ircd_crypt.h"
index 964e027b4fc1cd804272b2396441fa312b05271d..d30c8d90a6f33d3de07b81368490b8b50468e684 100644 (file)
@@ -307,16 +307,20 @@ static struct FeatureDesc {
   F_B(HOST_HIDING, 0, 1, 0),
   F_S(HIDDEN_HOST, FEAT_CASE, "users.undernet.org", 0),
   F_S(HIDDEN_IP, 0, "127.0.0.1", 0),
+  F_B(AUTOINVISIBLE, 0, 1, 0),
   F_B(CONNEXIT_NOTICES, 0, 0, 0),
+  F_B(USER_HIDECHANS, 0, 0, 0),
   F_B(OPLEVELS, 0, 1, 0),
   F_B(ZANNELS, 0, 1, 0),
   F_B(LOCAL_CHANNELS, 0, 1, 0),
   F_B(TOPIC_BURST, 0, 0, 0),
+  F_B(AUTOCHANMODES, 0, 1, 0),
+  F_S(AUTOCHANMODES_LIST, FEAT_CASE | FEAT_NULL, "ntCN", 0),
 
   /* features that probably should not be touched */
   F_I(KILLCHASETIMELIMIT, 0, 30, 0),
   F_I(MAXCHANNELSPERUSER, 0, 10, 0),
-  F_I(NICKLEN, 0, 12, 0),
+  F_I(NICKLEN, 0, 15, 0),
   F_I(AVBANLEN, 0, 40, 0),
   F_I(MAXBANS, 0, 45, 0),
   F_I(MAXSILES, 0, 15, 0),
@@ -350,7 +354,12 @@ static struct FeatureDesc {
   F_B(ANNOUNCE_INVITES, 0, 0, 0),
 
   /* features that affect all operators */
+  F_B(EXTENDED_CHECKCMD, 0, 0, 0),
   F_B(CONFIG_OPERCMDS, 0, 0, 0),
+  F_B(SETHOST, 0, 0, 0),
+  F_B(SETHOST_FREEFORM, 0, 0, 0),
+  F_B(SETHOST_USER, 0, 0, 0),
+  F_B(SETHOST_AUTO, 0, 0, 0),
 
   /* HEAD_IN_SAND Features */
   F_B(HIS_SNOTICES, 0, 1, 0),
@@ -379,6 +388,7 @@ static struct FeatureDesc {
   F_B(HIS_STATS_q, 0, 1, 0),
   F_B(HIS_STATS_R, 0, 1, 0),
   F_B(HIS_STATS_r, 0, 1, 0),
+  F_B(HIS_STATS_s, 0, 1, 0),
   F_B(HIS_STATS_t, 0, 1, 0),
   F_B(HIS_STATS_T, 0, 1, 0),
   F_B(HIS_STATS_u, 0, 0, 0),
@@ -394,15 +404,19 @@ static struct FeatureDesc {
   F_B(HIS_WHOIS_LOCALCHAN, 0, 1, 0),
   F_B(HIS_WHO_SERVERNAME, 0, 1, 0),
   F_B(HIS_WHO_HOPCOUNT, 0, 1, 0),
+  F_B(HIS_WHO_FILTERIP, 0, 1, 0),
   F_B(HIS_MODEWHO, 0, 1, 0),
   F_B(HIS_BANWHO, 0, 1, 0),
   F_B(HIS_KILLWHO, 0, 1, 0),
+  /* Asuka - Reimplement HEAD_IN_SAND_GLINE from Lain */
+  F_B(HIS_GLINE, 0, 1, 0),
   F_B(HIS_REWRITE, 0, 1, 0),
   F_I(HIS_REMOTE, 0, 1, 0),
   F_B(HIS_NETSPLIT, 0, 1, 0),
   F_S(HIS_SERVERNAME, 0, "*.undernet.org", feature_notify_servername),
   F_S(HIS_SERVERINFO, 0, "The Undernet Underworld", feature_notify_serverinfo),
   F_S(HIS_URLSERVERS, 0, "http://www.undernet.org/servers.php", 0),
+  F_B(HIS_USERGLINE, 0, 1, 0),
 
   /* Misc. random stuff */
   F_S(NETWORK, 0, "UnderNet", 0),
index a47694712c9d4e6525754777bf8f21e5665974fa..8e56384b896e9b3b892441e8e7ba05e0e2cfad14 100644 (file)
@@ -102,6 +102,7 @@ static struct lexer_token {
   TOKEN(USERMODE),
   TOKEN(FAST),
   TOKEN(AUTOCONNECT),
+  TOKEN(SPOOFHOST),
   TOKEN(PROGRAM),
 #undef TOKEN
   { "administrator", ADMIN },
index 3d5fdcd3d7912de67b49e16652e8c7fcbd0b9d34..4d8dff21ba279c3739281760f547928657576696 100644 (file)
@@ -164,6 +164,7 @@ static struct LogDesc {
   S(SOCKET, -1, 0),
   S(IAUTH, -1, SNO_NETWORK),
   S(DEBUG, -1, SNO_DEBUG),
+  S(SETHOST, -1, SNO_OLDSNO),
 #undef S
   { LS_LAST_SYSTEM, 0, 0, -1, 0, -1, 0 }
 };
index ac6205f30b3f87dc055aafe6d4895a1891f53104..cc1e2c68e8c01845d51e9aadcee5216444214139 100644 (file)
@@ -65,6 +65,7 @@
   extern struct ServerConf* serverConfList;
   extern struct s_map*      GlobalServiceMapList;
   extern struct qline*      GlobalQuarantineList;
+  extern struct sline*      GlobalSList;
 
   int yylex(void);
   /* Now all the globals we need :/... */
@@ -75,6 +76,7 @@
   struct DenyConf *dconf;
   struct ServerConf *sconf;
   struct s_map *smap;
+  struct sline *spoof;
   struct Privs privs;
   struct Privs privs_dirty;
 
@@ -157,6 +159,7 @@ static void parse_error(char *pattern,...) {
 %token FAST
 %token AUTOCONNECT
 %token PROGRAM
+%token SPOOFHOST
 /* and now a lot of privileges... */
 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
@@ -184,7 +187,7 @@ blocks: blocks block | block;
 block: adminblock | generalblock | classblock | connectblock |
        uworldblock | operblock | portblock | jupeblock | clientblock |
        killblock | cruleblock | motdblock | featuresblock | quarantineblock |
-       pseudoblock | iauthblock | error ';';
+       pseudoblock | iauthblock | spoofblock | error ';';
 
 /* The timespec, sizespec and expr was ripped straight from
  * ircd-hybrid-7. */
@@ -1019,3 +1022,62 @@ iauthprogram: PROGRAM '='
   while (stringno > 0)
     MyFree(stringlist[stringno--]);
 } stringlist ';';
+
+spoofblock: SPOOFHOST QSTRING '{'
+{
+  spoof = MyCalloc(1, sizeof(struct sline));
+  spoof->spoofhost = $2;
+  spoof->passwd = NULL;
+  spoof->realhost = NULL;
+  spoof->username = NULL;
+}
+spoofitems '}' ';'
+{
+  struct irc_in_addr ip;
+  char bits;
+
+  if (spoof->username == NULL && spoof->realhost) {
+    parse_error("Username missing in spoofhost.");
+  } else if (spoof->realhost == NULL && spoof->username) {
+    parse_error("Realhost missing in spoofhost.");
+  }
+
+  if (spoof->realhost) {
+    if (!string_has_wildcards(spoof->realhost)) {
+      if (ipmask_parse(spoof->realhost, &ip, &bits) != 0) {
+        spoof->address = ip;
+        spoof->bits = bits;
+        spoof->flags = SLINE_FLAGS_IP;
+      } else {
+        Debug((DEBUG_DEBUG, "S-Line: \"%s\" appears not to be a valid IP address, might be wildcarded.", spoof->realhost));
+        spoof->flags = SLINE_FLAGS_HOSTNAME;
+      }
+    } else
+      spoof->flags = SLINE_FLAGS_HOSTNAME;
+  } else
+    spoof->flags = 0;
+
+
+  spoof->next = GlobalSList;
+  GlobalSList = spoof;
+
+  spoof = NULL;
+};
+
+spoofitems: spoofitem spoofitems | spoofitem;
+spoofitem: spoofpassword | spoofrealhost | spoofrealident;
+spoofpassword: PASS '=' QSTRING ';'
+{
+  MyFree(spoof->passwd);
+  spoof->passwd = $3;
+};
+spoofrealhost: HOST '=' QSTRING ';'
+{
+  MyFree(spoof->realhost);
+  spoof->realhost = $3;
+};
+spoofrealident: USERNAME '=' QSTRING ';'
+{
+  MyFree(spoof->username);
+  spoof->username = $3;
+};
index 6e675a21c41d77936223355e2fd7329e7dc0ac18..da48b4c2e03e8f3f93d66728d8cbdccd1e7a13e6 100644 (file)
@@ -86,6 +86,7 @@
 void relay_channel_message(struct Client* sptr, const char* name, const char* text)
 {
   struct Channel* chptr;
+  const char *ch;
   assert(0 != sptr);
   assert(0 != name);
   assert(0 != text);
@@ -105,6 +106,22 @@ void relay_channel_message(struct Client* sptr, const char* name, const char* te
       check_target_limit(sptr, chptr, chptr->chname, 0))
     return;
 
+  /* +cC checks */
+  if (chptr->mode.mode & MODE_NOCOLOUR)
+    for (ch=text;*ch;ch++)
+      if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) {
+        send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+        return;
+      }
+
+  if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(text,"\001ACTION ",8))
+    for (ch=text;*ch;)
+      if (*ch++==1) { 
+        send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+        return;
+      }
+
+  
   sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr),
                           SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
 }
@@ -118,6 +135,7 @@ void relay_channel_message(struct Client* sptr, const char* name, const char* te
 void relay_channel_notice(struct Client* sptr, const char* name, const char* text)
 {
   struct Channel* chptr;
+  const char *ch;
   assert(0 != sptr);
   assert(0 != name);
   assert(0 != text);
@@ -134,6 +152,26 @@ void relay_channel_notice(struct Client* sptr, const char* name, const char* tex
       check_target_limit(sptr, chptr, chptr->chname, 0))
     return;
 
+  if ((chptr->mode.mode & MODE_NONOTICE)) {
+    send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+    return;
+  }
+
+  /* +cC checks */
+  if (chptr->mode.mode & MODE_NOCOLOUR)
+    for (ch=text;*ch;ch++)
+      if (*ch==2 || *ch==3 || *ch==22 || *ch==27 || *ch==31) {
+        send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+        return;
+      }
+
+  if ((chptr->mode.mode & MODE_NOCTCP) && ircd_strncmp(text,"\001ACTION ",8))
+    for (ch=text;*ch;)
+      if (*ch++==1) { 
+        send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+        return;
+      }
+
   sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
                           SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
 }
@@ -338,6 +376,16 @@ void relay_private_message(struct Client* sptr, const char* name, const char* te
       is_silenced(sptr, acptr))
     return;
 
+  /* ASUKA -- slug
+   * +R check, if target is +R and we're not +r (or opered) then
+   * deny the message
+   */
+
+  if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr)) {
+    send_reply(sptr, ERR_ACCOUNTONLY, cli_name(acptr));
+    return;
+  }
+
   /*
    * send away message if user away
    */
@@ -373,6 +421,15 @@ void relay_private_notice(struct Client* sptr, const char* name, const char* tex
        check_target_limit(sptr, acptr, cli_name(acptr), 0)) ||
       is_silenced(sptr, acptr))
     return;
+
+  /* ASUKA -- slug
+   * +R check, if target is +R and we're not +r (or opered) then
+   * deny the message
+   */
+
+  if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr))
+    return;
+
   /*
    * deliver the message
    */
index 7bd9a047a4968aed3b6a4c0d3d4b505b0d3e568d..e974a760f7d8cea363634c586678dd4b22258226 100644 (file)
@@ -180,8 +180,8 @@ struct FieldData {
 #define CONV_VARARGS   0x05000000      /**< convert a %v */
 #define CONV_CLIENT    0x06000000      /**< convert a struct Client */
 #define CONV_CHANNEL   0x07000000      /**< convert a struct Channel */
+#define CONV_REAL      0x08000000      /**< convert a struct Client and show realhost */
 
-#define CONV_RESERVED7 0x08000000      /**< reserved for future expansion */
 #define CONV_RESERVED6 0x09000000      /**< reserved for future expansion */
 #define CONV_RESERVED5 0x0a000000      /**< reserved for future expansion */
 #define CONV_RESERVED4 0x0b000000      /**< reserved for future expansion */
@@ -1778,6 +1778,11 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
        fld_s.flags |= ARG_PTR | CONV_CLIENT;
        break;
 
+      case 'R': /* convert a client name... */
+        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ZERO | TYPE_MASK);
+        fld_s.flags |= ARG_PTR | CONV_REAL;
+        break;
+       
       case 'H': /* convert a channel name... */
        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
                         FLAG_COLON | TYPE_MASK);
@@ -2038,7 +2043,8 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
 
       vdata->vd_chars = buf_s.buf_loc; /* return relevant data */
       vdata->vd_overflow = SNP_MAX(buf_s.buf_overflow, buf_s.overflow);
-    } else if ((fld_s.flags & CONV_MASK) == CONV_CLIENT) {
+    } else if (((fld_s.flags & CONV_MASK) == CONV_CLIENT) ||
+               ((fld_s.flags & CONV_MASK) == CONV_REAL)) {
       struct Client *cptr = (struct Client*) fld_s.value.v_ptr;
       const char *str1 = 0, *str2 = 0, *str3 = 0;
       int slen1 = 0, slen2 = 0, slen3 = 0, elen = 0, plen = 0;
@@ -2057,8 +2063,13 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
        if (!IsServer(cptr) && !IsMe(cptr) && fld_s.flags & FLAG_ALT) {
          assert(0 != cli_user(cptr));
          assert(0 != *(cli_name(cptr)));
-         str2 = cli_user(cptr)->username;
-         str3 = cli_user(cptr)->host;
+          if ((fld_s.flags & CONV_MASK) == CONV_REAL) {
+            str2 = cli_user(cptr)->realusername;
+            str3 = cli_user(cptr)->realhost;
+          } else {
+            str2 = cli_user(cptr)->username;
+            str3 = cli_user(cptr)->host;
+          }
        } else
          fld_s.flags &= ~FLAG_ALT;
       }
index 1bc54f09e0c0b1197137ac07f29610f364654397..5697d0c28ff94bf15f212b7460c1c720bfd30c1f 100644 (file)
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_burst.c,v 1.40.2.2 2006/01/12 03:02:50 entrope Exp $
+ * $Id: m_burst.c,v 1.40 2005/09/27 02:41:57 entrope Exp $
  */
 
 /*
@@ -219,57 +219,6 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   timestamp = atoi(parv[2]);
 
-  if (chptr->creationtime)     /* 0 for new (empty) channels,
-                                   i.e. when this server just restarted. */
-  {
-    if (parc == 3)             /* Zannel BURST? */
-    {
-      /* An empty channel without +A set, will cause a BURST message
-        with exactly 3 parameters (because all modes have been reset).
-        If the timestamp on such channels is only a few seconds older
-        from our own, then we ignore this burst: we do not deop our
-        own side.
-        Likewise, we expect the other (empty) side to copy our timestamp
-        from our own BURST message, even though it is slightly larger.
-
-        The reason for this is to allow people to join an empty
-        non-A channel (a zannel) during a net.split, and not be
-        deopped when the net reconnects (with another zannel). When
-        someone joins a split zannel, their side increments the TS by one.
-        If they cycle a few times then we still don't have a reason to
-        deop them. Theoretically I see no reason not to accept ANY timestamp,
-        but to be sure, we only accept timestamps that are just a few
-        seconds off (one second for each time they cycled the channel). */
-
-      /* Don't even deop users who cycled four times during the net.break. */
-      if (timestamp < chptr->creationtime &&
-          chptr->creationtime <= timestamp + 4 &&
-         chptr->users != 0)    /* Only do this when WE have users, so that
-                                  if we do this the BURST that we sent has
-                                  parc > 3 and the other side will use the
-                                  test below: */
-       timestamp = chptr->creationtime; /* Do not deop our side. */
-    }
-    else if (chptr->creationtime < timestamp &&
-             timestamp <= chptr->creationtime + 4 &&
-            chptr->users == 0)
-    {
-      /* If one side of the net.junction does the above
-         timestamp = chptr->creationtime, then the other
-        side must do this: */
-      chptr->creationtime = timestamp; /* Use the same TS on both sides. */
-    }
-    /* In more complex cases, we might still end up with a
-       creationtime desync of a few seconds, but that should
-       be synced automatically rather quickly (every JOIN
-       caries a timestamp and will sync it; modes by users do
-       not carry timestamps and are accepted regardless).
-       Only when nobody joins the channel on the side with
-       the oldest timestamp before a new net.break occurs
-       precisely inbetween the desync, an unexpected bounce
-       might happen on reconnect. */
-  }
-
   if (!chptr->creationtime || chptr->creationtime > timestamp) {
     /*
      * Kick local members if channel is +i or +k and our TS was larger
@@ -478,7 +427,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
                  current_mode = (current_mode & ~CHFL_DELAYED) | CHFL_VOICE;
                  oplevel = -1; /* subsequent digits are an absolute op-level value. */
                 }
-               else if (IsDigit(*ptr)) {
+               else if (isdigit(*ptr)) {
                  int level_increment = 0;
                  if (oplevel == -1) { /* op-level is absolute value? */
                    if (current_mode_needs_reset) {
@@ -490,7 +439,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
                  current_mode = (current_mode & ~(CHFL_DEOPPED | CHFL_DELAYED)) | CHFL_CHANOP;
                  do {
                    level_increment = 10 * level_increment + *ptr++ - '0';
-                 } while (IsDigit(*ptr));
+                 } while(isdigit(*ptr));
                  oplevel += level_increment;
                }
                else /* I don't recognize that flag */
diff --git a/ircd/m_check.c b/ircd/m_check.c
new file mode 100644 (file)
index 0000000..370ef7d
--- /dev/null
@@ -0,0 +1,660 @@
+/*
+ * IRC - Internet Relay Chat, ircd/m_check.c
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ * University of Oulu, Computing Center
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * 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.
+ */
+
+#include "channel.h"
+#include "check.h"
+#include "client.h"
+#include "hash.h"
+#include "ircd.h"
+#include "ircd_alloc.h"
+#include "ircd_defs.h"
+#include "ircd_features.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "ircd_snprintf.h"
+#include "list.h"
+#include "listener.h"
+#include "match.h"
+#include "numeric.h"
+#include "numnicks.h"
+#include "querycmds.h"
+#include "send.h"
+#include "s_user.h"
+#include "s_debug.h"
+
+#include <string.h>
+
+#define CHECK_CHECKCHAN 0x01 /* -c */
+#define CHECK_SHOWUSERS 0x02 /* ! -u */
+#define CHECK_OPSONLY   0x04 /* -o */
+#define CHECK_SHOWIPS   0x08 /* -i */
+#define CHECK_CIDRMASK  0x10 /* automatically detected when performing a hostmask /CHECK */
+
+/*
+ * - ASUKA ---------------------------------------------------------------------
+ * This is the implimentation of the CHECK function for Asuka.
+ * Some of this code is from previous QuakeNet ircds, but most of it is mine..
+ * The old code was written by Durzel (durzel@quakenet.org).
+ * 
+ * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+ * -----------------------------------------------------------------------------
+ */
+
+/*
+ * Syntax: CHECK <channel|nick|server|hostmask> [-flags]
+ * 
+ * Where valid flags are:
+ * -c: Show channels when checking a hostmask.
+ * -i: Show IPs instead of hostnames when displaying results.
+ * -o: Only show channel operators when checking a channel.
+ * -u: Hide users when checking a channel.
+ * 
+ * <hostmask> can be of the form host, user@host, nick!user@host, 
+ * with host being host.domain.cc, 127.0.0.1 or 127.0.0.0/24.
+ * Wildcards are supported.
+ */
+
+int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
+  struct Channel *chptr;
+  struct Client *acptr;
+  char *param;
+  int flags = CHECK_SHOWUSERS, i;
+
+  if (parc < 2) {
+    send_reply(sptr, ERR_NEEDMOREPARAMS, "CHECK");
+    return 0;
+  }
+
+  /* This checks to see if any flags have been supplied */
+  if ((parc >= 3) && (parv[2][0] == '-')) {
+    for (i = 0; parv[2][i]; i++) {
+      switch (parv[2][i]) {
+      case 'c':
+        flags |= CHECK_CHECKCHAN;
+        break;
+        
+      case 'o':
+        flags |= CHECK_OPSONLY; /* fall through */
+      case 'u':
+        flags &= ~(CHECK_SHOWUSERS);
+        break;
+        
+      case 'i':
+        flags |= CHECK_SHOWIPS;
+        break;
+        
+      default:
+        /* might want to raise some sort of error here? */
+        break;
+      }
+    }
+  }
+
+  if (IsChannelName(parv[1])) { /* channel */
+    if ((chptr = FindChannel(parv[1]))) {
+      checkChannel(sptr, chptr);
+      checkUsers(sptr, chptr, flags);
+    }
+    else
+      send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
+  }
+  else if ((acptr = FindClient(parv[1])) && !(FindServer(parv[1]))) { /* client and not a server */
+    if (!IsRegistered(acptr)) {
+      send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
+      return 0;
+    }
+
+    checkClient(sptr, acptr);
+  }
+  else if ((acptr = FindServer(parv[1]))) { /* server */
+    checkServer(sptr, acptr);
+  }
+  else if (checkHostmask(sptr, parv[1], flags) > 0) /* hostmask */
+    return 1;
+  else /* no match */
+    send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
+  return 1;
+}
+
+static int checkClones(struct Channel *chptr, char *nick, char *host) {
+  int clones = 0;
+  struct Membership *lp;
+  struct Client *acptr;
+
+  for (lp = chptr->members; lp; lp = lp->next_member) {
+    acptr = lp->user;
+    if (!strcmp(acptr->cli_user->realhost, host) && strcmp(acptr->cli_name, nick)) {
+      /* this is a clone */
+      clones++;
+    }
+  }
+
+  return ((clones) ? clones + 1 : 0);
+}
+
+void checkUsers(struct Client *sptr, struct Channel *chptr, int flags) {
+  struct Membership *lp;
+  struct Ban *ban;
+  struct Client *acptr;
+
+  char outbuf[BUFSIZE], ustat[64];
+  int cntr = 0, opcntr = 0, vcntr = 0, clones = 0, bans = 0, c = 0, authed = 0;
+
+  if (flags & CHECK_SHOWUSERS) send_reply(sptr, RPL_DATASTR, "Users (@ = op, + = voice)");
+
+  for (lp = chptr->members; lp; lp = lp->next_member) {
+    int opped = 0;
+
+    acptr = lp->user;
+
+    if ((c = checkClones(chptr, acptr->cli_name, acptr->cli_user->realhost)) != 0) {
+      ircd_snprintf(0, ustat, sizeof(ustat), "%2d ", c);
+      clones++;
+    }
+    else
+      strcpy(ustat, "   ");
+
+    if (chptr && is_chan_op(acptr, chptr)) {
+      strcat(ustat, "@");
+      opcntr++;
+      opped = 1;
+    }
+    else if (chptr && has_voice(acptr, chptr)) {
+      strcat(ustat, "+");
+      vcntr++;
+    }
+    else
+      strcat(ustat, " ");
+
+    if ((c = IsAccount(acptr)) != 0) ++authed;
+
+    if ((flags & CHECK_SHOWUSERS) || ((flags & CHECK_OPSONLY) && opped)) {
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%c", acptr->cli_info, COLOR_OFF);
+      send_reply(sptr, RPL_CHANUSER, ustat, acptr->cli_name, acptr->cli_user->realusername,
+            (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : acptr->cli_user->realhost, outbuf, 
+            (c ? acptr->cli_user->account : ""));
+    }
+
+    cntr++;
+  }
+
+  send_reply(sptr, RPL_DATASTR, " ");
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf),
+      "Total users:: %d (%d ops, %d voiced, %d clones, %d authed)",
+      cntr, opcntr, vcntr, clones, authed);
+
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  send_reply(sptr, RPL_DATASTR, " ");
+
+  /* Do not display bans if ! flags & CHECK_SHOWUSERS */
+  if (!(flags & CHECK_SHOWUSERS)) {
+    send_reply(sptr, RPL_ENDOFCHECK, " ");
+    return;
+  }
+
+  /* Bans */
+  send_reply(sptr, RPL_DATASTR, "Bans on channel::");
+
+  for (ban = chptr->banlist; ban; ban = ban->next) {
+    ircd_snprintf(0, outbuf, sizeof(outbuf),  "[%d] - %s - Set by %s, on %s", 
+      ++bans, ban->banstr, ban->who, myctime(ban->when));
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  if (bans == 0)
+    send_reply(sptr, RPL_DATASTR, "<none>");
+
+  send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+void checkChannel(struct Client *sptr, struct Channel *chptr) {
+  char outbuf[TOPICLEN + MODEBUFLEN + 64], modebuf[MODEBUFLEN], parabuf[MODEBUFLEN];
+
+  /* Header */
+  send_reply(sptr, RPL_DATASTR, " ");
+  send_reply(sptr, RPL_CHKHEAD, "channel", chptr->chname);
+  send_reply(sptr, RPL_DATASTR, " ");
+
+  /* Creation Time */
+  ircd_snprintf(sptr, outbuf, sizeof(outbuf), "  Creation time:: %s", myctime(chptr->creationtime));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  /* Topic */
+  if (strlen(chptr->topic) <= 0)
+    send_reply(sptr, RPL_DATASTR, "          Topic:: <none>");
+  else {
+    ircd_snprintf(sptr, outbuf, sizeof(outbuf), "          Topic:: %s", chptr->topic);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+
+    /* ..set by */
+    ircd_snprintf(sptr, outbuf, sizeof(outbuf), "         Set by:: %s", chptr->topic_nick);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  /* Channel Modes */
+
+  strcpy(outbuf, "Channel mode(s):: ");
+
+  modebuf[0] = '\0';
+  parabuf[0] = '\0';
+
+  channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), chptr, NULL);
+
+  if(modebuf[1] == '\0')
+      strcat(outbuf, "<none>");
+  else if(*parabuf) {
+    strcat(outbuf, modebuf);
+    strcat(outbuf, " ");
+    strcat(outbuf, parabuf);
+  }
+  else
+    strcat(outbuf, modebuf);
+
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  /* Don't send 'END OF CHECK' message, it's sent in checkUsers, which is called after this. */
+}
+
+void checkClient(struct Client *sptr, struct Client *acptr) {
+  struct Channel *chptr;
+  struct Membership *lp;
+  struct irc_sockaddr sin;
+  char outbuf[BUFSIZE];
+  time_t nowr;
+
+  /* Header */
+  send_reply(sptr, RPL_DATASTR, " ");
+  send_reply(sptr, RPL_CHKHEAD, "user", acptr->cli_name);
+  send_reply(sptr, RPL_DATASTR, " ");
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "           Nick:: %s (%s%s)", acptr->cli_name, NumNick(acptr));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  if (MyUser(acptr)) {  
+    ircd_snprintf(0, outbuf, sizeof(outbuf),  "      Signed on:: %s", myctime(acptr->cli_firsttime));
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "      Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick);
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "  User/Hostmask:: %s@%s (%s)", acptr->cli_user->username, acptr->cli_user->host,
+  ircd_ntoa(&(cli_ip(acptr))));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  if (IsSetHost(acptr) || IsAccount(acptr)) {
+    ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", acptr->cli_user->realusername, acptr->cli_user->realhost);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "      Real Name:: %s%c", cli_info(acptr), COLOR_OFF);
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  if (IsService(acptr) == -1)
+    send_reply(sptr, RPL_DATASTR, "         Status:: Network Service");
+  else if (IsAnOper(acptr))
+    send_reply(sptr, RPL_DATASTR, "         Status:: IRC Operator");
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "   Connected to:: %s", cli_name(acptr->cli_user->server));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  /* +s (SERV_NOTICE) is not relayed to us from remote servers,
+   * so we cannot tell if a remote client has that mode set.
+   * And hacking it onto the end of the output of umode_str is EVIL BAD AND WRONG
+   * (and breaks if the user is +r) so we won't do that either.
+   */
+
+  if (strlen(umode_str(acptr)) < 1)
+    strcpy(outbuf, "       Umode(s):: <none>");
+  else
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "       Umode(s):: +%s", umode_str(acptr));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  if (acptr->cli_user->joined == 0)
+    send_reply(sptr, RPL_DATASTR, "     Channel(s):: <none>");
+  else if (acptr->cli_user->joined > 50) {
+
+    /* NB. As a sanity check, we DO NOT show the individual channels the
+     *     client is on if it is on > 50 channels.  This is to prevent the ircd
+     *     barfing ala Uworld when someone does /quote check Q :).. (I shouldn't imagine
+     *     an Oper would want to see every single channel 'x' client is on anyway if
+     *     they are on *that* many).
+     */
+
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "     Channel(s):: - (total: %u)", acptr->cli_user->joined);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+  else {
+    char chntext[BUFSIZE];
+    int len = strlen("     Channel(s):: ");
+    int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name);
+    *chntext = '\0';
+
+    strcpy(chntext, "     Channel(s):: ");
+    for (lp = acptr->cli_user->channel; lp; lp = lp->next_channel) {
+      chptr = lp->channel;
+      if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) {
+        send_reply(sptr, RPL_DATASTR, chntext);
+        *chntext = '\0';
+        strcpy(chntext, "     Channel(s):: ");
+        len = strlen(chntext);
+      }
+      if (IsDeaf(acptr))
+        *(chntext + len++) = '-';
+      if (is_chan_op(acptr, chptr))
+        *(chntext + len++) = '@';
+      else if (has_voice(acptr, chptr))
+        *(chntext + len++) = '+';
+      else if (IsZombie(lp))
+        *(chntext + len++) = '!';
+      if (len)
+        *(chntext + len) = '\0';
+
+      strcpy(chntext + len, chptr->chname);
+      len += strlen(chptr->chname);
+      strcat(chntext + len, " ");
+      len++;
+    }
+
+    if (chntext[0] != '\0')
+      send_reply(sptr, RPL_DATASTR, chntext);
+  }
+
+  /* If client processing command ISN'T target (or a registered
+   * Network Service), show idle time since the last time we
+   * parsed something.
+   */
+  if (MyUser(acptr) && !(IsService(acptr) == -1) && !(strCasediff(acptr->cli_name, sptr->cli_name) == 0)) {
+    nowr = CurrentTime - acptr->cli_user->last;
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "       Idle for:: %d days, %02ld:%02ld:%02ld",
+        nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  /* Away message (if applicable) */
+  if (acptr->cli_user->away) {
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "   Away message:: %s", acptr->cli_user->away);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+  }
+
+  /* If local user.. */
+  if (MyUser(acptr)) {
+    os_get_peername(con_fd(cli_connect(sptr)), &sin);
+
+    send_reply(sptr, RPL_DATASTR, " ");
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "          Ports:: %d -> %d (client -> server)",
+        sin.port, cli_listener(acptr)->addr.port);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+    if (feature_bool(FEAT_EXTENDED_CHECKCMD)) {
+      /* Note: sendq = receiveq for a client (it makes sense really) */
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "      Data sent:: %lu.%0.3u Kb (%u protocol messages)",
+            (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr));
+      send_reply(sptr, RPL_DATASTR, outbuf);                          
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "  Data received:: %lu.%0.3lu Kb (%u protocol messages)",
+            (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr));
+      send_reply(sptr, RPL_DATASTR, outbuf);
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "  receiveQ size:: %d bytes (max. %d bytes)",
+            DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD));
+      send_reply(sptr, RPL_DATASTR, outbuf);
+            ircd_snprintf(0, outbuf, sizeof(outbuf), "     sendQ size:: %d bytes (max. %d bytes)",
+            DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr));                                
+      send_reply(sptr, RPL_DATASTR, outbuf);                
+    }
+  }
+
+  /* Send 'END OF CHECK' message */
+  send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+void checkServer(struct Client *sptr, struct Client *acptr) {
+  char outbuf[BUFSIZE];
+
+  /* Header */
+  send_reply(sptr, RPL_DATASTR, " ");
+  send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name);
+  send_reply(sptr, RPL_DATASTR, " ");
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "   Connected at:: %s", myctime(acptr->cli_serv->timestamp));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "    Server name:: %s", acptr->cli_name);
+  send_reply(sptr, RPL_DATASTR,  outbuf);
+
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "        Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+  
+  ircd_snprintf(0, outbuf, sizeof(outbuf), "          Users:: %d / %d", cli_serv(acptr)->clients, 
+    base64toint(cli_serv(acptr)->nn_capacity));
+  send_reply(sptr, RPL_DATASTR, outbuf);
+  
+  if (IsBurst(acptr))
+    send_reply(sptr, RPL_DATASTR, "         Status:: Bursting");
+  else if (IsBurstAck(acptr))
+    send_reply(sptr, RPL_DATASTR, "         Status:: Awaiting EOB Ack");
+  else if (IsService(acptr))
+    send_reply(sptr, RPL_DATASTR, "         Status:: Network Service");
+  else if (IsHub(acptr))
+    send_reply(sptr, RPL_DATASTR, "         Status:: Network Hub");
+  
+  if (feature_bool(FEAT_EXTENDED_CHECKCMD)) {
+    int dlinkc = 0;
+    struct DLink* slink = NULL;
+    
+    send_reply(sptr, RPL_DATASTR, " ");
+    send_reply(sptr, RPL_DATASTR, "Downlinks::");
+    for (slink = cli_serv(acptr)->down; slink; slink = slink->next) {
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc, 
+            IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ", 
+            cli_name(slink->value.cptr));
+      send_reply(sptr, RPL_DATASTR, outbuf);
+    }
+    
+    if (!dlinkc)
+      send_reply(sptr, RPL_DATASTR, "<none>");
+  }
+
+  /* Send 'END OF CHECK' message */
+  send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+signed int checkHostmask(struct Client *sptr, char *hoststr, int flags) {
+  struct Client *acptr;
+  struct Channel *chptr;
+  struct Membership *lp;
+  int count = 0, found = 0;
+  char outbuf[BUFSIZE];
+  char targhost[NICKLEN + USERLEN + HOSTLEN + 3], curhost[NICKLEN + USERLEN + HOSTLEN + 3];
+  char nickm[NICKLEN + 1], userm[USERLEN + 1], hostm[HOSTLEN + 1];
+  char *p = NULL;
+  struct irc_in_addr cidr_check;
+  char cidr_check_bits;
+
+  strcpy(nickm,"*");
+  strcpy(userm,"*");
+  strcpy(hostm,"*");
+
+  if (!strchr(hoststr, '!') && !strchr(hoststr, '@'))
+    ircd_strncpy(hostm,hoststr,HOSTLEN);
+  else {
+    if (p = strchr(hoststr, '@')) {
+      *p++ = '\0';
+      if (*p) ircd_strncpy(hostm,p, HOSTLEN);
+    }
+
+    /* Get the nick!user mask */
+    if (p = strchr(hoststr, '!')) {
+      *p++ = '\0';
+      if (*p) ircd_strncpy(userm,p,USERLEN);
+      if (*hoststr) ircd_strncpy(nickm,hoststr,NICKLEN);
+    }
+    else if (*hoststr) {
+      /* Durz: We should only do the following *IF* the hoststr has not already been
+       * copied into hostm (ie. neither ! or @ specified).. otherwise, when we do
+       * /quote check *.barrysworld.com - we end up with targhost as: *!*.barryswo@*.barrysworld.com
+       */
+      ircd_strncpy(userm,hoststr,USERLEN);
+    }
+  }
+  if (ipmask_parse(hostm, &cidr_check, &cidr_check_bits) != 0) {
+    flags |= CHECK_CIDRMASK;
+  }
+  
+  /*if ((p = strchr(hostm, '/')) || inet_aton(hostm, &cidr_check)) {
+    if (p)
+      *p = '\0';
+    if (inet_aton(hostm, &cidr_check)) {
+      cidr_check_bits = p ? atoi(p + 1) : 32;
+      if ((cidr_check_bits >= 0) && (cidr_check_bits <= 32)) {
+        flags |= CHECK_CIDRMASK;
+        cidr_check.s_addr &= NETMASK(cidr_check_bits);
+      }
+    }
+    if (p)
+      *p = '/';
+  }*/
+
+  /* Copy formatted string into "targhost" buffer */
+  ircd_snprintf(0, targhost, sizeof(targhost),  "%s!%s@%s", nickm, userm, hostm);
+
+  targhost[sizeof(targhost) - 1] = '\0';
+
+  /* Note: we have to exclude the last client struct as it is not a real client
+   * structure, and therefore any attempt to access elements in it would cause
+   * a segfault.
+   */
+
+  for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
+    /* Dont process if acptr is a unregistered client, a server or a ping */
+    if (!IsRegistered(acptr) || IsServer(acptr))
+      continue;
+
+    if (IsMe(acptr))   /* Always the last acptr record */
+      break;
+
+    if(count > 500) { /* sanity stuff */
+      send_reply(sptr, RPL_ENDOFCHECK, " ");
+      break;
+    }
+
+    /* Copy host info into buffer */
+    curhost[0] = '\0';
+    ircd_snprintf(0, curhost, sizeof(curhost), "%s!%s@%s", acptr->cli_name, acptr->cli_user->realusername, acptr->cli_user->realhost);
+
+    if (flags & CHECK_CIDRMASK) {
+      if (ipmask_check(&cli_ip(acptr), &cidr_check, cidr_check_bits) && !match(nickm, acptr->cli_name) 
+            && (!match(userm, acptr->cli_user->realusername) || !match(userm, acptr->cli_user->username)))
+        found = 1;
+    }
+    else {
+      if(match((const char*)targhost,(const char*)curhost) == 0)
+        found = 1;
+      else {
+        curhost[0] = '\0';
+        ircd_snprintf(0, curhost, sizeof(curhost), "%s!%s@%s", acptr->cli_name, acptr->cli_user->username, acptr->cli_user->host);
+
+        if(match((const char*)targhost,(const char*)curhost) == 0)
+          found = 1;
+      }
+    }
+
+    if (found == 1) {
+      found = 0;  /* reset that so it doesn't get crazy go nuts */
+
+      /* Show header if we've found at least 1 record */
+      if (count == 0) {
+        /* Output header */ 
+        send_reply(sptr, RPL_DATASTR, " ");
+        send_reply(sptr, RPL_CHKHEAD, "host", targhost);
+
+        send_reply(sptr, RPL_DATASTR, " ");
+        ircd_snprintf(0, outbuf, sizeof(outbuf),  "%s   %-*s%-*s%s", "No.", (NICKLEN + 2 ), "Nick",
+                (USERLEN + 2), "User", "Host");
+        send_reply(sptr, RPL_DATASTR, outbuf);
+      }
+
+      ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d  %-*s%-*s%s", (count+1), (NICKLEN + 2),
+            acptr->cli_name, (USERLEN + 2), acptr->cli_user->realusername, 
+            (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : acptr->cli_user->realhost);
+      send_reply(sptr, RPL_DATASTR, outbuf);
+
+      /* Show channel output (if applicable) - the 50 channel limit sanity check
+       * is specifically to prevent coredumping when someone lamely tries to /check
+       * Q or some other channel service...
+       */
+      if (flags & CHECK_CHECKCHAN) {
+        if (acptr->cli_user->joined > 0 && acptr->cli_user->joined <= 50) {
+          char chntext[BUFSIZE];
+          int len = strlen("      on channels: ");
+          int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name);
+          *chntext = '\0';
+
+          strcpy(chntext, "      on channels: ");
+          for (lp = acptr->cli_user->channel; lp; lp = lp->next_channel) {
+            chptr = lp->channel;
+            if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) {
+              send_reply(sptr, RPL_DATASTR, chntext);
+              *chntext = '\0';
+              strcpy(chntext, "      on channels: ");
+              len = strlen(chntext);
+            }
+            if (IsDeaf(acptr))
+              *(chntext + len++) = '-';
+            if (is_chan_op(acptr, chptr))
+              *(chntext + len++) = '@';
+            else if (has_voice(acptr, chptr))
+              *(chntext + len++) = '+';
+            else if (IsZombie(lp))
+              *(chntext + len++) = '!';
+            if (len)
+              *(chntext + len) = '\0';
+
+            strcpy(chntext + len, chptr->chname);
+            len += strlen(chptr->chname);
+            strcat(chntext + len, " ");
+            len++;
+          }
+          if (chntext[0] != '\0')
+            send_reply(sptr, RPL_DATASTR, chntext);
+
+          send_reply(sptr, RPL_DATASTR, " ");
+        }
+      }
+      count++;
+    }
+  }
+
+  if (count > 0) {
+    send_reply(sptr, RPL_DATASTR, " ");
+
+    ircd_snprintf(0, outbuf, sizeof(outbuf), "Matching records found:: %d", count);
+    send_reply(sptr, RPL_DATASTR, outbuf);
+
+    send_reply(sptr, RPL_ENDOFCHECK, " ");
+  }
+
+  return count;
+}
index de87212ae1a6f718e9af0f6f373b64e0c76c1e8e..890331d2780c2f9d90ce16b31959ca7d9e821b62 100644 (file)
@@ -124,6 +124,10 @@ do_clearmode(struct Client *cptr, struct Client *sptr, struct Channel *chptr,
     MODE_LIMIT,                'l',
     MODE_REGONLY,      'r',
     MODE_DELJOINS,      'D',
+    MODE_NOQUITPARTS,   'u',
+    MODE_NOCOLOUR,      'c',
+    MODE_NOCTCP,        'C',
+    MODE_NONOTICE,      'N',
     0x0, 0x0
   };
   int *flag_p;
index 5bcbd85391f3255270d75b11442990fb2f6d0043..c32c5d6ce7b76405b001660aa16958813db07c4f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * IRC - Internet Relay Chat, ircd/m_destruct.c
- * Copyright (C) 1997, 2005 Carlo Wood.
+ * Copyright (C) 1997 Carlo Wood.
  *
  * See file AUTHORS in IRC package for additional names of
  * the programmers.
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_destruct.c,v 1.9.2.3 2006/01/03 01:25:50 entrope Exp $
+ * $Id: m_destruct.c,v 1.9 2005/03/20 16:06:18 entrope Exp $
  */
 
 #include "config.h"
@@ -113,76 +113,7 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
   /* Don't pass on DESTRUCT messages for channels that
      are not empty, but instead send a BURST msg upstream. */
   if (chptr->users > 0) {
-#if 0  /* Once all servers are 2.10.12, this can be used too.
-           Until then we have to use CREATE and MODE to
-          get the message accross, because older server do
-          not accept a BURST outside the net.burst. */
     send_channel_modes(cptr, chptr);
-#else
-  /* This happens when a JOIN and DESTRUCT crossed, ie:
-
-     server1 ----------------- server2
-        DESTRUCT-->   <-- JOIN,MODE
-
-     Where the JOIN and MODE are the result of joining
-     the zannel before it expired on server2, or in the
-     case of simulateous expiration, a DESTRUCT crossing
-     with another DESTRUCT (that will be ignored) and
-     a CREATE of a user joining right after that:
-
-     server1 ----------------- server2
-        DESTRUCT-->   <-- DESTRUCT <-- CREATE
-     
-     in both cases, when the DESTRUCT arrives on
-     server2 we need to send synchronizing messages
-     upstream (to server1).  Since sending two CREATEs
-     or JOINs for the same user after another is a
-     protocol violation, we first have to send PARTs
-     (we can't send a DESTRUCT because 2.10.11 ignores
-     DESTRUCT messages (just passes them on) and has
-     a bug that causes two JOIN's for the same user to
-     result in that user being on the channel twice). */
-
-    struct Membership *member;
-    struct ModeBuf mbuf;
-    struct Ban *link;
-
-    /* Next, send all PARTs upstream. */
-    for (member = chptr->members; member; member = member->next_member)
-      sendcmdto_one(member->user, CMD_PART, cptr, "%H", chptr);
-
-    /* Next, send JOINs for all members. */
-    for (member = chptr->members; member; member = member->next_member)
-      sendcmdto_one(member->user, CMD_JOIN, cptr, "%H", chptr);
-
-    /* Build MODE strings. We use MODEBUF_DEST_BOUNCE with MODE_DEL to assure
-       that the resulting MODEs are only sent upstream. */
-    modebuf_init(&mbuf, sptr, cptr, chptr, MODEBUF_DEST_SERVER | MODEBUF_DEST_BOUNCE);
-
-    /* Op/voice the users as appropriate. We use MODE_DEL because we fake a bounce. */
-    for (member = chptr->members; member; member = member->next_member)
-    {
-      if (IsChanOp(member))
-        modebuf_mode_client(&mbuf, MODE_DEL | MODE_CHANOP, member->user, OpLevel(member));
-      if (HasVoice(member))
-        modebuf_mode_client(&mbuf, MODE_DEL | MODE_VOICE, member->user, MAXOPLEVEL + 1);
-    }
-
-    /* Send other MODEs. */
-    modebuf_mode(&mbuf, MODE_DEL | chptr->mode.mode);
-    if (*chptr->mode.key)
-      modebuf_mode_string(&mbuf, MODE_DEL | MODE_KEY, chptr->mode.key, 0);
-    if (chptr->mode.limit)
-      modebuf_mode_uint(&mbuf, MODE_DEL | MODE_LIMIT, chptr->mode.limit);
-    if (*chptr->mode.upass)
-      modebuf_mode_string(&mbuf, MODE_DEL | MODE_UPASS, chptr->mode.upass, 0);
-    if (*chptr->mode.apass)
-      modebuf_mode_string(&mbuf, MODE_DEL | MODE_APASS, chptr->mode.apass, 0);
-    for (link = chptr->banlist; link; link = link->next)
-      modebuf_mode_string(&mbuf, MODE_DEL | MODE_BAN, link->banstr, 0);
-    modebuf_flush(&mbuf);
-#endif
-
     return 0;
   }
 
@@ -190,8 +121,7 @@ int ms_destruct(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
   sendcmdto_serv_butone(&me, CMD_DESTRUCT, 0, "%s %Tu", parv[1], chanTS);
 
   /* Remove the empty channel. */
-  if (chptr->destruct_event)
-    remove_destruct_event(chptr);
+  remove_destruct_event(chptr);
   destruct_channel(chptr);
 
   return 0;
index 47ab28757baf3e3533ccf6a9c36083d82eda035e..79fd974b9cc64f2e5042bf7830a81d3ff8059aaf 100644 (file)
@@ -153,23 +153,26 @@ ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     flags |= GLINE_FORCE;
 
   if (!(target[0] == '*' && target[1] == '\0')) {
-    if (!(acptr = FindNServer(target)))
+    if (!( (acptr = FindNServer(target)) || 
+           (acptr = SeekServer(target)) ) )
       return 0; /* no such server */
 
     if (!IsMe(acptr)) { /* manually propagate */
       if (!lastmod)
        sendcmdto_one(sptr, CMD_GLINE, acptr,
-                     (parc == 3) ? "%C %s" : "%C %s %s :%s", acptr, mask,
+                     (parc == 3) ? "%s %s" : "%s %s %s :%s", target, mask,
                      parv[3], reason);
       else
-       sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s %s %s :%s", acptr,
+       sendcmdto_one(sptr, CMD_GLINE, acptr, "%s %s%s %s %s :%s", target,
                      flags & GLINE_OPERFORCE ? "!" : "", mask, parv[3],
                      parv[4], reason);
 
       return 0;
     }
 
-    flags |= GLINE_LOCAL;
+    /* For asuka we don't want glines sent this way treated as local
+     * flags |= GLINE_LOCAL;
+     */
   }
 
   if (*mask == '-')
@@ -331,6 +334,9 @@ mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 int
 m_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 {
+  if (feature_bool(FEAT_HIS_USERGLINE))
+    return send_reply(sptr, ERR_DISABLED, "GLINE");
+
   if (parc < 2)
     return send_reply(sptr, ERR_NOSUCHGLINE, "");
 
index 0d87642b28b16f84e720a5488802d663ed6d11ca..6f510b935777564174497b8ef592d864ea7dd6ca 100644 (file)
@@ -166,6 +166,11 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   /* If we get here, it was a VALID and meaningful INVITE */
 
+  if (IsAccountOnly(acptr) && !IsAccount(sptr) && !IsOper(sptr)) {
+    send_reply(sptr, ERR_ACCOUNTONLY, cli_name(acptr));
+    return 0;
+  }
+  
   if (check_target_limit(sptr, acptr, cli_name(acptr), 0))
     return 0;
 
index 4a121860fae8a9dc196e1e4981da64c7e2a60385..e5c5fe204252afa78c7b49d84e134c9dc29b6969 100644 (file)
@@ -150,9 +150,9 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     }
 
     /* BADCHANed channel */
-    if ((gline = gline_find(name, GLINE_BADCHAN | GLINE_EXACT)) &&
+    if ((gline = gline_find(name, GLINE_BADCHAN)) &&
        GlineIsActive(gline) && !IsAnOper(sptr)) {
-      send_reply(sptr, ERR_BANNEDFROMCHAN, name);
+      send_reply(sptr, ERR_BADCHANNAME, name, gline->gl_reason);
       continue;
     }
 
@@ -174,6 +174,8 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
       }
 
       joinbuf_join(&create, chptr, CHFL_CHANOP | CHFL_CHANNEL_MANAGER);
+      if (feature_bool(FEAT_AUTOCHANMODES) && feature_str(FEAT_AUTOCHANMODES_LIST) && strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) > 0)
+        SetAutoChanModes(chptr);
     } else if (find_member_link(chptr, sptr)) {
       continue; /* already on channel */
     } else if (check_target_limit(sptr, chptr, chptr->chname, 0)) {
@@ -205,6 +207,14 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
       else if (*chptr->mode.key && (!key || strcmp(key, chptr->mode.key)))
         err = ERR_BADCHANNELKEY;
 
+      /*
+       * ASUKA_X:
+       * Allow XtraOpers to join all channels.
+       * --Bigfoot
+       */
+      if (IsXtraOp(sptr))
+        err = 0;
+      
       /* An oper with WALK_LCHAN privilege can join a local channel
        * he otherwise could not join by using "OVERRIDE" as the key.
        * This will generate a HACK(4) notice, but fails if the oper
index e0eae8b3d94820507f3a78bad6bfa691a64514be..36299d45414315b9a807ab74235a2c3bfed44165 100644 (file)
@@ -131,7 +131,15 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     return 0; /* find_chasing sends the reply for us */
 
   /* Don't allow the channel service to be kicked */
-  if (IsChannelService(who))
+  /*
+   * ASUKA_X:
+   * Allow +X'ed users to kick +k'ed, but not U-lined services.
+   * --Bigfoot
+   */
+  if (IsChannelService(who) && IsService(cli_user(who)->server))
+    return send_reply(sptr, ERR_ISREALSERVICE, cli_name(who), chptr->chname);
+
+  if (IsChannelService(who) && !IsXtraOp(sptr) && (who!=sptr))
     return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname);
 
   /* Prevent kicking opers from local channels -DM- */
@@ -168,7 +176,7 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     sendcmdto_one(sptr, CMD_KICK, sptr, "%H %C :%s", chptr, who, comment);
     CheckDelayedJoins(chptr);
   } else
-    sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, 0, "%H %C :%s", chptr, who,
+    sendcmdto_channel_butserv_butone((IsServer(sptr) ? &me : sptr), CMD_KICK, chptr, NULL, 0, "%H %C :%s", chptr, who,
                                      comment);
 
   make_zombie(member, who, cptr, sptr, chptr);
index 24ade1d71f456fb70c3d0026f756e41a5880619f..5e9f4d0d1ba740b16297058bef710ce1ae5a3edf 100644 (file)
@@ -277,7 +277,15 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /*
    * if the user is +k, prevent a kill from local user
    */
-  if (IsChannelService(victim))
+  /*
+   * ASUKA_X:
+   * Allow +X'ed users to kill +k'ed, but not U-lined services.
+   * --Bigfoot
+   */
+  if (IsChannelService(victim) && IsService(cli_user(victim)->server))
+    return send_reply(sptr, ERR_ISREALSERVICE, "KILL", cli_name(victim));
+
+  if (IsChannelService(victim) && !IsXtraOp(sptr) && !(victim==sptr))
     return send_reply(sptr, ERR_ISCHANSERVICE, "KILL", cli_name(victim));
 
 
index 4623f17868d7876176a22335c6144e86216cfbb9..ab5facd52e4848aaf3eb98d756970f5f9b77da23 100644 (file)
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_names.c,v 1.22.2.2 2005/11/17 00:05:00 entrope Exp $
+ * $Id: m_names.c,v 1.22.2.1 2005/10/06 04:00:26 entrope Exp $
  */
 
 /*
@@ -242,8 +242,7 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   
   s = strchr(para, ','); /* Recursively call m_names for each comma-separated channel. Eww. */
   if (s) {
-    *s++ = '\0';
-    parv[1+showingdelayed] = s;
+    parv[1+showingdelayed] = ++s;
     m_names(cptr, sptr, parc, parv);
   }
  
@@ -390,8 +389,7 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   
   s = strchr(para, ','); /* Recursively call m_names for each comma-separated channel. */
   if (s) {
-    *s++ = '\0';
-    parv[1+!!showingdelayed] = s;
+    parv[1+!!showingdelayed] = ++s;
     m_names(cptr, sptr, parc, parv);
   }
  
index ccdbc9281ad53ece92868353dc42c5579729b5e5..891c45733f82a62b05859ecb4bd131a97e4ef42e 100644 (file)
@@ -98,6 +98,7 @@
 #include "s_user.h"
 #include "send.h"
 #include "sys.h"
+#include "gline.h"
 
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <stdlib.h>
@@ -181,6 +182,11 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return 0;
   }
 
+  if (IsRegistered(sptr) && !IsAnOper(sptr) && IsNickGlined(sptr, nick)) {
+    send_reply(sptr, ERR_ERRONEUSNICKNAME, nick);
+    return 0;
+  }
+  
   /* 
    * Check if this is a LOCAL user trying to use a reserved (Juped)
    * nick, if so tell him that it's a nick in use...
index 15cc50911d1b7b89f9c0b9f0be036bdd1ba38c14..580a5ca6138d81959eb4149cadb73abe1fb0796a 100644 (file)
@@ -151,7 +151,7 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   {
     send_reply(sptr, ERR_NOOPERHOST);
     sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)",
-                        parv[0], cli_user(sptr)->username, cli_sockhost(sptr));
+                        parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr));
     return 0;
   }
   assert(0 != (aconf->status & CONF_OPERATOR));
@@ -163,7 +163,7 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     if (ACR_OK != attach_conf(sptr, aconf)) {
       send_reply(sptr, ERR_NOOPERHOST);
       sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s "
-                          "(%s@%s)", parv[0], cli_user(sptr)->username,
+                          "(%s@%s)", parv[0], cli_user(sptr)->realusername,
                           cli_sockhost(sptr));
       return 0;
     }
@@ -187,16 +187,16 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     send_reply(sptr, RPL_YOUREOPER);
 
     sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)",
-                        parv[0], cli_user(sptr)->username, cli_sockhost(sptr),
+                        parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr),
                         IsOper(sptr) ? 'O' : 'o');
 
-    log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#C)", name, sptr);
+    log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#R)", name, sptr);
   }
   else
   {
     send_reply(sptr, ERR_PASSWDMISMATCH);
     sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)",
-                        parv[0], cli_user(sptr)->username, cli_sockhost(sptr));
+                        parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr));
   }
   return 0;
 }
index 14f7278d3457c7032deb18365acf89dccc589c0a..534e864b1009cb099847139c5518a89173ea4b23 100644 (file)
@@ -107,9 +107,11 @@ int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   if (cli_user(sptr)) {
     struct Membership* chan;
+    /* (slug for +u) removed !IsDelayedJoin(chan) as splidge said to */
     for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) {
-        if (!IsZombie(chan) && !IsDelayedJoin(chan) && !member_can_send_to_channel(chan, 0))
-        return exit_client(cptr, sptr, sptr, "Signed off");
+        if (!IsZombie(chan) && (!member_can_send_to_channel(chan, 0)
+           || (chan->channel->mode.mode & MODE_NOQUITPARTS)))
+          return exit_client(cptr, sptr, sptr, "Signed off");
     }
   }
   if (parc > 1 && !BadPtr(parv[parc - 1]))
diff --git a/ircd/m_sethost.c b/ircd/m_sethost.c
new file mode 100644 (file)
index 0000000..9d05309
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * IRC - Internet Relay Chat, ircd/m_sethost.c
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ *                    University of Oulu, Computing Center
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * 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.
+ *
+ * $Id: asuka-sethost.patch,v 1.27 2005/02/13 17:28:11 froo Exp $
+ */
+
+/*
+ * m_functions execute protocol messages on this server:
+ *
+ *    cptr    is always NON-NULL, pointing to a *LOCAL* client
+ *            structure (with an open socket connected!). This
+ *            identifies the physical socket where the message
+ *            originated (or which caused the m_function to be
+ *            executed--some m_functions may call others...).
+ *
+ *    sptr    is the source of the message, defined by the
+ *            prefix part of the message if present. If not
+ *            or prefix not found, then sptr==cptr.
+ *
+ *            (!IsServer(cptr)) => (cptr == sptr), because
+ *            prefixes are taken *only* from servers...
+ *
+ *            (IsServer(cptr))
+ *                    (sptr == cptr) => the message didn't
+ *                    have the prefix.
+ *
+ *                    (sptr != cptr && IsServer(sptr) means
+ *                    the prefix specified servername. (?)
+ *
+ *                    (sptr != cptr && !IsServer(sptr) means
+ *                    that message originated from a remote
+ *                    user (not local).
+ *
+ *            combining
+ *
+ *            (!IsServer(sptr)) means that, sptr can safely
+ *            taken as defining the target structure of the
+ *            message in this server.
+ *
+ *    *Always* true (if 'parse' and others are working correct):
+ *
+ *    1)      sptr->from == cptr  (note: cptr->from == cptr)
+ *
+ *    2)      MyConnect(sptr) <=> sptr == cptr (e.g. sptr
+ *            *cannot* be a local connection, unless it's
+ *            actually cptr!). [MyConnect(x) should probably
+ *            be defined as (x == x->from) --msa ]
+ *
+ *    parc    number of variable parameter strings (if zero,
+ *            parv is allowed to be NULL)
+ *
+ *    parv    a NULL terminated list of parameter pointers,
+ *
+ *                    parv[0], sender (prefix string), if not present
+ *                            this points to an empty string.
+ *                    parv[1]...parv[parc-1]
+ *                            pointers to additional parameters
+ *                    parv[parc] == NULL, *always*
+ *
+ *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
+ *                    non-NULL pointers.
+ */
+#include "config.h"
+
+#include "client.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "ircd_features.h"
+#include "msgq.h"
+#include "numeric.h"
+#include "s_user.h"
+#include "s_debug.h"
+#include "struct.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+/*
+ * m_sethost - generic message handler
+ *
+ * mimic old lain syntax:
+ *
+ * (Oper) /SETHOST ident host.cc [quit-message]
+ * (User) /SETHOST host.cc password
+ * (Both) /SETHOST undo
+ *
+ * check for undo, prepend parv w. <nick> -h or +h
+ */
+int m_sethost(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+  char hostmask[512];
+  struct Flags setflags;
+
+  /* Back up the flags first */
+  setflags = cli_flags(sptr);
+
+  if (parc < 2)
+    return need_more_params(sptr, "SETHOST");
+
+  if (0 == ircd_strcmp("undo", parv[1])) {
+    set_hostmask(sptr, NULL, NULL);
+  } else {
+    if (parc<3)
+      return need_more_params(sptr, "SETHOST");
+    if (IsAnOper(sptr)) {
+      ircd_snprintf(0, hostmask, USERLEN + HOSTLEN + 1, "%s@%s", parv[1], parv[2]);
+      if (!is_hostmask(hostmask)) {
+       send_reply(sptr, ERR_BADHOSTMASK, hostmask);
+       return 0;
+      }
+      if (set_hostmask(sptr, hostmask, NULL))
+       FlagClr(&setflags, FLAG_SETHOST);
+    } else {
+      if (!is_hostmask(parv[1])) {
+       send_reply(sptr, ERR_BADHOSTMASK, parv[1]);
+       return 0;
+      }
+      if (set_hostmask(sptr, parv[1], parv[2]))
+        FlagClr(&setflags, FLAG_SETHOST);
+    }
+  }  
+
+  send_umode_out(cptr, sptr, &setflags, 0);
+}
index 1f4e7dd4a992dd2d3ee8c0e1ee92d0aa05d22ccb..8228cb200cbe24f2ba26125595d6132816498734 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_topic.c,v 1.21.2.1 2005/12/31 01:41:40 entrope Exp $
+ * $Id: m_topic.c,v 1.21 2005/08/17 02:35:36 entrope Exp $
  */
 
+/*
+ * m_functions execute protocol messages on this server:
+ *
+ *    cptr    is always NON-NULL, pointing to a *LOCAL* client
+ *            structure (with an open socket connected!). This
+ *            identifies the physical socket where the message
+ *            originated (or which caused the m_function to be
+ *            executed--some m_functions may call others...).
+ *
+ *    sptr    is the source of the message, defined by the
+ *            prefix part of the message if present. If not
+ *            or prefix not found, then sptr==cptr.
+ *
+ *            (!IsServer(cptr)) => (cptr == sptr), because
+ *            prefixes are taken *only* from servers...
+ *
+ *            (IsServer(cptr))
+ *                    (sptr == cptr) => the message didn't
+ *                    have the prefix.
+ *
+ *                    (sptr != cptr && IsServer(sptr) means
+ *                    the prefix specified servername. (?)
+ *
+ *                    (sptr != cptr && !IsServer(sptr) means
+ *                    that message originated from a remote
+ *                    user (not local).
+ *
+ *            combining
+ *
+ *            (!IsServer(sptr)) means that, sptr can safely
+ *            taken as defining the target structure of the
+ *            message in this server.
+ *
+ *    *Always* true (if 'parse' and others are working correct):
+ *
+ *    1)      sptr->from == cptr  (note: cptr->from == cptr)
+ *
+ *    2)      MyConnect(sptr) <=> sptr == cptr (e.g. sptr
+ *            *cannot* be a local connection, unless it's
+ *            actually cptr!). [MyConnect(x) should probably
+ *            be defined as (x == x->from) --msa ]
+ *
+ *    parc    number of variable parameter strings (if zero,
+ *            parv is allowed to be NULL)
+ *
+ *    parv    a NULL terminated list of parameter pointers,
+ *
+ *                    parv[0], sender (prefix string), if not present
+ *                            this points to an empty string.
+ *                    parv[1]...parv[parc-1]
+ *                            pointers to additional parameters
+ *                    parv[parc] == NULL, *always*
+ *
+ *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
+ *                    non-NULL pointers.
+ */
 #include "config.h"
 
 #include "channel.h"
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <stdlib.h> /* for atoi() */
 
-/** Set a channel topic or report an error.
- * @param[in] sptr Original topic setter.
- * @param[in] cptr Neighbor that sent the topic message.
- * @param[in] chptr Channel to set topic on.
- * @param[in] topic New topic.
- * @param[in] ts Timestamp that topic was set (0 for current time).
- */
-static void do_settopic(struct Client *sptr, struct Client *cptr,
+static void do_settopic(struct Client *sptr, struct Client *cptr, 
                        struct Channel *chptr, char *topic, time_t ts)
 {
    struct Client *from;
@@ -58,6 +107,21 @@ static void do_settopic(struct Client *sptr, struct Client *cptr,
        from = &his;
    else
        from = sptr;
+   if (IsChannelService(sptr))
+   {
+       /* allow off-channel services to set the topic of any channel */
+   }
+   else if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr))
+   {
+      /* if +t and not @'d, return an error and ignore the topic */
+      send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
+      return;
+   }
+   else if (!client_can_send_to_channel(sptr, chptr, 1))
+   {
+      send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+      return;
+   }
    /* Note if this is just a refresh of an old topic, and don't
     * send it to all the clients to save bandwidth.  We still send
     * it to other servers as they may have split and lost the topic.
@@ -79,20 +143,15 @@ static void do_settopic(struct Client *sptr, struct Client *cptr,
        * it to everyone else on the channel to save bandwidth
        */
     else if (MyUser(sptr))
-      sendcmdto_one(sptr, CMD_TOPIC, sptr, "%H :%s", chptr, chptr->topic);
+      sendcmdto_one(sptr, CMD_TOPIC, sptr, "%H :%s", chptr, chptr->topic);     
 }
 
-/** Handle a local user's attempt to get or set a channel topic.
- *
- * \a parv has the following elements:
- * \li \a parv[1] is the channel name
- * \li \a parv[\a parc - 1] is the topic (if \a parc > 2)
+/*
+ * m_topic - generic message handler
  *
- * See @ref m_functions for discussion of the arguments.
- * @param[in] cptr Client that sent us the message.
- * @param[in] sptr Original source of message.
- * @param[in] parc Number of arguments.
- * @param[in] parv Argument vector.
+ * parv[0]        = sender prefix
+ * parv[1]        = channel
+ * parv[parc - 1] = topic (if parc > 2)
  */
 int m_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
@@ -133,28 +192,20 @@ int m_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                   chptr->topic_time);
       }
     }
-    else if ((chptr->mode.mode & MODE_TOPICLIMIT) && !is_chan_op(sptr, chptr))
-      send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
-    else if (!client_can_send_to_channel(sptr, chptr, 1))
-      send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
-    else
+    else 
       do_settopic(sptr,cptr,chptr,topic,0);
   }
   return 0;
 }
 
-/** Handle a remote user's attempt to set a channel topic.
- * \a parv has the following elements:
- * \li \a parv[1] is the channel name
- * \li \a parv[2] is the channel creation timestamp (optional)
- * \li \a parv[2] is the topic's timestamp (optional)
- * \li \a parv[\a parc - 1] is the topic
- *
- * See @ref m_functions for discussion of the arguments.
- * @param[in] cptr Client that sent us the message.
- * @param[in] sptr Original source of message.
- * @param[in] parc Number of arguments.
- * @param[in] parv Argument vector.
+/*
+ * ms_topic - server message handler
+ *
+ * parv[0]        = sender prefix
+ * parv[1]        = channel
+ * parv[2]        = channel timestamp (optional)
+ * parv[3]        = topic timestamp (optional)
+ * parv[parc - 1] = topic
  */
 int ms_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
index 9fe392c1813c68799b28b09fb59d6f05ef6e821d..b6790809b8fee35c768ade8e0ca5246571ead4de 100644 (file)
@@ -104,7 +104,7 @@ static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct
               * of +x.  If an oper wants the real host, he should go to
               * /whois to get it.
               */
-             HasHiddenHost(cptr) && (sptr != cptr) ?
+             !IsAnOper(sptr) ?
              cli_user(cptr)->host : cli_user(cptr)->realhost);
 }
 
index 062fe687ea3a6cd01899734db0befce4e9db32b6..dd0481027dea8faeefbf5295741fc1c55908a846 100644 (file)
@@ -95,6 +95,7 @@
 
 static void userip_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
 {
+  /* !!FIXME!! */
   assert(IsUser(cptr));
   msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
              SeeOper(sptr,cptr) ? "*" : "",
@@ -105,7 +106,7 @@ static void userip_formatter(struct Client* cptr, struct Client *sptr, struct Ms
               * of +x.  If an oper wants the real IP, he should go to
               * /whois to get it.
               */
-             HasHiddenHost(cptr) && (sptr != cptr) ?
+             (HasHiddenHost(cptr) || HasSetHost(cptr)) && !IsAnOper(sptr) ?
              feature_str(FEAT_HIDDEN_IP) :
              ircd_ntoa(&cli_ip(cptr)));
 }
index dbe45c6f9793560760e48c0fadaf56e92b87e80e..8db8147301bc51bc814e04b27994e97e32eb4813 100644 (file)
@@ -115,7 +115,7 @@ int m_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
     return send_reply(sptr, ERR_NOTEXTTOSEND);
 
   if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr, 0)) {
+    if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
       if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
           check_target_limit(sptr, chptr, chptr->chname, 0))
         return 0;
@@ -145,7 +145,7 @@ int ms_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[
     return 0;
 
   if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr, 0)) {
+    if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
       sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
                               SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
                               "%H :%s", chptr, parv[parc - 1]);
index 43c0cb8d1a06c02bf8b716494f37afb8e3766b62..02a59fac47da41a272e28daa5a072953e3ad6b8b 100644 (file)
@@ -114,7 +114,7 @@ int m_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv[
     return send_reply(sptr, ERR_NOTEXTTOSEND);
 
   if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr, 0)) {
+    if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
       if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
           check_target_limit(sptr, chptr, chptr->chname, 0))
         return 0;
@@ -144,7 +144,7 @@ int ms_wallvoices(struct Client* cptr, struct Client* sptr, int parc, char* parv
     return 0;
 
   if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr, 0)) {
+    if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) {
       sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr,
                               SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES, 
                               "%H :%s", chptr, parv[parc - 1]);
index b0de69466905def5fbfc29f442734e2484dbced9..ee974c9ae0ecbf913b2b583ab60f17fc69c86dbd 100644 (file)
@@ -287,6 +287,9 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (feature_bool(FEAT_HIS_WHO_SERVERNAME) && !IsAnOper(sptr))
     matchsel &= ~WHO_FIELD_SER;
 
+  if (feature_bool(FEAT_HIS_WHO_FILTERIP) && !IsAnOper(sptr))
+    matchsel &= ~WHO_FIELD_NIP;
+
   if (qrt && (fields & WHO_FIELD_QTY))
   {
     p = qrt;
@@ -404,13 +407,14 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               && ((!(matchsel & WHO_FIELD_HOS))
               || matchexec(cli_user(acptr)->host, mymask, minlen))
               && ((!(matchsel & WHO_FIELD_HOS))
+              || !HasSetHost(acptr)
              || !HasHiddenHost(acptr)
              || !IsAnOper(sptr)
               || matchexec(cli_user(acptr)->realhost, mymask, minlen))
               && ((!(matchsel & WHO_FIELD_REN))
               || matchexec(cli_info(acptr), mymask, minlen))
               && ((!(matchsel & WHO_FIELD_NIP))
-             || (HasHiddenHost(acptr) && !IsAnOper(sptr))
+              || ((HasHiddenHost(acptr) || HasSetHost(acptr)) && !IsAnOper(sptr))
               || !ipmask_check(&cli_ip(acptr), &imask, ibits))
               && ((!(matchsel & WHO_FIELD_ACC))
               || matchexec(cli_user(acptr)->account, mymask, minlen)))
@@ -442,13 +446,14 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
             && ((!(matchsel & WHO_FIELD_HOS))
             || matchexec(cli_user(acptr)->host, mymask, minlen))
             && ((!(matchsel & WHO_FIELD_HOS))
+            || !HasSetHost(acptr)
            || !HasHiddenHost(acptr)
            || !IsAnOper(sptr)
             || matchexec(cli_user(acptr)->realhost, mymask, minlen))
             && ((!(matchsel & WHO_FIELD_REN))
             || matchexec(cli_info(acptr), mymask, minlen))
             && ((!(matchsel & WHO_FIELD_NIP))
-           || (HasHiddenHost(acptr) && !IsAnOper(sptr))
+            || ((HasHiddenHost(acptr) || HasSetHost(acptr)) && !IsAnOper(sptr))
             || !ipmask_check(&cli_ip(acptr), &imask, ibits))
             && ((!(matchsel & WHO_FIELD_ACC))
             || matchexec(cli_user(acptr)->account, mymask, minlen)))
index 5d974877316909d74d3df9f073273ec515ee91c7..5db095a8262ef30e47708bc8e313a9cbb8981b8e 100644 (file)
@@ -144,7 +144,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc)
                   cli_info(acptr));
 
   /* Display the channels this user is on. */
-  if (!IsChannelService(acptr))
+  if ((!IsChannelService(acptr) && !IsNoChan(acptr)) || (acptr==sptr))
   {
     struct Membership* chan;
     mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name);
@@ -211,16 +211,21 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc)
     if (IsAccount(acptr))
       send_reply(sptr, RPL_WHOISACCOUNT, name, user->account);
 
-    if (HasHiddenHost(acptr) && (IsAnOper(sptr) || acptr == sptr))
-      send_reply(sptr, RPL_WHOISACTUALLY, name, user->username,
+    if ((HasHiddenHost(acptr) || HasSetHost(acptr)) && (IsAnOper(sptr) || acptr == sptr))
+      send_reply(sptr, RPL_WHOISACTUALLY, name, user->realusername,
                  user->realhost, ircd_ntoa(&cli_ip(acptr)));
 
+    if (!IsAnOper(sptr) && IsParanoid(acptr) && IsAnOper(acptr))
+      sendcmdto_one(&me, CMD_NOTICE, acptr, "%C :whois: %s performed a /WHOIS on you.", acptr, cli_name(sptr));
+    
     /* Hint: if your looking to add more flags to a user, eg +h, here's
      *       probably a good place to add them :)
      */
 
-    if (MyConnect(acptr) && (!feature_bool(FEAT_HIS_WHOIS_IDLETIME) ||
-                             (sptr == acptr || IsAnOper(sptr) || parc >= 3)))
+    if (MyConnect(acptr) &&
+        (IsAnOper(sptr) ||
+         (!IsNoIdle(acptr) && (!feature_bool(FEAT_HIS_WHOIS_IDLETIME) ||
+                              sptr == acptr || parc >= 3))))
        send_reply(sptr, RPL_WHOISIDLE, name, CurrentTime - user->last,
                   cli_firsttime(acptr));
   }
index 9decccf3a2d144ae199a2fbec4330b050a3a4dec..38f0d90abe1e2a74734fa55fe1655a614198357e 100644 (file)
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_whowas.c,v 1.12.2.1 2006/01/01 04:39:07 entrope Exp $
+ * $Id: m_whowas.c,v 1.12 2005/04/25 21:25:20 entrope Exp $
  */
 
 /*
@@ -139,7 +139,7 @@ int m_whowas(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
        send_reply(sptr, RPL_WHOWASUSER, temp->name, temp->username,
                   temp->hostname, temp->realname);
         if (IsAnOper(sptr) && temp->realhost)
-          send_reply(sptr, RPL_WHOISACTUALLY, temp->name, temp->username, temp->realhost, "<untracked>");
+          send_reply(sptr, RPL_WHOISACTUALLY, temp->name, temp->username, temp->realhost);
         send_reply(sptr, RPL_WHOISSERVER, temp->name,
                    (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsOper(sptr)) ?
                      feature_str(FEAT_HIS_SERVERNAME) :
index 09d6916a4f6c0b0968111c9a958026cb4c61f450..a2b05ca9438024edfc5183ab5c5791b5041afd6e 100644 (file)
@@ -617,6 +617,13 @@ struct Message msgtab[] = {
     /* UNREG, CLIENT, SERVER, OPER, SERVICE */
     { m_ignore, m_not_oper, ms_asll, mo_asll, m_ignore }
    },
+  {
+    MSG_SETHOST,
+    TOK_SETHOST,
+    0, MAXPARA, MFLG_SLOW, 0, NULL,
+    /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+    { m_unregistered, m_sethost, m_ignore, m_sethost, m_ignore }
+  },
 #if WE_HAVE_A_REAL_CAPABILITY_NOW
   {
     MSG_CAP,
@@ -626,6 +633,23 @@ struct Message msgtab[] = {
     { m_cap, m_cap, m_ignore, m_cap, m_ignore }
   },
 #endif
+
+  /*
+   * - ASUKA ---------------------------------------------------------------------
+   * Add the command for CHECK.
+   * This was adapted from Lain for use in Asuka.
+   * Original code by Durzel (durzel@quakenet.org).
+   *
+   * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+   * -----------------------------------------------------------------------------
+   */
+  {
+    MSG_CHECK,
+    TOK_CHECK,
+    0, MAXPARA, MFLG_SLOW, 0, NULL,
+    { m_unregistered, m_not_oper, m_check, m_check, m_ignore }
+  },
+
   /* This command is an alias for QUIT during the unregistered part of
    * of the server.  This is because someone jumping via a broken web
    * proxy will send a 'POST' as their first command - which we will
@@ -868,8 +892,14 @@ parse_client(struct Client *cptr, char *buffer, char *bufend)
   paramcount = mptr->parameters;
   i = bufend - ((s) ? s : ch);
   mptr->bytes += i;
-  if ((mptr->flags & MFLG_SLOW) || !IsAnOper(cptr))
-    cli_since(cptr) += (2 + i / 120);
+  if ((mptr->flags & MFLG_SLOW) || !IsAnOper(cptr)) {
+    if (IsAnOper(cptr)) {
+      cli_since(cptr) += 1;
+    } else {
+      cli_since(cptr) += (2 + i / 120);
+    }
+  }
+
   /*
    * Allow only 1 msg per 2 seconds
    * (on average) to prevent dumping.
index 19fced4b88e4dd1e10f1a1ac1ab2c9e2f9da8bec..fcc7ca3bc0a657e2e81ae9c38cc1cee9a5cb1934 100644 (file)
@@ -264,7 +264,7 @@ static int auth_set_username(struct AuthRequest *auth)
     return exit_client(sptr, sptr, &me, "USER: Bogus userid.");
 
   /* Check for K- or G-line. */
-  killreason = find_kill(sptr);
+  killreason = find_kill(sptr, 1);
   if (killreason) {
     ServerStats->is_ref++;
     return exit_client(sptr, sptr, &me,
index 1c3483aaba2a5239151df4c1933586c5925ee886..d69901ba03c40907a5ad842494931a4801835467 100644 (file)
@@ -581,7 +581,7 @@ static int read_packet(struct Client *cptr, int socket_ready)
   unsigned int length = 0;
 
   if (socket_ready &&
-      !(IsUser(cptr) &&
+      !(IsUser(cptr) && !IsOper(cptr) &&
        DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD))) {
     switch (os_recv_nonb(cli_fd(cptr), readbuf, sizeof(readbuf), &length)) {
     case IO_SUCCESS:
@@ -622,8 +622,11 @@ static int read_packet(struct Client *cptr, int socket_ready)
     if (length > 0 && dbuf_put(&(cli_recvQ(cptr)), readbuf, length) == 0)
       return exit_client(cptr, cptr, &me, "dbuf_put fail");
 
-    if (DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD))
+    if (IsUser(cptr)) {
+      if (DBufLength(&(cli_recvQ(cptr))) > feature_int(FEAT_CLIENT_FLOOD)
+       && !IsOper(cptr))
       return exit_client(cptr, cptr, &me, "Excess Flood");
+    }
 
     while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr) && 
            (IsTrusted(cptr) || cli_since(cptr) - CurrentTime < 10))
index 2b6c84cb02056594b01a28087211686ccd78a9bf..244c073b9d1b7bdedd81a756e0144fc3347a42a3 100644 (file)
@@ -74,6 +74,8 @@ int              GlobalConfCount;
 struct s_map     *GlobalServiceMapList;
 /** Global list of channel quarantines. */
 struct qline     *GlobalQuarantineList;
+/** Global list of spoofhosts. */
+struct sline    *GlobalSList = 0;
 
 /** Current line number in scanner input. */
 int lineno;
@@ -943,6 +945,7 @@ int rehash(struct Client *cptr, int sig)
   clearNickJupes();
 
   clear_quarantines();
+  clear_slines();
 
   if (sig != 2)
     restart_resolver();
@@ -983,7 +986,7 @@ int rehash(struct Client *cptr, int sig)
        * get past K/G's etc, we'll "fix" the bug by actually explaining
        * whats going on.
        */
-      if ((found_g = find_kill(acptr))) {
+      if ((found_g = find_kill(acptr, 0))) {
         sendto_opmask_butone(0, found_g == -2 ? SNO_GLINE : SNO_OPERKILL,
                              found_g == -2 ? "G-line active for %s%s" :
                              "K-line active for %s%s",
@@ -1034,10 +1037,11 @@ int init_conf(void)
 /** Searches for a K/G-line for a client.  If one is found, notify the
  * user and disconnect them.
  * @param cptr Client to search for.
+ * @param glinecheck Whether we check for glines.
  * @return 0 if client is accepted; -1 if client was locally denied
  * (K-line); -2 if client was globally denied (G-line).
  */
-int find_kill(struct Client *cptr)
+int find_kill(struct Client *cptr, int glinecheck)
 {
   const char*      host;
   const char*      name;
@@ -1084,7 +1088,13 @@ int find_kill(struct Client *cptr)
     return -1;
   }
 
-  if ((agline = gline_lookup(cptr, 0))) {
+  /* added glinecheck to define if we check for glines too, shouldn't happen
+   * when rehashing as it is causing problems with big servers and lots of glines.
+   * Think of a 18000 user leaf with 18000 glines present, this will probably
+   * cause the server to split from the net.
+   * -skater_x
+   */
+  if (glinecheck && (agline = gline_lookup(cptr, 0)) && GlineIsActive(agline)) {
     /*
      * find active glines
      * added a check against the user's IP address to find_gline() -Kev
@@ -1186,3 +1196,81 @@ int conf_check_server(struct Client *cptr)
   return 0;
 }
 
+void clear_slines(void)
+{
+  struct sline *sline;
+  while ((sline = GlobalSList)) {
+    GlobalSList = sline->next;
+    MyFree(sline->spoofhost);
+    if (!EmptyString(sline->passwd))
+      MyFree(sline->passwd);
+    if (!EmptyString(sline->realhost))
+      MyFree(sline->realhost);
+    if (!EmptyString(sline->username))
+      MyFree(sline->username);
+    MyFree(sline);
+  }
+}
+
+/*
+ * conf_check_slines()
+ *
+ * Check S lines for the specified client, passed in cptr struct.
+ * If the client's IP is S-lined, process the substitution here.
+ *
+ * Precondition
+ *  cptr != NULL
+ *
+ * Returns
+ *  0 = No S-line found
+ *  1 = S-line found and substitution done.
+ *
+ * -mbuna 9/2001
+ * -froo 1/2003
+ *
+ */
+
+int
+conf_check_slines(struct Client *cptr)
+{
+  struct sline *sconf;
+  char *hostonly;
+
+  for (sconf = GlobalSList; sconf; sconf = sconf->next) {
+    if (sconf->flags == SLINE_FLAGS_IP) {
+      if (!ipmask_check(&(cli_ip(cptr)), &(sconf->address), sconf->bits))
+        continue;
+    } else if (sconf->flags == SLINE_FLAGS_HOSTNAME) {
+        if ((match(sconf->realhost, cli_sockhost(cptr)) != 0) &&
+           (match(sconf->realhost, cli_sock_ip(cptr)) != 0))   /* wildcarded IP address */
+          continue;
+    } else {
+        continue;
+    }
+
+    if (match(sconf->username, cli_user(cptr)->username) == 0) {
+     /* Ignore user part if u@h. */
+     if ((hostonly = strchr(sconf->spoofhost, '@')))
+        hostonly++;
+      else
+        hostonly = sconf->spoofhost;
+
+      if(!*hostonly)
+        continue;
+
+      ircd_strncpy(cli_user(cptr)->host, hostonly, HOSTLEN);
+      log_write(LS_USER, L_INFO, LOG_NOSNOTICE, "S-Line (%s@%s) by (%#R)",
+          cli_user(cptr)->username, hostonly, cptr);
+      return 1;
+    }
+  }
+  return 0;
+}
+
+void free_spoofhost(struct sline *spoof) {
+       MyFree(spoof->spoofhost);
+       MyFree(spoof->passwd);
+       MyFree(spoof->realhost);
+       MyFree(spoof->username);
+       MyFree(spoof);
+}
index 3d39aa71715ada89820f3aa7ac93ec87e36330f4..087359ba0d0686dffcca304ba9dab751e5ca25e5 100644 (file)
@@ -526,7 +526,7 @@ static Numeric replyTable[] = {
 /* 246 */
   { RPL_STATSTLINE, "%c %s %s", "246" },
 /* 247 */
-  { RPL_STATSGLINE, "%c %s%s%s %Tu %c :%s", "247" },
+  { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %c :%s", "247" },
 /* 248 */
   { RPL_STATSULINE, "U %s", "248" },
 /* 249 */
@@ -592,7 +592,7 @@ static Numeric replyTable[] = {
 /* 279 */
   { 0 },
 /* 280 */
-  { RPL_GLIST, "%s%s%s %Tu %s %c :%s", "280" },
+  { RPL_GLIST, "%s%s%s%s%s %Tu %s %c :%s", "280" },
 /* 281 */
   { RPL_ENDOFGLIST, ":End of G-line List", "281" },
 /* 282 */
@@ -602,19 +602,19 @@ static Numeric replyTable[] = {
 /* 284 */
   { RPL_FEATURE, 0, "284" },
 /* 285 */
-  { 0 },
+  { RPL_NEWHOSTIS, "%s: %s host %s - [%s@%s]" },
 /* 286 */
-  { 0 },
+  { RPL_CHKHEAD, ":Information for %s %s", "286" },
 /* 287 */
-  { 0 },
+  { RPL_CHANUSER, ":    %s%s (%s@%s)   (%s) %s", "287" },
 /* 288 */
   { 0 },
 /* 289 */
   { 0 },
 /* 290 */
-  { 0 },
+  { RPL_DATASTR, ":%s", "290" },
 /* 291 */
-  { 0 },
+  { RPL_ENDOFCHECK, ":%s", "291" },
 /* 292 */
   { 0 },
 /* 293 */
@@ -640,7 +640,7 @@ static Numeric replyTable[] = {
 /* 303 */
   { RPL_ISON, ":", "303" },
 /* 304 */
-  { 0 },
+  { RPL_TEXT, "%s", "304" },
 /* 305 */
   { RPL_UNAWAY, ":You are no longer marked as being away", "305" },
 /* 306 */
@@ -692,7 +692,7 @@ static Numeric replyTable[] = {
 /* 329 */
   { RPL_CREATIONTIME, "%s %Tu", "329" },
 /* 330 */
-  { RPL_WHOISACCOUNT, "%s %s :is logged in as", "330" },
+  { RPL_WHOISACCOUNT, "%s %s :is authed as", "330" },
 /* 331 */
   { RPL_NOTOPIC, "%s :No topic is set.", "331" },
 /* 332 */
@@ -828,9 +828,9 @@ static Numeric replyTable[] = {
 /* 397 */
   { 0 },
 /* 398 */
-  { 0 },
+  { RPL_STATSSLINE, "%d %s %s %s %s", "398" },
 /* 399 */
-  { 0 },
+  { RPL_USINGSLINE, ":Using S-line privilege", "399" },
 /* 400 */
   { 0 },
 /* 401 */
@@ -848,7 +848,7 @@ static Numeric replyTable[] = {
 /* 407 */
   { ERR_TOOMANYTARGETS, "%s :Duplicate recipients. No message delivered", "407" },
 /* 408 */
-  { 0 },
+  { ERR_SEARCHNOMATCH, ":%s %s No matching record(s) found", "408" },
 /* 409 */
   { ERR_NOORIGIN, ":No origin specified", "409" },
 /* 410 */
@@ -974,23 +974,23 @@ static Numeric replyTable[] = {
 /* 470 */
   { 0 },
 /* 471 */
-  { ERR_CHANNELISFULL, "%s :Cannot join channel (+l)", "471" },
+  { ERR_CHANNELISFULL, "%s :Cannot join channel, Channel is full (+l)", "471" },
 /* 472 */
   { ERR_UNKNOWNMODE, "%c :is unknown mode char to me", "472" },
 /* 473 */
-  { ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)", "473" },
+  { ERR_INVITEONLYCHAN, "%s :Cannot join channel, you must be invited (+i)", "473" },
 /* 474 */
-  { ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)", "474" },
+  { ERR_BANNEDFROMCHAN, "%s :Cannot join channel, you are banned (+b)", "474" },
 /* 475 */
-  { ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)", "475" },
+  { ERR_BADCHANNELKEY, "%s :Cannot join channel, you need the correct key (+k)", "475" },
 /* 476 */
   { ERR_BADCHANMASK, "%s :Bad Channel Mask", "476" },
 /* 477 */
-  { ERR_NEEDREGGEDNICK, "%s :Cannot join channel (+r)", "477" },
+  { ERR_NEEDREGGEDNICK, "%s :Cannot join channel, you must be authed to join (+r)", "477" },
 /* 478 */
   { ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", "478" },
 /* 479 */
-  { ERR_BADCHANNAME, "%s :Cannot join channel (access denied on this server)", "479" },
+  { ERR_BADCHANNAME, "%s :Cannot join channel (G-lined: %s)", "479" },
 /* 480 */
   { 0 },
 /* 481 */
@@ -1000,11 +1000,11 @@ static Numeric replyTable[] = {
 /* 483 */
   { ERR_CANTKILLSERVER, ":You cant kill a server!", "483" },
 /* 484 */
-  { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop a network service", "484" },
+  { ERR_ISCHANSERVICE, "%s %s :Cannot kill, kick or deop an IRC operator", "484" },
 /* 485 */
-  { 0 },
+  { ERR_ISREALSERVICE, "%s %s :Cannot kill, kick or deop a network service", "485" },
 /* 486 */
-  { 0 },
+  { ERR_ACCOUNTONLY, "%s :You must be authed in order to message this user", "486" },
 /* 487 */
   { 0 },
 /* 488 */
@@ -1092,9 +1092,9 @@ static Numeric replyTable[] = {
 /* 529 */
   { 0 },
 /* 530 */
-  { 0 },
+  { ERR_BADHOSTMASK, "%s :Invalid username/hostmask", "530" },
 /* 531 */
-  { 0 },
+  { ERR_HOSTUNAVAIL, "%s :sethost not found", "531" },
 /* 532 */
   { 0 },
 /* 533 */
index 71274a11c43694cd400c1b80430fbf87c473abb6..2b3f46ac37c3ce8998e168d48271ddc48bce5b92 100644 (file)
@@ -247,7 +247,7 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
       sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
                    "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
                    cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
-                   cli_user(acptr)->username, cli_user(acptr)->realhost,
+                   cli_user(acptr)->realusername, cli_user(acptr)->realhost,
                    *s ? "+" : "", s, *s ? " " : "",
                    iptobase64(xxx_buf, &cli_ip(acptr), sizeof(xxx_buf), IsIPv6(cptr)),
                    NumNick(acptr), cli_info(acptr));
index 2cce34f51bd8bc11a09a28d2a13ded56d34e3a80..7d13fbb2e4f558c07063bba8bf8adf745864442b 100644 (file)
@@ -400,6 +400,44 @@ stats_quarantine(struct Client* to, const struct StatDesc* sd, char* param)
   }
 }
 
+static void
+stats_sline(struct Client* to, const struct StatDesc* sd, char* param)
+{
+  int y = 1, i = 1;
+  struct sline *sline;
+
+  if (IsAnOper(to))
+    send_reply(to, SND_EXPLICIT | RPL_TEXT, "# Type Spoofhost Realhost Ident");
+  else
+    send_reply(to, SND_EXPLICIT | RPL_TEXT, "# Type Spoofhost");
+
+  for (sline = GlobalSList; sline; sline = sline->next) {
+    if (param && match(param, sline->spoofhost)) { /* narrow search */
+      if (IsAnOper(to))
+          y++;
+      else
+        if (!EmptyString(sline->passwd))
+          y++;
+      continue;
+    }
+
+    if (IsAnOper(to)) {
+      send_reply(to, RPL_STATSSLINE, (param) ? y : i, 
+         (EmptyString(sline->passwd)) ? "oper" : "user",
+         sline->spoofhost, 
+         (EmptyString(sline->realhost)) ? "" : sline->realhost,
+         (EmptyString(sline->username)) ? "" : sline->username);
+      i++;
+    } else {
+      if (!EmptyString(sline->passwd)) {
+        send_reply(to, RPL_STATSSLINE, (param) ? y : i, "user", sline->spoofhost,
+           "", "", "");
+        i++;
+      }
+    }
+  }
+}
+
 /** List service pseudo-command mappings.
  * @param[in] to Client requesting statistics.
  * @param[in] sd Stats descriptor for request (ignored).
@@ -590,6 +628,9 @@ struct StatDesc statsinfo[] = {
     send_usage, 0,
     "System resource usage (Debug only)." },
 #endif
+  { 's', "spoofhosts", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_s,
+    stats_sline, 0,
+    "Spoofed hosts information." },
   { 'T', "motds", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_T,
     motd_report, 0,
     "Configured Message Of The Day files." },
index c5333c30ee6e922bc94811aac8239f7dc9516224..009000673c734c48f7f35aac1baf0cabfff9ad35 100644 (file)
@@ -73,6 +73,9 @@
 #include <string.h>
 #include <sys/stat.h>
 
+static char *IsVhost(char *hostmask, int oper);
+static char *IsVhostPass(char *hostmask);
+
 /** Count of allocated User structures. */
 static int userCount = 0;
 
@@ -354,6 +357,16 @@ int register_user(struct Client *cptr, struct Client *sptr)
 
     Count_unknownbecomesclient(sptr, UserStats);
 
+    if (MyConnect(sptr) && feature_bool(FEAT_AUTOINVISIBLE))
+      SetInvisible(sptr);
+    
+    if(MyConnect(sptr) && feature_bool(FEAT_SETHOST_AUTO)) {
+      if (conf_check_slines(sptr)) {
+        send_reply(sptr, RPL_USINGSLINE);
+        SetSetHost(sptr);
+      }
+    }
+
     SetUser(sptr);
     cli_handler(sptr) = CLIENT_HANDLER;
     SetLocalNumNick(sptr);
@@ -449,6 +462,14 @@ int register_user(struct Client *cptr, struct Client *sptr)
                     sptr, cli_name(&me));
       return exit_client(cptr, sptr, &me,"Too many connections from your host -- throttled");
     }
+
+    if(MyConnect(sptr) && feature_bool(FEAT_SETHOST_AUTO)) {
+      if (conf_check_slines(sptr)) {
+        send_reply(sptr, RPL_USINGSLINE);
+        SetSetHost(sptr);
+      }
+    }
+
     SetUser(sptr);
   }
 
@@ -464,7 +485,7 @@ int register_user(struct Client *cptr, struct Client *sptr)
                              "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
                              cli_name(sptr), cli_hopcount(sptr) + 1,
                              cli_lastnick(sptr),
-                             user->username, user->realhost,
+                             user->realusername, user->realhost,
                              *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
                              iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 1),
                              NumNick(sptr), cli_info(sptr));
@@ -474,7 +495,7 @@ int register_user(struct Client *cptr, struct Client *sptr)
                              "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
                              cli_name(sptr), cli_hopcount(sptr) + 1,
                              cli_lastnick(sptr),
-                             user->username, user->realhost,
+                             user->realusername, user->realhost,
                              *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
                              iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 0),
                              NumNick(sptr), cli_info(sptr));
@@ -511,7 +532,13 @@ static const struct UserMode {
   { FLAG_CHSERV,      'k' },
   { FLAG_DEBUG,       'g' },
   { FLAG_ACCOUNT,     'r' },
-  { FLAG_HIDDENHOST,  'x' }
+  { FLAG_HIDDENHOST,  'x' },
+  { FLAG_ACCOUNTONLY, 'R' },
+  { FLAG_XTRAOP,      'X' },
+  { FLAG_NOCHAN,      'n' },
+  { FLAG_NOIDLE,      'I' },
+  { FLAG_SETHOST,     'h' },
+  { FLAG_PARANOID,    'P' }
 };
 
 /** Length of #userModeList. */
@@ -538,6 +565,8 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
   if (IsServer(sptr)) {
     int   i;
     const char* account = 0;
+    char* hostmask = 0;
+    char* host = 0;
     const char* p;
 
     /*
@@ -559,6 +588,8 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
             SetFlag(new_client, userModeList[i].flag);
            if (userModeList[i].flag == FLAG_ACCOUNT)
              account = parv[7];
+            if (userModeList[i].flag == FLAG_SETHOST)
+              hostmask = parv[parc - 4];
             break;
           }
         }
@@ -582,7 +613,7 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
 
     cli_serv(sptr)->ghost = 0;        /* :server NICK means end of net.burst */
     ircd_strncpy(cli_username(new_client), parv[4], USERLEN);
-    ircd_strncpy(cli_user(new_client)->username, parv[4], USERLEN);
+    ircd_strncpy(cli_user(new_client)->realusername, parv[4], USERLEN);
     ircd_strncpy(cli_user(new_client)->host, parv[5], HOSTLEN);
     ircd_strncpy(cli_user(new_client)->realhost, parv[5], HOSTLEN);
     ircd_strncpy(cli_info(new_client), parv[parc - 1], REALLEN);
@@ -600,6 +631,13 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
     if (HasHiddenHost(new_client))
       ircd_snprintf(0, cli_user(new_client)->host, HOSTLEN, "%s.%s",
         account, feature_str(FEAT_HIDDEN_HOST));
+    if (HasSetHost(new_client)) {
+      if ((host = strrchr(hostmask, '@')) != NULL) {
+        *host++ = '\0';
+        ircd_strncpy(cli_username(new_client), hostmask, USERLEN);
+        ircd_strncpy(cli_user(new_client)->host, host, HOSTLEN);
+      }
+    }
 
     return register_user(cptr, new_client);
   }
@@ -614,7 +652,7 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
     if (MyUser(sptr)) {
       const char* channel_name;
       struct Membership *member;
-      if ((channel_name = find_no_nickchange_channel(sptr))) {
+      if ((channel_name = find_no_nickchange_channel(sptr)) && !IsXtraOp(sptr)) {
         return send_reply(cptr, ERR_BANNICKCHANGE, channel_name);
       }
       /*
@@ -744,6 +782,10 @@ int check_target_limit(struct Client *sptr, void *target, const char *name,
   if (IsChannelName(name) && IsInvited(sptr, target))
     return 0;
 
+  /* opers always have a free target */
+  if (IsAnOper(sptr))
+    return 0;
+
   /*
    * Same target as last time?
    */
@@ -866,7 +908,7 @@ void send_umode_out(struct Client *cptr, struct Client *sptr,
   {
     if ((acptr = LocalClientArray[i]) && IsServer(acptr) &&
         (acptr != cptr) && (acptr != sptr) && *umodeBuf)
-      sendcmdto_one(sptr, CMD_MODE, acptr, "%s :%s", cli_name(sptr), umodeBuf);
+      sendcmdto_one(sptr, CMD_MODE, acptr, "%s %s", cli_name(sptr), umodeBuf);
   }
   if (cptr && MyUser(cptr))
     send_umode(cptr, sptr, old, ALL_UMODES);
@@ -922,6 +964,11 @@ hide_hostmask(struct Client *cptr, unsigned int flag)
     /* Local users cannot set +x unless FEAT_HOST_HIDING is true. */
     if (MyConnect(cptr) && !feature_bool(FEAT_HOST_HIDING))
       return 0;
+    /* If the user is +h, we don't hide the hostmask.  Set the flag to keep sync though */
+    if (HasSetHost(cptr)) {
+      SetFlag(cptr, flag);
+       return 0;
+    }
     break;
   case FLAG_ACCOUNT:
     /* Invalidate all bans against the user so we check them again */
@@ -968,6 +1015,190 @@ hide_hostmask(struct Client *cptr, unsigned int flag)
   return 0;
 }
 
+/*
+ * set_hostmask() - derived from hide_hostmask()
+ *
+ */
+int set_hostmask(struct Client *cptr, char *hostmask, char *password)
+{
+  int restore = 0;
+  int freeform = 0;
+  char *host, *new_vhost, *vhost_pass;
+  char hiddenhost[USERLEN + HOSTLEN + 2];
+  struct Membership *chan;
+
+  Debug((DEBUG_INFO, "set_hostmask() %C, %s, %s", cptr, hostmask, password));
+
+  /* sethost enabled? */
+  if (MyConnect(cptr) && !feature_bool(FEAT_SETHOST)) {
+    send_reply(cptr, ERR_DISABLED, "SETHOST");
+    return 0;
+  }
+
+  /* sethost enabled for users? */
+  if (MyConnect(cptr) && !IsAnOper(cptr) && !feature_bool(FEAT_SETHOST_USER)) {
+    send_reply(cptr, ERR_NOPRIVILEGES);
+    return 0;
+  }
+  /* MODE_DEL: restore original hostmask */
+  if (EmptyString(hostmask)) {
+    /* is already sethost'ed? */
+    if (IsSetHost(cptr)) {
+      restore = 1;
+      sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Host change");
+      /* If they are +rx, we need to return to their +x host, not their "real" host */
+      if (HasHiddenHost(cptr))
+        ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "%s.%s",
+          cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST));
+      else
+        strncpy(cli_user(cptr)->host, cli_user(cptr)->realhost, HOSTLEN);
+      strncpy(cli_user(cptr)->username, cli_user(cptr)->realusername, USERLEN);
+      /* log it */
+      if (MyConnect(cptr))
+        log_write(LS_SETHOST, L_INFO, LOG_NOSNOTICE,
+            "SETHOST (%s@%s) by (%#R): restoring real hostmask",
+            cli_user(cptr)->username, cli_user(cptr)->host, cptr);
+    } else
+      return 0;
+  /* MODE_ADD: set a new hostmask */
+  } else {
+    /* chop up ident and host.cc */
+    if ((host = strrchr(hostmask, '@'))) /* oper can specifiy ident@host.cc */
+      *host++ = '\0';
+    else /* user can only specifiy host.cc [password] */
+      host = hostmask;
+    /*
+     * Oper sethost
+     */
+    if (MyConnect(cptr)) {
+      if (IsAnOper(cptr)) {
+        if ((new_vhost = IsVhost(host, 1)) == NULL) {
+          if (!feature_bool(FEAT_SETHOST_FREEFORM)) {
+            send_reply(cptr, ERR_HOSTUNAVAIL, hostmask);
+            log_write(LS_SETHOST, L_INFO, LOG_NOSNOTICE,
+                "SETHOST (%s@%s) by (%#R): no such s-line",
+                (host != hostmask) ? hostmask : cli_user(cptr)->username, host, cptr);
+            return 0;
+          } else /* freeform active, log and go */
+            freeform = 1;
+        }
+        sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Host change");
+        /* set the new ident and host */
+        if (host != hostmask) /* oper only specified host.cc */
+          strncpy(cli_user(cptr)->username, hostmask, USERLEN);
+        strncpy(cli_user(cptr)->host, host, HOSTLEN);
+        /* log it */
+        log_write(LS_SETHOST, (freeform) ? L_NOTICE : L_INFO,
+            (freeform) ? 0 : LOG_NOSNOTICE, "SETHOST (%s@%s) by (%#R)%s",
+            cli_user(cptr)->username, cli_user(cptr)->host, cptr,
+            (freeform) ? ": using freeform" : "");
+      /*
+       * plain user sethost, handled here
+       */
+      } else {
+        /* empty password? */
+        if (EmptyString(password)) {
+          send_reply(cptr, ERR_NEEDMOREPARAMS, "MODE");
+          return 0;
+        }
+        /* no such s-line */
+        if ((new_vhost = IsVhost(host, 0)) == NULL) {
+          send_reply(cptr, ERR_HOSTUNAVAIL, hostmask);
+          log_write(LS_SETHOST, L_INFO, LOG_NOSNOTICE, "SETHOST (%s@%s %s) by (%#R): no such s-line",
+              cli_user(cptr)->username, host, password, cptr);
+          return 0;
+        }
+        /* no password */
+        if ((vhost_pass = IsVhostPass(new_vhost)) == NULL) {
+          send_reply(cptr, ERR_PASSWDMISMATCH);
+          log_write(LS_SETHOST, L_INFO, 0, "SETHOST (%s@%s %s) by (%#R): trying to use an oper s-line",
+              cli_user(cptr)->username, host, password, cptr);
+          return 0;
+        }
+        /* incorrect password */
+        if (strCasediff(vhost_pass, password)) {
+          send_reply(cptr, ERR_PASSWDMISMATCH);
+          log_write(LS_SETHOST, L_NOTICE, 0, "SETHOST (%s@%s %s) by (%#R): incorrect password",
+              cli_user(cptr)->username, host, password, cptr);
+          return 0;
+        }
+        sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Host change");
+        /* set the new host */
+        strncpy(cli_user(cptr)->host, new_vhost, HOSTLEN);
+        /* log it */
+        log_write(LS_SETHOST, L_INFO, LOG_NOSNOTICE, "SETHOST (%s@%s) by (%#R)",
+            cli_user(cptr)->username, cli_user(cptr)->host, cptr);
+      }
+    } else { /* remote user */
+        sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Host change");
+        if (host != hostmask) /* oper only specified host.cc */
+          strncpy(cli_user(cptr)->username, hostmask, USERLEN);
+        strncpy(cli_user(cptr)->host, host, HOSTLEN);
+    }
+  }
+
+  if (restore)
+    ClearSetHost(cptr);
+  else
+    SetSetHost(cptr);
+
+  if (MyConnect(cptr)) {
+    ircd_snprintf(0, hiddenhost, HOSTLEN + USERLEN + 2, "%s@%s",
+      cli_user(cptr)->username, cli_user(cptr)->host);
+    send_reply(cptr, RPL_HOSTHIDDEN, hiddenhost);
+  }
+
+#if 0
+  /* Code copied from hide_hostmask().  This is the old (pre-delayedjoin) 
+   * version.  Switch this in if you're not using the delayed join patch. */
+  /*
+   * Go through all channels the client was on, rejoin him
+   * and set the modes, if any
+   */
+  for (chan = cli_user(cptr)->channel; chan; chan = chan->next_channel) {
+    if (IsZombie(chan))
+      continue;
+    sendcmdto_channel_butserv_butone(cptr, CMD_JOIN, chan->channel, cptr,
+      "%H", chan->channel);
+    if (IsChanOp(chan) && HasVoice(chan)) {
+      sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr,
+        "%H +ov %C %C", chan->channel, cptr, cptr);
+    } else if (IsChanOp(chan) || HasVoice(chan)) {
+      sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr,
+        "%H +%c %C", chan->channel, IsChanOp(chan) ? 'o' : 'v', cptr);
+    }
+  }
+#endif
+
+  /*
+   * Go through all channels the client was on, rejoin him
+   * and set the modes, if any
+   */
+  for (chan = cli_user(cptr)->channel; chan; chan = chan->next_channel) {
+    if (IsZombie(chan))
+      continue;
+    /* If this channel has delayed joins and the user has no modes, just set
+     * the delayed join flag rather than showing the join, even if the user
+     * was visible before */
+    if (!IsChanOp(chan) && !HasVoice(chan)
+        && (chan->channel->mode.mode & MODE_DELJOINS)) {
+      SetDelayedJoin(chan);
+    } else {
+      sendcmdto_channel_butserv_butone(cptr, CMD_JOIN, chan->channel, cptr, 0,
+        "%H", chan->channel);
+    }
+    if (IsChanOp(chan) && HasVoice(chan)) {
+      sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0,
+        "%H +ov %C %C", chan->channel, cptr, cptr);
+    } else if (IsChanOp(chan) || HasVoice(chan)) {
+      sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0,
+        "%H +%c %C", chan->channel, IsChanOp(chan) ? 'o' : 'v', cptr);
+    }
+  }
+  return 1;
+}
+
 /** Set a user's mode.  This function checks that \a cptr is trying to
  * set his own mode, prevents local users from setting inappropriate
  * modes through this function, and applies any other side effects of
@@ -990,9 +1221,12 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
   unsigned int tmpmask = 0;
   int snomask_given = 0;
   char buf[BUFSIZE];
+  char *hostmask, *password;
   int prop = 0;
   int do_host_hiding = 0;
+  int do_set_host = 0;
 
+  hostmask = password = NULL;
   what = MODE_ADD;
 
   if (parc < 2)
@@ -1023,7 +1257,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
     for (i = 0; i < USERMODELIST_SIZE; i++)
     {
       if (HasFlag(sptr, userModeList[i].flag) &&
-          userModeList[i].flag != FLAG_ACCOUNT)
+          ((userModeList[i].flag != FLAG_ACCOUNT) &&
+          (userModeList[i].flag != FLAG_SETHOST)))
         *m++ = userModeList[i].c;
     }
     *m = '\0';
@@ -1107,7 +1342,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
         if (what == MODE_ADD)
           SetInvisible(sptr);
         else
-          ClearInvisible(sptr);
+          if (!feature_bool(FEAT_AUTOINVISIBLE) || IsOper(sptr)) /* Don't allow non-opers to -i if FEAT_AUTOINVISIBLE is set */
+            ClearInvisible(sptr);
         break;
       case 'd':
         if (what == MODE_ADD)
@@ -1121,6 +1357,24 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
         else
           ClearChannelService(sptr);
         break;
+      case 'X':
+        if (what == MODE_ADD)
+          SetXtraOp(sptr);
+        else
+          ClearXtraOp(sptr);
+        break;
+      case 'n':
+        if (what == MODE_ADD)
+          SetNoChan(sptr);
+        else
+          ClearNoChan(sptr);
+        break;
+      case 'I':
+        if (what == MODE_ADD)
+          SetNoIdle(sptr);
+        else
+          ClearNoIdle(sptr);
+        break;
       case 'g':
         if (what == MODE_ADD)
           SetDebug(sptr);
@@ -1129,7 +1383,43 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
         break;
       case 'x':
         if (what == MODE_ADD)
-         do_host_hiding = 1;
+          do_host_hiding = 1;
+         break;
+      case 'h':
+         if (what == MODE_ADD) {
+           if (*(p + 1) && is_hostmask(*(p + 1))) {
+             do_set_host = 1;
+             hostmask = *++p;
+             /* DON'T step p onto the trailing NULL in the parameter array! - splidge */
+             if (*(p+1))
+               password = *++p;
+             else
+               password = NULL;
+           } else {
+             if (!*(p+1))
+               send_reply(sptr, ERR_NEEDMOREPARAMS, "SETHOST");
+             else {
+               send_reply(sptr, ERR_BADHOSTMASK, *(p+1));
+               p++; /* Swallow the arg anyway */
+             }
+           }
+         } else { /* MODE_DEL */
+           do_set_host = 1;
+           hostmask = NULL;
+           password = NULL;
+         }
+         break;
+      case 'R':
+        if (what == MODE_ADD)
+          SetAccountOnly(sptr);
+        else
+          ClearAccountOnly(sptr);
+        break;
+      case 'P':
+       if (what == MODE_ADD)
+          SetParanoid(sptr);
+        else
+          ClearParanoid(sptr);
        break;
       default:
         send_reply(sptr, ERR_UMODEUNKNOWNFLAG, *m);
@@ -1151,8 +1441,17 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
      * new umode; servers can set it, local users cannot;
      * prevents users from /kick'ing or /mode -o'ing
      */
-    if (!FlagHas(&setflags, FLAG_CHSERV))
+    if (!FlagHas(&setflags, FLAG_CHSERV) && !IsOper(sptr))
       ClearChannelService(sptr);
+    if (!FlagHas(&setflags, FLAG_XTRAOP) && !IsOper(sptr))
+      ClearXtraOp(sptr);
+    if (!FlagHas(&setflags, FLAG_NOCHAN) && !(IsOper(sptr) || feature_bool(FEAT_USER_HIDECHANS)))
+      ClearNoChan(sptr);
+    if (!FlagHas(&setflags, FLAG_NOIDLE) && !IsOper(sptr))
+      ClearNoIdle(sptr);
+    if (!FlagHas(&setflags, FLAG_PARANOID) && !IsOper(sptr))
+      ClearParanoid(sptr);
+
     /*
      * only send wallops to opers
      */
@@ -1210,6 +1509,12 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
     ++UserStats.inv_clients;
   if (!FlagHas(&setflags, FLAG_HIDDENHOST) && do_host_hiding)
     hide_hostmask(sptr, FLAG_HIDDENHOST);
+  if (do_set_host) {
+    /* We clear the flag in the old mask, so that the +h will be sent */
+    /* Only do this if we're SETTING +h and it succeeded */
+    if (set_hostmask(sptr, hostmask, password) && hostmask)
+      FlagClr(&setflags, FLAG_SETHOST);
+  }
   send_umode_out(cptr, sptr, &setflags, prop);
 
   return 0;
@@ -1255,10 +1560,15 @@ char *umode_str(struct Client *cptr)
       while ((*m++ = *t++))
        ; /* Empty loop */
     }
+    m--; /* Step back over the '\0' */
   }
 
-  *m = '\0';
-
+  if (IsSetHost(cptr)) {
+    *m++ = ' ';
+    ircd_snprintf(0, m, USERLEN + HOSTLEN + 2, "%s@%s", cli_user(cptr)->username,
+         cli_user(cptr)->host);
+  } else
+    *m = '\0';
   return umodeBuf;                /* Note: static buffer, gets
                                    overwritten by send_umode() */
 }
@@ -1275,6 +1585,7 @@ void send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old,
 {
   int i;
   int flag;
+  int needhost = 0;
   char *m;
   int what = MODE_NULL;
 
@@ -1304,6 +1615,16 @@ void send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old,
         continue;
       break;      
     }
+    /* Special case for SETHOST.. */
+    if (flag == FLAG_SETHOST) {
+      /* Don't send to users */
+      if (cptr && MyUser(cptr))
+       continue;
+      
+      /* If we're setting +h, add the parameter later */
+      if (!FlagHas(old, flag)) 
+       needhost++;    
+    }
     if (FlagHas(old, flag))
     {
       if (what == MODE_DEL)
@@ -1327,9 +1648,14 @@ void send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old,
       }
     }
   }
-  *m = '\0';
+  if (needhost) {
+    *m++ = ' ';
+    ircd_snprintf(0, m, USERLEN + HOSTLEN + 1, "%s@%s", cli_user(sptr)->username,
+         cli_user(sptr)->host);
+  } else
+    *m = '\0';
   if (*umodeBuf && cptr)
-    sendcmdto_one(sptr, CMD_MODE, cptr, "%s :%s", cli_name(sptr), umodeBuf);
+    sendcmdto_one(sptr, CMD_MODE, cptr, "%s %s", cli_name(sptr), umodeBuf);
 }
 
 /**
@@ -1352,6 +1678,110 @@ int is_snomask(char *word)
   return 0;
 }
 
+ /*
+  * Check to see if it resembles a valid hostmask.
+  */
+int is_hostmask(char *word)
+{
+  int i = 0;
+  char *host;
+
+  Debug((DEBUG_INFO, "is_hostmask() %s", word));
+
+  if (strlen(word) > (HOSTLEN + USERLEN + 1) || strlen(word) <= 0)
+    return 0;
+
+  /* if a host is specified, make sure it's valid */
+  host = strrchr(word, '@');
+  if (host) {
+     if (strlen(++host) < 1)
+       return 0;
+     if (strlen(host) > HOSTLEN)
+       return 0;
+  }
+
+  if (word) {
+    if ('@' == *word)  /* no leading @'s */
+        return 0;
+
+    if ('#' == *word) {        /* numeric index given? */
+      for (word++; *word; word++) {
+        if (!IsDigit(*word))
+          return 0;
+      }
+      return 1;
+    }
+
+    /* normal hostmask, account for at most one '@' */
+    for (; *word; word++) {
+      if ('@' == *word) {
+        i++;
+        continue;
+      }
+      if (!IsHostChar(*word))
+        return 0;
+    }
+    return (1 < i) ? 0 : 1; /* no more than on '@' */
+  }
+  return 0;
+}
+
+ /*
+  * IsVhost() - Check if given host is a valid spoofhost
+  * (ie: configured thru a S:line)
+  */
+static char *IsVhost(char *hostmask, int oper)
+{
+  unsigned int i = 0, y = 0;
+  struct sline *sconf;
+
+  Debug((DEBUG_INFO, "IsVhost() %s", hostmask));
+
+  if (EmptyString(hostmask))
+    return NULL;
+
+  /* spoofhost specified as index, ie: #27 */
+  if ('#' == hostmask[0]) {
+    y = atoi(hostmask + 1);
+    for (i = 0, sconf = GlobalSList; sconf; sconf = sconf->next) {
+      if (!oper && EmptyString(sconf->passwd))
+        continue;
+      if (y == ++i)
+        return sconf->spoofhost;
+    }
+    return NULL;
+  }
+
+  /* spoofhost specified as host, ie: host.cc */
+  for (sconf = GlobalSList; sconf; sconf = sconf->next)
+    if (strCasediff(hostmask, sconf->spoofhost) == 0)
+      return sconf->spoofhost;
+
+  return NULL;
+}
+
+ /*
+  * IsVhostPass() - Check if given spoofhost has a password
+  * associated with it, and if, return the password (cleartext)
+  */
+static char *IsVhostPass(char *hostmask)
+{
+  struct sline *sconf;
+
+  Debug((DEBUG_INFO, "IsVhostPass() %s", hostmask));
+
+  if (EmptyString(hostmask))
+    return NULL;
+
+  for (sconf = GlobalSList; sconf; sconf = sconf->next)
+    if (strCasediff(hostmask, sconf->spoofhost) == 0) {
+      Debug((DEBUG_INFO, "sconf->passwd %s", sconf->passwd));
+      return EmptyString(sconf->passwd) ? NULL : sconf->passwd;
+    }
+
+  return NULL;
+}
+
 /** Update snomask \a oldmask according to \a arg and \a what.
  * @param[in] oldmask Original user mask.
  * @param[in] arg Update string (either a number or '+'/'-' followed by a number).
index f2649d36ee003c400516f1c1335803ed12b8980b..f4c5c019d9056722d34eaa4deef68415acdddad4 100644 (file)
@@ -281,7 +281,7 @@ static int match_it(struct Client *from, struct Client *one, const char *mask, i
   {
     case MATCH_HOST:
       return (match(mask, cli_user(one)->host) == 0 ||
-        (HasHiddenHost(one) && match(mask, cli_user(one)->realhost) == 0));
+        ((HasHiddenHost(one) || HasSetHost(one)) && match(mask, cli_user(one)->realhost) == 0));
     case MATCH_SERVER:
     default:
       return (match(mask, cli_name(cli_user(one)->server)) == 0);
index 3bf9335ce72635e43cb35eae412052fee0ce51da..f7c2a2155c5104d8a121ee95fa29bbb92fb0722b 100644 (file)
@@ -2,5 +2,4 @@ Makefile
 ircd_chattr_t
 ircd_in_addr_t
 ircd_string_t
-ircd_match_t
 *.log
index dc67e155619654668710d27feb1658812779436f..3da51d15103268c68036ba04d840f544de8ef956 100644 (file)
@@ -88,7 +88,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
   if (repchan)
     chan = find_channel_member(acptr, repchan);
   else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA)))
-           && !IsChannelService(acptr))
+           && !IsChannelService(acptr) && !IsNoChan(acptr)) 
   {
     for (chan = cli_user(acptr)->channel; chan; chan = chan->next_channel)
       if (PubChannel(chan->channel) &&
@@ -127,7 +127,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (fields & WHO_FIELD_NIP)
   {
-    const char* p2 = HasHiddenHost(acptr) && !IsAnOper(sptr) ?
+    const char* p2 = (HasHiddenHost(acptr) || HasSetHost(acptr)) && !IsAnOper(sptr) ?
       feature_str(FEAT_HIDDEN_IP) :
       ircd_ntoa(&cli_ip(acptr));
     *(p1++) = ' ';
@@ -203,6 +203,8 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
         *(p1++) = 'w';
       if (SendDebug(acptr))
         *(p1++) = 'g';
+      if (HasSetHost(acptr))
+        *(p1++) = 'h';
     }
     if (HasHiddenHost(acptr))
       *(p1++) = 'x';
@@ -267,17 +269,17 @@ count_users(char *mask)
 {
   struct Client *acptr;
   int count = 0;
-  char namebuf[USERLEN + HOSTLEN + 2];
+  char namebuf[NICKLEN + USERLEN + HOSTLEN + 3];
   char ipbuf[USERLEN + 16 + 2];
 
   for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
     if (!IsUser(acptr))
       continue;
 
-    ircd_snprintf(0, namebuf, sizeof(namebuf), "%s@%s",
+    ircd_snprintf(0, namebuf, sizeof(namebuf), "%s!%s@%s", cli_name(acptr),
                  cli_user(acptr)->username, cli_user(acptr)->host);
-    ircd_snprintf(0, ipbuf, sizeof(ipbuf), "%s@%s", cli_user(acptr)->username,
-                 ircd_ntoa(&cli_ip(acptr)));
+    ircd_snprintf(0, ipbuf, sizeof(ipbuf), "%s!%s@%s", cli_name(acptr),
+                  cli_user(acptr)->username, ircd_ntoa(&(cli_ip(acptr))));
 
     if (!match(mask, namebuf) || !match(mask, ipbuf))
       count++;
diff --git a/tools/convert_slines.sh b/tools/convert_slines.sh
new file mode 100644 (file)
index 0000000..f6a401b
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# $Id: asuka-sethost.patch,v 1.29 2005/02/24 01:06:52 froo Exp $
+#
+# aid in converting S: and F:lines from old lain configs
+# to the new "super S:line" format of asuka.
+#
+# When       Who                               What
+# 2003-01-05 froo@quakenet.org Created.
+
+PATH=/bin:/usr/bin
+PROG=`basename $0`
+USAGE="Usage: $PROG </path/to/ircd.cfg>"
+
+if [ $# -lt 1 ]; then
+       echo $USAGE
+       exit
+fi
+
+CONFIG=$1
+
+if [ ! -f $CONFIG ]; then
+       echo "Can't open \"$CONFIG\", bailing out."
+       exit
+fi
+
+{
+for LINE in `grep -E "^F:" $CONFIG`
+do
+       IDENT=`echo $LINE | cut -f2 -d:`
+       REALHOST=`echo $LINE | cut -f3 -d:`
+       SPOOFHOST=`echo $LINE | cut -f4 -d:`
+
+       IDENT=`echo $IDENT | sed -e 's,^~,\*,'`
+
+       echo "S:$SPOOFHOST::$REALHOST:$IDENT"
+done
+
+for LINE in `grep -E "^S:" $CONFIG`
+do
+       SPOOFHOST=`echo $LINE | cut -f2 -d:`
+       PASSWD=`echo $LINE | cut -f3 -d:`
+
+       IDENT=`echo $IDENT | sed -e 's,^~,\*,'`
+
+       echo "S:$SPOOFHOST:$PASSWD::"
+done
+} | sort
+
+exit 0