Author: Bleep <tomh@inxpress.net>
authorBleep <twhelvey1@home.com>
Sat, 18 Mar 2000 01:59:57 +0000 (01:59 +0000)
committerBleep <twhelvey1@home.com>
Sat, 18 Mar 2000 01:59:57 +0000 (01:59 +0000)
Log message:
Rollback pline8 patch, remove server hosts and addresses from strings
sent over the wire. NOTE: this might leak in a couple places let us
know if you find any hostname/address leaks. See the example.conf for
information on setting up virtual hosting (minor change).

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@23 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

24 files changed:
.patches
ChangeLog
config/config-sh.in
doc/Configure.help
doc/example.conf
doc/ircd.8
include/ircd.h
include/patchlevel.h
include/s_bsd.h
ircd/channel.c
ircd/chkconf.c
ircd/ircd.c
ircd/opercmds.c
ircd/parse.c
ircd/s_auth.c
ircd/s_bsd.c
ircd/s_conf.c
ircd/s_debug.c
ircd/s_misc.c
ircd/s_ping.c
ircd/s_serv.c
ircd/s_user.c
ircd/send.c
ircd/userload.c

index a00f8d8f980e36a00afb69ebd7289f90c0d3bef6..915a87a7f2ba184fe26658babefe6adca85f6c7c 100644 (file)
--- a/.patches
+++ b/.patches
@@ -1 +1 @@
-ircu2.10.07+.08
+ircu2.10.07+.09
index 2b895a45473807731e20efd2832abc3e2bd797f1..8753262bd50a5779b4296a7e9faaf5702d388862 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,14 @@
 #
 # ChangeLog for Undernet ircu Servers
 #
 #
 # ChangeLog for Undernet ircu Servers
 #
-# $Id: ChangeLog,v 1.11 2000-03-14 01:35:20 bleep Exp $
+# $Id: ChangeLog,v 1.12 2000-03-18 01:59:56 bleep Exp $
 #
 # Please insert new entries on the top of the list, a one or two line comment
 # is sufficient. Please include your name on the entries we know who to blame.
 # Please keep lines < 80 chars.
 #-------------------------------------------------------------------------------
 #
 # Please insert new entries on the top of the list, a one or two line comment
 # is sufficient. Please include your name on the entries we know who to blame.
 # Please keep lines < 80 chars.
 #-------------------------------------------------------------------------------
-* s_auth.c (start_auth): Bugfix - uninitialized len variable caused binding to
-  client local address to fail, initialize to sizeof(struct sockaddr_in).
-  Clean up leaking file descriptors, set authfd to -1 when closed for error.
-  Bug stomping and fix by Gte. --Bleep
-* Add Run's pline patch. --Run
-* channel.c (send_channel_modes): send modes for second line for channels with
-  a lot of ops. --Gte
-* config-sh.in: add runs fix for symlink restart bug. --Bleep
+* Added hostname hiding compatible with ircu2.10.10 to allow host hiding
+  for transitioning services, back out pline8 for now. --Bleep
 * Fixed default behavior for BADCHAN. supposed to DEFAULT yes, however
   should not change each time a make config is done. -- WT
 * doc/readme.www: add Runs link update patch for linux info. --Bleep
 * Fixed default behavior for BADCHAN. supposed to DEFAULT yes, however
   should not change each time a make config is done. -- WT
 * doc/readme.www: add Runs link update patch for linux info. --Bleep
index 2df6b728165c7457abe9dfd92678302b1e097510..b2033a65015201740f2ad53e38aafbd39ff55d33 100644 (file)
@@ -171,6 +171,7 @@ comment 'General defines'
     fi
   fi
   bool 'Set up a Unix domain socket to connect clients/servers' UNIXPORT
     fi
   fi
   bool 'Set up a Unix domain socket to connect clients/servers' UNIXPORT
+  bool 'Do you need virtual hosting' VIRTUAL_HOST
   PREV_HUB=$HUB
   bool 'Will you connect to more then one server at a time' HUB
   if [ "$PREV_HUB" != "$HUB" ]; then
   PREV_HUB=$HUB
   bool 'Will you connect to more then one server at a time' HUB
   if [ "$PREV_HUB" != "$HUB" ]; then
@@ -200,13 +201,14 @@ comment 'Debugging (do not define this on production servers)'
     define_bool MEMSIZESTATS $MEMSIZESTATS
     define_bool MEMTIMESTATS $MEMTIMESTATS
   fi
     define_bool MEMSIZESTATS $MEMSIZESTATS
     define_bool MEMTIMESTATS $MEMTIMESTATS
   fi
+  bool 'Are you testing on a host without DNS' NODNS
 endmenu
 
 mainmenu_option next_comment
 comment 'Paths and files'
   eval DPATH_DEFAULT="${prefix}/lib/ircd"
   string 'Directory where all ircd stuff resides' DPATH $DPATH_DEFAULT
 endmenu
 
 mainmenu_option next_comment
 comment 'Paths and files'
   eval DPATH_DEFAULT="${prefix}/lib/ircd"
   string 'Directory where all ircd stuff resides' DPATH $DPATH_DEFAULT
-  define_string SPATH "$BINDIR/$SYMLINK"
+  define_string SPATH "$BINDIR/ircd"
   echo "The following filenames are either full paths or files within DPATH"
   string 'Server configuration file' CPATH 'ircd.conf'
   string 'Server MOTD file' MPATH 'ircd.motd'
   echo "The following filenames are either full paths or files within DPATH"
   string 'Server configuration file' CPATH 'ircd.conf'
   string 'Server MOTD file' MPATH 'ircd.motd'
index 6b1046dba1ff55498d8f639f35d71ce3d68e2e2f..508e20832743bce28a47f49f55ee2d6069a844ea 100644 (file)
@@ -302,6 +302,24 @@ UNIXPORT
   or when your local IRC client doesn't support UNIX domain sockets,
   specify 'n' here.  Otherwise specify 'y'.
 
   or when your local IRC client doesn't support UNIX domain sockets,
   specify 'n' here.  Otherwise specify 'y'.
 
+Do you need virtual hosting
+VIRTUAL_HOST
+  This is only needed when you want to run two or more servers on the
+  same machine and on the same port (but different devices).
+  In general you will only need this if you have at least two ethernet
+  cards in your machine with a different IP-number.
+  If you specify 'y' here, then you can "bind" a server to one of your
+  interfaces.  You should use the command line option '-w' to tell the
+  server to which interface to bind to.  No error is reported if this
+  fails, the server will simply not run.
+  If no '-w' option is given then the server name specified in the
+  'M: line' of the "ircd.conf" file of the server is used, provided it
+  resolves to an IP-number of one of your interfaces.  Note that
+  normally the name does not have to resolve, but when you define this,
+  it MUST resolve or you must use the -w command line option, or the
+  "bind" will fail.
+  If you are unsure, specify 'n'.
+
 Will you connect to more then one server at a time
 HUB
   All servers of one IRC "network" are connected in a "tree" (no loops).
 Will you connect to more then one server at a time
 HUB
   All servers of one IRC "network" are connected in a "tree" (no loops).
@@ -430,6 +448,19 @@ MEMTIMESTATS
   counted blocks must be returned.  This allows to ignore recently allocated
   blocks and permanently allocated blocks (since the start of the server).
 
   counted blocks must be returned.  This allows to ignore recently allocated
   blocks and permanently allocated blocks (since the start of the server).
 
+Are you testing on a host without DNS
+NODNS
+  If you are playing with the server off-line, and no DNS is available, then
+  long delays occur before the server starts up because it tries to resolv
+  the name given on the M:line (which usually isn't given in /etc/hosts) and
+  for each connecting client.
+  If you specify 'y' here, then a call to gethostbyname() will be done only
+  for the real hostname, and the server will not try to resolv clients that
+  connect to `localhost'.
+  Note that other calls to gethostbyname() are still done anyway if you
+  use VIRTUAL_HOST and that the server still tries to resolv clients
+  that connect to the real IP-number of the server.
+
 Directory where all ircd stuff sits
 DPATH
   DPATH is provided so that the other path names may be provided in just
 Directory where all ircd stuff sits
 DPATH
   DPATH is provided so that the other path names may be provided in just
index 4d7f1f46ab039deb7fd7c3dec19e44a93d6393b9..8d8d023027c998b2e58d882917a10f707142797e 100644 (file)
 
 #
 # First some information about the server.
 
 #
 # First some information about the server.
-# M:<server name>:*:<description>:<server port>:<server numeric>
+# M:<server name>:<virtual ip>:<description>:<server port>:<server numeric>
+#
+# The <virtual ip> must be either be empty, contain a "*", or contain
+# the IP address of an interface on your system. If it contains an address,
+# the address will be bound to if you have specified virtual hosting.
 #
 # The <server port> is the port that other servers can connect to.
 # Client ports need to be specified with a P: line, see below.
 #
 # The <server port> is the port that other servers can connect to.
 # Client ports need to be specified with a P: line, see below.
-# Note that P: lines can still be used to override the address
-# that a server port is bound to, use the <server port> of the M:
-# line in that case on the P: line.
 #
 # Note that <server numeric> has to be unique on the network your server
 # is running on, must be between 1 and 64, and is not updated on a rehash.
 
 #
 # Note that <server numeric> has to be unique on the network your server
 # is running on, must be between 1 and 64, and is not updated on a rehash.
 
-M:London.UK.Eu.UnderNet.org:*:[127.0.0.1] University of London, England:4400:1
+# M:London.UK.Eu.UnderNet.org:127.0.0.1:University of London, England:4400:1
+M:London.UK.Eu.UnderNet.org:*:University of London, England:4400:1
 
 #
 # This sets information that can be retrieved with the /ADMIN command.
 
 #
 # This sets information that can be retrieved with the /ADMIN command.
@@ -335,40 +337,13 @@ O:*@*.cs.vu.nl:VRKLKuGKn0jLs:Niels::10
 # is located behind a firewall, you may want to make another hole in it
 # for this port.
 #
 # is located behind a firewall, you may want to make another hole in it
 # for this port.
 #
-# P:<ipmask, or path>:[<interface>|*]::<client port number>
-#
-# or
-#
-# P:<ipmask, or path>:[<interface>|*]::<server port>
-#
-# where <server port> is the port specified on the M: line.
-#
+# P:<hostmask, or path>:::<client port number>
 
 
-# Listen on port 6667 and 6668, use the default interface
-# (that is: the interface specified on the commandline with
-#  -w <interface IP#>, or the interface of the IP# that the
-#  M: line resolves too (or ALL interfaces if it doesn't
-#  resolve)).
 P::::6667
 P::::6668
 P::::6667
 P::::6668
-# Only accept clients from 168.* on port 6666
-P:168.*:::6666
-
-# Listen on port 7700 for clients that connect to "127.0.0.1"
-# where "127.0.0.1" can be the IP number of any of your interfaces.
-P::127.0.0.1::7700
-# Bind to all interfaces:
-P::*::6669
-
-# Open a client UNIX port on /tmp/.ircd
+P:*.nl:::6666
 P:/tmp/.ircd:::6667
 
 P:/tmp/.ircd:::6667
 
-# Listen on loopback and eth0 (192.168.1.1) for other servers:
-P::192.168.1.1::4400   # <<--- The last P: line not specifying 127.0.0.1
-                       #       is uses as IP# for _outgoing_ connections.
-P::127.0.0.1::4400
-# where 4400 is the server port (as specified on the M: line)
-
 #
 # Well, you have now reached the end of this sample configuration file
 # If you have any questions, feel free to mail <doco-com@undernet.org>
 #
 # Well, you have now reached the end of this sample configuration file
 # If you have any questions, feel free to mail <doco-com@undernet.org>
index a274c48996a1e9ff8f96559abc00b4bd5906b0c9..be36b88fc323e56497f01e0fb1d9fd0ce5968dc0 100644 (file)
@@ -62,19 +62,11 @@ ircd stream tcp wait irc /etc/ircd ircd \-i
 allows inetd to start up ircd on request.
 .TP
 .B \-w interface
 allows inetd to start up ircd on request.
 .TP
 .B \-w interface
-\fIinterface\fP is passed to gethostbyname(3) in order to retrieve the
-IP-number of the default interface to bind to.  An example would be to
-use `-w localhost' after which the server listens by default on the
-loopback interface.  Use `ifconfig -a' to see which interfaces you have.
-Without this option the hostname in the M: line is used as default
-interface and if that doesn't resolve, all interfaces are used. The
-server uses the default interface to listen for UDP packets (UPING)
-and for each listen port without a specified interface to bind to.
-Interfaces can be specified per listen port in the configuration file
-(ircd.conf) using P: lines. Note that the last P: line in the
-ircd.conf specifying an interface (not localhost) overrules the
-default CONNECT interface (outgoing connections) but does not change
-the default listen interface as described above.
+If the server was compiled with VIRTUAL_HOST (run 'make config' to toggle
+this compile option), then \fIinterface\fP is passed to gethostbyname(3) in
+order to retrieve the IP-number of the interface to bind to. An example
+would be to use '-w localhost', after which the server only listens on the
+loopback interface.  Run `ifconfig -a' to see which interfaces you have.
 .TP
 .B \-f filename
 Specifies the ircd.conf file to be used for this ircdaemon. The option
 .TP
 .B \-f filename
 Specifies the ircd.conf file to be used for this ircdaemon. The option
index af7393d4d2c17eda56416e2c81c13853c123db38..f9340434fa52672e4564936bf6fdedc8a0e59396 100644 (file)
@@ -42,7 +42,6 @@ extern time_t now;
 extern aClient *client;
 extern time_t TSoffset;
 extern unsigned int bootopt;
 extern aClient *client;
 extern time_t TSoffset;
 extern unsigned int bootopt;
-extern int have_server_port;
 extern time_t nextdnscheck;
 extern time_t nextconnect;
 extern int dorehash;
 extern time_t nextdnscheck;
 extern time_t nextconnect;
 extern int dorehash;
index 27811f3acfd98b793a5dd5222aa3f1edf7f1347a..531b25fda251d1202ffacf2eb79e891d6f9cca26 100644 (file)
@@ -59,7 +59,7 @@
                \
                \
                \
                \
                \
                \
-               ".hide8"
+               ""
 
 /*
  * Deliberate empty lines
 
 /*
  * Deliberate empty lines
index 7975d8f5f08a1613f672f8ec226bfb126dc2a363..a81cf0a7150335b99a9266b566709fde3abdb11f 100644 (file)
@@ -159,7 +159,7 @@ extern int setsnomask(aClient *cptr, snomask_t newmask, int what);
 extern snomask_t umode_make_snomask(snomask_t oldmask, char *arg, int what);
 extern int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp);
 extern void report_error(char *text, aClient *cptr);
 extern snomask_t umode_make_snomask(snomask_t oldmask, char *arg, int what);
 extern int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp);
 extern void report_error(char *text, aClient *cptr);
-extern int inetport(aClient *cptr, char *name, char *bind_addr, unsigned short int port);
+extern int inetport(aClient *cptr, char *name, unsigned short int port);
 extern int add_listener(aConfItem *aconf);
 extern void close_listeners(void);
 extern void init_sys(void);
 extern int add_listener(aConfItem *aconf);
 extern void close_listeners(void);
 extern void init_sys(void);
@@ -171,13 +171,14 @@ extern int get_sockerr(aClient *cptr);
 extern void set_non_blocking(int fd, aClient *cptr);
 extern aClient *add_connection(aClient *cptr, int fd, int type);
 extern int read_message(time_t delay);
 extern void set_non_blocking(int fd, aClient *cptr);
 extern aClient *add_connection(aClient *cptr, int fd, int type);
 extern int read_message(time_t delay);
-extern void get_my_name(aClient *cptr, char *name, size_t len);
+extern void get_my_name(aClient *cptr);
 extern int setup_ping(void);
 
 extern int highest_fd, resfd;
 extern unsigned int readcalls;
 extern aClient *loc_clients[MAXCONNECTIONS];
 extern int setup_ping(void);
 
 extern int highest_fd, resfd;
 extern unsigned int readcalls;
 extern aClient *loc_clients[MAXCONNECTIONS];
+#ifdef VIRTUAL_HOST
 extern struct sockaddr_in vserv;
 extern struct sockaddr_in vserv;
-extern struct sockaddr_in cserv;
+#endif
 
 #endif /* S_BSD_H */
 
 #endif /* S_BSD_H */
index 91044d00c43638fcabc49e512b9fc0934d75abfe..651cdd61053ba148b11f7ecbb62420c3d5b6d5fc 100644 (file)
@@ -728,13 +728,11 @@ void send_channel_modes(aClient *cptr, aChannel *chptr)
          if (new_mode)         /* Do we have a nick with a new mode ? */
          {
            new_mode = 0;
          if (new_mode)         /* Do we have a nick with a new mode ? */
          {
            new_mode = 0;
-            if (lp1->flags & (CHFL_CHANOP | CHFL_VOICE)) {
-             sendbuf[sblen++] = ':';
-             if (lp1->flags & CHFL_CHANOP)
-               sendbuf[sblen++] = 'o';
-             if (lp1->flags & CHFL_VOICE)
-               sendbuf[sblen++] = 'v';
-            }
+           sendbuf[sblen++] = ':';
+           if (lp1->flags & CHFL_CHANOP)
+             sendbuf[sblen++] = 'o';
+           if (lp1->flags & CHFL_VOICE)
+             sendbuf[sblen++] = 'v';
          }
        }
        if (full)
          }
        }
        if (full)
index 24185091584b26c0592504f94485569556fbc9cd..97eb4416201dab797a996ed1a23c2a32e96d8992 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
          break;
        case 'x':
          debugflag = 1;
          break;
        case 'x':
          debugflag = 1;
-         if (isdigit((int)argv[1][2]))
+         if (isdigit(argv[1][2]))
            debugflag = atoi(&argv[1][2]);
          break;
        default:
            debugflag = atoi(&argv[1][2]);
          break;
        default:
index 030b1277c7437d6fad2c444e086bfbfc749161d3..3f8ddadd0cfad7cb0515e4cbeb352c265d787a51 100644 (file)
@@ -48,7 +48,9 @@
 #include <arpa/nameser.h>
 #include <resolv.h>
 #endif
 #include <arpa/nameser.h>
 #include <resolv.h>
 #endif
+#ifdef VIRTUAL_HOST
 #include <sys/socket.h>                /* Needed for AF_INET on some OS */
 #include <sys/socket.h>                /* Needed for AF_INET on some OS */
+#endif
 #include "h.h"
 #include "res.h"
 #include "struct.h"
 #include "h.h"
 #include "res.h"
 #include "struct.h"
@@ -282,8 +284,7 @@ static time_t try_connections(void)
       (*pconf = con_conf)->next = 0;
     }
     if (connect_server(con_conf, (aClient *)NULL, (struct hostent *)NULL) == 0)
       (*pconf = con_conf)->next = 0;
     }
     if (connect_server(con_conf, (aClient *)NULL, (struct hostent *)NULL) == 0)
-      sendto_ops("Connection to %s[%s] activated.",
-         con_conf->name, con_conf->host);
+      sendto_ops("Connection to %s activated.", con_conf->name);
   }
   Debug((DEBUG_NOTICE, "Next connection check : %s", myctime(next)));
   return (next);
   }
   Debug((DEBUG_NOTICE, "Next connection check : %s", myctime(next)));
   return (next);
@@ -337,7 +338,7 @@ static time_t check_pings(void)
       if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr)))
       {
        Debug((DEBUG_NOTICE, "%s/%s timeout %s", DoingDNS(cptr) ? "DNS" : "",
       if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr)))
       {
        Debug((DEBUG_NOTICE, "%s/%s timeout %s", DoingDNS(cptr) ? "DNS" : "",
-           DoingAuth(cptr) ? "AUTH" : "", get_client_name(cptr, TRUE)));
+           DoingAuth(cptr) ? "AUTH" : "", get_client_name(cptr, FALSE)));
        if (cptr->authfd >= 0)
        {
          close(cptr->authfd);
        if (cptr->authfd >= 0)
        {
          close(cptr->authfd);
@@ -355,8 +356,7 @@ static time_t check_pings(void)
       }
       if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
       {
       }
       if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
       {
-       sendto_ops("No response from %s, closing link",
-           get_client_name(cptr, FALSE));
+       sendto_ops("No response from %s, closing link", cptr->name);
        exit_client(cptr, cptr, &me, "Ping timeout");
        continue;
       }
        exit_client(cptr, cptr, &me, "Ping timeout");
        continue;
       }
@@ -385,7 +385,7 @@ static time_t check_pings(void)
              me.name, ERR_BADPING, cptr->name);
        }
        exit_client_msg(cptr, cptr, &me, "Ping timeout for %s",
              me.name, ERR_BADPING, cptr->name);
        }
        exit_client_msg(cptr, cptr, &me, "Ping timeout for %s",
-           get_client_name(cptr, FALSE));
+           IsServer(cptr) ? cptr->name : get_client_name(cptr, FALSE));
       }
       continue;
     }
       }
       continue;
     }
@@ -519,7 +519,7 @@ static void open_debugfile(void)
     cptr->flags = 0;
     cptr->acpt = cptr;
     loc_clients[2] = cptr;
     cptr->flags = 0;
     cptr->acpt = cptr;
     loc_clients[2] = cptr;
-    strcpy(cptr->sockhost, me.sockhost);
+    strcpy(cptr->sockhost, me.name);
 
     printf("isatty = %d ttyname = %#x\n", isatty(2), (unsigned int)ttyname(2));
     if (!(bootopt & BOOT_TTY)) /* leave debugging output on fd 2 */
 
     printf("isatty = %d ttyname = %#x\n", isatty(2), (unsigned int)ttyname(2));
     if (!(bootopt & BOOT_TTY)) /* leave debugging output on fd 2 */
@@ -551,8 +551,6 @@ static void open_debugfile(void)
   return;
 }
 
   return;
 }
 
-int have_server_port;
-
 int main(int argc, char *argv[])
 {
   unsigned short int portarg = 0;
 int main(int argc, char *argv[])
 {
   unsigned short int portarg = 0;
@@ -590,12 +588,9 @@ int main(int argc, char *argv[])
   myargv = argv;
   umask(077);                  /* better safe than sorry --SRB */
   memset(&me, 0, sizeof(me));
   myargv = argv;
   umask(077);                  /* better safe than sorry --SRB */
   memset(&me, 0, sizeof(me));
+#ifdef VIRTUAL_HOST
   memset(&vserv, 0, sizeof(vserv));
   memset(&vserv, 0, sizeof(vserv));
-  vserv.sin_family = AF_INET;
-  vserv.sin_addr.s_addr = htonl(INADDR_ANY);
-  memset(&cserv, 0, sizeof(cserv));
-  cserv.sin_addr.s_addr = htonl(INADDR_ANY);
-  cserv.sin_family = AF_INET;
+#endif
 
   setup_signals();
   initload();
 
   setup_signals();
   initload();
@@ -675,33 +670,31 @@ int main(int argc, char *argv[])
       case 'v':
        printf("ircd %s\n", version);
        exit(0);
       case 'v':
        printf("ircd %s\n", version);
        exit(0);
+#ifdef VIRTUAL_HOST
       case 'w':
       {
        struct hostent *hep;
        if (!(hep = gethostbyname(p)))
        {
       case 'w':
       {
        struct hostent *hep;
        if (!(hep = gethostbyname(p)))
        {
-         fprintf(stderr, "%s: Error resolving \"%s\" (h_errno == %d).\n",
-             argv[-1], p, h_errno);
+         fprintf(stderr, "%s: Error creating virtual host \"%s\": %d",
+             argv[0], p, h_errno);
          return -1;
        }
        if (hep->h_addrtype == AF_INET && hep->h_addr_list[0] &&
            !hep->h_addr_list[1])
        {
          return -1;
        }
        if (hep->h_addrtype == AF_INET && hep->h_addr_list[0] &&
            !hep->h_addr_list[1])
        {
-         int fd;
          memcpy(&vserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
          memcpy(&vserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
-         memcpy(&cserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
-         /* Test if we can bind to this address */
-         fd = socket(AF_INET, SOCK_STREAM, 0);
-          if (bind(fd, (struct sockaddr *)&vserv, sizeof(vserv)) == 0)
-         {
-           close(fd);
-           break;
-         }
+         vserv.sin_family = AF_INET;
        }
        }
-       fprintf(stderr, "%s:\tError binding to interface \"%s\".\n"
-           "   \tUse `ifconfig -a' to check your interfaces.\n", argv[-1], p);
-       return -1;
+       else
+       {
+         fprintf(stderr, "%s: Error creating virtual host \"%s\": "
+             "Use -w <IP-number of interface>\n", argv[0], p);
+         return -1;
+       }
+       break;
       }
       }
+#endif
       case 'x':
 #ifdef DEBUGMODE
        if (euid != uid)
       case 'x':
 #ifdef DEBUGMODE
        if (euid != uid)
@@ -823,6 +816,9 @@ int main(int argc, char *argv[])
   initmsgtree();
   initstats();
   open_debugfile();
   initmsgtree();
   initstats();
   open_debugfile();
+  if (portnum == 0)
+    portnum = PORTNUM;
+  me.port = portnum;
   init_sys();
   me.flags = FLAGS_LISTEN;
   if ((bootopt & BOOT_INETD))
   init_sys();
   me.flags = FLAGS_LISTEN;
   if ((bootopt & BOOT_INETD))
@@ -843,20 +839,26 @@ int main(int argc, char *argv[])
     printf("Couldn't open configuration file %s\n", configfile);
     exit(-1);
   }
     printf("Couldn't open configuration file %s\n", configfile);
     exit(-1);
   }
+  get_my_name(&me);
+
   if (!(bootopt & BOOT_INETD))
   {
   if (!(bootopt & BOOT_INETD))
   {
+    static char star[] = "*";
+    aConfItem *aconf;
+
+    if ((aconf = find_me()) && portarg == 0 && aconf->port != 0)
+      portnum = aconf->port;
     Debug((DEBUG_ERROR, "Port = %u", portnum));
     Debug((DEBUG_ERROR, "Port = %u", portnum));
-    if (!have_server_port && inetport(&me, "*", "", portnum))
+    if (inetport(&me, star, portnum))
       exit(1);
   }
       exit(1);
   }
-  else if (inetport(&me, "*", "*", 0))
+  else if (inetport(&me, "*", 0))
     exit(1);
 
   read_tlines();
   rmotd = read_motd(RPATH);
   motd = read_motd(MPATH);
   setup_ping();
     exit(1);
 
   read_tlines();
   rmotd = read_motd(RPATH);
   motd = read_motd(MPATH);
   setup_ping();
-  get_my_name(&me, me.sockhost, sizeof(me.sockhost) - 1);
   now = time(NULL);
   me.hopcount = 0;
   me.authfd = -1;
   now = time(NULL);
   me.hopcount = 0;
   me.authfd = -1;
index 8b318bfb0d6d8959a3bdf805b24696cd20219218..2b0e057862d73d9ce3e0c588c039b4749f63db2c 100644 (file)
@@ -246,6 +246,9 @@ static void report_configured_links(aClient *sptr, int mask)
        sendto_one(sptr, rpl_str(p[1]),
            me.name, sptr->name, c, host, pass, name, port,
            get_conf_class(tmp));
        sendto_one(sptr, rpl_str(p[1]),
            me.name, sptr->name, c, host, pass, name, port,
            get_conf_class(tmp));
+      else if ((tmp->status & (CONF_CONNECT_SERVER|CONF_NOCONNECT_SERVER)))
+       sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, "*", name,
+           port, get_conf_class(tmp));
       else
        sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name,
            port, get_conf_class(tmp));
       else
        sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name,
            port, get_conf_class(tmp));
@@ -409,8 +412,7 @@ int m_stats(aClient *cptr, aClient *sptr, int parc, char *parv[])
        if (!(doall || wilds) && strCasediff(name, acptr->name))
          continue;
        sendto_one(sptr, Lformat, me.name, RPL_STATSLINKINFO, parv[0],
        if (!(doall || wilds) && strCasediff(name, acptr->name))
          continue;
        sendto_one(sptr, Lformat, me.name, RPL_STATSLINKINFO, parv[0],
-           (isUpper(stat)) ?
-           get_client_name(acptr, TRUE) : get_client_name(acptr, FALSE),
+            acptr->name,
            (int)DBufLength(&acptr->sendQ), (int)acptr->sendM,
            (int)acptr->sendK, (int)acptr->receiveM, (int)acptr->receiveK,
            time(NULL) - acptr->firsttime);
            (int)DBufLength(&acptr->sendQ), (int)acptr->sendM,
            (int)acptr->sendK, (int)acptr->receiveM, (int)acptr->receiveK,
            time(NULL) - acptr->firsttime);
@@ -659,7 +661,7 @@ int m_stats(aClient *cptr, aClient *sptr, int parc, char *parv[])
  *
  *    parv[0] = sender prefix
  *    parv[1] = servername
  *
  *    parv[0] = sender prefix
  *    parv[1] = servername
- *    parv[2] = [IP-number:]port number
+ *    parv[2] = port number
  *    parv[3] = remote server
  */
 int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
  *    parv[3] = remote server
  */
 int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
@@ -668,7 +670,6 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
   unsigned short int port, tmpport;
   aConfItem *aconf, *cconf;
   aClient *acptr;
   unsigned short int port, tmpport;
   aConfItem *aconf, *cconf;
   aClient *acptr;
-  char *p;
 
   if (!IsPrivileged(sptr))
   {
 
   if (!IsPrivileged(sptr))
   {
@@ -718,17 +719,9 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
     return 0;
   }
 
     return 0;
   }
 
-  if (parc > 2 && !BadPtr(parv[2]))
-    p = strchr(parv[2], ':');
-  else
-    p = 0;
-  if (p)
-    *p = 0;
   for (aconf = conf; aconf; aconf = aconf->next)
     if (aconf->status == CONF_CONNECT_SERVER &&
   for (aconf = conf; aconf; aconf = aconf->next)
     if (aconf->status == CONF_CONNECT_SERVER &&
-       match(parv[1], aconf->name) == 0 &&
-       (!p || match(parv[2], aconf->host) == 0 ||
-       match(parv[2], strchr(aconf->host, '@') + 1) == 0))
+       match(parv[1], aconf->name) == 0)
       break;
   /* Checked first servernames, then try hostnames. */
   if (!aconf)
       break;
   /* Checked first servernames, then try hostnames. */
   if (!aconf)
@@ -737,8 +730,6 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
          (match(parv[1], aconf->host) == 0 ||
          match(parv[1], strchr(aconf->host, '@') + 1) == 0))
        break;
          (match(parv[1], aconf->host) == 0 ||
          match(parv[1], strchr(aconf->host, '@') + 1) == 0))
        break;
-  if (p)
-    *p = ':';
 
   if (!aconf)
   {
 
   if (!aconf)
   {
@@ -760,12 +751,7 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
   tmpport = port = aconf->port;
   if (parc > 2 && !BadPtr(parv[2]))
   {
   tmpport = port = aconf->port;
   if (parc > 2 && !BadPtr(parv[2]))
   {
-    p = strchr(parv[2], ':');
-    if (!p)
-      p = parv[2];
-    else
-      p = p + 1;
-    if ((port = atoi(p)) == 0)
+    if ((port = atoi(parv[2])) == 0)
     {
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
     {
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
@@ -825,12 +811,12 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
     case 0:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
     case 0:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
-           ":%s NOTICE %s :*** Connecting to %s[%s].",
-           me.name, parv[0], aconf->host, aconf->name);
+           ":%s NOTICE %s :*** Connecting to %s.",
+           me.name, parv[0], aconf->name);
       else
        sendto_one(sptr,
       else
        sendto_one(sptr,
-           "%s NOTICE %s%s :*** Connecting to %s[%s].",
-           NumServ(&me), NumNick(sptr), aconf->host, aconf->name);
+           "%s NOTICE %s%s :*** Connecting to %s.",
+           NumServ(&me), NumNick(sptr), aconf->name);
       break;
     case -1:
       /* Comments already sent */
       break;
     case -1:
       /* Comments already sent */
@@ -838,20 +824,20 @@ int m_connect(aClient *cptr, aClient *sptr, int parc, char *parv[])
     case -2:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr, ":%s NOTICE %s :*** Host %s is unknown.",
     case -2:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr, ":%s NOTICE %s :*** Host %s is unknown.",
-           me.name, parv[0], aconf->host);
+           me.name, parv[0], aconf->name);
       else
        sendto_one(sptr, "%s NOTICE %s%s :*** Host %s is unknown.",
       else
        sendto_one(sptr, "%s NOTICE %s%s :*** Host %s is unknown.",
-           NumServ(&me), NumNick(sptr), aconf->host);
+           NumServ(&me), NumNick(sptr), aconf->name);
       break;
     default:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
            ":%s NOTICE %s :*** Connection to %s failed: %s",
       break;
     default:
       if (MyUser(sptr) || Protocol(cptr) < 10)
        sendto_one(sptr,
            ":%s NOTICE %s :*** Connection to %s failed: %s",
-           me.name, parv[0], aconf->host, strerror(retval));
+           me.name, parv[0], aconf->name, strerror(retval));
       else
        sendto_one(sptr,
            "%s NOTICE %s%s :*** Connection to %s failed: %s",
       else
        sendto_one(sptr,
            "%s NOTICE %s%s :*** Connection to %s failed: %s",
-           NumServ(&me), NumNick(sptr), aconf->host, strerror(retval));
+           NumServ(&me), NumNick(sptr), aconf->name, strerror(retval));
   }
   aconf->port = tmpport;
   return 0;
   }
   aconf->port = tmpport;
   return 0;
@@ -973,7 +959,7 @@ int m_settime(aClient *cptr, aClient *sptr, int parc, char *parv[])
   }
 #else
   sendto_ops("SETTIME from %s, clock is set %ld seconds %s",
   }
 #else
   sendto_ops("SETTIME from %s, clock is set %ld seconds %s",
-      get_client_name(sptr, FALSE), (dt < 0) ? -dt : dt,
+      sptr->name, (dt < 0) ? -dt : dt,
       (dt < 0) ? "forwards" : "backwards");
   TSoffset -= dt;
   if (IsUser(sptr))
       (dt < 0) ? "forwards" : "backwards");
   TSoffset -= dt;
   if (IsUser(sptr))
@@ -1289,7 +1275,6 @@ int m_trace(aClient *cptr, aClient *sptr, int parc, char *parv[])
 
   for (i = 0; i <= highest_fd; i++)
   {
 
   for (i = 0; i <= highest_fd; i++)
   {
-    char *name;
     unsigned int conClass;
 
     if (!(acptr = loc_clients[i]))     /* Local Connection? */
     unsigned int conClass;
 
     if (!(acptr = loc_clients[i]))     /* Local Connection? */
@@ -1301,28 +1286,31 @@ int m_trace(aClient *cptr, aClient *sptr, int parc, char *parv[])
       continue;
     if (!dow && strCasediff(tname, acptr->name))
       continue;
       continue;
     if (!dow && strCasediff(tname, acptr->name))
       continue;
-    name = get_client_name(acptr, FALSE);
     conClass = get_client_class(acptr);
 
     switch (acptr->status)
     {
       case STAT_CONNECTING:
        sendto_one(sptr, rpl_str(RPL_TRACECONNECTING),
     conClass = get_client_class(acptr);
 
     switch (acptr->status)
     {
       case STAT_CONNECTING:
        sendto_one(sptr, rpl_str(RPL_TRACECONNECTING),
-           me.name, parv[0], conClass, name);
+           me.name, parv[0], conClass, acptr->name);
        cnt++;
        break;
       case STAT_HANDSHAKE:
        sendto_one(sptr, rpl_str(RPL_TRACEHANDSHAKE),
        cnt++;
        break;
       case STAT_HANDSHAKE:
        sendto_one(sptr, rpl_str(RPL_TRACEHANDSHAKE),
-           me.name, parv[0], conClass, name);
+           me.name, parv[0], conClass, acptr->name);
        cnt++;
        break;
       case STAT_ME:
        break;
       case STAT_UNKNOWN:
       case STAT_UNKNOWN_USER:
        cnt++;
        break;
       case STAT_ME:
        break;
       case STAT_UNKNOWN:
       case STAT_UNKNOWN_USER:
+       sendto_one(sptr, rpl_str(RPL_TRACEUNKNOWN),
+           me.name, parv[0], conClass, get_client_name(acptr, FALSE));
+       cnt++;
+       break;
       case STAT_UNKNOWN_SERVER:
        sendto_one(sptr, rpl_str(RPL_TRACEUNKNOWN),
       case STAT_UNKNOWN_SERVER:
        sendto_one(sptr, rpl_str(RPL_TRACEUNKNOWN),
-           me.name, parv[0], conClass, name);
+           me.name, parv[0], conClass, acptr->name);
        cnt++;
        break;
       case STAT_USER:
        cnt++;
        break;
       case STAT_USER:
@@ -1333,10 +1321,10 @@ int m_trace(aClient *cptr, aClient *sptr, int parc, char *parv[])
        {
          if (IsAnOper(acptr))
            sendto_one(sptr, rpl_str(RPL_TRACEOPERATOR),
        {
          if (IsAnOper(acptr))
            sendto_one(sptr, rpl_str(RPL_TRACEOPERATOR),
-               me.name, parv[0], conClass, name, now - acptr->lasttime);
+               me.name, parv[0], conClass, get_client_name(acptr, FALSE), now - acptr->lasttime);
          else
            sendto_one(sptr, rpl_str(RPL_TRACEUSER),
          else
            sendto_one(sptr, rpl_str(RPL_TRACEUSER),
-               me.name, parv[0], conClass, name, now - acptr->lasttime);
+               me.name, parv[0], conClass, get_client_name(acptr, FALSE), now - acptr->lasttime);
          cnt++;
        }
        break;
          cnt++;
        }
        break;
@@ -1360,14 +1348,14 @@ int m_trace(aClient *cptr, aClient *sptr, int parc, char *parv[])
        if (acptr->serv->user)
          sendto_one(sptr, rpl_str(RPL_TRACESERVER),
              me.name, parv[0], conClass, link_s[i],
        if (acptr->serv->user)
          sendto_one(sptr, rpl_str(RPL_TRACESERVER),
              me.name, parv[0], conClass, link_s[i],
-             link_u[i], name, acptr->serv->by,
+             link_u[i], acptr->name, acptr->serv->by,
              acptr->serv->user->username,
              acptr->serv->user->host,
              now - acptr->lasttime, now - acptr->serv->timestamp);
        else
          sendto_one(sptr, rpl_str(RPL_TRACESERVER),
              me.name, parv[0], conClass, link_s[i],
              acptr->serv->user->username,
              acptr->serv->user->host,
              now - acptr->lasttime, now - acptr->serv->timestamp);
        else
          sendto_one(sptr, rpl_str(RPL_TRACESERVER),
              me.name, parv[0], conClass, link_s[i],
-             link_u[i], name, *(acptr->serv->by) ?
+             link_u[i], acptr->name, *(acptr->serv->by) ?
              acptr->serv->by : "*", "*", me.name,
              now - acptr->lasttime, now - acptr->serv->timestamp);
        cnt++;
              acptr->serv->by : "*", "*", me.name,
              now - acptr->lasttime, now - acptr->serv->timestamp);
        cnt++;
@@ -1379,10 +1367,10 @@ int m_trace(aClient *cptr, aClient *sptr, int parc, char *parv[])
        break;
       case STAT_PING:
        sendto_one(sptr, rpl_str(RPL_TRACEPING), me.name,
        break;
       case STAT_PING:
        sendto_one(sptr, rpl_str(RPL_TRACEPING), me.name,
-           parv[0], name, (acptr->acpt) ? acptr->acpt->name : "<null>");
+           parv[0], acptr->name, (acptr->acpt) ? acptr->acpt->name : "<null>");
        break;
       default:                 /* We actually shouldn't come here, -msa */
        break;
       default:                 /* We actually shouldn't come here, -msa */
-       sendto_one(sptr, rpl_str(RPL_TRACENEWTYPE), me.name, parv[0], name);
+       sendto_one(sptr, rpl_str(RPL_TRACENEWTYPE), me.name, parv[0], acptr->name);
        cnt++;
        break;
     }
        cnt++;
        break;
     }
@@ -1430,7 +1418,7 @@ int m_close(aClient *cptr, aClient *sptr, int UNUSED(parc), char *parv[])
     if (!IsUnknown(acptr) && !IsConnecting(acptr) && !IsHandshake(acptr))
       continue;
     sendto_one(sptr, rpl_str(RPL_CLOSING), me.name, parv[0],
     if (!IsUnknown(acptr) && !IsConnecting(acptr) && !IsHandshake(acptr))
       continue;
     sendto_one(sptr, rpl_str(RPL_CLOSING), me.name, parv[0],
-       get_client_name(acptr, TRUE), acptr->status);
+       get_client_name(acptr, FALSE), acptr->status);
     exit_client(cptr, acptr, &me, "Oper Closing");
     closed++;
   }
     exit_client(cptr, acptr, &me, "Oper Closing");
     closed++;
   }
@@ -1467,10 +1455,10 @@ int m_die(aClient *UNUSED(cptr), aClient *sptr, int UNUSED(parc), char *parv[])
       continue;
     if (IsUser(acptr))
       sendto_one(acptr, ":%s NOTICE %s :Server Terminating. %s",
       continue;
     if (IsUser(acptr))
       sendto_one(acptr, ":%s NOTICE %s :Server Terminating. %s",
-         me.name, acptr->name, get_client_name(sptr, TRUE));
+         me.name, acptr->name, get_client_name(sptr, FALSE));
     else if (IsServer(acptr))
       sendto_one(acptr, ":%s ERROR :Terminated by %s",
     else if (IsServer(acptr))
       sendto_one(acptr, ":%s ERROR :Terminated by %s",
-         me.name, get_client_name(sptr, TRUE));
+         me.name, get_client_name(sptr, FALSE));
   }
 #ifdef __cplusplus
   s_die(0);
   }
 #ifdef __cplusplus
   s_die(0);
index 50639a435c956176319811b1ac23bbc58c5a41e0..aa8ebc75837d419e7968c6b351867d5199a19a74 100644 (file)
@@ -397,7 +397,7 @@ int parse_client(aClient *cptr, char *buffer, char *bufend)
        sendto_one(from, ":%s %d %s %s :Unknown command",
            me.name, ERR_UNKNOWNCOMMAND, from->name, ch);
       Debug((DEBUG_ERROR, "Unknown (%s) from %s",
        sendto_one(from, ":%s %d %s %s :Unknown command",
            me.name, ERR_UNKNOWNCOMMAND, from->name, ch);
       Debug((DEBUG_ERROR, "Unknown (%s) from %s",
-         ch, get_client_name(cptr, TRUE)));
+         ch, get_client_name(cptr, FALSE)));
     }
     ircstp->is_unco++;
     return (-1);
     }
     ircstp->is_unco++;
     return (-1);
@@ -717,7 +717,7 @@ int parse_server(aClient *cptr, char *buffer, char *bufend)
       if (buffer[0] != '\0')
       {
        Debug((DEBUG_ERROR, "Unknown (%s) from %s",
       if (buffer[0] != '\0')
       {
        Debug((DEBUG_ERROR, "Unknown (%s) from %s",
-           ch, get_client_name(cptr, TRUE)));
+           ch, get_client_name(cptr, FALSE)));
       }
 #endif
       ircstp->is_unco++;
       }
 #endif
       ircstp->is_unco++;
index f0ef3623dede4973b0a320942427eed07236ca93..44f45eaa9779724240f39bddd6e7235e7e335d1d 100644 (file)
@@ -67,7 +67,6 @@ void start_auth(aClient *cptr)
 {
   struct sockaddr_in sock;
   int err;
 {
   struct sockaddr_in sock;
   int err;
-  int len = sizeof(struct sockaddr_in);
 
   Debug((DEBUG_NOTICE, "start_auth(%p) fd %d status %d",
       cptr, cptr->fd, cptr->status));
 
   Debug((DEBUG_NOTICE, "start_auth(%p) fd %d status %d",
       cptr, cptr->fd, cptr->status));
@@ -76,18 +75,15 @@ void start_auth(aClient *cptr)
   cptr->authfd = socket(AF_INET, SOCK_STREAM, 0);
   err = errno;
   alarm(0);
   cptr->authfd = socket(AF_INET, SOCK_STREAM, 0);
   err = errno;
   alarm(0);
-  if (cptr->authfd < 0 && err == EAGAIN)
-    sendto_ops("Can't allocate fd for auth on %s : socket: No more sockets",
-       get_client_name(cptr, TRUE));
 
   if (cptr->authfd < 0)
   {
 #ifdef USE_SYSLOG
     syslog(LOG_ERR, "Unable to create auth socket for %s:%m",
 
   if (cptr->authfd < 0)
   {
 #ifdef USE_SYSLOG
     syslog(LOG_ERR, "Unable to create auth socket for %s:%m",
-       get_client_name(cptr, TRUE));
+       get_client_name(cptr, FALSE));
 #endif
     Debug((DEBUG_ERROR, "Unable to create auth socket for %s:%s",
 #endif
     Debug((DEBUG_ERROR, "Unable to create auth socket for %s:%s",
-       get_client_name(cptr, TRUE), strerror(get_sockerr(cptr))));
+       get_client_name(cptr, FALSE), strerror(get_sockerr(cptr))));
     if (!DoingDNS(cptr))
       SetAccess(cptr);
     ircstp->is_abad++;
     if (!DoingDNS(cptr))
       SetAccess(cptr);
     ircstp->is_abad++;
@@ -95,7 +91,6 @@ void start_auth(aClient *cptr)
   }
   if (cptr->authfd >= (MAXCONNECTIONS - 2))
   {
   }
   if (cptr->authfd >= (MAXCONNECTIONS - 2))
   {
-    sendto_ops("Can't allocate fd for auth on %s", get_client_name(cptr, TRUE));
     close(cptr->authfd);
     cptr->authfd = -1;
     return;
     close(cptr->authfd);
     cptr->authfd = -1;
     return;
@@ -103,22 +98,15 @@ void start_auth(aClient *cptr)
 
   set_non_blocking(cptr->authfd, cptr);
 
 
   set_non_blocking(cptr->authfd, cptr);
 
-  if (getsockname(cptr->fd, (struct sockaddr *)&sock, &len) == -1
-      || (sock.sin_port = 0)   /* Reset sin_port and let OS choose the port */
-      || bind(cptr->authfd, (struct sockaddr *)&sock, len) == -1)
+#ifdef VIRTUAL_HOST
+  if (bind(cptr->authfd, (struct sockaddr *)&vserv, sizeof(vserv)) == -1)
   {
     report_error("binding auth stream socket %s: %s", cptr);
     close(cptr->authfd);
     cptr->authfd = -1;
   {
     report_error("binding auth stream socket %s: %s", cptr);
     close(cptr->authfd);
     cptr->authfd = -1;
-    /*
-     * fsck can't return exit_client here ... let read_message
-     * do it when we get done here. At any rate this error is
-     * fatal for the client, mark it dead.
-     */
-    cptr->flags |= FLAGS_DEADSOCKET;
     return;
   }
     return;
   }
-
+#endif
   memcpy(&sock.sin_addr, &cptr->ip, sizeof(struct in_addr));
 
   sock.sin_port = htons(113);
   memcpy(&sock.sin_addr, &cptr->ip, sizeof(struct in_addr));
 
   sock.sin_port = htons(113);
@@ -169,7 +157,7 @@ void send_authports(aClient *cptr)
   {
 #ifdef USE_SYSLOG
     syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m",
   {
 #ifdef USE_SYSLOG
     syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m",
-       get_client_name(cptr, TRUE));
+       get_client_name(cptr, FALSE));
 #endif
     goto authsenderr;
   }
 #endif
     goto authsenderr;
   }
index b38f61b493831fcf56a8c9da87dc2b112bb88b69..9c4a64e09d9c5897a27043e819d51482ce81de5d 100644 (file)
@@ -117,17 +117,15 @@ static char readbuf[8192];
 static struct pollfd poll_fds[MAXCONNECTIONS + 1];
 static aClient *poll_cptr[MAXCONNECTIONS + 1];
 #endif /* USE_POLL */
 static struct pollfd poll_fds[MAXCONNECTIONS + 1];
 static aClient *poll_cptr[MAXCONNECTIONS + 1];
 #endif /* USE_POLL */
-struct sockaddr_in vserv;      /* Default address/interface to bind listen sockets to.
-                                   This is set with the -w commandline option OR whatever
-                                  the name in the M: line resolves to OR INADDR_ANY. */
-struct sockaddr_in cserv;      /* Default address/interface to bind connecting sockets to.
-                                  This is set with the -w commandline option OR whatever
-                                  the name in the M: line resolves to OR the first
-                                  interface specified in the ircd.conf file for the
-                                  server port. */
+#ifdef VIRTUAL_HOST
+struct sockaddr_in vserv;
+#endif
 static int running_in_background;
 
 #ifdef GODMODE
 static int running_in_background;
 
 #ifdef GODMODE
+#ifndef NODNS
+#define NODNS
+#endif
 #ifndef NOFLOODCONTROL
 #define NOFLOODCONTROL
 #endif
 #ifndef NOFLOODCONTROL
 #define NOFLOODCONTROL
 #endif
@@ -193,12 +191,10 @@ void report_error(char *text, aClient *cptr)
 {
   Reg1 int errtmp = errno;     /* debug may change 'errno' */
   Reg2 char *host;
 {
   Reg1 int errtmp = errno;     /* debug may change 'errno' */
   Reg2 char *host;
-#if defined(SO_ERROR) && !defined(SOL2)
   int err;
   size_t len = sizeof(err);
   int err;
   size_t len = sizeof(err);
-#endif
 
 
-  host = (cptr) ? get_client_name(cptr, FALSE) : "";
+  host = (cptr) ? cptr->name : "";
 
   Debug((DEBUG_ERROR, text, host, strerror(errtmp)));
 
 
   Debug((DEBUG_ERROR, text, host, strerror(errtmp)));
 
@@ -234,24 +230,19 @@ void report_error(char *text, aClient *cptr)
  * depending on the IP# mask given by 'name'.  Returns the fd of the
  * socket created or -1 on error.
  */
  * depending on the IP# mask given by 'name'.  Returns the fd of the
  * socket created or -1 on error.
  */
-int inetport(aClient *cptr, char *name, char *bind_addr, unsigned short int port)
+int inetport(aClient *cptr, char *name, unsigned short int port)
 {
 {
-  unsigned short int sin_port;
+  static struct sockaddr_in server;
   int ad[4], opt;
   int ad[4], opt;
+  size_t len = sizeof(server);
   char ipname[20];
 
   char ipname[20];
 
-#ifdef TESTNET
-    sin_port = htons(port + 10000);
-#else
-    sin_port = htons(port);
-#endif
-
   ad[0] = ad[1] = ad[2] = ad[3] = 0;
 
   /*
    * do it this way because building ip# from separate values for each
    * byte requires endian knowledge or some nasty messing. Also means
   ad[0] = ad[1] = ad[2] = ad[3] = 0;
 
   /*
    * do it this way because building ip# from separate values for each
    * byte requires endian knowledge or some nasty messing. Also means
-   * easy conversion of "*" to 0.0.0.0 or 134.* to 134.0.0.0 :-)
+   * easy conversion of "*" 0.0.0.0 or 134.* to 134.0.0.0 :-)
    */
   sscanf(name, "%d.%d.%d.%d", &ad[0], &ad[1], &ad[2], &ad[3]);
   sprintf_irc(ipname, "%d.%d.%d.%d", ad[0], ad[1], ad[2], ad[3]);
    */
   sscanf(name, "%d.%d.%d.%d", &ad[0], &ad[1], &ad[2], &ad[3]);
   sprintf_irc(ipname, "%d.%d.%d.%d", ad[0], ad[1], ad[2], ad[3]);
@@ -272,7 +263,7 @@ int inetport(aClient *cptr, char *name, char *bind_addr, unsigned short int port
     if (cptr->fd < 0 && errno == EAGAIN)
     {
       sendto_ops("opening stream socket %s: No more sockets",
     if (cptr->fd < 0 && errno == EAGAIN)
     {
       sendto_ops("opening stream socket %s: No more sockets",
-         get_client_name(cptr, TRUE));
+         cptr->name);
       return -1;
     }
   }
       return -1;
     }
   }
@@ -297,39 +288,52 @@ int inetport(aClient *cptr, char *name, char *bind_addr, unsigned short int port
    */
   if (port)
   {
    */
   if (port)
   {
-    struct sockaddr_in bindaddr;
-    memset(&bindaddr, 0, sizeof(struct sockaddr_in));
-    if (*bind_addr == '*' && bind_addr[1] == 0)
-      bindaddr.sin_addr.s_addr = htonl(INADDR_ANY);    /* Bind to all interfaces */
-    else if (*bind_addr)
-    {
-      bindaddr.sin_addr.s_addr = inet_addr(bind_addr); /* Use name from P: line */
-      /* If server port and bind_addr isn't localhost: */
-      if (port == portnum && strcmp("127.0.0.1", bind_addr))
-        cserv.sin_addr.s_addr = bindaddr.sin_addr.s_addr;      /* Initialize /connect port */
-    }
-    else
-      bindaddr.sin_addr = vserv.sin_addr;              /* Default */
-    bindaddr.sin_family = AF_INET;
-    bindaddr.sin_port = sin_port;
-    if (bind(cptr->fd, (struct sockaddr *)&bindaddr, sizeof(bindaddr)) == -1)
+    server.sin_family = AF_INET;
+#ifndef VIRTUAL_HOST
+    server.sin_addr.s_addr = INADDR_ANY;
+#else
+    server.sin_addr = vserv.sin_addr;
+#endif
+#ifdef TESTNET
+    server.sin_port = htons(port + 10000);
+#else
+    server.sin_port = htons(port);
+#endif
+    if (bind(cptr->fd, (struct sockaddr *)&server, sizeof(server)) == -1)
     {
       report_error("binding stream socket %s: %s", cptr);
       close(cptr->fd);
       return -1;
     }
   }
     {
       report_error("binding stream socket %s: %s", cptr);
       close(cptr->fd);
       return -1;
     }
   }
+  if (getsockname(cptr->fd, (struct sockaddr *)&server, &len))
+  {
+    report_error("getsockname failed for %s: %s", cptr);
+    close(cptr->fd);
+    return -1;
+  }
 
   if (cptr == &me)             /* KLUDGE to get it work... */
   {
     char buf[1024];
 
   if (cptr == &me)             /* KLUDGE to get it work... */
   {
     char buf[1024];
-    sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*", port);
+
+#ifdef TESTNET
+    sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*",
+       ntohs(server.sin_port) - 10000);
+#else
+    sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*",
+       ntohs(server.sin_port));
+#endif
     write(1, buf, strlen(buf));
   }
   if (cptr->fd > highest_fd)
     highest_fd = cptr->fd;
   cptr->ip.s_addr = inet_addr(ipname);
     write(1, buf, strlen(buf));
   }
   if (cptr->fd > highest_fd)
     highest_fd = cptr->fd;
   cptr->ip.s_addr = inet_addr(ipname);
-  cptr->port = port;
+#ifdef TESTNET
+  cptr->port = ntohs(server.sin_port) - 10000;
+#else
+  cptr->port = ntohs(server.sin_port);
+#endif
   listen(cptr->fd, 128);       /* Use listen port backlog of 128 */
   loc_clients[cptr->fd] = cptr;
 
   listen(cptr->fd, 128);       /* Use listen port backlog of 128 */
   loc_clients[cptr->fd] = cptr;
 
@@ -356,7 +360,7 @@ int unixport(aClient *cptr, char *path, unsigned short int port)
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("error opening unix domain socket %s: No more sockets",
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("error opening unix domain socket %s: No more sockets",
-       get_client_name(cptr, TRUE));
+       cptr->name);
     return -1;
   }
   if (cptr->fd == -1)
     return -1;
   }
   if (cptr->fd == -1)
@@ -437,7 +441,7 @@ int add_listener(aConfItem *aconf)
   }
   else
 #endif
   }
   else
 #endif
-  if (inetport(cptr, aconf->host, aconf->passwd, aconf->port))
+  if (inetport(cptr, aconf->host, aconf->port))
     cptr->fd = -2;
 
   if (cptr->fd >= 0)
     cptr->fd = -2;
 
   if (cptr->fd >= 0)
@@ -446,8 +450,6 @@ int add_listener(aConfItem *aconf)
     cptr->confs->next = NULL;
     cptr->confs->value.aconf = aconf;
     set_non_blocking(cptr->fd, cptr);
     cptr->confs->next = NULL;
     cptr->confs->value.aconf = aconf;
     set_non_blocking(cptr->fd, cptr);
-    if (aconf->port == portnum)
-      have_server_port = 1;
   }
   else
     free_client(cptr);
   }
   else
     free_client(cptr);
@@ -630,7 +632,7 @@ static int check_init(aClient *cptr, char *sockn)
   /* If descriptor is a tty, special checking... */
   if (isatty(cptr->fd))
   {
   /* If descriptor is a tty, special checking... */
   if (isatty(cptr->fd))
   {
-    strncpy(sockn, me.sockhost, HOSTLEN);
+    strncpy(sockn, me.name, HOSTLEN);
     memset(&sk, 0, sizeof(struct sockaddr_in));
   }
   else if (getpeername(cptr->fd, (struct sockaddr *)&sk, &len) == -1)
     memset(&sk, 0, sizeof(struct sockaddr_in));
   }
   else if (getpeername(cptr->fd, (struct sockaddr *)&sk, &len) == -1)
@@ -642,7 +644,7 @@ static int check_init(aClient *cptr, char *sockn)
   if (inet_netof(sk.sin_addr) == IN_LOOPBACKNET)
   {
     cptr->hostp = NULL;
   if (inet_netof(sk.sin_addr) == IN_LOOPBACKNET)
   {
     cptr->hostp = NULL;
-    strncpy(sockn, me.sockhost, HOSTLEN);
+    strncpy(sockn, me.name, HOSTLEN);
   }
   memcpy(&cptr->ip, &sk.sin_addr, sizeof(struct in_addr));
 #ifdef TESTNET
   }
   memcpy(&cptr->ip, &sk.sin_addr, sizeof(struct in_addr));
 #ifdef TESTNET
@@ -755,7 +757,7 @@ int check_server(aClient *cptr)
     n_conf = find_conf(lp, name, NFLAG);
     if (!c_conf || !n_conf)
     {
     n_conf = find_conf(lp, name, NFLAG);
     if (!c_conf || !n_conf)
     {
-      sendto_ops("Connecting Error: %s[%s]", name, cptr->sockhost);
+      sendto_ops("Connecting Error: %s", name);
       det_confs_butmask(cptr, 0);
       return -1;
     }
       det_confs_butmask(cptr, 0);
       return -1;
     }
@@ -937,7 +939,7 @@ static int completed_connection(aClient *cptr)
   aconf = find_conf(cptr->confs, cptr->name, CONF_CONNECT_SERVER);
   if (!aconf)
   {
   aconf = find_conf(cptr->confs, cptr->name, CONF_CONNECT_SERVER);
   if (!aconf)
   {
-    sendto_ops("Lost C-Line for %s", get_client_name(cptr, FALSE));
+    sendto_ops("Lost C-Line for %s", cptr->name);
     return -1;
   }
   if (!BadPtr(aconf->passwd))
     return -1;
   }
   if (!BadPtr(aconf->passwd))
@@ -946,7 +948,7 @@ static int completed_connection(aClient *cptr)
   aconf = find_conf(cptr->confs, cptr->name, CONF_NOCONNECT_SERVER);
   if (!aconf)
   {
   aconf = find_conf(cptr->confs, cptr->name, CONF_NOCONNECT_SERVER);
   if (!aconf)
   {
-    sendto_ops("Lost N-Line for %s", get_client_name(cptr, FALSE));
+    sendto_ops("Lost N-Line for %s", cptr->name);
     return -1;
   }
   make_server(cptr);
     return -1;
   }
   make_server(cptr);
@@ -1154,7 +1156,7 @@ static void set_sock_opts(int fd, aClient *cptr)
        sprintf(s, "%02x:", *t++);
       *s = '\0';
       sendto_ops("Connection %s using IP opts: (%s)",
        sprintf(s, "%02x:", *t++);
       *s = '\0';
       sendto_ops("Connection %s using IP opts: (%s)",
-         get_client_name(cptr, TRUE), readbuf);
+         get_client_name(cptr, FALSE), readbuf);
     }
     if (setsockopt(fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *)NULL, 0) < 0)
       report_error("setsockopt(IP_OPTIONS) %s: %s", cptr);
     }
     if (setsockopt(fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *)NULL, 0) < 0)
       report_error("setsockopt(IP_OPTIONS) %s: %s", cptr);
@@ -1164,10 +1166,9 @@ static void set_sock_opts(int fd, aClient *cptr)
 
 int get_sockerr(aClient *cptr)
 {
 
 int get_sockerr(aClient *cptr)
 {
-  int errtmp = errno;
-#if defined(SO_ERROR) && !defined(SOL2)
-  int err = 0;
+  int errtmp = errno, err = 0;
   size_t len = sizeof(err);
   size_t len = sizeof(err);
+#if defined(SO_ERROR) && !defined(SOL2)
   if (cptr->fd >= 0)
     if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
       if (err)
   if (cptr->fd >= 0)
     if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *)&err, &len))
       if (err)
@@ -1219,6 +1220,8 @@ void set_non_blocking(int fd, aClient *cptr)
   return;
 }
 
   return;
 }
 
+extern unsigned short server_port;
+
 /*
  * Creates a client which has just connected to us on the given fd.
  * The sockhost field is initialized with the ip# of the host.
 /*
  * Creates a client which has just connected to us on the given fd.
  * The sockhost field is initialized with the ip# of the host.
@@ -1232,7 +1235,7 @@ aClient *add_connection(aClient *cptr, int fd, int type)
   aConfItem *aconf = NULL;
   acptr =
       make_client(NULL,
   aConfItem *aconf = NULL;
   acptr =
       make_client(NULL,
-      (cptr->port == portnum) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER);
+      (cptr->port == server_port) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER);
 
   if (cptr != &me)
     aconf = cptr->confs->value.aconf;
 
   if (cptr != &me)
     aconf = cptr->confs->value.aconf;
@@ -1293,11 +1296,25 @@ aClient *add_connection(aClient *cptr, int fd, int type)
 
     lin.flags = ASYNC_CLIENT;
     lin.value.cptr = acptr;
 
     lin.flags = ASYNC_CLIENT;
     lin.value.cptr = acptr;
-    Debug((DEBUG_DNS, "lookup %s", inetntoa(addr.sin_addr)));
-    acptr->hostp = gethost_byaddr(&acptr->ip, &lin);
-    if (!acptr->hostp)
-      SetDNS(acptr);
-    nextdnscheck = 1;
+#ifdef NODNS
+    if (!strcmp("127.0.0.1", inetntoa(addr.sin_addr)))
+    {
+      static struct hostent lhe = { "localhost", NULL, 0, 0, NULL };
+      acptr->hostp = &lhe;
+      if (!DoingAuth(acptr))
+       SetAccess(acptr);
+    }
+    else
+    {
+#endif
+      Debug((DEBUG_DNS, "lookup %s", inetntoa(addr.sin_addr)));
+      acptr->hostp = gethost_byaddr(&acptr->ip, &lin);
+      if (!acptr->hostp)
+       SetDNS(acptr);
+      nextdnscheck = 1;
+#ifdef NODNS
+    }
+#endif
   }
 
   if (aconf)
   }
 
   if (aconf)
@@ -1341,7 +1358,7 @@ static void add_unixconnection(aClient *cptr, int fd)
    * Copy ascii address to 'sockhost' just in case. Then we
    * have something valid to put into error messages...
    */
    * Copy ascii address to 'sockhost' just in case. Then we
    * have something valid to put into error messages...
    */
-  get_sockhost(acptr, me.sockhost);
+  strncpy(acptr->sockhost, me.name, HOSTLEN);
   if (cptr != &me)
     aconf = cptr->confs->value.aconf;
   if (aconf)
   if (cptr != &me)
     aconf = cptr->confs->value.aconf;
   if (aconf)
@@ -1852,8 +1869,7 @@ int read_message(time_t delay)
                STIME_T_FMT " minutes", count, (now - last_time) / 60);
          }
          else
                STIME_T_FMT " minutes", count, (now - last_time) / 60);
          }
          else
-           sendto_ops("All connections in use. (%s)", get_client_name(cptr,
-               TRUE));
+           sendto_ops("All connections in use. (%s)", cptr->name);
          count = 0;
          last_time = now;
        }
          count = 0;
          last_time = now;
        }
@@ -1936,7 +1952,7 @@ int read_message(time_t delay)
       continue;
     nfds--;
     readcalls++;
       continue;
     nfds--;
     readcalls++;
-    if (length > 0 || length == CPTR_KILLED)
+    if (length > 0)
       continue;
 
     /*
       continue;
 
     /*
@@ -1950,9 +1966,12 @@ int read_message(time_t delay)
      */
     Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d %d", LOC_FD(i), errno, length));
 
      */
     Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d %d", LOC_FD(i), errno, length));
 
+    if (length == CPTR_KILLED)
+      continue;
+
     if ((IsServer(cptr) || IsHandshake(cptr)) && errno == 0 && length == 0)
       exit_client_msg(cptr, cptr, &me, "Server %s closed the connection (%s)",
     if ((IsServer(cptr) || IsHandshake(cptr)) && errno == 0 && length == 0)
       exit_client_msg(cptr, cptr, &me, "Server %s closed the connection (%s)",
-         get_client_name(cptr, FALSE), cptr->serv->last_error_msg);
+         cptr->name, cptr->serv->last_error_msg);
     else
       exit_client_msg(cptr, cptr, &me, "Read error to %s: %s",
          get_client_name(cptr, FALSE), (length < 0) ?
     else
       exit_client_msg(cptr, cptr, &me, "Read error to %s: %s",
          get_client_name(cptr, FALSE), (length < 0) ?
@@ -1999,11 +2018,11 @@ int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp)
       {
        if (MyUser(by) || Protocol(by->from) < 10)
          sendto_one(by, ":%s NOTICE %s :Connection to %s already in progress",
       {
        if (MyUser(by) || Protocol(by->from) < 10)
          sendto_one(by, ":%s NOTICE %s :Connection to %s already in progress",
-             me.name, by->name, get_client_name(c2ptr, TRUE));
+             me.name, by->name, c2ptr->name);
        else
          sendto_one(by,
              "%s NOTICE %s%s :Connection to %s already in progress",
        else
          sendto_one(by,
              "%s NOTICE %s%s :Connection to %s already in progress",
-             NumServ(&me), NumNick(by), get_client_name(c2ptr, TRUE));
+             NumServ(&me), NumNick(by), c2ptr->name);
       }
       return -1;
     }
       }
       return -1;
     }
@@ -2066,11 +2085,11 @@ int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp)
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by, ":%s NOTICE %s :Couldn't connect to %s",
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by, ":%s NOTICE %s :Couldn't connect to %s",
-           me.name, by->name, get_client_name(cptr, TRUE));
+           me.name, by->name, cptr->name);
       else
 #endif
        sendto_one(by, "%s NOTICE %s%s :Couldn't connect to %s",
       else
 #endif
        sendto_one(by, "%s NOTICE %s%s :Couldn't connect to %s",
-           NumServ(&me), NumNick(by), get_client_name(cptr, TRUE));
+           NumServ(&me), NumNick(by), cptr->name);
     }
     free_client(cptr);
     return -1;
     }
     free_client(cptr);
     return -1;
@@ -2091,12 +2110,11 @@ int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp)
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by, ":%s NOTICE %s :Connect to host %s failed: %s",
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by, ":%s NOTICE %s :Connect to host %s failed: %s",
-           me.name, by->name, get_client_name(cptr, TRUE), strerror(err));
+           me.name, by->name, cptr->name, strerror(err));
       else
 #endif
        sendto_one(by, "%s NOTICE %s%s :Connect to host %s failed: %s",
       else
 #endif
        sendto_one(by, "%s NOTICE %s%s :Connect to host %s failed: %s",
-           NumServ(&me), NumNick(by), get_client_name(cptr, TRUE),
-           strerror(err));
+           NumServ(&me), NumNick(by), cptr->name, strerror(err));
     }
     close(cptr->fd);
     cptr->fd = -2;
     }
     close(cptr->fd);
     cptr->fd = -2;
@@ -2123,19 +2141,19 @@ int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp)
       !find_conf_host(cptr->confs, aconf->host, CONF_CONNECT_SERVER))
   {
     sendto_ops("Host %s is not enabled for connecting:no C/N-line",
       !find_conf_host(cptr->confs, aconf->host, CONF_CONNECT_SERVER))
   {
     sendto_ops("Host %s is not enabled for connecting:no C/N-line",
-       aconf->host);
+              aconf->name);
     if (by && IsUser(by) && !MyUser(by))
     {
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by,
            ":%s NOTICE %s :Connect to host %s failed: no C/N-lines",
     if (by && IsUser(by) && !MyUser(by))
     {
 #ifndef NO_PROTOCOL9
       if (Protocol(by->from) < 10)
        sendto_one(by,
            ":%s NOTICE %s :Connect to host %s failed: no C/N-lines",
-           me.name, by->name, get_client_name(cptr, TRUE));
+           me.name, by->name, cptr->name);
       else
 #endif
        sendto_one(by,
            "%s NOTICE %s%s :Connect to host %s failed: no C/N-lines",
       else
 #endif
        sendto_one(by,
            "%s NOTICE %s%s :Connect to host %s failed: no C/N-lines",
-           NumServ(&me), NumNick(by), get_client_name(cptr, TRUE));
+           NumServ(&me), NumNick(by), cptr->name);
     }
     det_confs_butmask(cptr, 0);
     close(cptr->fd);
     }
     det_confs_butmask(cptr, 0);
     close(cptr->fd);
@@ -2182,7 +2200,6 @@ static struct sockaddr *connect_inet(aConfItem *aconf, aClient *cptr, int *lenp)
 {
   static struct sockaddr_in server;
   Reg3 struct hostent *hp;
 {
   static struct sockaddr_in server;
   Reg3 struct hostent *hp;
-  struct sockaddr_in bindaddr;
 
   /*
    * Might as well get sockhost from here, the connection is attempted
 
   /*
    * Might as well get sockhost from here, the connection is attempted
@@ -2194,7 +2211,7 @@ static struct sockaddr *connect_inet(aConfItem *aconf, aClient *cptr, int *lenp)
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("opening stream socket to server %s: No more sockets",
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("opening stream socket to server %s: No more sockets",
-       get_client_name(cptr, TRUE));
+       cptr->name);
     return NULL;
   }
   if (cptr->fd == -1)
     return NULL;
   }
   if (cptr->fd == -1)
@@ -2208,23 +2225,37 @@ static struct sockaddr *connect_inet(aConfItem *aconf, aClient *cptr, int *lenp)
     return NULL;
   }
   mysk.sin_port = 0;
     return NULL;
   }
   mysk.sin_port = 0;
+
   memset(&server, 0, sizeof(server));
   server.sin_family = AF_INET;
   get_sockhost(cptr, aconf->host);
 
   memset(&server, 0, sizeof(server));
   server.sin_family = AF_INET;
   get_sockhost(cptr, aconf->host);
 
+#ifdef VIRTUAL_HOST
+  mysk.sin_addr = vserv.sin_addr;
+#endif
+
   /*
    * Bind to a local IP# (with unknown port - let unix decide) so
    * we have some chance of knowing the IP# that gets used for a host
    * with more than one IP#.
    */
   /*
    * Bind to a local IP# (with unknown port - let unix decide) so
    * we have some chance of knowing the IP# that gets used for a host
    * with more than one IP#.
    */
-  memcpy(&bindaddr, &cserv, sizeof(bindaddr));
-  if (aconf->ipnum.s_addr == 0x100007f)
-    bindaddr.sin_addr.s_addr = 0x100007f;      /* bind with localhost when we are connecting to localhost */
-  if (bind(cptr->fd, (struct sockaddr *)&bindaddr, sizeof(bindaddr)) == -1)
+  /* No we don't bind it, not all OS's can handle connecting with
+   * an already bound socket, different ip# might occur anyway
+   * leading to a freezing select() on this side for some time.
+   * I had this on my Linux 1.1.88 --Run
+   */
+#ifdef VIRTUAL_HOST
+  /*
+   * No, we do bind it if we have virtual host support. If we don't
+   * explicitly bind it, it will default to IN_ADDR_ANY and we lose
+   * due to the other server not allowing our base IP --smg
+   */
+  if (bind(cptr->fd, (struct sockaddr *)&mysk, sizeof(mysk)) == -1)
   {
     report_error("error binding to local port for %s: %s", cptr);
     return NULL;
   }
   {
     report_error("error binding to local port for %s: %s", cptr);
     return NULL;
   }
+#endif
 
   /*
    * By this point we should know the IP# of the host listed in the
 
   /*
    * By this point we should know the IP# of the host listed in the
@@ -2271,7 +2302,7 @@ static struct sockaddr *connect_unix(aConfItem *aconf, aClient *cptr, int *lenp)
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("Unix domain connect to host %s failed: No more sockets",
   if (cptr->fd == -1 && errno == EAGAIN)
   {
     sendto_ops("Unix domain connect to host %s failed: No more sockets",
-       get_client_name(cptr, TRUE));
+       cptr->name);
     return NULL;
   }
   if (cptr->fd == -1)
     return NULL;
   }
   if (cptr->fd == -1)
@@ -2303,73 +2334,29 @@ static struct sockaddr *connect_unix(aConfItem *aconf, aClient *cptr, int *lenp)
  * matches the server's name) and its primary IP#.  Hostname is stored
  * in the client structure passed as a pointer.
  */
  * matches the server's name) and its primary IP#.  Hostname is stored
  * in the client structure passed as a pointer.
  */
-void get_my_name(aClient *cptr, char *name, size_t len)
+void get_my_name(aClient *cptr)
 {
 {
-  static char tmp[HOSTLEN + 1];
-#if HAVE_UNAME
-  struct utsname utsn;
-#endif
-  struct hostent *hp;
-  char *cname = cptr->name;
-  size_t len2;
-
+  struct ConfItem* aconf = find_me();
   /*
    * Setup local socket structure to use for binding to.
    */
   memset(&mysk, 0, sizeof(mysk));
   mysk.sin_family = AF_INET;
   /*
    * Setup local socket structure to use for binding to.
    */
   memset(&mysk, 0, sizeof(mysk));
   mysk.sin_family = AF_INET;
+  mysk.sin_addr.s_addr = INADDR_ANY; 
 
 
-#if HAVE_UNAME
-  if (uname(&utsn) == -1)
-    return;
-  len2 = strlen(utsn.nodename);
-  if (len2 > len)
-    len2 = len;
-  strncpy(name, utsn.nodename, len2);
-#else /* HAVE_GETHOSTNAME */
-  if (gethostname(name, len) == -1)
-    return;
-#endif
-  name[len] = '\0';
-
-  /* Assume that a name containing '.' is a FQDN */
-  if (!strchr(name, '.'))
-    add_local_domain(name, len - strlen(name));
-
-  /*
-   * If hostname gives another name than cname, then check if there is
-   * a CNAME record for cname pointing to hostname. If so accept
-   * cname as our name.   meLazy
-   */
-  if (BadPtr(cname))
+  if (!aconf || BadPtr(aconf->host))
     return;
     return;
-  if ((hp = gethostbyname(cname)) || (hp = gethostbyname(name)))
-  {
-    const char *hname;
-    int i = 0;
-
-    for (hname = hp->h_name; hname; hname = hp->h_aliases[i++])
-    {
-      strncpy(tmp, hname, sizeof(tmp) - 1);
-      add_local_domain(tmp, sizeof(tmp) - 1 - strlen(tmp));
+  strncpy(me.name, aconf->host, sizeof(me.name) - 1);
 
 
-      /*
-       * Copy the matching name over and store the
-       * 'primary' IP# as 'myip' which is used
-       * later for making the right one is used
-       * for connecting to other hosts.
-       */
-      if (!strCasediff(me.name, tmp))
-       break;
-    }
-    if (strCasediff(me.name, tmp))
-      strncpy(name, hp->h_name, len);
-    else
-      strncpy(name, tmp, len);
-    memcpy(&mysk.sin_addr, hp->h_addr, sizeof(struct in_addr));
-    Debug((DEBUG_DEBUG, "local name is %s", get_client_name(&me, TRUE)));
+  if (!BadPtr(aconf->passwd) && 0 != strcmp(aconf->passwd, "*")) {
+    mysk.sin_addr.s_addr = inet_addr(aconf->passwd);
+    if (INADDR_NONE == mysk.sin_addr.s_addr)
+      mysk.sin_addr.s_addr = INADDR_ANY;
+#ifdef VIRTUAL_HOST
+    memcpy(&vserv, &mysk, sizeof(struct sockaddr_in));
+#endif
   }
   }
-  return;
+  Debug((DEBUG_DEBUG, "local name is %s", get_client_name(&me, TRUE)));
 }
 
 /*
 }
 
 /*
@@ -2381,7 +2368,11 @@ int setup_ping(void)
   int on = 1;
 
   memset(&from, 0, sizeof(from));
   int on = 1;
 
   memset(&from, 0, sizeof(from));
-  from.sin_addr = cserv.sin_addr;
+#ifdef VIRTUAL_HOST
+  from.sin_addr = vserv.sin_addr;
+#else
+  from.sin_addr.s_addr = htonl(INADDR_ANY);
+#endif
 #ifdef TESTNET
   from.sin_port = htons(atoi(UDP_PORT) + 10000);
 #else
 #ifdef TESTNET
   from.sin_port = htons(atoi(UDP_PORT) + 10000);
 #else
index b9498824c78eb8a5adb3412b3ecbc67abfd09901..05da98d91375036aacfefca511e2a92a8e02b86c 100644 (file)
@@ -773,6 +773,8 @@ int rehash(aClient *cptr, int sig)
 
 #define MAXCONFLINKS 150
 
 
 #define MAXCONFLINKS 150
 
+unsigned short server_port;
+
 int initconf(int opt)
 {
   static char quotes[9][2] = {
 int initconf(int opt)
 {
   static char quotes[9][2] = {
@@ -946,11 +948,7 @@ int initconf(int opt)
       tmp = getfield(NULL, ':');
       if (aconf->status & CONF_ME)
       {
       tmp = getfield(NULL, ':');
       if (aconf->status & CONF_ME)
       {
-       portnum = aconf->port;
-       if (portnum == 0)
-         portnum = PORTNUM;
-       me.port = portnum;
-       vserv.sin_port = htons(portnum);
+       server_port = aconf->port;
        if (!tmp)
        {
          Debug((DEBUG_FATAL, "Your M: line must have the Numeric, "
        if (!tmp)
        {
          Debug((DEBUG_FATAL, "Your M: line must have the Numeric, "
@@ -1059,23 +1057,8 @@ int initconf(int opt)
     if (aconf->status == CONF_ME)
     {
       strncpy(me.info, aconf->name, sizeof(me.info) - 1);
     if (aconf->status == CONF_ME)
     {
       strncpy(me.info, aconf->name, sizeof(me.info) - 1);
-      if (me.name[0] == '\0' && aconf->host[0])
-      {
-       strncpy(me.name, aconf->host, sizeof(me.name) - 1);
-       if (vserv.sin_addr.s_addr == htonl(INADDR_ANY))         /* Not already initialised on commandline with -w ? */
-       {
-         struct hostent *hep;
-         hep = gethostbyname(me.name);
-         if (hep && hep->h_addrtype == AF_INET && hep->h_addr_list[0] && !hep->h_addr_list[1])
-          {
-           memcpy(&vserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
-           memcpy(&cserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr));
-          }
-       }
-      }
       if (portnum == 0)
        portnum = aconf->port;
       if (portnum == 0)
        portnum = aconf->port;
-      have_server_port = 0;
     }
 
     /*
     }
 
     /*
index 1b18d646accdb67aa6dba289235aed0fdf013dfd..5ba170503a9182e5c8ab2fb90f962c342d637627 100644 (file)
@@ -167,6 +167,9 @@ char serveropts[] = {
 #if defined(USE_POLL) && defined(HAVE_POLL_H)
     'U',
 #endif
 #if defined(USE_POLL) && defined(HAVE_POLL_H)
     'U',
 #endif
+#ifdef VIRTUAL_HOST
+    'v',
+#endif
 #ifdef BADCHAN
    'W',
 #ifdef LOCAL_BADCHAN
 #ifdef BADCHAN
    'W',
 #ifdef LOCAL_BADCHAN
index 5b00ee11881bcb294f0189a8f3c6d0812e06151c..f93aff2bbe78b281bb99bccb11167fdeaac04bcb 100644 (file)
@@ -174,7 +174,7 @@ char *get_client_name(aClient *sptr, int showip)
       if (showip)
        sprintf_irc(nbuf, "%s[%s]", sptr->name, sptr->sockhost);
       else
       if (showip)
        sprintf_irc(nbuf, "%s[%s]", sptr->name, sptr->sockhost);
       else
-       sprintf_irc(nbuf, "%s[%s]", sptr->name, me.sockhost);
+       sprintf_irc(nbuf, "%s[%s]", sptr->name, me.name);
     }
     else
     {
     }
     else
     {
@@ -425,10 +425,10 @@ int exit_client(aClient *cptr,    /* Connection being handled by
       sendto_lops_butone(sptr, "%s SQUIT by %s [%s]:",
          (sptr->user->server == bcptr ||
          sptr->user->server == bcptr->serv->up) ? "Local" : "Remote",
       sendto_lops_butone(sptr, "%s SQUIT by %s [%s]:",
          (sptr->user->server == bcptr ||
          sptr->user->server == bcptr->serv->up) ? "Local" : "Remote",
-         get_client_name(sptr, TRUE), sptr->user->server->name);
+         get_client_name(sptr, FALSE), sptr->user->server->name);
     else if (sptr != &me && bcptr->serv->up != sptr)
       sendto_ops("Received SQUIT %s from %s :", bcptr->name,
     else if (sptr != &me && bcptr->serv->up != sptr)
       sendto_ops("Received SQUIT %s from %s :", bcptr->name,
-         IsServer(sptr) ? sptr->name : get_client_name(sptr, TRUE));
+         IsServer(sptr) ? sptr->name : get_client_name(sptr, FALSE));
     sendto_op_mask(SNO_NETWORK, "Net break: %s (%s)", comment1, comment);
   }
 
     sendto_op_mask(SNO_NETWORK, "Net break: %s (%s)", comment1, comment);
   }
 
index c694869946747b0024df28dee6270aa84cdf8d75..aa10dd94bfa4a7b58695a01b9ddb618d46da69b6 100644 (file)
@@ -325,7 +325,6 @@ int m_uping(aClient *cptr, aClient *sptr, int parc, char *parv[])
   aConfItem *aconf;
   unsigned short int port;
   int fd, opt;
   aConfItem *aconf;
   unsigned short int port;
   int fd, opt;
-  char *p;
 
   if (!IsPrivileged(sptr))
   {
 
   if (!IsPrivileged(sptr))
   {
@@ -394,17 +393,9 @@ int m_uping(aClient *cptr, aClient *sptr, int parc, char *parv[])
   }
 
   /* Check if a CONNECT would be possible at all (adapted from m_connect) */
   }
 
   /* Check if a CONNECT would be possible at all (adapted from m_connect) */
-  if (parc > 2 && !BadPtr(parv[2]))
-    p = strchr(parv[2], ':');
-  else
-    p = 0;
-  if (p)
-    *p = 0;
   for (aconf = conf; aconf; aconf = aconf->next)
     if (aconf->status == CONF_CONNECT_SERVER &&
   for (aconf = conf; aconf; aconf = aconf->next)
     if (aconf->status == CONF_CONNECT_SERVER &&
-       match(parv[1], aconf->name) == 0 &&
-        (!p || match(parv[2], aconf->host) == 0 ||
-       match(parv[2], strchr(aconf->host, '@') + 1) == 0))
+       match(parv[1], aconf->name) == 0)
       break;
   if (!aconf)
     for (aconf = conf; aconf; aconf = aconf->next)
       break;
   if (!aconf)
     for (aconf = conf; aconf; aconf = aconf->next)
@@ -412,8 +403,6 @@ int m_uping(aClient *cptr, aClient *sptr, int parc, char *parv[])
          (match(parv[1], aconf->host) == 0 ||
          match(parv[1], strchr(aconf->host, '@') + 1) == 0))
        break;
          (match(parv[1], aconf->host) == 0 ||
          match(parv[1], strchr(aconf->host, '@') + 1) == 0))
        break;
-  if (p)
-    *p = ':';
   if (!aconf)
   {
     if (MyUser(sptr) || Protocol(cptr) < 10)
   if (!aconf)
   {
     if (MyUser(sptr) || Protocol(cptr) < 10)
@@ -432,7 +421,7 @@ int m_uping(aClient *cptr, aClient *sptr, int parc, char *parv[])
   /*
    * Determine port: First user supplied, then default : 7007
    */
   /*
    * Determine port: First user supplied, then default : 7007
    */
-  if (!p || (port = atoi(p + 1)) <= 0)
+  if (BadPtr(parv[2]) || (port = atoi(parv[2])) <= 0)
     port = atoi(UDP_PORT);
 
   alarm(2);
     port = atoi(UDP_PORT);
 
   alarm(2);
@@ -502,18 +491,6 @@ int m_uping(aClient *cptr, aClient *sptr, int parc, char *parv[])
     close(fd);
     return 0;
   }
     close(fd);
     return 0;
   }
-  if (bind(fd, (struct sockaddr *)&cserv, sizeof(cserv)) == -1)
-  {
-    sendto_ops("Failure binding fd for uping");
-    if (MyUser(sptr) || Protocol(cptr) < 10)
-      sendto_one(sptr, ":%s NOTICE %s :UPING: failure binding udp socket",
-         me.name, parv[0]);
-    else
-      sendto_one(sptr, "%s NOTICE %s%s :UPING: failure binding udp socket",
-         NumServ(&me), NumNick(sptr));
-    close(fd);
-    return 0;
-  }
 
   if (fd > highest_fd)
     highest_fd = fd;
 
   if (fd > highest_fd)
     highest_fd = fd;
index 868d2eb68e4c9a6e210001847afaccafb11b582b..77e97aaafd8bf091882126b64a555f73f9f49e52 100644 (file)
@@ -88,6 +88,8 @@ static int a_kills_b_too(aClient *a, aClient *b)
   return (a == b ? 1 : 0);
 }
 
   return (a == b ? 1 : 0);
 }
 
+extern unsigned short server_port;
+
 /*
  *  m_server
  *
 /*
  *  m_server
  *
@@ -123,11 +125,11 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
   if (IsUserPort(cptr))
     return exit_client_msg(cptr, cptr, &me,
        "You cannot connect a server to a user port; connect to %s port %u",
   if (IsUserPort(cptr))
     return exit_client_msg(cptr, cptr, &me,
        "You cannot connect a server to a user port; connect to %s port %u",
-       me.name, portnum);
+       me.name, server_port);
 
   recv_time = TStime();
   info[0] = '\0';
 
   recv_time = TStime();
   info[0] = '\0';
-  inpath = get_client_name(cptr, TRUE);
+  inpath = cptr->name;
   if (parc < 7)
   {
     sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SERVER");
   if (parc < 7)
   {
     sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SERVER");
@@ -161,7 +163,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
   if (prot < atoi(MINOR_PROTOCOL))
   {
     sendto_ops("Got incompatible protocol version (%s) from %s",
   if (prot < atoi(MINOR_PROTOCOL))
   {
     sendto_ops("Got incompatible protocol version (%s) from %s",
-       parv[5], get_client_name(cptr, TRUE));
+       parv[5], get_client_name(cptr, FALSE));
     return exit_new_server(cptr, sptr, host, timestamp,
        "Incompatible protocol: %s", parv[5]);
   }
     return exit_new_server(cptr, sptr, host, timestamp,
        "Incompatible protocol: %s", parv[5]);
   }
@@ -181,7 +183,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
   if (*ch || !strchr(host, '.'))
   {
     sendto_ops("Bogus server name (%s) from %s",
   if (*ch || !strchr(host, '.'))
   {
     sendto_ops("Bogus server name (%s) from %s",
-       host, get_client_name(cptr, TRUE));
+       host, get_client_name(cptr, FALSE));
     return exit_client_msg(cptr, cptr, &me, "Bogus server name (%s)", host);
   }
 
     return exit_client_msg(cptr, cptr, &me, "Bogus server name (%s)", host);
   }
 
@@ -264,15 +266,14 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
        if (crule_eval(cconf->passwd))
        {
          ircstp->is_ref++;
        if (crule_eval(cconf->passwd))
        {
          ircstp->is_ref++;
-         sendto_ops("Refused connection from %s.", get_client_host(cptr));
+         sendto_ops("Refused connection from %s.", cptr->name);
          return exit_client(cptr, cptr, &me, "Disallowed by connection rule");
        }
 
     if (check_server(cptr))
     {
       ircstp->is_ref++;
          return exit_client(cptr, cptr, &me, "Disallowed by connection rule");
        }
 
     if (check_server(cptr))
     {
       ircstp->is_ref++;
-      sendto_ops("Received unauthorized connection from %s.",
-         get_client_host(cptr));
+      sendto_ops("Received unauthorized connection from %s.", cptr->name);
       return exit_client(cptr, cptr, &me, "No C/N conf lines");
     }
 
       return exit_client(cptr, cptr, &me, "No C/N conf lines");
     }
 
@@ -357,7 +358,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
        *s = '@';
        ircstp->is_ref++;
        sendto_ops("Username mismatch [%s]v[%s] : %s",
        *s = '@';
        ircstp->is_ref++;
        sendto_ops("Username mismatch [%s]v[%s] : %s",
-           aconf->host, cptr->username, get_client_name(cptr, TRUE));
+           aconf->host, cptr->username, get_client_name(cptr, FALSE));
        return exit_client(cptr, cptr, &me, "Bad Username");
       }
       *s = '@';
        return exit_client(cptr, cptr, &me, "Bad Username");
       }
       *s = '@';
@@ -615,7 +616,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
       return exit_new_server(cptr, sptr, host, timestamp,
          (active_lh_line == 2) ?
          "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)",
       return exit_new_server(cptr, sptr, host, timestamp,
          (active_lh_line == 2) ?
          "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)",
-         get_client_name(cptr, TRUE), host,
+         cptr->name, host,
          lhconf ? (lhconf->host ? lhconf->host : "*") : "!");
     else
     {
          lhconf ? (lhconf->host ? lhconf->host : "*") : "!");
     else
     {
@@ -625,7 +626,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
        if (exit_client_msg(cptr, LHcptr, &me,
            (active_lh_line == 2) ?
            "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)",
        if (exit_client_msg(cptr, LHcptr, &me,
            (active_lh_line == 2) ?
            "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)",
-           get_client_name(cptr, TRUE), host,
+           cptr->name, host,
            lhconf ? (lhconf->host ? lhconf->host : "*") : "!") == CPTR_KILLED)
          return CPTR_KILLED;
       }
            lhconf ? (lhconf->host ? lhconf->host : "*") : "!") == CPTR_KILLED)
          return CPTR_KILLED;
       }
@@ -689,7 +690,7 @@ int m_server(aClient *cptr, aClient *sptr, int parc, char *parv[])
       if (!(cconf = bcptr->serv->nline))
       {
        sendto_ops("Lost N-line for %s on %s. Closing",
       if (!(cconf = bcptr->serv->nline))
       {
        sendto_ops("Lost N-line for %s on %s. Closing",
-           get_client_name(cptr, TRUE), host);
+           cptr->name, host);
        return exit_client(cptr, cptr, &me, "Lost N line");
       }
       if (match(my_name_for_link(me.name, cconf), acptr->name) == 0)
        return exit_client(cptr, cptr, &me, "Lost N line");
       }
       if (match(my_name_for_link(me.name, cconf), acptr->name) == 0)
@@ -788,7 +789,7 @@ int m_server_estab(aClient *cptr, aConfItem *aconf, aConfItem *bconf)
 
   split = (strCasediff(cptr->name, cptr->sockhost)
       && strnCasecmp(cptr->info, "JUPE", 4));
 
   split = (strCasediff(cptr->name, cptr->sockhost)
       && strnCasecmp(cptr->info, "JUPE", 4));
-  inpath = get_client_name(cptr, TRUE);
+  inpath = cptr->name;
   host = cptr->name;
 
   if (IsUnknown(cptr))
   host = cptr->name;
 
   if (IsUnknown(cptr))
@@ -853,16 +854,16 @@ int m_server_estab(aClient *cptr, aConfItem *aconf, aConfItem *bconf)
     {
       if (Protocol(acptr) > 9)
        sendto_one(acptr,
     {
       if (Protocol(acptr) > 9)
        sendto_one(acptr,
-           "%s SERVER %s 2 0 " TIME_T_FMT " %s%u %s%s 0 :[%s] %s",
+           "%s SERVER %s 2 0 " TIME_T_FMT " %s%u %s%s 0 :%s",
            NumServ(&me), cptr->name, cptr->serv->timestamp,
            (Protocol(cptr) > 9) ? "J" : "J0", Protocol(cptr), NumServCap(cptr),
            NumServ(&me), cptr->name, cptr->serv->timestamp,
            (Protocol(cptr) > 9) ? "J" : "J0", Protocol(cptr), NumServCap(cptr),
-           cptr->sockhost, cptr->info);
+           cptr->info);
       else
        sendto_one(acptr,
       else
        sendto_one(acptr,
-           ":%s SERVER %s 2 0 " TIME_T_FMT " %s%u %s%s 0 :[%s] %s", me.name,
+           ":%s SERVER %s 2 0 " TIME_T_FMT " %s%u %s%s 0 :%s", me.name,
            cptr->name, cptr->serv->timestamp,
            (Protocol(cptr) > 9) ? "J" : "J0", Protocol(cptr), NumServCap(cptr),
            cptr->name, cptr->serv->timestamp,
            (Protocol(cptr) > 9) ? "J" : "J0", Protocol(cptr), NumServCap(cptr),
-           cptr->sockhost, cptr->info);
+           cptr->info);
     }
     else
     {
     }
     else
     {
@@ -912,18 +913,18 @@ int m_server_estab(aClient *cptr, aConfItem *aconf, aConfItem *bconf)
       {
        if (Protocol(cptr) > 9)
          sendto_one(cptr,
       {
        if (Protocol(cptr) > 9)
          sendto_one(cptr,
-             "%s SERVER %s %d 0 " TIME_T_FMT " %s%u %s%s 0 :[%s] %s",
+             "%s SERVER %s %d 0 " TIME_T_FMT " %s%u %s%s 0 :%s",
              NumServ(acptr->serv->up), acptr->name,
              acptr->hopcount + 1, acptr->serv->timestamp,
              protocol_str, Protocol(acptr),
              NumServ(acptr->serv->up), acptr->name,
              acptr->hopcount + 1, acptr->serv->timestamp,
              protocol_str, Protocol(acptr),
-             NumServCap(acptr), acptr->sockhost, acptr->info);
+             NumServCap(acptr), acptr->info);
        else
          sendto_one(cptr,
        else
          sendto_one(cptr,
-             ":%s SERVER %s %d 0 " TIME_T_FMT " %s%u %s%s 0 :[%s] %s",
+             ":%s SERVER %s %d 0 " TIME_T_FMT " %s%u %s%s 0 :%s",
              acptr->serv->up->name, acptr->name,
              acptr->hopcount + 1, acptr->serv->timestamp,
              protocol_str, Protocol(acptr),
              acptr->serv->up->name, acptr->name,
              acptr->hopcount + 1, acptr->serv->timestamp,
              protocol_str, Protocol(acptr),
-             NumServCap(acptr), acptr->sockhost, acptr->info);
+             NumServCap(acptr), acptr->info);
       }
       else
       {
       }
       else
       {
@@ -1019,10 +1020,10 @@ int m_error(aClient *cptr, aClient *sptr, int parc, char *parv[])
     return exit_client_msg(cptr, cptr, &me, "Register first");
 
   if (cptr == sptr)
     return exit_client_msg(cptr, cptr, &me, "Register first");
 
   if (cptr == sptr)
-    sendto_ops("ERROR :from %s -- %s", get_client_name(cptr, FALSE), para);
+    sendto_ops("ERROR :from %s -- %s", cptr->name, para);
   else
     sendto_ops("ERROR :from %s via %s -- %s",
   else
     sendto_ops("ERROR :from %s via %s -- %s",
-       sptr->name, get_client_name(cptr, FALSE), para);
+       sptr->name, cptr->name, para);
 
   if (sptr->serv)
   {
 
   if (sptr->serv)
   {
index 6cce3293f6a96dbcb783212472c05c9370bedcee..1a6dba59b6c8c4804d7ededf0bf1b96383149a5c 100644 (file)
@@ -408,7 +408,7 @@ static int register_user(aClient *cptr, aClient *sptr,
        break;
       case ACR_NO_AUTHORIZATION:
        sendto_op_mask(SNO_UNAUTH, "Unauthorized connection from %s.",
        break;
       case ACR_NO_AUTHORIZATION:
        sendto_op_mask(SNO_UNAUTH, "Unauthorized connection from %s.",
-           get_client_host(sptr));
+           sptr->sockhost);
        ircstp->is_ref++;
        return exit_client(cptr, sptr, &me,
            "No Authorization - use another server");
        ircstp->is_ref++;
        return exit_client(cptr, sptr, &me,
            "No Authorization - use another server");
@@ -417,7 +417,7 @@ static int register_user(aClient *cptr, aClient *sptr,
        {
          last_too_many1 = now;
          sendto_op_mask(SNO_TOOMANY, "Too many connections in class for %s.",
        {
          last_too_many1 = now;
          sendto_op_mask(SNO_TOOMANY, "Too many connections in class for %s.",
-             get_client_host(sptr));
+             sptr->sockhost);
        }
        IPcheck_connect_fail(sptr);
        ircstp->is_ref++;
        }
        IPcheck_connect_fail(sptr);
        ircstp->is_ref++;
@@ -429,7 +429,7 @@ static int register_user(aClient *cptr, aClient *sptr,
          last_too_many2 = now;
          sendto_op_mask(SNO_TOOMANY,
              "Too many connections from same IP for %s.",
          last_too_many2 = now;
          sendto_op_mask(SNO_TOOMANY,
              "Too many connections from same IP for %s.",
-             get_client_host(sptr));
+             sptr->sockhost);
        }
        ircstp->is_ref++;
        return exit_client(cptr, sptr, &me,
        }
        ircstp->is_ref++;
        return exit_client(cptr, sptr, &me,
@@ -441,7 +441,7 @@ static int register_user(aClient *cptr, aClient *sptr,
        return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
     }
     if (IsUnixSocket(sptr))
        return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
     }
     if (IsUnixSocket(sptr))
-      strncpy(user->host, me.sockhost, HOSTLEN);
+      strncpy(user->host, me.name, HOSTLEN);
     else
       strncpy(user->host, sptr->sockhost, HOSTLEN);
     aconf = sptr->confs->value.aconf;
     else
       strncpy(user->host, sptr->sockhost, HOSTLEN);
     aconf = sptr->confs->value.aconf;
@@ -579,7 +579,7 @@ static int register_user(aClient *cptr, aClient *sptr,
     sendto_one(sptr, rpl_str(RPL_WELCOME), me.name, nick, nick);
     /* This is a duplicate of the NOTICE but see below... */
     sendto_one(sptr, rpl_str(RPL_YOURHOST), me.name, nick,
     sendto_one(sptr, rpl_str(RPL_WELCOME), me.name, nick, nick);
     /* This is a duplicate of the NOTICE but see below... */
     sendto_one(sptr, rpl_str(RPL_YOURHOST), me.name, nick,
-       get_client_name(&me, FALSE), version);
+              me.name, version);
     sendto_one(sptr, rpl_str(RPL_CREATED), me.name, nick, creation);
     sendto_one(sptr, rpl_str(RPL_MYINFO), me.name, parv[0], me.name, version);
     m_lusers(sptr, sptr, 1, parv);
     sendto_one(sptr, rpl_str(RPL_CREATED), me.name, nick, creation);
     sendto_one(sptr, rpl_str(RPL_MYINFO), me.name, parv[0], me.name, version);
     m_lusers(sptr, sptr, 1, parv);
@@ -769,7 +769,7 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
   {
     sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "NICK");
     sendto_ops("bad NICK param count for %s from %s",
   {
     sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "NICK");
     sendto_ops("bad NICK param count for %s from %s",
-       parv[1], get_client_name(cptr, FALSE));
+       parv[1], cptr->name);
     return 0;
   }
   if (MyConnect(sptr) && (s = strchr(parv[1], '~')))
     return 0;
   }
   if (MyConnect(sptr) && (s = strchr(parv[1], '~')))
@@ -790,7 +790,7 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
     {
       ircstp->is_kill++;
       sendto_ops("Bad Nick: %s From: %s %s",
     {
       ircstp->is_kill++;
       sendto_ops("Bad Nick: %s From: %s %s",
-         parv[1], parv[0], get_client_name(cptr, FALSE));
+         parv[1], parv[0], cptr->name);
       if (Protocol(cptr) < 10)
        sendto_one(cptr, ":%s KILL %s :%s (%s <- %s[%s])",
            me.name, parv[1], me.name, parv[1], nick, cptr->name);
       if (Protocol(cptr) < 10)
        sendto_one(cptr, ":%s KILL %s :%s (%s <- %s[%s])",
            me.name, parv[1], me.name, parv[1], nick, cptr->name);
@@ -801,11 +801,11 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
       if (!IsServer(sptr))     /* bad nick _change_ */
       {
        sendto_lowprot_butone(cptr, 9, ":%s KILL %s :%s (%s <- %s!%s@%s)",
       if (!IsServer(sptr))     /* bad nick _change_ */
       {
        sendto_lowprot_butone(cptr, 9, ":%s KILL %s :%s (%s <- %s!%s@%s)",
-           me.name, parv[0], me.name, get_client_name(cptr, FALSE), parv[0],
+           me.name, parv[0], me.name, cptr->name, parv[0],
            sptr->user ? sptr->username : "",
            sptr->user ? sptr->user->server->name : cptr->name);
        sendto_highprot_butone(cptr, 10, "%s KILL %s :%s (%s <- %s!%s@%s)",
            sptr->user ? sptr->username : "",
            sptr->user ? sptr->user->server->name : cptr->name);
        sendto_highprot_butone(cptr, 10, "%s KILL %s :%s (%s <- %s!%s@%s)",
-           NumServ(&me), parv[0], me.name, get_client_name(cptr, FALSE),
+           NumServ(&me), parv[0], me.name, cptr->name,
            parv[0], sptr->user ? sptr->username : "",
            sptr->user ? sptr->user->server->name : cptr->name);
        sptr->flags |= FLAGS_KILLED;
            parv[0], sptr->user ? sptr->username : "",
            sptr->user ? sptr->user->server->name : cptr->name);
        sptr->flags |= FLAGS_KILLED;
@@ -851,12 +851,12 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
      * Ultimate way to jupiter a nick ? >;-). -avalon
      */
     sendto_ops("Nick collision on %s(%s <- %s)",
      * Ultimate way to jupiter a nick ? >;-). -avalon
      */
     sendto_ops("Nick collision on %s(%s <- %s)",
-       sptr->name, acptr->from->name, get_client_name(cptr, FALSE));
+       sptr->name, acptr->from->name, cptr->name);
     ircstp->is_kill++;
     if (Protocol(cptr) < 10)
       sendto_one(cptr, ":%s KILL %s :%s (%s <- %s)",
          me.name, sptr->name, me.name, acptr->from->name,
     ircstp->is_kill++;
     if (Protocol(cptr) < 10)
       sendto_one(cptr, ":%s KILL %s :%s (%s <- %s)",
          me.name, sptr->name, me.name, acptr->from->name,
-         get_client_name(cptr, FALSE));
+         cptr->name);
     else
       sendto_one(cptr, "%s KILL %s%s :%s (%s <- %s)",
          NumServ(&me), NumNick(sptr), me.name, acptr->from->name,
     else
       sendto_one(cptr, "%s KILL %s%s :%s (%s <- %s)",
          NumServ(&me), NumNick(sptr), me.name, acptr->from->name,
@@ -864,7 +864,7 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
           * NOTE: Cannot use get_client_name twice here, it returns static
           *       string pointer--the other info would be lost.
           */
           * NOTE: Cannot use get_client_name twice here, it returns static
           *       string pointer--the other info would be lost.
           */
-         get_client_name(cptr, FALSE));
+         cptr->name);
     sptr->flags |= FLAGS_KILLED;
     return exit_client(cptr, sptr, &me, "Nick/Server collision");
   }
     sptr->flags |= FLAGS_KILLED;
     return exit_client(cptr, sptr, &me, "Nick/Server collision");
   }
@@ -951,7 +951,7 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
        strCasediff(acptr->user->host, parv[5]));
     sendto_ops("Nick collision on %s (%s " TIME_T_FMT " <- %s " TIME_T_FMT
        " (%s user@host))", acptr->name, acptr->from->name, acptr->lastnick,
        strCasediff(acptr->user->host, parv[5]));
     sendto_ops("Nick collision on %s (%s " TIME_T_FMT " <- %s " TIME_T_FMT
        " (%s user@host))", acptr->name, acptr->from->name, acptr->lastnick,
-       get_client_name(cptr, FALSE), lastnick, differ ? "Different" : "Same");
+       cptr->name, lastnick, differ ? "Different" : "Same");
   }
   else
   {
   }
   else
   {
@@ -963,7 +963,7 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
        strCasediff(acptr->user->host, sptr->user->host));
     sendto_ops("Nick change collision from %s to %s (%s " TIME_T_FMT " <- %s "
        TIME_T_FMT ")", sptr->name, acptr->name, acptr->from->name,
        strCasediff(acptr->user->host, sptr->user->host));
     sendto_ops("Nick change collision from %s to %s (%s " TIME_T_FMT " <- %s "
        TIME_T_FMT ")", sptr->name, acptr->name, acptr->from->name,
-       acptr->lastnick, get_client_name(cptr, FALSE), lastnick);
+       acptr->lastnick, cptr->name, lastnick);
   }
   /*
    * Now remove (kill) the nick on our side if it is the youngest.
   }
   /*
    * Now remove (kill) the nick on our side if it is the youngest.
@@ -983,11 +983,11 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
        sendto_lowprot_butone(cptr, 9,  /* Kill old from outgoing servers */
            ":%s KILL %s :%s (%s <- %s (Nick collision))",
            me.name, sptr->name, me.name, acptr->from->name,
        sendto_lowprot_butone(cptr, 9,  /* Kill old from outgoing servers */
            ":%s KILL %s :%s (%s <- %s (Nick collision))",
            me.name, sptr->name, me.name, acptr->from->name,
-           get_client_name(cptr, FALSE));
+           cptr->name);
        sendto_highprot_butone(cptr, 10,        /* Kill old from outgoing servers */
            "%s KILL %s%s :%s (%s <- %s (Nick collision))",
            NumServ(&me), NumNick(sptr), me.name, acptr->from->name,
        sendto_highprot_butone(cptr, 10,        /* Kill old from outgoing servers */
            "%s KILL %s%s :%s (%s <- %s (Nick collision))",
            NumServ(&me), NumNick(sptr), me.name, acptr->from->name,
-           get_client_name(cptr, FALSE));
+           cptr->name);
        if (MyConnect(sptr) && IsServer(cptr) && Protocol(cptr) > 9)
          sendto_one(cptr, "%s KILL %s%s :%s (Ghost2)",
              NumServ(&me), NumNick(sptr), me.name);
        if (MyConnect(sptr) && IsServer(cptr) && Protocol(cptr) > 9)
          sendto_one(cptr, "%s KILL %s%s :%s (Ghost2)",
              NumServ(&me), NumNick(sptr), me.name);
@@ -1006,11 +1006,11 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
     sendto_lowprot_butone(cptr, 9,     /* Kill our old from outgoing servers */
        ":%s KILL %s :%s (%s <- %s (older nick overruled))",
        me.name, acptr->name, me.name, acptr->from->name,
     sendto_lowprot_butone(cptr, 9,     /* Kill our old from outgoing servers */
        ":%s KILL %s :%s (%s <- %s (older nick overruled))",
        me.name, acptr->name, me.name, acptr->from->name,
-       get_client_name(cptr, FALSE));
+       cptr->name);
     sendto_highprot_butone(cptr, 10,   /* Kill our old from outgoing servers */
        "%s KILL %s%s :%s (%s <- %s (older nick overruled))",
        NumServ(&me), NumNick(acptr), me.name, acptr->from->name,
     sendto_highprot_butone(cptr, 10,   /* Kill our old from outgoing servers */
        "%s KILL %s%s :%s (%s <- %s (older nick overruled))",
        NumServ(&me), NumNick(acptr), me.name, acptr->from->name,
-       get_client_name(cptr, FALSE));
+       cptr->name);
     if (MyConnect(acptr) && IsServer(cptr) && Protocol(cptr) > 9)
       sendto_one(cptr, "%s%s QUIT :Local kill by %s (Ghost)",
          NumNick(acptr), me.name);
     if (MyConnect(acptr) && IsServer(cptr) && Protocol(cptr) > 9)
       sendto_one(cptr, "%s%s QUIT :Local kill by %s (Ghost)",
          NumNick(acptr), me.name);
@@ -1021,11 +1021,11 @@ int m_nick(aClient *cptr, aClient *sptr, int parc, char *parv[])
     sendto_lowprot_butone(cptr, 9,     /* Kill our old from outgoing servers */
        ":%s KILL %s :%s (%s <- %s (nick collision from same user@host))",
        me.name, acptr->name, me.name, acptr->from->name,
     sendto_lowprot_butone(cptr, 9,     /* Kill our old from outgoing servers */
        ":%s KILL %s :%s (%s <- %s (nick collision from same user@host))",
        me.name, acptr->name, me.name, acptr->from->name,
-       get_client_name(cptr, FALSE));
+       cptr->name);
     sendto_highprot_butone(cptr, 10,   /* Kill our old from outgoing servers */
        "%s KILL %s%s :%s (%s <- %s (nick collision from same user@host))",
        NumServ(&me), NumNick(acptr), me.name, acptr->from->name,
     sendto_highprot_butone(cptr, 10,   /* Kill our old from outgoing servers */
        "%s KILL %s%s :%s (%s <- %s (nick collision from same user@host))",
        NumServ(&me), NumNick(acptr), me.name, acptr->from->name,
-       get_client_name(cptr, FALSE));
+       cptr->name);
     if (MyConnect(acptr) && IsServer(cptr) && Protocol(cptr) > 9)
       sendto_one(cptr,
          "%s%s QUIT :Local kill by %s (Ghost: switched servers too fast)",
     if (MyConnect(acptr) && IsServer(cptr) && Protocol(cptr) > 9)
       sendto_one(cptr,
          "%s%s QUIT :Local kill by %s (Ghost: switched servers too fast)",
@@ -1780,7 +1780,7 @@ int m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
   aClient *acptr;
 int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
   aClient *acptr;
-  char *inpath = get_client_name(cptr, FALSE);
+  char *inpath = cptr->name;
   char *user, *path, *killer;
   int chasing = 0;
 
   char *user, *path, *killer;
   int chasing = 0;
 
@@ -1885,10 +1885,7 @@ int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
      * ...!operhost!oper
      * ...!operhost!oper (comment)
      */
      * ...!operhost!oper
      * ...!operhost!oper (comment)
      */
-    if (IsUnixSocket(cptr))    /* Don't use get_client_name syntax */
-      inpath = me.sockhost;
-    else
-      inpath = cptr->sockhost;
+    inpath = cptr->user->host;
     if (!BadPtr(path))
     {
       sprintf_irc(buf,
     if (!BadPtr(path))
     {
       sprintf_irc(buf,
@@ -2246,16 +2243,12 @@ int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
       !strcmp(encr, aconf->passwd) && attach_conf(sptr, aconf) == ACR_OK)
   {
     int old = (sptr->flags & ALL_UMODES);
       !strcmp(encr, aconf->passwd) && attach_conf(sptr, aconf) == ACR_OK)
   {
     int old = (sptr->flags & ALL_UMODES);
-    char *s;
 
 
-    s = strchr(aconf->host, '@');
-    *s++ = '\0';
 #ifdef OPER_REMOTE
     if (aconf->status == CONF_LOCOP)
     {
 #else
 #ifdef OPER_REMOTE
     if (aconf->status == CONF_LOCOP)
     {
 #else
-    if ((match(s, me.sockhost) && !IsLocal(sptr)) ||
-       aconf->status == CONF_LOCOP)
+    if (!IsLocal(sptr) || aconf->status == CONF_LOCOP)
     {
 #endif
       ClearOper(sptr);
     {
 #endif
       ClearOper(sptr);
@@ -2268,7 +2261,6 @@ int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
       SetOper(sptr);
       ++nrof.opers;
     }
       SetOper(sptr);
       ++nrof.opers;
     }
-    *--s = '@';
     sendto_ops("%s (%s@%s) is now operator (%c)", parv[0],
        sptr->user->username, sptr->sockhost, IsOper(sptr) ? 'O' : 'o');
     sptr->flags |= (FLAGS_WALLOP | FLAGS_SERVNOTICE | FLAGS_DEBUG);
     sendto_ops("%s (%s@%s) is now operator (%c)", parv[0],
        sptr->user->username, sptr->sockhost, IsOper(sptr) ? 'O' : 'o');
     sptr->flags |= (FLAGS_WALLOP | FLAGS_SERVNOTICE | FLAGS_DEBUG);
@@ -2492,7 +2484,7 @@ int m_umode(aClient *cptr, aClient *sptr, int parc, char *parv[])
   {
     if (IsServer(cptr))
       sendto_ops_butone(NULL, &me, ":%s WALLOPS :MODE for User %s From %s!%s",
   {
     if (IsServer(cptr))
       sendto_ops_butone(NULL, &me, ":%s WALLOPS :MODE for User %s From %s!%s",
-         me.name, parv[1], get_client_name(cptr, FALSE), sptr->name);
+         me.name, parv[1], cptr->name, sptr->name);
     else
       sendto_one(sptr, err_str(ERR_USERSDONTMATCH), me.name, parv[0]);
     return 0;
     else
       sendto_one(sptr, err_str(ERR_USERSDONTMATCH), me.name, parv[0]);
     return 0;
index 3c4e73e281e1835bc1552ef8a220a115c983df55..cd4913271f3f0420a021c150698804434e7e6f45 100644 (file)
@@ -81,7 +81,7 @@ static void dead_link(aClient *to, char *notice)
   LastDeadComment(to)[sizeof(LastDeadComment(to)) - 1] = 0;
 
   if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
   LastDeadComment(to)[sizeof(LastDeadComment(to)) - 1] = 0;
 
   if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
-    sendto_ops("%s for %s", LastDeadComment(to), get_client_name(to, FALSE));
+    sendto_ops("%s for %s", LastDeadComment(to), to->name);
   Debug((DEBUG_ERROR, LastDeadComment(to)));
 }
 
   Debug((DEBUG_ERROR, LastDeadComment(to)));
 }
 
@@ -232,8 +232,8 @@ void sendbufto_one(aClient *to)
   {
     if (IsServer(to))
       sendto_ops("Max SendQ limit exceeded for %s: "
   {
     if (IsServer(to))
       sendto_ops("Max SendQ limit exceeded for %s: "
-         SIZE_T_FMT " > " SIZE_T_FMT,
-         get_client_name(to, FALSE), DBufLength(&to->sendQ), get_sendq(to));
+         SIZE_T_FMT " > " SIZE_T_FMT, to->name,
+         DBufLength(&to->sendQ), get_sendq(to));
     dead_link(to, "Max sendQ exceeded");
     return;
   }
     dead_link(to, "Max sendQ exceeded");
     return;
   }
index ae867827b337e086b15a83356049f40e20068930..e195fab43eeed5fc4b37122579f561cce29bf9f5 100644 (file)
@@ -206,7 +206,7 @@ void calc_load(aClient *sptr)
       "Minute  Hour    Day   Yest. YYest. Userload for:";
   /* *INDENT-ON* */
   static const char *what[3] = {
       "Minute  Hour    Day   Yest. YYest. Userload for:";
   /* *INDENT-ON* */
   static const char *what[3] = {
-    "local domain clients",
+    "local clients",
     "total clients",
     "total connections"
   };
     "total clients",
     "total connections"
   };