1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-26 18:36:38 +02:00

2 Commits

Author SHA1 Message Date
cmunk 5f49057d01 Addition of Unreal3.1-beta3 2000-05-28 08:45:32 +00:00
cvs2hg 7c8ad67b28 fixup commit for branch 'unlabeled-1.1.1.1.4' 2000-02-28 22:45:49 +00:00
132 changed files with 23857 additions and 29964 deletions
-6
View File
@@ -1,6 +0,0 @@
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| UnrealIRCd 3.0 |
| Configuration |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| http://unreal.tspre.org |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
-8
View File
@@ -1,8 +0,0 @@
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| UnrealIRCD Custom Create Network Configuration|
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| |
| This will not be too hard, just follow the |
| instructions, and answer the questions... |
| |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
-2
View File
@@ -1,2 +0,0 @@
List of helpers in the alpha/beta phase:
* Headbang, Alpha/beta tester
-315
View File
@@ -1,315 +0,0 @@
/*
* UnrealIRCd Changes File - (C) Carsten Munk 1999
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
*** BUGS ***
* When a +q sets +L it sets it but displays an error msg
(??:
*** Stskeeps (cmunk@rox-56506.fyremoon.net) has joined channel #a
*** #a 951758184
*** Mode change "+q Stskeeps" on channel #a by Stskeeps
*** Mode change "-oaATcfebW" for user Stskeeps by Stskeeps
*** Channel mode +l <max> is requried for +L to be set
*** Mode change "+l 1" on channel #a by Stskeeps
*** Mode change "+L #moo" on channel #a by Stskeeps
)
*** Unreal3.0-Morrigan(fix) ***
* NOTE: If your system clock is wrong you will have problems with TOPICs
being set on all servers. That is because TOPICs which are _new_ are
taken instead of old
- Fixed +f not banning when * is specified
- Fixed +q (chan owners) not being able to set +L (partially fixed)
- Fixed /tsctl segfaulting the server
- Fixed the killing bug. The cause was that when m_mode was called in the
NICKv2 parsing routine, it sent out a :nick MODE :+x which was an unknown
nick, and the NICK was being sent just after, causing it to kill the user
(was a _huge_ bastard to find)
- If someone changes their nick to irc and WebTV is enabled, problems
occur FIX: deny change to that in m_nick (bug fixed)
- Added lost unrealircd.bmp.gz file
*** Unreal3.0-Morrigan ***
- Added the new GUI main coded by DrBin, first coding by {X}
- Added v64net.network
- Added 972-scripterz.network
- Made NO_FDLIST compilation work as well
- Fixed DCCDENY bug (p->mask, p->mask) (*slaps sts*)
- +F not flood off if netsplit happens
- Made TODO, made "Unable to write tunefile" show an error if *nix
- Added stormdancing.network
- send.c sendto_realops problem solved
- Fixed a segfaulting bug in /tsctl reported by x-wartech
- Fixed segfaulting bug with -oh bounce stuff in channel.c reported by Dana
- Fixed +q bug reported by several people, inc DrBin
- Added networks/fireirc.network
- Fixed +f * option not banning correctly
- Fixed fdlist on win32 problem
- Added /HTM for high traffic mode status (partially added)
- Added networks/digitalirc.network
- G:lines expire every 5th second now
- /stats T now show incoming and outgoing rate
- Some HTM stuff
- Some release stuff
- Fixed up some NICKv2 stuff, more faster stuff:)
- Moved old Changes stuff to Changes.old
- Made so /path ~path or ".."'s in T:lines arent possible
- Made it so certain files ie ircd.conf,oper.motd, unrealircd.conf, ircd.log
can't be used in a T:line
- Added dynconf option to specify SOCKS kill message & ban message & bantime
- Fixed SOCKS exception bug (!!)
- Fixed some indention in dynconf.c and a memory leak problem (what were you
smoking code?:P)
- iNAH bugfixes( call them fixes and ill smash you;))
- Recoded color striping to be ALOT more accurate and faster
- Using hybrid IsMember()
- Fixed +F bug (again)
- Added FDlists, does those work on win32?
- De-Potvinized addline, addmotd, and addomotd (should run faster)
- Made addline, addmotd, addomotd display to the user what was written
- Removed /snote and /snotes (no one used them)
- GPL stuff
- Some comestic tkl fixes..
- Fixed +F bug
- Made +F connect notices more bandwidth friendly,
only bad things:
- Not showing port in connect +F
- On servers rejoin you get +F flooded (will be fixed in an later
release)
- Made ALLOW_CHATOPS a unrealircd.conf option rather than a #define
- Fixed a bug where you had to be +AC to see adminchats
- chatops, adchat, nachat, techat, wallops no longer require a leading :
- More TKL stuff..
- m_chatops uses sendto_umode now, and also removed sendto_chatops
- Remote rehashes now support the - flags, ex -dcc, -vhost etc
- Fixed more G:Line stuff
- Fixed G:Line bug with not expiring correctly - thanks Dark-Prince for
being guinea pig, and to JojoII for finding it
- Fixed +ix remote bug reported by RevPsych
- /list can now make opers see +s channels
- Did some SJOIN2 work..
- Fixed /whois bug with WHOIS_Channels
- Fixed a minor, yet annoying bug in the dynconf version system, thanks to GoNiS
- Fixed bug: EpicII stripping too much of /oper fail notice
- Fixed bug: SJOIN TS Change notice should not show when (ts == oldts)
- Fixed WEBTV_NONOTICE bug with CTCPs - thanks rjameson
- Fixed +h can +o themselves bug, thanks to Mikey, HERZ and many other
people
- Added TSP client/server
- Fixed m_netinfo stuff..
- Fixed a bug with the new m_names and +h (chanmode)
- Removed .CHANGES.NEW2 - not in use anyways
- Now using new m_names from bahamut by Lucas Madar (DarkRot)
- Removed zombie code
- Fixed up the MODE_ADMINONLY code
- Fixed some bugs in can_send
- Added TS Change notice to SJOIN
- Fixed a +f bug, and fixed SJOIN resynch bug (serious)
- Fixed up the remote rehash code a bit
- Updated conf.doc
- Added some WebTV stuff, read config.h
- Removed the NO_DEFAULT_INVISIBLE define from config.h
- Added MODE_I to unrealircd.conf, auto setting of +i when a user connects
- Fixed a minor unrealircd.conf bug
- Fixed up all SJOIN fuzz, made RESYNCMODES be 12
- Fixed this bug:
* After sync on other server
*** Stskeeps is using modes +oiwghsaHATcCreWIdt
should be:
Stskeeps is using modes +owghskaATcfrebW
- Made unrealircd.conf option to hide U:lines from non-opers in /links
- Updated the unrealircd.conf and all the .network files to support the
version system, and for unrealircd.conf to support HIDE_ULINES
- Made a versioning system for unrealircd.conf and *.network (This will
allow us to makesure _old_ versions are not being used when new features
are added to the files)
- TKL/zap bugfix!!
- Channel mode +H errors in numeric 459 now, coded by Rev_Null- thanks
- Moved RPL_WHOISSPECIAL to 320
- Another TKL bug.
- TKL bug fixed
- Made TKL backwards compatible
- TKLs are now syncing
- Bug fixes..
- Fixed TKL<->GLINE protocol problems
- Renamed chmode +I to +V as it screwed up some clients thinking it was
IRCnet..
- Took out m_fjoin, not in use
- Fixed up +e so it works with mIRC channel dialog now
- Added channel mode +H, only setable by SkoAdmin, makes +I users unable to
join channel - code&thanks to RevPsych & Rev_Null
- Removed all MegaIRC references
- Fixed VHOST desynch bug..
- Removed aGline record
- Fixed some idention in msg.h
- Fixed warning in s_misc.c
- Removes /ns, /cs, /ms, /os, /hs commands (not in use)
- Fixed bug where /statserv needed a : for more than one param
- Fixed so that /trace only cloaks hostname if it is an oper
- Fixed token non case sensitive problem
- Fixed warning in mp2parv..
- Fixed DEBUGMODE compile bug..
- Fixed BOTMOTD bug..
- Fixed some bugs (1.16->1.17) and removed aClient->user->host and replaced
it by realhost. Saves memory
- Fixing up for beta release
- Updated networks/networks.ndx
- Reason in temp and static K:lines like |kc.gline will show user klined
file kc.gline (only legal names are |kc.*)
- Added e:lines to the docs
- Added solargalaxy.network
- Fixed a minor +S (chanmode) bug
- Fixed a bug where if a channel was +n it would display a
must be +v msg rather than no external msgs (thank Potvin for that one)
- Made dccdeny's notice +e users when a file is rejected
- Added NOTICE in m_sajoin/m_sapart (You were forced to join/part #)
- Added e:lines, SOCKS check exception lines
format: e:ip (not hostname):*:*
- Added doc/faq entry about debian on sparcs..
- added debian sparc support (read doc/faq)
- SJOIN sortof working. Straight testing needed
- made /botmotd use NOTICE AUTH (so all bots will see it)
- fixed NICKv2 umode field when no mode bug..
- added T (TechAdmin) to the SMO flags
- fixed a little _mistake_ in the /dusers error message
- fixed a bug where +c (chanmode) blocked all privmsgs :P
- m_sjoin compiled, need to make it unreal3.0 compatible
- added include/sjoin.h for SJOIN stuff
- Deleted :server prefix from SWHOIS burst.
- Added UMODE_SETHOST (+t), and set NICKv2 up to only send when a real
virthost. Spares bandwidth:) +t is _not_ user setable
- Removed UMODE_COFOUND, UMODE_WMASTER, not in use anymore.
- Fixed up MODE_LINK, MODE_FLOODLIMIT syncronization,
you can mode do /mode # -lf without parameters
- Gave Unreal correct orgin (df4.6.5)
- Gave /stats N,S a header
- Added network solarxtreme.network
- /stats N returns .network file information
- /stats S returns unrealircd.conf information
- Added a virtualhost field to NICKv2
- Updated conf.doc
- Removed all traces of CLIENT_COMPILE
- Some Linux-ALPHA support.. i need accces to a alpha box :P
Fixes done by Ramuh (irc.risanet.com) originally for UltimateIRCd,
thanks to ShadowMastr for forwarding me..
- Removed all traces of services.h..
- NICKv2 working.. :)
- Updated doc/faq slightly
- Updated doc/example.conf with new lines an Oflags
- Implemented NICKv2 (umode field in NICK)
- Similar topics are sent along now .. was a bug ? (thanks Headbang,
WonderWal, etc)
- Fixed up compile warnings
- Fixed channel.c warning in can_join
- Removed SHOW_PASSWORD define, not in use anymore
- Removed USE_CASETABLES define, not in use anymore
- Removed TIMED_KLINE define, not in use anymore
- Added OPER_NO_HIDING define
- Removed RelicNet +z, unreal isnt at use at relicnet anyways and
i still dont believe that potvin _thought_ he could make them use it?
hah!
- Added REMOVE_ADVERTISING define (off by default) , check include/config.h
and src/s_user.c (m_message) for more info (by ice)
- Fixed channel name similarity bug reported by IXpfah
- Comment on Nickflood/joinflood thing (stskeeps): Services can do that?
- Fixed up some version.c.SH stuff
- Added SJOIN protoctl for preparing for SJOIN
- Split up PROTOCTL_SUPPORTED in PROTOCTL_SERVER and PROTOCTL_CLIENT
- Added networks/uzaynet.network
- NOTICE auth, tells you that it found a bad SOCKS.
- Made umode +d work correctly
- Made it so users can't see the RPL_WHOISCHANNELS for a
+I user
- Fixed a bug in +I where a +I user couldn't see themself
in /names
- Fixed a minor bug in /chgident
- Added bot.motd support on +B and /botmotd
- /join 0 now shows "Left all channels" in reason why left
- Added +H umode, hides oper status
in /who /who 0 o /whois (so opers
can spy on a channel and no one knows
- win32: s_socks.c small problem fixed
- Fixed a bug in the new zline code
- Fixed a typo in the Win32 socks check (oops)
- (development) added TODO.maybe
- Added /vhost login password
read the s_extra.c on vhost.conf format
- vhost.conf, added /rehash -vhost
- Removed s_user.c/m_message warning
- SOCKS check functioning
- Removed src/list2.c - not in use
- Removed networks/agitated.network, no longer existing network
- Added networks/bunker7.network
- Deleted ircdbug
- Renamed LICENCE to LICENSE
- /version shows alpha while in development..
- (development) added include/stamp.h for static development stamping
- send.c optimations from ircu :)
- Added codemastr as offical developer
- Now using GPL v2
- NOTICE AUTH problem solved, i hope
- Took out UNIXPORT code
- Removed traces of R_LINE* in config.h
- SOCKS check in progress
- Fixed the Blowbug
- TSCTL svstime works now :P correctly that is
- nick is using modes +rx
instead of "nick is using modes [+rx]
- Removed some lame brackets
- /close sendto_ops() now
- Fixed small SVSNICK bug (.)
- Fixed +L resync bug..
- df4.6.7 SVSNICK - fixes desynchs
- Took out all the R_LINES code
- Took out all SERVICES_MODE code
- Took out all USE_SERVICES code
- Added .crjava patch by Fish read include/config.h for more info..
- Added IRCu .ack patch you can now use "ONE" in password line in I:Lines
to ensure only one connecting from that kind of I:line per IP.
- /Lusers <mask> is not working anymore.. took out possible flood thing..
- /List - IRCops should be able to see +s now (thanks Headbang and others)
- RPL_YOURHOST - Your host is server, running version x
Removed [hostname].
- RPL_MYINFO now selfupdates when adding new modes (channel and user)
- Fixed umodestring
- Umode +d avail to everyone now:P
- Fixed channel mode +r defunctional bug
(thanks to gdb and the coder-com people who learnt me to use gdb:P)
- SVSFLINE <+/-/*> [mask] [reason]
+ = add (mask + reason)
- = delete (mask)
* = wipe all services F:Lines
(13/12/1999 working.)
- Fixed server<->server token problem
- Moved /info data to m_info_send
- Made SIGSEGV do core too.. MAIL THEM TO ME ALONG WITH THE src/ircd FILE
if it tells ya to!
- Fixed "GLINE @moo.org 10 :moo\r" G:Line bug (they haunt me)
- New F:Line system (dccdeny.conf)
- Removed OLD F:lines
- Fixed up /stats f/F
- Made /rehash -dcc = rehashes dccdeny.conf
/rehash -dyn = rehashes dynamic configuration (RISK OF TERMINATE:P)
/rehash -rest = rehashes channel restrict config chrestrict.conf
- New channel restrict system
(chrestrict.conf)
# = comment
allow #moo = can join #moo
msg message = shows message when cannot join cos of allow
-1676
View File
File diff suppressed because it is too large Load Diff
-20
View File
@@ -1,20 +0,0 @@
Send donations to:
UnrealIRCd Project
P.O.Box 52
7400 Herning
Denmark
(if you want to that is.. I mean .. I do my coding for fun.. -
send a teddybear or something to my nephews or something for
my nieces.. so they can keep quiet while I'm trying to do anything)
Disks, HD's, free internet time or alike are welcome ;p ;)
-- Techie (which HAD got 20 MB free HD space out of 400 MB on his own puter)
(just got a 8.4gb and rh6.0 *_*)
(and used 200 MB on his shell to code this :>) ..
- oh and btw i'm male:P (*looks at BlueFlame^*)
[ $Id$ ]
-153
View File
@@ -1,153 +0,0 @@
$Id$
Installation Procedures for the UnrealIRCD:
=======================================================================
Created by Stskeeps <stskeeps@tspre.org>
=======================================================================
This document describes how to install ircd, the unix daemon that acts as
an IRC server.
For more information on UnrealIRCD contact us at
unreal-dev@lists.sourceforge.net
The UnrealIRCD is available from http://unreal.tspre.org
along with the latest copy of this document.
=======================================================================
This version of the UnrealIRCD is known to compile on the following
platforms, and with the following compilers. If you wish to add to this
list, send the relevant information to us.
OS and Version Compiler and Version Comments
------------------- ------------------------ -------------------------------
NetBSD 1.2B gcc 2.7.2
FreeBSD 2.1.0 gcc 2.6.3 Do NOT use crypt at all...
SunOS 4.1.4 gcc 2.7-96q1 (Cygnus)
Solaris 2.4 gcc 2.7-96q1 (Cygnus) (SunOS 5.4)
Solaris 2.5 SunWorks Pro C (SunOS 5.5.1)
cc: SC4.0 18 Oct 1995 C 4.0
Digital Unix 3.2 gcc 2.7-96q3 (Cygnus)
Linux 2.0.24 gcc 2.7.2.1
HPUX 9.01 gcc 2.6.3
HPUX 10.01 gcc 2.7-96q3 (Cygnus)
Linux PPC (iMac)
AmigaOS 3.0 GCC egcs-2.91.66 (compile with -D_AMIGA)
Windows NT/95 MSVC++ 4.0
Linux Mandrake Read FAQ
=======================================================================
Unpacking the Distribution
If you are reading this, you have most likely already done this, but to
recap:
The UnrealIRCD server comes tarred and gziped. To uncompress it and expand
it, use the following commands at the Unix prompt:
gzip -d Unreal3.0.tar.gz
tar -xvf Unreal3.0.tar
This will create a new directory called Unreal3.0 and unpack the source
into it.
=======================================================================
Editing the Configuration Files
In previous versions of the source code many files had to be edited to
make things right for any given server.
In this version you DO NOT NEED TO EDIT THE Makefile OR ANY FILES
IN include! That is, unless you set some strange options. If you
find the need to edit include/config.h, for example,
mail us and tell us why ; Config can be made smarter, and that will make
it so you won't have to edit anything for the next version.
=======================================================================
Compiling Your Server
Windows users: You must compile the Config program first. To do this
run the following command: $CC src\Config.c
where $CC is the name of your compiler. for MSVC users that is 'cl'
To build the server, simply run
% ./Config
to start the configuraton program. This program looks at your system
and generate the include/setup.h, include/settings.h, and Options files.
You will be asked some questions. Usually the default answers are the best
ones and most correct. To accept the default, just hit RETURN.
Next, type 'make'. This will compile your server. Depending on your system,
this may be a good time for a caffeine break. (MSVC users run 'nmake')
Hopefully, the server will compile without incident. If it does not, and
you are not able to determine the error, please email
unreal-dev@lists.sourceforge.net and hopefully someone will be able to help you with the problem. If you
do need to fix something, mail there with a patch.
BE CERTAIN TO INCLUDE OPERATING SYSTEM INFORMATION (uname -a) AND COMPILER
VERSION (gcc -v, for instance) IN ALL BUG REPORTS.
=======================================================================
Installing the Files
'make install' does not work in this release -- it doesn't do anything
except a compile if that is needed.
The only files you need are the binary from src/ircd and and an ircd.conf
(see below for copying doc/example.conf as your initial ircd.conf). You
probably will want to create a MOTD file too, as well as place the man
pages from the doc directory to appropriate place in your system.
=======================================================================
Configuring Your Server
The previous step places a file named 'example.conf' into your irc
directory you specified to Config.
To create an IRC configuration file, edit: ircd.conf
Now edit this file to reflect your server. The file is mainly
self-explanatory. Note that if you plan to use your server on ROXnet,
make sure that you have the following line:
U:services.roxnet.org:*:*
If you need help configuring your file, please connect to ROXnet,
(irc.flirt.org or irc.roxnet.org) - go to channel #UnrealIRCd, and ask.
=======================================================================
Starting Your Server
Simply enter the complete path to the executable into the Unix command
line, then hit return. Your server is now operational, assuming that you
have completed all the steps described above.
NOTE: If you get something like the following when running ircd:
ircd fd table too big
Hard Limit: 256 IRC max: 1024
Fix MAXCONNECTIONS
You need to change config.h and recompile. Find the line that says
"#define MAXCONNECTIONS 1024", and change it to the number given after
"Hard Limit" (most likely 256), then make the server again, following the
above instructions.
Enjoy!
- The UnrealIRCd Team - unreal-dev@lists.sourceforge.net
-340
View File
@@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
-205
View File
@@ -1,205 +0,0 @@
#/************************************************************************
#* IRC - Internet Relay Chat, Makefile
#* Copyright (C) 1990, Jarkko Oikarinen
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 1, or (at your option)
#* any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#* $Id$
#*/
CC=gcc
INCLUDEDIR=../include
NETWORKSDIR=
FROMDOS=/home/cmunk/bin/4dos
# [CHANGEME]
# Default flags:
# Change XCFLAGS if you don't like what Config puts there. Same with
# IRCDLIBS.
#
# If you are configuring by hand, try "-O -g" for XCFLAGS, and leave
# IRCDLIBS blank. If that fails, try recomendations below.
#
XCFLAGS=
IRCDLIBS=
#
# use the following on MIPS:
#CFLAGS= -systype bsd43 -DSYSTYPE_BSD43 -I$(INCLUDEDIR)
# For Irix 4.x (SGI), use the following:
#CFLAGS= -g -cckr -I$(INCLUDEDIR)
#
# on NEXT use:
#CFLAGS=-bsd -I$(INCLUDEDIR)
#on NeXT other than 2.0:
#IRCDLIBS=-lsys_s
#
# AIX 370 flags
#CFLAGS=-D_BSD -Hxa -I$(INCLUDEDIR)
#IRCDLIBS=-lbsd
#
# Dynix/ptx V2.0.x
#CFLAGS= -I$(INCLUDEDIR) -O -Xo
#IRCDLIBS= -lsocket -linet -lnsl -lseq
#
# Dynix/ptx V1.x.x
#IRCDLIBS= -lsocket -linet -lnsl -lseq
#
#use the following on SUN OS without nameserver libraries inside libc
#IRCDLIBS=-lresolv
#
# Solaris 2
#IRCDLIBS=-lsocket -lnsl -lresolv -L/usr/ucblib -R/usr/ucblib -lgen
#
# ESIX
#CFLAGS=-O -I$(INCLUDEDIR) -I/usr/ucbinclude
#IRCDLIBS=-L/usr/ucblib -L/usr/lib -lsocket -lucb -lns -lnsl
#
# LDFLAGS - flags to send the loader (ld). SunOS users may want to add
# -Bstatic here.
#
#LDFLAGS=-Bstatic
#
#Dell SVR4
#CC=gcc
#CFLAGS= -I$(INCLUDEDIR) -O2
#IRCDLIBS=-lsocket -lnsl -lucb
# [CHANGEME]
# IRCDMODE is the mode you want the binary to be.
# The 4 at the front is important (allows for setuidness)
#
# WARNING: if you are making ircd SUID or SGID, check config.h to make sure
# you are not defining CMDLINE_CONFIG
IRCDMODE = 711
# [CHANGEME]
# IRCDDIR must be the same as DPATH in include/config.h
#
IRCDDIR=/usr/local/lib/ircd
# [CHANGEME]
# Some SunOS versions want this. Try it without first.
#RES=res_init.o res_comp.o res_mkquery.o
# BSDI systems want this.
#RES=res_skipname.o
# The rest are perfectly content with this.
RES=
# [CHANGEME]
# If you get a compile-time error dealing with u_int32_t, comment out
# this line.
# NEED_U_INT32_T= -DNEED_U_INT32_T
NEED_U_INT32_T=
# [CHANGEME]
# If you get a link-time error dealing with strtoul, comment out
# this line.
# STRTOUL= strtoul.o
STRTOUL=
# [CHANGEME]
# If you get crashes around a specific number of clients, and that client
# load comes close or a little over the system-defined value of FD_SETSIZE,
# override it here and see what happens.
FD_SETSIZE=
CFLAGS=-I$(INCLUDEDIR) $(XCFLAGS) $(NEED_U_INT32_T) $(FD_SETSIZE)
SHELL=/bin/sh
SUBDIRS=src
BINDIR=$(IRCDDIR)
MANDIR=/usr/local/man
INSTALL=/usr/bin/install
RM=rm
CP=cp
TOUCH=touch
all: build
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'IRCDLIBS=${IRCDLIBS}' \
'LDFLAGS=${LDFLAGS}' 'IRCDMODE=${IRCDMODE}' \
'BINDIR=${BINDIR}' 'INSTALL=${INSTALL}' \
'INCLUDEDIR=${INCLUDEDIR}' 'IRCDDIR=${IRCDDIR}' \
'MANDIR=${MANDIR}' 'RM=${RM}' 'CP=${CP}' 'TOUCH=${TOUCH}' \
'RES=${RES}' 'SHELL=${SHELL}' 'STRTOUL=${STRTOUL}'
server:
build:
-@if [ ! -f include/setup.h ] ; then \
echo "Hmm...doesn't look like you've run Config..."; \
echo "Doing so now."; \
sh Config; \
fi
@for i in $(SUBDIRS); do \
echo "Building $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} build; ) \
done
@echo ' __________________________________________________ '
@echo '| Compile is now complete. Now you have to go do |'
@echo '| The load-time configuration - try go read the |'
@echo '| file "dynconf" using your favourite viewer or |'
@echo '| editor. The file will contain instructions on how|'
@echo '| to do the dynamic configuration :) |'
@echo '| |'
@echo '| Thanks for using Unreal IRCd! If you are in need |'
@echo '| for any kind of help regarding the IRCd email us |'
@echo '| at unreal-dev@lists.sourceforge.net |'
@echo '|__________________________________________________|'
clean:
$(RM) -f *~ \#* core *.orig include/*.orig
@for i in $(SUBDIRS); do \
echo "Cleaning $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} clean; ) \
done
-@if [ -f include/setup.h ] ; then \
echo "To really restart installation, remove include/setup.h" ; \
fi
-@if [ -f include/settings.h ] ; then \
echo "and include/settings.h" ; \
fi
cleandir: clean
rm -rf include/networks.h include/setup.h include/settings.h Makefile Settings
makex: fromdos
chmod +x Config newnet bsdinstall ircd ircdcron/ircdchk killircd
chmod +x makeconf rehash ircdreg
fromdos: cleandir
$(FROMDOS) -dv *
$(FROMDOS) -dv src/*
$(FROMDOS) -dv include/*
$(FROMDOS) -dv doc/*
$(FROMDOS) -dv crypt/*
$(FROMDOS) -dv ircdcron/*
makedist: makex
echo "Making UnrealIRCd compatible IRCd Dist."
stamp: makedist
echo "/* Auto created release stamping */" > include/stamp.h
echo "#define RELEASEID2 \"`date +%s`\"" >> include/stamp.h
echo "#define RELEASESTUFF \"`hostname`\"" >> include/stamp.h
echo "" >> include/stamp.h
depend:
@for i in $(SUBDIRS); do \
echo "Making dependencies in $$i";\
( cd $$i; ${MAKE} ${MAKEARGS} depend; ) \
done
install: all
@echo "Now install by hand; make install is broken."
-15
View File
@@ -1,15 +0,0 @@
Some notes to remember:
-----------------------
* Don't EVER try to link it to incompatible IRCds (this does not
include services). It is *INCOMPATIBLE*. Please HEED this warning!!!
* If you need any help you can email me at stskeeps@tspre.org
* Please read the Changes file about release notes
* Bugs? Read Unreal.nfo
* Unreal IRCd is not meant to be a simple IRCd, rather an advanced
IRCd, please read the documentation before asking questions
[ $Id$ ]
-21
View File
@@ -1,21 +0,0 @@
TODO: (Possible 3.1)
* Limit calls to these functions using parse()
0.00 3.91 0.00 6475 0.00 0.00 check_registered
0.00 3.91 0.00 6827 0.00 0.00 check_registered_user
* Optimize:
0.00 3.91 0.00 1292 0.00 0.01 is_banned
12.55 9.61 2.57 41320 0.06 0.10 check_lusers
4.64 11.54 0.95 41566 0.02 0.02 count_channels
3.08 13.96 0.63 850968 0.00 0.00 flush_connections
(fdlists?)
0.15 19.62 0.03 29 1.03 1.80 send_list
* Add svsvline for global vlines
* New /whowas system /who as well
* Short MOTDs
* B:Lines
* Channel mode +d
* Raising PING bug
* Make alternative I/O engine using poll()
* Remove some of the _little_ config.h defines and replace with
unrealircd.conf lines, ex ADMINCHAT, REMOTE_REHASH
* X-Windows GUI (how bad it can be but hey! :P)
-28
View File
@@ -1,28 +0,0 @@
TSpre.org
Many here maybe not heard of the Story
how IRC started (and how EFnet started)
EFnet's name means "Eris-Free Network".
Eris was a central hub at the fomer world-
wide IRC network, that anyone could just add
C:N pairs for and connect to.
I was inspired of the tought of a network
where anyone could link without application and all
that shit..
Combined with the IRCd i made (Unreal) and the tspre.org
domain i got donated by Nutcais (my IRC bro). Ive decided to
start the TSpre IRC network, where anyone with TSpre servers
(dreamforge, IRCu p9, and their alike)
(mostly preffered is Unreal thou).. Its an experimental
network where people can test out thier IRCds and
wIRds without having to fill out apps and so on.
There are no real rules. So just have fun :)
See http://www.tspre.org for more info on this=)
--Stskeeps (stskeeps@tspre.org)
-49
View File
@@ -1,49 +0,0 @@
===============================================
= UnrealIRCd v3.0 =
===============================================
Was brought to you by:
* Stskeeps <stskeeps@tspre.org>
* codemastr <codemastr@tspre.org>
Precenses on the Internet:
* http://unreal.tspre.org or http://unreal.sourceforge.net
* ftp://unreal.sourceforge.net/pub/unreal
* ftp://ftp.shadow-realm.org/pub/ircd/UnrealIRCd
CVS Repository:
* Alpha versions (or beta)
==========================
cvs -z9 -d :pserver:anonymous@cvs.unreal.sourceforge.net:/cvsroot/unreal login
(just press enter when it asks for password)
cvs -z9 -d :pserver:anonymous@cvs.unreal.sourgeforge.net:/cvsroot/unreal co alpha
* To get support
================
* IRC: /server irc.flirt.org 6667 - /join #unrealircd
* Mailing list: unreal-support@lists.sourceforge.net (for support)
* Got a bug to report?
======================
* If the server crashes and dumps core do this:
* Go into the Unreal directory and type this:
gdb src/ircd core.filename
where core.filename is the filename in the dumping core message
if it loads gdb, (not saying "command not found" etc), type "bt" in
the program (type "quit" to get out again)
The output coming out there please mail it to
unreal-dev@lists.sourceforge.net, along with OS type,
what "uname -a" says, any clues what it is, if you did anything etc
etc. Please keep the core dump files if we ask you to mail us them
if needed
* If you experince any wierdnesses (that doesnt crash the server)
please mail unreal-dev@lists.sourceforge.net with any clues on what
you did, what you experinced etc.
* Got a suggestion?
===================
* Mail it to unreal-dev@lists.sourceforge.net :) or catch one from
the Unreal team online on IRC:)
-84
View File
@@ -1,84 +0,0 @@
#! /bin/sh
#
# $Id$
# Old: @(#)install.sh 4.5 (Berkeley) 10/12/83
#
cmd=/bin/mv
strip=""
chmod="/bin/chmod 755"
chown="chown -f root"
chgrp="/bin/chgrp -f bin"
while true ; do
case $1 in
-s ) strip="strip"
shift
;;
-c ) cmd="/bin/cp"
shift
;;
-m ) chmod="/bin/chmod $2"
shift
shift
;;
-o ) chown="/etc/chown -f $2"
shift
shift
;;
-g ) chgrp="/bin/chgrp -f $2"
shift
shift
;;
-d ) cmd="/bin/mkdir"
shift
;;
* ) break
;;
esac
done
if [ ! ${2-""} ]
then echo "install: no destination specified"
exit 1
fi
if [ ${3-""} ]
then echo "install: too many files specified -> $*"
exit 1
fi
if [ $1 = $2 -o $2 = . ]
then echo "install: can't move $1 onto itself"
exit 1
fi
case $cmd in
/bin/mkdir )
file=$2/$1
;;
* )
if [ '!' -f $1 ]
then echo "install: can't open $1"
exit 1
fi
if [ -d $2 ]
then file=$2/$1
else file=$2
fi
/bin/rm -f $file
;;
esac
case $cmd in
/bin/mkdir )
if [ ! -d "$file" ]
then $cmd $file
fi
;;
* )
$cmd $1 $file
if [ $strip ]
then $strip $file
fi
;;
esac
$chown $file
$chgrp $file
$chmod $file
-38
View File
@@ -1,38 +0,0 @@
#************************************************************************
#* IRC - Internet Relay Chat, ircd/crypt/Makefile
#* Copyright (C) 1991 Darren Reed
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 1, or (at your option)
#* any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#* $Id$
#*/
#
# Change this to the path of your local ircd.conf file
#
IRCDCONF = ../ircd.conf
all: mkpasswd
crypt: install
mkpasswd: mkpasswd.c
cc -lcrypt -O mkpasswd.c -o mkpasswd
install:
crypter ${IRCDCONF}
@echo 'done.'
clean:
/bin/rm -f mkpasswd
-63
View File
@@ -1,63 +0,0 @@
/************************************************************************
* IRC - Internet Relay Chat, ircd/crypt/README
* Copyright (C) 1991 Nelson Minar
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
The change implemented here is that the operator password in irc.conf
is no longer stored in plaintext form, but is encrypted the same way
that user passwords are encrypted on normal UNIX systems. Ie, instead
of having
O:*:goodboy:Nelson
in your ircd.conf file, you have
O:*:sCnvYRmbFJ7oI:Nelson
You still type "/oper Nelson goodboy" to become operator. However, if
someone gets ahold of your irc.conf file, they can no longer figure
out what the password is from reading it. There are still other
security holes, namely server-server passwords, but this closes one
obvious problem.
So how do you generate these icky looking strings for passwords?
There's a simple program called mkpasswd to do that for you. Just run
mkpasswd, and at the prompt type in your plaintext password. It will
spit out the encrypted password, which you should then just copy into
the irc.conf file. This should be done only when adding new passwords
to your irc.conf file. To change over your irc.conf file to use
encrypted passwords, define CRYPT_OPER_PASSWORD in config.h. You will
need to recompile your server if you already compiled it with this
feature disabled. Once compiled, edit the Makefile in this directory
and chang "IRCDCONF" to your irc.conf file. Then "make install" in this
directory to replace all the operator passwords in your irc.conf file
with the encrypted format.
Choose your passwords carefully. Do not choose something in a
dictionary, make sure its at least 5 characters. Anything past 8
characters is ignored.
One thing to note about crypt() passwords - for every plaintext, there
are 4096 different passwords. Some valid encryptions of "goodboy"
include t1Ub2RhRQHd4g sCnvYRmbFJ7oI and Xr4Z.Kg5tcdy6. The first
two characters (the "salt") determine which of the 4096 passwords
you will get. mkpasswd chooses the salt randomly, or alternately
will let you specify one on the command line.
see also - crypt(3)
-55
View File
@@ -1,55 +0,0 @@
#!/usr/local/bin/perl
#************************************************************************
#* IRC - Internet Relay Chat, ircd/crypt/crypter
#* Copyright (C) 1991 Sean Batt
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 1, or (at your option)
#* any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#* $Id$
#*
#*/
#From Sean Batt sean@coombs.anu.edu.au
#
#Temporary output file
#
$tmpfile = "/tmp/ircd.conf.tmp";
#
#Original ircd.conf file
#
$ircdconf = @ARGV[0];
print "crypting ",$ircdconf,"\n";
@saltset = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '.', '/');
umask(0077);
open ($ircdout, ">/tmp/ircd.conf.tmp") || die "open $!";
while ($text = <>) {
#if its not an "O" line we can ignore it
$text =~ /^o/i || print ($ircdout $text) && next;
chop($text);
@oline = split(':', $text);
$salt = $saltset[rand(time)%64].$saltset[(rand(time)>>6)%64];
$oline[2] = crypt(@oline[2], $salt);
print ($ircdout join(':',@oline)."\n");
}
close ($ircdout);
close ($ircdin);
print "/bin/cp ",$tmpfile," ",$ircdconf,"\n";
(fork()==0) ? exec("/bin/cp", $tmpfile, $ircdconf) : wait;
#unlink($tmpfile);
-43
View File
@@ -1,43 +0,0 @@
/* simple password generator by Nelson Minar (minar@reed.edu)
* copyright 1991, all rights reserved.
* You can use this code as long as my name stays with it.
*
* $Id$
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern char *getpass();
int main(argc, argv)
int argc;
char *argv[];
{
static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
char salt[3];
char * plaintext;
int i;
if (argc < 2) {
srandom(time(0)); /* may not be the BEST salt, but its close */
salt[0] = saltChars[random() % 64];
salt[1] = saltChars[random() % 64];
salt[2] = 0;
}
else {
salt[0] = argv[1][0];
salt[1] = argv[1][1];
salt[2] = '\0';
if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars, salt[1]) == NULL))
fprintf(stderr, "illegal salt %s\n", salt), exit(1);
}
plaintext = getpass("Enter Password: ");
printf("Encryption: %s\n", crypt(plaintext, salt));
return 0;
}
-126
View File
@@ -1,126 +0,0 @@
[ $Id$ ]
---------------------------
Version Elite2.0 ==========
===========================
- Since +x was rewritten, the ban bug is 100% fixed. :)
- Rewrote +x hidden host function completely.
- Fixed FUNNY bug with hiddenhost and /who (Reported by Prod|gy)
- Added/Removed irc networks
- Fixed bug in /watch (Reported/Fixed by Despise)
- Added nick-change flood protection.
- Added an awesome manual... ./manual to run
- Removed /who notice for opers.
- Added protection of /akill *@* :)
- Removed java stuff completely. (Java clients are like normal IRC clients...right?)
- Added new +a mode. This mode can only be set by +q channel owners. When you are +a in a
channel, you cannot be deopped or kicked. (Syntax: /mode #chan +a <nick>)
- Added new +q channel mode. ChanServ must set the channel founder +q so they are also
known as channel owners via the ircd. Channel owners are protected and may set
other users +a which they will also be protected (but not chan owners).
(Syntax: /mode #chan +q <nick>)
- Re-coded /MAP
- Changed GLINE notices from sendto_ops to send to all opers with +e flag on.
- Added (addnet) script, you can run this to add your net settings to the next release.
- Changed <server> to <ircnetwork> in whois "Blah is an oper on <server>"
- Added new +L channel mode. If a #chat has a limit (+l) of 10 users, and +L set to channel
#chat2, when a user trys to join #chat, they won't get "#chat is full", they will be
auto-joined to #chat2 - (Linked channels in other words).
(Syntax: /mode #chan +L <linked chan>)
- Changes user@shadow-33.com to user@user-33.one.com (noone will know one.com is the realhost)
- Changed +x for IP's from (x.x.x.***) to (x.x.x.network-#)
- In oline flags * will introduce +e on oper up. (before: required +e in oline flag)
- Removed +t usermode (UMODE_ALL) - wasn't used.
- Made 'create your own network setting' feature more stable.
- Added new channel mode (+x) to disable colored text in channel.
- Added +C (Co Administrator)
- Added +T (Technical Administrator)
- Changed /map to numerics...
- Made startup message when booting more stable.
Version Elite1.3 (02/23/99)
============================
- Cleaned up version.c.SH
- Added new net settings (netdomain & helpchan)
- Added new net config creator in ./Config
- Made ./Config more easier...
- Created new usermode +j (Java user)
- New hostname (java.shadownet.org) for java users.
- Removed RUN_SERVICES code from entire ircd.
Version Elite1.2.4 (02/14/99)
============================
- Fixed the nick crash bug! (damn m_kill small error)
- New network(s) added.
- Changed one thing in m_gline (nothing big)
Version Elite1.2.3 (02/10/99)
============================
- Removed SOCKS checking. (possibly cause of crashing)
- Added new networks
Version Elite1.2.2 (02/02/99)
============================
- Fixed the crashing bug. (Changing nicks with linked servers)
- Modified AceStar net settings.
- Q-line notices are back (except for ULined clients).
- Fixed /kill bug with services.
Version Elite1.2.1 (01/29/99)
============================
- Fixed multiple notices from +N / -N
- Added some text to s_err.c
- Possibly fixed the odd crashing... ?
Version Elite1.2 (01/24/99)
============================
- Netadmin can be used via +N in the oline slot now.
- When +N is executed, net-wide oper msg's are sent about it.
- Completely removed the freeze function (it's a toy unlike a command)
- Changed abit of the GLINE adding notice.
- Added logging to a file for glines (gline.log)
- Implemented SOCKS checking (thx Rhom).
- Changed channel lists only when 2 ppl in chan to 1.
- Changed sendto_ops function in many places in s_user.c/s_serv.c to
sendto_locfailops.
- Changed GNOTICE in s_user.c/s_serv.c to GLOBOPS
- Fixed hiddenhost bug with /kill (+w could see real host of oper)
- Fixed hiddenhost bug with /oper (+s could see real host of oper)
[Special thanks goes out to Rhom for reporting/help patch bugs]
Version Elite1.1.1 (12/12/98)
=============================
- Fixed /whois bug (had problems with mIRC clients *sigh*)
- Fixed /topic bug (didn't allow topic changes at all.)
Version Elite1.1 (12/6/98)
============================
- Fixed ./Config script (Net select)
- Fixed /remgline bug.
- If ULined clients, channels are not shown which they are in.
- Fixed +e / +t / +b (non-opers could get +et before)
- Fixed OperMode notice.
- Fixed Gline sending extra Global on expire.
- Fixed /whowas wrong hostname bug (by Thiago)
- Fixed chkconf ZLINE error (by matt)
- Added PhazeNet configuration
- Added option for auto +x in ./Config
- Freeze was disabled in this version (It will be back in 1.2)
Version Elite1.0 (09/20/98)
============================
- Changed Shadow3.9 to Elite1.0 (Starting a new IRCD)
- Changed some numeric's around in src/s_err.c
- Auto +x on Oper up.
- Fixed small error in ./ircd script.
- Made ./Config more Linux-redhat friendly.
- Added RelicNet to the ircd.
- include/config.h is much more compatible with all IRC nets.
- Added /gline (works 100%) [/gline <user@host> <seconds> <reason>].
- Fixed up /map.
- Added UMODE's +e & +t
* e: EYES [Can see ppl who /whois, and other notices.]
* t: ALL [See's all net notices ie: See's all Client connectings...]
- Fixed the hiddenhost bug with IP's...
- Fixed major bug with hiddenhost which caused coredump.
- Made a new script (makeconf) -- generates the ircd.conf file.
+304 -124
View File
@@ -1,5 +1,5 @@
esOriginally by Roddy Vagg -- roddy@dal.net
modified for UnrealIRCD3.0
Originally by Roddy Vagg -- roddy@dal.net
modified for UnrealIRCD3.1 by codemastr
--------------------
@@ -40,7 +40,15 @@ modified for UnrealIRCD3.0
7.7) .......................... Set SHOWOPERS Line
7.8) .......................... Set KILLDIFF Line
7.9) .......................... Set SHOWOPERMOTD Line
7.10) .......................... Set HIDE_ULINES Line
7.10).......................... Set HIDE_ULINES Line
7.11).......................... Set ALLOW_CHATOPS Line
7.12).......................... Set SOCKS_BAN_MESSAGE Line
7.13).......................... Set SOCKS_QUIT_MESSAGE Line
7.14).......................... Set SOCKSBANTIME Line
7.15).......................... Set MAXCHANNELSPERUSER Line
7.16).......................... Set WEBTV_SUPPORT Line
7.17).......................... Set NO_OPER_HIDING Line
7.18) ......................... Set AUTO_JOIN_CHANS Line
8) ............................. network files
8.1) .......................... Network Line
8.2) .......................... Set ircnetwork Line
@@ -76,8 +84,8 @@ modified for UnrealIRCD3.0
2) ircd.conf Basics:
When you compile your server, you must specify the correct paths to
where you plan on keeping your ircd.conf, for simplicity it is recomended
that you keep it in the same diretory as your ircd binary and other ircd
where you plan on keeping your ircd.conf, for simplicity it is recommended
that you keep it in the same directory as your ircd binary and other ircd
files.
note: You need only supply full pathnames for DPATH and SPATH, the
other defines will only point to files under these directories so you
@@ -89,7 +97,7 @@ modified for UnrealIRCD3.0
When you have made your ircd.conf you may check it with the program
`chkconf', this program is supplied with the source code release and will
be installed into your ircd directory when you run `make install',
`chkconf' will check your ircd.conf for errors so is a usefull tool for
`chkconf' will check your ircd.conf for errors so is a useful tool for
beginners to ircd.conf.
Your ircd.conf will be made up of a series of lines, each line is used
for a different purpose in the running of your server, some lines are
@@ -97,12 +105,12 @@ modified for UnrealIRCD3.0
start, these lines are listed below.
You may enter comments in your ircd.conf with the use of a hash mark (#)
at the beginning of a line, it is recommended that you make full use of
this to add comments to everything you put in your ircd.conf so you dont
this to add comments to everything you put in your ircd.conf so you don't
have any problems later.
eg: Put a contact email address and the name/nick of the server admin
above each C/N line pair.
When ircd reads the ircd.conf file, it does it upside down, so lines with
higher prefrence should go lower in the file, this will be explained later.
higher preference should go lower in the file, this will be explained later.
--------------------
@@ -116,7 +124,7 @@ modified for UnrealIRCD3.0
to other servers. (note: you can run ircd stand alone)
SUGGESTED: it is highly suggested that you use this line
OPTIONAL: it's completely up to you whether to define this or not
DISCOURAGED: you really really should not use this line if at all
DISCOURAGED: you really should not use this line if at all
possible.
Note that "*" in a field indicates an "unused" field.
@@ -126,35 +134,18 @@ modified for UnrealIRCD3.0
3.1) M Lines: [MANDATORY]
This line sets your server's name, description, and port number.
If you are to be a part of DALnet you will be assigned 2 different
DNS entries for your ircd machine, the 1st is for general public use
and involves: <servername>.DAL.net
The second is for use between servers for identification, these take
the form of: <servername>.[<state>].<country>.DAL.net
If your server is located in the US or Australia, you will be given
a `state' field in your server's real name, otherwise your `state', or
`area' will not be included.
Most IRC networks default to port 6667 for their client connection's,
but DALnet uses port 7000 as its standard, you should compile ircd with
port 7000, not 6667, but you may open up port 6667 (it is recomended
that you do) with a P line (see later). Your M line's port number
should be the same as the number you defined in your config.h at compile
time.
The standard port number used by most networks and supported by most clients is
6667. It is recommended that you specify this as your main port.
Syntax:
M:hostname:IP:Description Of Your Server:7000
M:hostname:IP:Description Of Your Server:6667
The 1st field should be the `real' name of your server, not the short
name.
The 2nd field is the IP the server should bind to - "*" if all interfaces
on the server
The 3rd field is your server's description, it is up to you what you
put in this field, but a short description of its geographic location
is recomended.
The 4th field is the port number you compiled ircd with. This should be
7000 for DALnet.
The 2nd field is the IP the server should bind to. Use an "*" to bind to all interfaces on the server. The 3rd field is your server's description, it is up to you what you put in this field, but a short description of its geographic location is recommended. The 4th field is the port number you compiled ircd with. This generally should be 6667.
Example:
M:disney.irc.net::Walt's IRC Server:7000
M:Irc.yournet.com::My first IRC server:6667
--------------------
@@ -174,7 +165,7 @@ A:A little info about your server:Admin's nick/real name:contact address
responsible for the server.
Example:
A:Disney's IRC Server:Admin - Walt Disney:walt@RIP.org
A:FooBar IRC Server:Admin - foobar:email - foo@bar.com
--------------------
@@ -183,10 +174,8 @@ A:Disney's IRC Server:Admin - Walt Disney:walt@RIP.org
These lines define connection classes. They allow you to fine-tune
your incomming and outgoing connections, both server and client types.
These classes are for use with C, N, I and O lines, more on this in later
sections. DALnet has a set of Y lines that each server must use for their
server connections, these are listed below and again at the bottom of this
document. Client connection classes are your responsibility, you must
make up your own set of Y lines for client connections based on your own
sections. Client and server connection classes are your responsibility, you
must make up your own set of Y lines for client connections based on your own
situation (netwise location, machine, etc).
Connection classes define a number of parameters for connections, these
include:
@@ -210,7 +199,7 @@ A:Disney's IRC Server:Admin - Walt Disney:walt@RIP.org
listed in the server's ircd.conf (see C/N lines) is missing and belongs
on a conenction class that is holding less connections that defined by
the max links field, the server will keep on trying to connect to
the missing server. The ammount time between connection attempts is what
the missing server. The amount time between connection attempts is what
you define in this field.
example:
server1 and server2 are listed in server0's ircd.conf but the only
@@ -226,10 +215,10 @@ A:Disney's IRC Server:Admin - Walt Disney:walt@RIP.org
class will be allowed as this number on server connection classes is used for
auto-connect purposes. As shown in the above example, when a missing server
is listed for a particular connection class, and the class is not `full',
your server will try and connect to this server untill it becomes visible
your server will try and connect to this server until it becomes visible
again. Servers being connected manually on a `full' connection class via the
/connect command will be allowed as long as you compiled with MAXIMUM_LINKS
high enough to accomidate all of your server connections. (you must compile
high enough to accommodate all of your server connections. (you must compile
as a HUB if you wish to hold more than one server connection, also see H
lines later in this document).
- Maximum sendq: SendQ defines the `que' of data waiting to be sent to the
@@ -242,7 +231,7 @@ A:Disney's IRC Server:Admin - Walt Disney:walt@RIP.org
0, it is `abnormal' for a sendq to be high for a client for a long period
of time. When 2 servers connect, they must send their own data to
eachother, this data includes: all the users on the server and already
connected servers, channels, user modes, channel modes, topics (DALnet only)
connected servers, channels, user modes, channel modes, topics
etc. When there are many clients on a particular side of the connection, a
sendq will build up, especially if the link is slow, or already congested
(example: the link from Australia to the US). When the sendq built up reaches
@@ -272,7 +261,7 @@ Y:1:90:0:20:10000
The number of clients allowed to use this class is 20.
Clients may only build up a sendq on the server of 10000 bits.
These are the standard server Y lines used on DALnet:
These are some standard Y:lines that most networks use:
# Connecting a hub to a hub
Y:20:10:300:1:3000000
@@ -288,6 +277,10 @@ Y:45:60:20:1:2200000
Y:42:240:0:0:2200000
# Connecting an AU leaf to a US hub
Y:43:240:60:1:2200000
# Oper connection class
Y:10:300:0:20:1000000
#User connection class
Y:1:90:0:256:500000
--------------------
@@ -298,7 +291,7 @@ Y:43:240:60:1:2200000
may connect, and which connection class they will connect through.
I lines, like C, N and O lines refer back to Y lines, as they allow
connections, and each connection to ircd needs to be assigned to a
connection class. If you dont provide a connection class, the connection
connection class. If you don't provide a connection class, the connection
will be governed by the defaults set at compile time in your config.h.
When a client connects to the server, it gives its own information,
this information includes username, nick and can include a password, the
@@ -346,9 +339,9 @@ I:205.133.*::*.toledolink.com::1
address starting with 205.133 OR with a hostname ending in
.toledolink.com to connect to the server. remember, ircd uses the
right-most match, so if I connect as rmiller@glass.toledolink.com
(which is rmiller@205.133.127.8) I will show up on irc as
(which is rmiller@205.133.127.8) I will show up on IRC as
rmiller@glass.toledolink.com since that is the first match it found.
(Even though the second match is valid). Any clients comming through
(Even though the second match is valid). Any clients coming through
on this line will use connection class 1.
I:*@205.133.*::*@*.toledolink.com::1
@@ -374,11 +367,11 @@ I:NOMATCH::*@*.de::3
I:NOMATCH::*@*.se::4
I:NOMATCH::*@*.au::5
I:129.180.*::*.une.edu.au::6
In this example, conencting clients will 1st be matched against the mask
In this example, connecting clients will 1st be matched against the mask
*.une.edu.au, if they match they will be placed on connection class 6
(note: if 6 is full, they will be rejected, they wont be passed on to the
next I line), then tried against the IP 129.180.*, if they match, they will
be placed on class 6. If the client dosen't match either of these masks, they
be placed on class 6. If the client doesn't match either of these masks, they
will be tried against the mask *.au, so if they are from Australia, but are
not from *.une.edu.au they will be placed on class 5. This goes on through
the other lines, being placed on the various connection classes if they match
@@ -394,12 +387,12 @@ I:129.180.*::*.une.edu.au::6
These lines provide rules as to who may gain Operator status on your server.
O lines are much like I lines in their operation and syntax.
Servers need not have any Operators as ircd, given well defined connection's
can perform all of its functions automatically. Server admins have the
can perform all of its functions automatically. Server admin's have the
ability to `kill -HUP' the server's PID to rehash the config file, removing
the need to use the /rehash command. However, a well running network such as
DALnet needs operators to oversee the users of the server, and make sure
users actually enjoy their time on IRC without being continually harrased
etc by troublematers.
the need to use the /rehash command. However, an efficient network needs
operators to oversee the users of the server, and make sure
users actually enjoy their time on IRC without being continually harassed
etc by troublemakers.
O lines give users power over the whole network, to use commands
such as /kill, local Operators only have power on their local server, that
is, the server where they can use the /oper command to make themselves +o.
@@ -411,41 +404,77 @@ I:129.180.*::*.une.edu.au::6
Syntax:
O:hostname:password:nickname::class
O:hostname:password:nickname:flags:class
See I lines for rules about the hostname and using ident.
If you use ident, a client matching the hostname must have ident running on
their host to be able to +o themselves.
If you compiled defining oper passwords to be crypted, you must 1st crypt
the plaintext using mkpasswd, a program supplied with the ircd distribution.
the plain text using mkpasswd, a program supplied with the ircd distribution.
See src/crypt/README for more information on this.
The nickname is the nickname they must pass with the /oper command
ie:
/oper <nickname> <password>
The flags allow you to specify what access an oper will have with great
control. This also allows you to give users Administrator access on your
server. A set of standard FULL ACCESS flags is OaARDNz*^. See below for a
complete list of flags.
The class is the connection class to be used when the user /oper's using
the O line, they connect using the standard I -- Y lines, but when they
/oper succusfully they are passed across to the new Y line.
/oper successfully they are passed across to the new Y line.
Examples:
O:RIP.org:waltspass:Walt::10
O:RIP.org:waltspass:Walt:OaARD:10
This line will allow anyone on the host RIP.org (running ident or not) to
issue the command `/oper Walt waltspass', at which point they will be moved
over to class 10 and be made usermode +o.
over to class 10 and be made an Admin with /restart and /die access.
Valid Flags:
r = access to /rehash server
R = access to /restart server
D = access to /die server
h = oper can send /help ops
g = oper can send /globops
w = oper can send /wallops
l = oper can send /locops
c = access to do local /squits and /connects
L = access to do remote /squits and /connects
k = access to do local /kills
K = access to do global /kills
b = oper can /kline users from server
B = oper can /unkline users from server
n = oper can send local server notices(/notice $servername message)
G = oper can send global server notices(/notce $*.my.net message)
S = oper can join unlimited amount of channels
A = admin
u = oper can set /umode +c
f = oper can set /umode +f
^ = oper can set /umode +I
e = oper can set /umode +e
W = oper can set /umode +W
H = oper gets auto +x on /oper
o = local oper, flags included: rhgwlckbBnuf
O = global oper, flags included: oRDCK
a = services admin, access to /samode
C = co admin
T = tech admin
A = admin
N = network admin access to remote /rehash and remote /restart and a bunch more
* = flags included: AaNCTzSHW^
--------------------
3.6) U Lines: [OPTIONAL]
These lines define which server(s) on the network your server is connected
to will be able to `hack' channel modes.
On DALnet, services.dal.net is given this power, this allows the server
On most networks, services are given this power, this allows the server
to change modes on channels without being a channel operator, the
commonly used form is ChanServ changing channel modes while not in the
channels.
If you are connected to a network such as DALnet that requires you to have
certain U lines and you don't have them, your server will cause problems
to the other servers when the server(s) that require U lines attempt to
change channel modes.
It is very important that you add the U:lines required by your network, because
if you don't it can lead to desync in channel modes as well as "mode setting
wars".
U lined servers also have the capability to add Akill's to your server,
Akill's are much the same as the /kline command except that they show up
as A: lines on /stats k.
@@ -456,11 +485,9 @@ U:servername:*:*
lined server's name.
Example:
U:services.dal.net::
U:services2.dal.net::
Both these lines are required on all DALnet server's, they allow servers
with the name's `services.dal.net' and `services2.dal.net' to hack channel
modes.
U:services.your.net:*:*
This will allow services.your.net to "hack" channel modes and use certain
U:line only commands.
--------------------
@@ -469,13 +496,13 @@ U:services2.dal.net::
These lines are always used in pairs, one will not work without the other.
C lines define who your server may connect to, while N lines define what
servers may connect to you.
When two servers connect, they both send eachother the `SERVER' command,
When two servers connect, they both send each other the `SERVER' command,
this command contains the server name and server info (set by M lines)
along with this command is sent a password with the PASS command, C and N
lines provide a set of rules governing the connection between servers
given the details of the server and pass command's.
When one a server initiates the connection, the other server will check
the details of the incomming server against its N lines, if a match is
the details of the incoming server against its N lines, if a match is
found, the server will return the server and pass command's to the
initiating server, which will also check its N lines for a match.
For a server to initiate a connection, it must have a C line. C lines
@@ -488,7 +515,7 @@ U:services2.dal.net::
C:remote server's hostname/IP:password:remote server's name:port:class
N:remote server's hostname/IP:password:remote server's name:host mask:class
The remote server's hostname/IP should be the location on the internet that
the server can be found. IP addresses are prefered as they are more secure,
the server can be found. IP addresses are preferred as they are more secure,
and can be a little quicker for the server. As with I and O lines, ident
can be used with this 1st field to specify the username the ircd on the
remote server is running from (if the remote server is running ident), to
@@ -496,10 +523,10 @@ N:remote server's hostname/IP:password:remote server's name:host mask:class
The password should be crypted if you compile ircd specifying that link
passwords should be crypted. Your link passwords should be very secure, as
they provide more power, if hacked, than Operator passwords do. However
crypted link passwords can be very akward to keep track of.
crypted link passwords can be very awkward to keep track of.
Your C line password is the password used in the pass command, while your
N line password will be used to check against the pass command used by
incomming servers. So, your C line password should match the listed
incoming servers. So, your C line password should match the listed
server's N line password, and your N line password should match their C
line password.
If you compile your ircd specifying crypted link passwords, you only need
@@ -513,10 +540,8 @@ N:remote server's hostname/IP:password:remote server's name:host mask:class
with the SERVER command, so it must match the one given. The C and N line
pair should have the same name for this field.
The 4th field of C lines may contain the remote servers connection port.
Even though DALnet runs all its servers with a standard port 7000 open,
server -- server connections should be taken place through port 7325. It is
not mandatory that you place a port number in this field. If you don't give
a port number, the server will not try and autoconnect to the listed
It is not mandatory that you place a port number in this field. If you don't
give a port number, the server will not try and autoconnect to the listed
server. If you do give a port number, the server will only try and
autoconnect to the listed server if there is enough room on the connection
class listed at the end of the C line (connection classes are covered in
@@ -527,7 +552,7 @@ N:remote server's hostname/IP:password:remote server's name:host mask:class
port number, any /connect command's will use this port unless another port
number is given with the command.
The 4th field of N lines is called the `host mask', this defined how many
parts of your hostname the incomming server will mask to. So, if your
parts of your hostname the incoming server will mask to. So, if your
server's name is disney.us.dal.net, and you want the connecting server to
see you as *.us.dal.net you will give a host mask of 1 in your N line. This
field should normally be left blank.
@@ -535,38 +560,38 @@ N:remote server's hostname/IP:password:remote server's name:host mask:class
place the connection on. If your C line has a 42 in this field, and your
server initiates a connection through this line, the connection will be
placed on class 42, however, if You have a 42 in your C line and a 43 in
your N line and an incomming server initiates a connection via this N
your N line and an incoming server initiates a connection via this N
line, the server connection will be placed on class 43.
Examples:
C:143.53.233.32:mypass:somewhere.fr.dal.net:7325:35
N:143.53.233.32:yourpass:somewhere.fr.dal.net::35
C:143.53.233.32:mypass:somewhere.fr.your.net:7325:35
N:143.53.233.32:yourpass:somewhere.fr.your.net::35
This set will allow a server named somewhere.fr.dal.net to connect to your
server if it has the IP address of 143.53.233.32 and gives a password of
`yourpass'. This connection will be governed by connection class 35.
If your server recieves the command /connect somewhere.*, it will try and
If your server receives the command /connect somewhere.*, it will try and
connect to the IP 143.53.233.32 through port 7325 and give the password
`mypass'.
C:143.53.233.32:mypass:somewhere.fr.dal.net:7325:35
N:143.53.233.32:yourpass:somewhere.fr.dal.net::35
C:ircd@176.43.652.31:apass:elsewhere.jp.dal.net:7235:35
N:ircd@176.43.652.31:THEpass:elsewhere.jp.dal.net::33
C:143.53.233.32:mypass:somewhere.fr.your.net:7325:35
N:143.53.233.32:yourpass:somewhere.fr.your.net::35
C:ircd@176.43.652.31:apass:elsewhere.jp.your.net:7235:35
N:ircd@176.43.652.31:THEpass:elsewhere.jp.your.net::33
Both these set's will work as explained above, but if your Y line defining
class 35 has `max links' set to 1, and one of these servers is connected to
your server, your server will not try and autoconnect to the other since
the Y line is `full', but it will accept any incomming connections from the
the Y line is `full', but it will accept any incoming connections from the
other server and any /connect commands given for this server. If your Y
line allows for more connections but your C lines do not have port numbers,
your server will not try and autoconnect.
Since the second set in this example has a username, ident will be used to
authenticate any connections made to this server. If the listed server does
not run ident, or the incomming connection comes from another username, the
not run ident, or the incoming connection comes from another username, the
connection will be rejected.
If a connection is made via the second set by your server, the connection
will be ruled by connection class 35, if the other server initiates the
connection, the connection will use class 33.
Autoconnect C/N line pairs can be given prefrence over other pairs by placing
Autoconnect C/N line pairs can be given preference over other pairs by placing
them lower in your ircd.conf, the lower the line, the higher the priority
when autoconnecting.
Connection classes and C/N line set's allow you to refine your autoconnects
@@ -577,16 +602,16 @@ N:ircd@176.43.652.31:THEpass:elsewhere.jp.dal.net::33
3.8) K Lines [OPTIONAL]
These lines restric access to certain users to your server based on
These lines restrict access to certain users to your server based on
user@host matches and time of the day.
K lines can come in 3 forms, only one of which you can specify in your
ircd.conf, this type will show up as K on /stats k, the other other types
ircd.conf, this type will show up as K on /stats k, the other types
are `AutoKill' which will show up as A on /stats k, and `kline' which will
show up as k on /stats k. AutoKill's are set by U lined servers (see
above), they act in the same way as K lines except that they are set
remotly and are usually set on all servers, they dissapear when you
remotely and are usually set on all servers, they disappear when you
/rehash or restart your server. klines are set via the /kline command,
they operate more like AutoKill's than K lines because they also dissapear
they operate more like AutoKill's than K lines because they also disappear
when you /rehash, or restart the server. The /kline command can be used on
nicknames that appear on IRC, or you can use a user@host mask. If the
/kline is done on an existing nickname, a kline will be set with that users
@@ -628,9 +653,9 @@ K:*.lamer.org:|kc.spamming:*
K:*::*rad
This K line will reject anyone with the username `rad', or anything ending
in `rad'. This ban will dissalow anyone using `rad' running ident or not.
in `rad'. This ban will disallow anyone using `rad' running ident or not.
You must always take into account the ident character (`~') that is placed
infront of usernames when their host is not running ident. If you place a
in front of usernames when their host is not running ident. If you place a
K line on a username `rad' the user will be banned only if they are running
ident, but if this user can turn off ident they can appear as ~rad, this
will allow them to bypass any ban of username `rad'. So, wildcards should
@@ -642,24 +667,24 @@ K:*::*rad
3.9) Q Lines (server form) [DISCOURAGED]
Server form Q lines on DALnet servers are used to dissalow operators on
Server form Q lines on servers are used to disallow operators on
certain servers to use commands such as remote /kill's, and remote
/connect's, this will effectivly restrict the operators on the server to
local operator priveleges. These lines are usually only used for `test'
server situations. If a server isn't officially part of DALnet, they may
/connect's, this will effectively restrict the operators on the server to
local operator privileges. These lines are usually only used for `test'
server situations. If a server isn't officially part of a network, they may
be temporarily linked and Q lined, this means the server can be tested
while not posing a threat to the rest of DALnet. Q lines need only be
while not posing a threat to the rest of the network. Q lines need only be
placed on the hub connecting the `test' server.
Syntax:
Q:*:*:servername
The 1st 2 fields are currently unused. A Q line placed on a hub connected
to the named server will dissalow operators on the server to affect other
to the named server will disallow operators on the server to affect other
DALnet users/servers.
Example:
Q:::test-server.my.dal.net
Q line a server with the name `test-server.my.dal.net'.
Q:::test-server.my.net
Q line a server with the name `test-server.my.net'.
--------------------
@@ -682,10 +707,10 @@ Q:*:reason why nick is quarantined:nickname
Examples:
Q::No nicknames on MY server!:*
This Q line will dissalow any nicknames on the server giving the reason:
This Q line will disallow any nicknames on the server giving the reason:
No nicknames on MY server!
Only Operators will be allowed to use any nicknames, but since you must be
a user before you can be +o, you will effectivly ban everyone from your
a user before you can be +o, you will effectively ban everyone from your
server.
Q::Do not use the Lords name in vain!:God
@@ -693,7 +718,7 @@ Q::Do not use the Lords name in vain!:God
that they must find a new nickname and will be given the reason:
Do not use the Lords name in vain!
DALnet has a set of standard Q lines that should be in place on all
Below are a set of standard Q lines that should be in place on all
server's. They are as follows:
Q::Reserved for services:*Chan*S*rv*
@@ -701,8 +726,9 @@ Q::Reserved for services:*Nick*S*rv*
Q::Reserved for services:*Memo*S*rv
Q::Reserved for services:*Oper*S*rv*
Q::Reserved for services:*Help*S*rv*
Q::Reserved for operators:DALnet
Q::Reserved for services:*Stat*S*rv*
Q::Reserved for operators:IRC*op*
Q::Reserved for operators:*oper*
Q::Causes problems with mIRC:Status
--------------------
@@ -711,7 +737,7 @@ Q::Causes problems with mIRC:Status
These lines specify which servers are to behave as leaves, that is,
servers that may not have any other servers connected to them.
They will only be usefull if your server is a non-leaf (hub) server.
They will only be useful if your server is a non-leaf (hub) server.
Not only can you limit servers to leaves, but you can also specify
what tree depth may appear after certain servers. If a server connects
but tells your server that it has a larger tree depth behind it than is
@@ -738,18 +764,18 @@ L:hostmask of disallowed servers:*:server name:depth
Examples:
L:::leaf.de.dal.net
This line will allow a server named `leaf.de.dal.net' to connect only as
This line will allow a server named `leaf.de.your.net' to connect only as
a leaf. So this server may not connect any other servers behind it.
L:::semi-hub.sg.dal.net:1
This line will force the server named `semi-hub.sg.dal.net' to allow only
This line will force the server named `semi-hub.sg.your.net' to allow only
leaf servers to connect behind it. ie: to have a tree depth of 1.
L:*.us.dal.net::*.au.dal.net
L:*.eu.dal.net::*.au.dal.net
L:*.us.dal.net::*.au.your.net
L:*.eu.dal.net::*.au.your.net
These lines will make sure that any server with a name matching
*.au.dal.net will not introduce any servers matching *.us.dal.net or
*.eu.dal.net. This can be usefull for stopping certain hubs from letting
*.au.your.net will not introduce any servers matching *.us.your.net or
*.eu.your.net. This can be useful for stopping certain hubs from letting
its autoconnects route the network badly.
--------------------
@@ -763,7 +789,7 @@ L:*.eu.dal.net::*.au.dal.net
Syntax:
H:servers which are allowed behind the hub:*:hub servername
The 1st field defines what servernames the H lined server is allowed to
The 1st field defines what server names the H lined server is allowed to
introduce. Wildcards are allowed.
The 2nd field is currently unused and should be left blank.
The 3rd field should be the exact name of the server allowed to be a hub
@@ -771,16 +797,16 @@ H:servers which are allowed behind the hub:*:hub servername
the server's name includes a `*' (See N lines for host masking).
Examples:
H:*::dal-hub.us.dal.net
This line will allow the server with the name `dal-hub.us.dal.net' to act
H:*::dal-hub.us.your.net
This line will allow the server with the name `dal-hub.us.your.net' to act
as a hub server while you are connected to it, there are no restrictions
on the names of the servers it may introduce.
H:*.us.dal.net::usa-hub.us.dal.net
This line will allow the server named `usa-hub.us.dal.net' to act as a hub
H:*.us.dal.net::usa-hub.us.your.net
This line will allow the server named `usa-hub.us.your.net' to act as a hub
while your server is connected to it, but it is limited to introducing
servers with names matching `*.us.dal.net', so any servers trying to
connect to `usa-hub.us.dal.net' with a name such as `bad-link.nz.dal.net'
servers with names matching `*.us.your.net', so any servers trying to
connect to `usa-hub.us.your.net' with a name such as `bad-link.nz.your.net'
will be rejected by your server.
--------------------
@@ -811,8 +837,7 @@ P:hostmask or UNIX socket file:*:*:port number
Examples:
P:*:::7325
This will open up the DALnet server connection port and wait for
connections. This line is mandatory if you run a server connected to DALnet
This will open up port 7325.
P:*.net:::6665
This line will open up port 6665 and wait for connections, connections from
@@ -906,10 +931,10 @@ e:234.45.32.1:*:*
3.17) Summary:
Well, thats it for the lines you may use in your ircd.conf. Remember that
Well, that's it for the lines you may use in your ircd.conf. Remember that
ircd.conf is an art, just like any other type of programming. Some parts
are particularly easy, but other's, like Y lines, can take a while to get
used to. Given a little time experementing with lines on a network of
used to. Given a little time experimenting with lines on a network of
servers, you will become well versed in ircd.conf programming.
Good luck!
@@ -1257,6 +1282,161 @@ Set HIDE_ULINES .........: 0
--------------------
7.11) Set ALLOW_CHATOPS Line
This line defines whether or not /chatops will be allowed to be used. When
disabled /chatops as well as user mode +b will be disabled.
Syntax:
Set ALLOW_CHATOPS .......: 1/0
If this line is set to 1, then /chatops and +b are allowed, if it is set to 0,
then /chatops and +b are disabled.
Examples:
Set ALLOW_CHATOPS .......: 1
This line will allow use of /chatops and +b.
Set ALLOW_CHATOPS .......: 0
This line will disable /chatops and +b.
--------------------
7.12) Set SOCKS_BAN_MESSAGE Line
This line allows you to specify the reason to be used in the Z:line when a user
is killed for an open proxy server. It is very important that this is set, if
left NULL it can cause serious problems.
Syntax:
Set SOCKS_BAN_MESSAGE ...: message
In this line the word "message" should be replaced with the reason the user is
being Z:lined, the default is "Insecure SOCKS Server".
Examples:
Set SOCKS_BAN_MESSAGE ...: You are running an insecure SOCKS Server.
This line will Z:line a user using an open SOCKS server with the reason, "You
are running an insecure SOCKS Server."
--------------------
7.13) Set SOCKS_QUIT_MESSAGE Line
This line defines the message that will be used in the QUIT message the user
will have when they are killed for an insecure SOCKS server.
Syntax:
Set SOCKS_QUIT_MESSAGE ..: message
In this line the word "message" will be used as the QUIT message for the user
being killed.
Examples:
Set SOCKS_QUIT_MESSAGE ..: User was running an insecure SOCKS Server.
This line will use "User was running an insecure SOCKS Server." as the QUIT
message for the user when they are found to be running an insecure SOCKS
server.
--------------------
7.14) Set SOCKSBANTIME Line
This line lets you specify how long a user using an open SOCKS server will be
Z:lined for.
Syntax:
Set SOCKSBANTIME ........: time in seconds
This line will ban a user for "time in seconds" seconds, it is important to
remember that this is seconds, not minutes.
Examples:
Set SOCKSBANTIME ........: 86400
This line will Z:line all users running open SOCKS servers for 86400 seconds.
--------------------
7.15) Set MAXCHANNELSPERUSER Line
This line allows you to define the max amount of channels a user may join.
Note, IRCd Agents can still join unlimited channels no matter what this is set
to.
Syntax:
Set MAXCHANNELSPERUSER ..: number of channels
This line will allow users to join "number of channels", the recommended value
is 10 but it is not required.
Examples:
Set MAXCHANNELSPERUSER ..: 11
This line will allow users to join 11 channels before they are given an error.
--------------------
7.16) Set WEBTV_SUPPORT Line
This line allows you to specify whether WebTV Support will be enabled or not.
When WebTV Support is enabled the /NOTICE command is disabled also, anyone
using /NOTICE will send a /PRIVMSG. Also, in addition to using /<command> users
can /PRIVMSG irc <command> this is so WebTV users can also use commands.
Syntax:
Set WEBTV_SUPPORT .......: 1/0
When this line is set to 1, WebTV support will be enabled, when it is set to 0
it will be disabled and the IRCd will support /NOTICE as it normally would.
Examples:
Set WEBTV_SUPPORT .......: 1
This line enables WebTV Support disabling /NOTICE and enabling /PRIVMSG irc
<command>.
Set WEBTV_SUPPORT .......: 0
This line disables WebTV Support and leaving /NOTICE alone.
--------------------
7.17) Set NO_OPER_HIDING Line
This line allows you to specify whether IRCops will be allowed to set
themselves +I (if they have the ^ Oflag).
Syntax:
Set NO_OPER_HIDING ......: 1/0
If this line is set to 1 IRCops will not be able to use usermode +I, if this is
set to 0 they may use usermode +I.
Examples:
Set NO_OPER_HIDING ......: 1
This line has use of usermode +I disabled.
Set NO_OPER_HIDING ......: 0
This line has use of usermode +I enabled for IRCops.
--------------------
7.18) Set AUTO_JOIN_CHANS Line
This line allows you to force a user to join one or more channels when they
connect to the server. Using this will not override modes if you set it to make
a user join a +k channel they still need the password.
Syntax:
Set AUTO_JOIN_CHANS .....: 0/<channel>[,channel2,...]
When this line is set to 0 it will not make the user join any channels on
connect. If this is set to a channel name it will name the user join that
channel, to enter more than one channel use a comma separated list.
Examples:
Set AUTO_JOIN_CHANS .....: 0
This line makes it so the user will not be forced to join a channel when they
connect to the server.
Set AUTO_JOIN_CHANS .....: #main
This line will make the user join #main when they connect to the server.
Set AUTO_JOIN_CHANS .....: #main,#help
This line will make the user join #main and help when they connect, you may
specify as many channels as are defined in MAXCHANNELSPERUSER (see 7.15).
--------------------
8) network files:
The networks files allow you to specify some information specific about your
-271
View File
@@ -1,271 +0,0 @@
The Tao of Internet Relay Chat
Copyright (C) Ove Ruben R Olsen 1994
Version of 940110
Contributing masters: Master ScottM
-----
Something is formed by the electrons, born in the silent cable. Shaping
and growing and ungrowing. It is there yet not there. It is the source of
Internet Relay Chat. I do not know the name, thus I will call it the Tao
of Internet Relay Chat.
If the Tao is great, then the IRC is running ceaselessly. If the IRC is
great then the server is running without ever stoping. If the server is
great then the client will always be the server. The luser is then pleased
and there is Chat in the world.
The Tao of IRC squits far away and connects on returning.
-----
The genetic potential of birth, a lot to know, yet unknown.
In the begining there was nothing.
Out of nothing the Tao gave birth to tolsun.oulu.fi. tolsun gave birth to
OuluBox.
OuluBox gave birth to rmsg.
rmsg was not Tao, so MUT gave birth to IRC.
No one knows when IRC came into existance, the mighty master WiZ have it
to be at the end of the eight month in the year of the Dragon.
-----
Each channel has its purpose, however humble. Each channel is the Yin and
Yang of IRC. Each channels has it's place within the IRC.
In the beginning there was only channel 0, thus channel 0 is the soil of
IRC.
Channel 1 to channel 10 then was open as the sea. Channel 11 to 999 was the
trees and forests of IRC. Channels above 999 should not be mentioned, and
channels below 0 were unborn and contained many secrets.
This was not the right Tao, so IRC gave birth to +channels.
+channels had the yin and yang. Mode does not.
This was not the right Tao still, so IRC gave birth to #channels.
#channels have the yin and yang.
Only channel 0 is the right path to Tao, but avoid speaking on channel 0.
-----
There was a great dispute among the Broom-Walkers of the Relay. Some of them
wanted neither yin nor yang. Out of this Eris came into existance. Some of the
Broom-Walkers then created Eris Free-net.
This was the right Tao.
Kind Gentle and Boring Net was another wrong path to the Tao of Internet Relay
Chat.
Some time later there was a quantity of some lusers who wanted to be
Broom-Walkers also. The Eris Free Broom-Walkers did not agree with them,
thus a new IRC was born. This IRC is called the Undernet.
But this is not the right Tao, either.
-----
There will always be disputes among the Broom-Walkers of Internet Relay Chat.
This is the very nature of the IRC.
-----
Lusers that do not understand the Tao is always using the yang of Mode on
their channels. Lusers that do understand the Tao are always using Ignore
on their channels.
How could this not be so ?
-----
The wise sage luser is told about the Chat and uses it. The luser is told
about the IRC and is looking for it. The flock are told about the Tao and
make a fool of the IRC.
If there was no laughter, there would be no Tao.
-----
The master says:
"Without the Tao of Internet Relay Chat, life becomes meaningless."
The Relay of the old time was mysterious and sacred. We can neither imagine
its thoughts nor path; we are left but to describe.
-----
The sage luser must be aware like a frog crossing the highway.
-----
The great master Wumpus once dreamed that he was an automaton. When he awoke
he exclaimed:
"I don't know whether I am Wumpus dreaming that I am a client,
or a client dreaming that I am Wumpus!"
So was the first Automata born.
The master Nap then said:
"Any automata should not speak unless spoken to.
Any automata shall only whisper when spoken to."
Thus replied the master Gnarfer:
"The lusers shall keep in mind that a automata can be either good or
bad. Create good automata, and the IRC will hail you and you will
gain fame and fortune. Create bad automata and people will start to
hate you, and finaly you will be /KILLed to ethernal damnation"
Many lusers have fallen into the clutches of ethernal damnation. They where
not following the Tao.
-----
There once was a luser who went to #BotSex. Each day he saw the automatons.
The luser decided that he also would have such a automata.
He asked another luser for his automata. The other luser gave his automata
away.
The luser was not within the Tao, so he just started the automata. The automata
had only Yang inside so all the lusers files where deleted.
Some moons laither the same luser then had become a sage luser, and did create
his automata from the very grounds with materials found inside the IRC.
The luser was now within the Tao and his automata lived happily ever after.
-----
There once was a master who wrote automatons without the help of master Phone.
A novice luser, seeking to imitate him, began with the help of master Phone.
When the novice luser asked the master to evaluate his automata the master
replied: "What is a working automata for the master is not for the luser.
You must must BE the IRC before automating."
-----
Master BigCheese gave birth to master Troy; his duty clear. Master Troy gave
birth to master Phone, for the Tao of Irc must be eternal and must flow as the
ceaseless river of Time itself.
-----
Master Phone once said about the ircII client:
"public_msg is for a message from someone NOT on the channel
public_other is for a message on a channel that doesn't belong to
a window. public is for a message on a channel that belongs to a
window!"
Out of this raised the mighty chaos.
-----
The sage luser came to the master who wrote automata without the help of
master Phone. The sage luser asked the master who wrote automata: "Which is
easiest to make. A automata with the help of master Phone or an automata
made with the help of a language ?"
The master who wrote automata then replied:
"With the help of a language."
The sage luser was disapointed and exclaimed: "But, with master Phone you
do not need to know anything about the soil of IRC. Is not that the easiet
way ?"
"Not really" said the master who wrote automata, "when using master Phone
you are closed inside a box. For sure, it is a great box for the lusers,
but the master will need more power, thus a language is the only path to go.
With the language the master will never have to limit himself. When using
such a language the master will seek the best between the need and the
availibility."
"I see", said the sage luser.
This is the essence of Tao of IRC automatas.
-----
A client should be light and be used for communication. The spirit of a good
client is that it should be very convinient for the luser to use, but hard
for the luser who want to create automata.
There should never ever be too many functions or too few functions.
There should always be a ignore.
Without ignore the client is not within the Tao of Chating.
The client should always respond the luser with messages that will not
astnonish him too much. The server likewise. If the server does not, then it
is the clients job to explain what the server says.
A client which fails this, will be useless and cause confusion for the lusers.
The only way to correct this is to use another client or to write a new one.
-----
A luser asked the masters on #IrcHelp: "My client does not work".
The masters replied: "Upgrade your client".
The luser then wondered why the master knew. The master then told him about
the Protocol.
"Your client does not work beaucse it does not understand the server. Why
should it always work ? Only a fool would expect such. But, clients are made
by humans, and humans are not perfect. Only Tao is.
The IRC is solid. The IRC is floating, and will always be dynamic. Live with
that or /quit."
-----
The luser came to the masters of #IrcHelp, asking about the Tao of IRC within
the client.
The masters then said that the Tao of IRC always lies inside the client
regardless of how the client connects to the server.
"Is the Tao in irc ?" asked the luser.
"It so is" replied the masters of #IrcHelp.
"Is the Tao in the ircII, Kiwi, rxirc, vms, rockers and msa ?" asked the
luser.
"In all of them and in the TPC, irchat, zenirc, zircon X11-irc and even the
dos irc has the Tao" said the master quietly.
"Is the Tao in a telnet connection directly to the server ?"
The master then was quiet for a long time and said. "Please leave, such
questions are not within the Tao of IRC".
-----
The master says: "Without the Protocol of TCP the messages will not travel.
Without the client, the server is useless."
-----
There once was a luser who used the ircII client. "ircII can do anything I
ever need for using IRC" said the emacs client user, "I have /ON's, I have
assignments, I have aliasing. Why don't you use this instead of the huge
emacs client, which also has a messy screen?"
The emacs client user then replied by saying that "it is better to have a
scripting language that is the client instead of have a client that has
a scripting language." Upon hearing this, the ircII client luser fell silent.
-----
The master Wumpus said: "Time for you to leave. I did, now I'm happy."
The master Gnarfer replied: "Use, but never overuse IRC, then you will also
be happy within IRC"
-----
A luser came unto the masters of #EU-Opers and asked, "How can I be, yet not
be, a user@host within the IRC?"
The masters of #EU-Opers replied: "To be Tao is to be ones true self. To hide
ones self is not Tao, and is not IRC, you have much to learn before you shall
be at rest within the Flow of Irc. Please leave"
-21
View File
@@ -1,21 +0,0 @@
[ $Id$ ]
Dynamic Configuration Guide
Okay first you have to go edit the file "unrealircd.conf" in
the directory "networks/". In that file you see a field with
name "Include" .. if you want to create your own network file
(IRC network specification) you have to write like
"networks/<irc network>.network" like "networks/myircnetwork.network"
If there is already a network file you can just put in the path
like : "networks/dragonwings.org"
If you want to create your own network file
copy the file "template.network" to the name you want to use for
your network file and edit it.
If you experince any problems email me at stskeeps@tspre.org
or try msg me at /server irc.global-irc.net : #UnrealIRCd
My nick is mostly Stskeeps or Techie (or Nightwalker if i had a bad night:P)
--Stskeeps
-1
View File
@@ -1 +0,0 @@
...
-12
View File
@@ -1,12 +0,0 @@
all: client server
client:
gcc -o tsp-client tsp-client.c sscript.c
server:
gcc -o tsp-server-run tsp-server-run.c
gcc -o tsp-skin socker.c
clean:
rm -f *~
rm -f tsp-server-run tsp-client tsp-skin
-26
View File
@@ -1,26 +0,0 @@
how to use tsp-client:
first make it "make"
then run it like this:
$ ./tsp-client <tsp server> <port>
do this a couple of times
if the answers come within 1 second count its right
then take the most common time difference count and do in UnrealIRCd like
this:
/quote tsctl offset + <difference count>
then your server is time synched
current tsp servers online:
server port
-----------------------------
irc.flirt.org 6100
if you want to make your own TSP server (must be a box using NTP)
run ./tsp-server, it will then start running on port 6100
-40
View File
@@ -1,40 +0,0 @@
Socket Script C library
-----------------------
Home page:
http://www.linsupport.com
This is a simple library that provides usefull functions for C
networking applications. It's based on the Socket Script scripting
language, but meant for C programmers. These functions are really
shortcuts to C functions, meant to make their use simple.
This can create a static lib: libsscript.a
To compile:
make
Then to install it:
make install
(C) Copyright 1998-2000 Patrick Lambert <drow@post.com>
This library is under the LGPL license which means:
1- You can copy and use this program freely.
2- You may not claim that you wrote it.
3- If you want to include parts of this software in your own product,
you can do so if that product stays under free software and if all
copyright notices in source and documentation, as well as the no warranty
comment, remains.
4- This program is distributed without ANY WARRANTY, without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
-149
View File
@@ -1,149 +0,0 @@
/*
SOCKER Socket redirector version 0.1
Patrick Doyle Oct 1998
Based on tserver by Michael Johnson and Erik Troan
Puts a normal stdin & stdout based program up on a port
as a server process. Each connection spawns a new copy
of the program.
Please notify me of any changes to this code tha you
subsequently redistribute. I can be contacted at
patrick@minotaursoftware.com.
Also, please leave my name and those of Michael Johnson
and Erik Troan at the top of this file.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/wait.h>
#define ZOMBIE /* Causes zombies to be collected. Only works under Linux. */
#define debug printf
#undef debug
void debug(char *format, ...){}
int sock = -1;
void die(char *msg){
perror(msg);
exit(1);
}
void handle_sig(int signum){
if(signum == SIGCHLD){
/* Collect exit statuses. Prevent zombies. */
int status;
while(0 < waitpid(-1, &status, WNOHANG));
}else{
fprintf(stderr, "\nSocker exiting normally.\n");
close(sock);
exit(0);
}
}
#define asizeof(x) (sizeof(x)/sizeof(x[0]))
void setup_sig_handler(){
int sa_num;
static int sigs[] = {
SIGHUP, SIGINT, SIGQUIT, SIGXCPU, SIGXFSZ, SIGTERM
# ifdef ZOMBIE
, SIGCHLD
# endif
};
static struct sigaction sig_actions[asizeof(sigs)];
debug("Starting setup_sig_handler\n");
memset(sig_actions, 0, sizeof(sig_actions));
sig_actions[0].sa_handler = handle_sig;
sigemptyset(&(sig_actions[0].sa_mask));
for(sa_num=1; sa_num < asizeof(sigs); sa_num++){
memcpy(sig_actions+sa_num, sig_actions, sizeof(sig_actions[0]));
}
for(sa_num=0; sa_num < asizeof(sigs); sa_num++){
if(sigaction(sigs[sa_num], sig_actions+sa_num, NULL))
die("sigaction");
}
# ifdef ZOMBIE
siginterrupt(SIGCHLD, 0); /* Don't let SIGCHLD interrupt socket calls */
# endif
debug("Ending setup_sig_handler\n");
}
int main(int argc, char *argv[]) {
struct sockaddr_in address;
int conn, i, portnum;
size_t addrLength = sizeof(struct sockaddr_in);
fprintf(stderr, "SOCKER Socket Redirector Patrick Doyle Oct 1998\n");
if (argc < 3 || !(portnum = atoi(argv[1]))){
fprintf(stderr, "Usage: socker {port_num} {command}\n");
fprintf(stderr, "Waits for TCP connections on the given port, and then\n");
fprintf(stderr, "spawns a new process executing {command} for each connection.\n");
fprintf(stderr, "Exit status: 0=caught signal and exited; 1=error\n");
exit(1);
}
if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0)
die("socket");
debug("Calling setup_sig_handler\n");
setup_sig_handler();
/* Let the kernel reuse the socket address. This lets us run
twice in a row, without waiting for the (ip, port) tuple
to time out. */
i = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&i, i);
address.sin_family = AF_INET;
address.sin_port = htons(portnum);
memset(&address.sin_addr, 0, sizeof(address.sin_addr));
if (bind(sock, (struct sockaddr *) &address, sizeof(address)))
die("bind");
if (listen(sock, 5))
die("listen");
while ((conn = accept(sock, (struct sockaddr *) &address, &addrLength)) >= 0) {
if(fork()){ /* Parent; loop back to accept another */
close(conn);
}else{ /* Child; exec given command line */
close(sock);
/* Redirect stdin & stdout to socket */
if(0 != dup2(conn, 0) || 1 != dup2(conn, 1))
die("dup2 redirection");
/* Turn off buffering */
/* Note: this seems to have no effect beyond execvp */
setbuf(stdin, 0);
setbuf(stdout, 0);
setbuf(stderr, 0);
/* Execute command */
execvp(argv[2], argv+2);
/* Error if we get here */
fprintf(stderr, "execvp failed. Please make sure that '%s' refers to a valid program.\n", argv[2]);
_exit(1)/*
man fork says _exit should be called to prevent parent from
being corrupted.
*/;
}
}
if (conn < 0)
die("accept");
/* Shouldn't get here */
close(sock);
return 2;
}
-115
View File
@@ -1,115 +0,0 @@
Socket Script Library 2.0
-------------------------
Here are the functions and errno code numbers returned by some of SScript's
functions:
errno:
SSCRIPT_SOCKET_FAILED 10
SSCRIPT_BIND_FAILED 11
SSCRIPT_GETSOCKETNAME_FAILED 12
SSCRIPT_FLAGS_FAILED 13
SSCRIPT_CONNECT_FAILED 20
SSCRIPT_UDPSEND_FAILED 31
SSCRIPT_UDPRECEIVE_FAILED 32
SSCRIPT_READ_FAILED 33
The following are the SScript functions available in this library.
They return either a string, an int or void. If an error occurs, it returns
NULL (in case of a string) or -1 (in case of an int) and sets errno to
the right error code (see above). Note that since each connection is
associated with a socket number (sockfd), it is possible to make
multiple connections.
- char *sscript_lindex(char *input_string, int word_number);
Get <word_number> from <input_string>. Returns the requested word.
- char *sscript_lrange(char *input_string, int starting_at);
Return everything after <starting_at> in <input_string>.
- int sscript_connect(char *server, int port, char *virtual);
Connect to <server> at port <port>, binding to virtual address
<virtual>. If no binding is required, use NULL. Returns the socket
number.
- int sscript_server(int port);
Initialize a server socket. Returns the socket number.
- int sscript_wait_clients(int sockfd, int port, int forking);
Listen to port <port> and wait for clients. This function is a
blocking function. It will stay there untill it gets a client, and when
it does, it will create a child and return its associated socket number.
The child will go in the background if <forking> is set to 1
(required for multithreading). This returns the child' sockfd.
- char *sscript_get_remote_ip();
This function returns the IP that connected to a server-oriented program.
- void sscript_disconnect(int sockfd);
Diconnects the connection pointed by <sockfd>.
- void sscript_dump(int sockfd, char *filename);
Dumps the content of <filename> to the connection pointed by <sockfd>.
- void sscript_ping(char *hostname);
Sends a TCP ping (echo to port 7) to <hostname>. This is a blocking
function and only returns if the ping worked.
- int sscript_test(char *hostname, int port);
This tests if port <port> from <hostname> is open. Returns 0 if it is.
- char *sscript_version();
Returns the current library version.
- char *sscript_read(int sockfd, int chop);
Read from the connection pointed by <sockfd> and clear the last
char if <chop> is set to 1.
- void sscript_write(int sockfd, char *string);
Write <string> to the connection pointed by <sockfd>.
- int sscript_udp_send(char *hostname, int port, char *msg);
Send an UDP packet to <hostname> at port <port> containing the message <msg>
- char *sscript_udp_listen(int port);
Listen for UDP packets on port <port>. Available to root only.
- char *sscript_icmp_detect();
Listen for ICMP messages and return the type (see ICMP.types) and the IP
that sent one. Available to root only.
- char *sscript_resolve_host(char *hostname);
Resolve <hostname> into an IP.
- char *sscript_resolve_ip(char *ip);
Resolve <ip> into an hostname.
- char *sscript_get_localhost();
Get the local hostname.
- void sscript_binary_send(int sockfd, char *filename);
This function sends a binary file.
- void sscript_binary_get(int sockfd);
This function receives a binary file.
- char *sscript_login_to_passwd(char *login)
This function converts a login name to its crypted password.
- char *sscript_uid_to_login(long uid)
This function finds the login name for the UID provided.
- int sscript_sokstat(char *option, int sockfd)
This will give the settings for the currently open socket sockfd. Option
is what you want the setting of and can be sendbuf, recvbuf, error or type.
- char *sscript_time_read(int sockfd, int time);
This function reads from sockfd for time secs, and then returns what it
read, or "timeout".
- void sscript_redir(int sockfd1, int sockfd2);
This function will redirect packets from sockfd1 to sockfd2, and the
other way around.
- void sscript_nodelay(int sockfd);
Set the socket in non-blocking mode.
-509
View File
@@ -1,509 +0,0 @@
/*
* SScript - See the sscript.doc
* (C) 1998 Drow <drow@wildstar.net>
* http://devplanet.fastethernet.net
*/
#include "sscript.h"
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <net/if.h>
#include <strings.h>
#include <sys/file.h>
#include <signal.h>
#include <unistd.h>
#include <netdb.h>
#include <arpa/inet.h>
#ifndef FNDELAY
#define FNDELAY O_NONBLOCK
#endif
#ifdef POSIX
#include <pwd.h>
#include <sys/utsname.h>
#endif
char global_var[9][1024]; /* need to find why gcc outputs warns without this */
char remoteIP[30];
char *sscript_lindex(char *input_string, int word_number)
{
char *tokens[1024];
static char tmpstring[1024];
int i;
strncpy(tmpstring,input_string,1024);
(char *)tokens[i=0] = (char *)strtok(tmpstring, " ");
while (((char *)tokens[++i] = (char *)strtok(NULL, " ")));
tokens[i] = NULL;
return(tokens[word_number]);
}
int sscript_connect(char *server, int port, char *virtual)
{
struct sockaddr_in address;
struct sockaddr_in la;
int len, sockfd;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd<1)
{
errno = SSCRIPT_SOCKET_FAILED;
return -1;
}
address.sin_family = AF_INET;
address.sin_addr.s_addr = inet_addr(server);
address.sin_port = htons(port);
len = sizeof(address);
if(virtual!=NULL)
{
la.sin_family = AF_INET;
la.sin_addr.s_addr = inet_addr(virtual);
la.sin_port = 0;
bind(sockfd, (struct sockaddr *)&la, sizeof(la));
}
if(connect(sockfd, (struct sockaddr *)&address, len)<0)
{
errno = SSCRIPT_CONNECT_FAILED;
return -1;
}
return sockfd;
}
int sscript_server(int port)
{
int sockfd2, listen_len;
struct sockaddr_in listen_addr;
sockfd2 = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd2<1)
{
errno = SSCRIPT_SOCKET_FAILED;
return -1;
}
listen_addr.sin_family = AF_INET;
listen_addr.sin_addr.s_addr = htonl(INADDR_ANY);
listen_addr.sin_port = htons(port);
listen_len = sizeof(listen_addr);
if(bind(sockfd2, (struct sockaddr *)&listen_addr, listen_len))
{
errno = SSCRIPT_BIND_FAILED;
return -1;
}
return sockfd2;
}
int sscript_wait_clients(int sockfd2, int port, int forking)
{
int sockfd=(int)NULL,len,from_len,pid;
struct sockaddr_in address;
struct sockaddr_in from_addr;
struct sockaddr_in listen_addr;
listen_addr.sin_family = AF_INET;
listen_addr.sin_addr.s_addr = htonl(INADDR_ANY);
listen_addr.sin_port = htons(port);
len = sizeof(address);
listen(sockfd2, 5);
for(;;)
{
if(forking) if(sockfd!=(int)NULL) close(sockfd);
sockfd = accept(sockfd2, (struct sockaddr *)&address, &len);
if(forking) if((pid=fork())) break;
}
from_len=sizeof(from_addr);
memset(&from_addr, 0, sizeof(from_addr));
if(getpeername(sockfd, (struct sockaddr *)&from_addr,&from_len) < 0)
{
strcpy(remoteIP,"unknown");
}
else
{
strcpy(remoteIP,inet_ntoa(from_addr.sin_addr));
}
return sockfd;
}
char *sscript_get_remote_ip()
{
return remoteIP;
}
void sscript_disconnect(int sockfd)
{
shutdown(sockfd,2);
close(sockfd);
}
void sscript_dump(int sockfd, char *filename)
{
char temp[1024]="";
FILE *fpa;
fpa=fopen(filename,"r");
if(fpa==NULL) return;
while(fgets(temp,1024,fpa)!=NULL)
write(sockfd, temp, strlen(temp));
fclose(fpa);
}
void sscript_ping(char *hostname)
{
struct sockaddr_in other_addr;
int sockfd, result;
char temp[255];
sockfd=socket(AF_INET, SOCK_STREAM, 0);
if(sockfd<0)
{
errno = SSCRIPT_SOCKET_FAILED;
return;
}
other_addr.sin_family = AF_INET;
other_addr.sin_addr.s_addr = inet_addr(hostname);
other_addr.sin_port = htons(7);
connect(sockfd, (struct sockaddr*) &other_addr,sizeof(other_addr));
result=write(sockfd,"ping\n",strlen("ping\n"));
result=read(sockfd,temp,result);
close(sockfd);
}
int sscript_test(char *hostname, int port)
{
int sockfd;
struct sockaddr_in other_addr;
if((sockfd=socket(AF_INET, SOCK_STREAM, 0))<0)
{
errno = SSCRIPT_SOCKET_FAILED;
return -1;
}
other_addr.sin_family = AF_INET;
other_addr.sin_addr.s_addr = inet_addr(hostname);
other_addr.sin_port = htons(port);
if(connect(sockfd, (struct sockaddr*)&other_addr,sizeof(other_addr))==-1)
{
errno = SSCRIPT_CONNECT_FAILED;
close(sockfd);
return -1;
}
close(sockfd);
return 0;
}
char *sscript_version()
{
return ABOUT;
}
char *sscript_read(int sockfd, int chop)
{
int i, result;
char inchar;
char string[1024];
bzero(string,1024);
strcpy(string,"");
for(i=0;(result=read(sockfd,&inchar,1))!='\0';i++)
{
string[i]=inchar;
if(inchar=='\n') break;
}
if (chop) string[i-1]=' ';
strcpy(global_var[0],string);
return global_var[0];
}
void sscript_write(int sockfd, char *string)
{
write(sockfd, string, strlen(string));
}
int sscript_compare(char *case1, char *case2)
{
return (strcmp(case1,case2));
}
char *sscript_lrange(char *input_string, int starting_at)
{
char *tokens[555];
static char tmpstring[512]="";
int i;
char out_string[512]="";
strcpy(out_string,"");
if(input_string==NULL) {
strcpy(out_string," ");
strcat(out_string,NULL);
strcpy(global_var[1],out_string);
return global_var[1]; }
strcpy(tmpstring,input_string);
(char *)tokens[i=0] = (char *)strtok(tmpstring, " ");
while(((char *)tokens[++i] = (char *)strtok(NULL, " ")));
tokens[i] = NULL;
i++;
if(i<starting_at) return (int)NULL;
while(tokens[starting_at] != NULL)
{
strcat(out_string,tokens[starting_at]);
strcat(out_string, " ");
starting_at++;
}
strcpy(global_var[2],out_string);
return global_var[2];
}
int sscript_udp_send(char *hostname, int port, char *msg)
{
int udpsock;
struct sockaddr_in udpaddr;
udpsock = socket(AF_INET, SOCK_DGRAM, 0);
if(udpsock<0)
{
errno = SSCRIPT_SOCKET_FAILED;
return -1;
}
udpaddr.sin_family = AF_INET;
udpaddr.sin_port = htons(port);
udpaddr.sin_addr.s_addr = inet_addr(hostname);
if(sendto(udpsock,msg,sizeof(msg),0,(struct sockaddr *)&udpaddr,sizeof(udpaddr))<0)
{
errno = SSCRIPT_UDPSEND_FAILED;
return -1;
}
return 0;
}
char *sscript_udp_listen(int port)
{
int udpsock,len;
struct sockaddr_in udpaddr, from;
char msg[255];
udpsock = socket(AF_INET, SOCK_DGRAM, 0);
if(udpsock<0)
{
errno = SSCRIPT_SOCKET_FAILED;
return (char *)NULL;
}
udpaddr.sin_family = AF_INET;
udpaddr.sin_addr.s_addr = INADDR_ANY;
udpaddr.sin_port = htons(port);
if(bind(udpsock,(struct sockaddr *)&udpaddr,sizeof(udpaddr))<0)
{
errno = SSCRIPT_BIND_FAILED;
close(udpsock);
return (char *)NULL;
}
len = sizeof(from);
if(recvfrom(udpsock,msg,sizeof(msg),0,(struct sockaddr *)&from,&len)<0)
{
errno = SSCRIPT_UDPRECEIVE_FAILED;
close(udpsock);
return (char *)NULL;
}
close(udpsock);
strcpy(global_var[3],msg);
return global_var[3];
}
char *sscript_icmp_detect()
{
int icmpsock,len,result,type;
struct sockaddr_in icmpaddr;
char readbuf[1024]="";
char msg[255];
if((icmpsock=socket(AF_INET, SOCK_RAW, IPPROTO_ICMP))<0)
{
errno = SSCRIPT_SOCKET_FAILED;
return (char *)NULL;
}
icmpaddr.sin_family = AF_INET;
icmpaddr.sin_addr.s_addr = INADDR_ANY;
icmpaddr.sin_port = 0;
if(bind(icmpsock,(struct sockaddr *)&icmpaddr,sizeof(icmpaddr))<0)
{
errno = SSCRIPT_BIND_FAILED;
close(icmpsock);
return (char *)NULL;
}
len=sizeof(icmpaddr);
if(getsockname(icmpsock,(struct sockaddr *)&icmpaddr,&len)<0)
{
errno = SSCRIPT_GETSOCKETNAME_FAILED;
close(icmpsock);
return (char *)NULL;
}
if((result=read(icmpsock,readbuf,sizeof(readbuf)))<0)
{
errno = SSCRIPT_READ_FAILED;
close(icmpsock);
return (char *)NULL;
}
type=readbuf[20] & 0xff;
sprintf(msg,"%d %d.%d.%d.%d ",type,readbuf[12]&0xff,readbuf[13]&0xff,readbuf[14]&0xff,readbuf[15]&0xff);
close(icmpsock);
strcpy(global_var[4],msg);
return global_var[4];
}
char *sscript_resolve_host(char *hostname)
{
struct hostent *hp;
struct sockaddr_in from;
char result[255];
memset(&from, 0, sizeof(struct sockaddr_in));
from.sin_family = AF_INET;
hp=gethostbyname(hostname);
if(hp==NULL) strcpy(result,"unknown");
else
{
memcpy(&from.sin_addr,hp->h_addr,hp->h_length);
strcpy(result,inet_ntoa(from.sin_addr));
}
strcpy(global_var[5],result);
return global_var[5];
}
char *sscript_resolve_ip(char *ip)
{
struct hostent *hp;
struct sockaddr_in from;
char result[255];
from.sin_family = AF_INET;
from.sin_addr.s_addr = inet_addr(ip);
hp=gethostbyaddr((char *)&from.sin_addr, sizeof(struct in_addr),from.sin_family);
if(hp==NULL) strcpy(result,"unknown");
else strcpy(result,(char *)hp->h_name);;
strcpy(global_var[6],result);
return global_var[6];
}
char *sscript_get_localhost()
{
char result[255];
gethostname(result,sizeof(result));
strcpy(global_var[7],result);
return global_var[7];
}
void sscript_binary_send(int sockfd, char *string)
{
char temp4[255], temp2[255];
int cnt;
FILE *fpa;
sprintf(temp4,"uuencode %s %s > %s/.temp.uue 2>/dev/null",string,string,TMP_DIR);
system(temp4);
sprintf(temp2,"%s/.temp.uue",TMP_DIR);
fpa=fopen(temp2,"r");
if(fpa==NULL || fileno(fpa)<0) return;
else {
while((cnt = read(fileno(fpa), temp4, 250))>0)
write(sockfd, temp4, cnt);
if(fpa!=NULL) fclose(fpa);
sprintf(temp4,"rm -f %s/.temp.uue",TMP_DIR);
system(temp4);
}
}
void sscript_binary_get(int sockfd)
{
char temp2[255], temp4[255], inchar, inall[1024];
FILE *fpa;
int i;
sprintf(temp2,"%s/.temp.uue",TMP_DIR);
fpa=fopen(temp2,"w");
if(fpa==NULL || fileno(fpa)<0) return;
while(strcasecmp(inall,"end\n"))
{
bzero(inall, 1024);
for(i=0;read(sockfd,&inchar,1)!='\0';i++)
{
inall[i]=inchar;
if(inchar=='\n') break;
}
fputs(inall,fpa);
}
if(fpa!=NULL) fclose(fpa);
sprintf(temp4,"uudecode %s/.temp.uue",TMP_DIR);
system(temp4);
sprintf(temp4,"rm -f %s/.temp.uue",TMP_DIR);
system(temp4);
}
char *sscript_login_to_passwd(char *login)
{
#ifdef POSIX
struct passwd *pw;
pw = getpwnam(login);
if(pw!=NULL) return pw->pw_passwd;
#endif
return (char *)NULL;
}
char *sscript_uid_to_login(long my_uid)
{
#ifdef POSIX
struct passwd *pw;
pw = getpwuid(my_uid);
if(pw!=NULL) return pw->pw_name;
#endif
return (char *)NULL;
}
int sscript_sokstat(char *option, int sockfd)
{
int optlen=sizeof(int),optval=1;
if(!strcasecmp(option,"sendbuf")) getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&optval, &optlen);
else if(!strcasecmp(option,"recvbuf")) getsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, (char *)&optval, &optlen);
else if(!strcasecmp(option,"error")) getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char *)&optval, &optlen);
else if(!strcasecmp(option,"type")) getsockopt(sockfd, SOL_SOCKET, SO_TYPE, (char *)&optval, &optlen);
else optval=-1;
return optval;
}
char *sscript_time_read(int sockfd, int time_sec)
{
struct timeval timeout;
int max_fd;
fd_set readfs, newfs;
timeout.tv_sec=time_sec;
timeout.tv_usec=0;
FD_ZERO(&readfs);
FD_SET(sockfd, &readfs);
max_fd = sockfd;
memcpy(&newfs, &readfs, sizeof(readfs));
select(max_fd+1, &newfs, NULL, NULL, &timeout);
if(FD_ISSET (sockfd, &newfs))
{
read(sockfd, global_var[8], sizeof(global_var[8]));
return(global_var[8]);
}
return("timeout");
}
void sscript_redir(int sockfd, int rsck)
{
char buf[4096];
fd_set readfs, newfs;
int max_fd, len;
FD_ZERO(&readfs);
FD_SET(sockfd, &readfs);
FD_SET(rsck, &readfs);
if(sockfd>rsck) max_fd = sockfd;
else max_fd = rsck;
while(1) {
memcpy(&newfs, &readfs, sizeof(readfs));
select(max_fd+1, &newfs, NULL, NULL, NULL);
if(FD_ISSET(sockfd, &newfs))
{
if((len=read(sockfd, buf, sizeof(buf)))<1) break;
if(write(rsck, buf, len)!=len) break;
}
if(FD_ISSET(rsck, &newfs))
{
if((len=read(rsck, buf, sizeof(buf)))<1) break;
if(write(sockfd, buf, len)!=len) break;
}
}
}
void sscript_nodelay(int sockfd)
{
int i;
if(( i = fcntl(sockfd, F_GETFL, 0)) == -1);
else if (fcntl(sockfd, F_SETFL, i | FNDELAY) == -1);
}
-45
View File
@@ -1,45 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define SSCRIPT_SOCKET_FAILED 10
#define SSCRIPT_BIND_FAILED 11
#define SSCRIPT_GETSOCKETNAME_FAILED 12
#define SSCRIPT_FLAGS_FAILED 13
#define SSCRIPT_CONNECT_FAILED 20
#define SSCRIPT_UDPSEND_FAILED 31
#define SSCRIPT_UDPRECEIVE_FAILED 32
#define SSCRIPT_READ_FAILED 33
#define ABOUT "Socket Script library 2.0 by Patrick Lambert (drow@post.com)"
#define POSIX
#define TMP_DIR "."
char *sscript_lindex(char *input_string, int word_number);
int sscript_connect(char *server, int port, char *virtual);
int sscript_server(int port);
int sscript_wait_clients(int sockfd2, int port, int forking);
char *sscript_get_remote_ip();
void sscript_disconnect(int sockfd);
void sscript_dump(int sockfd, char *filename);
void sscript_ping(char *hostname);
int sscript_test(char *hostname, int port);
char *sscript_version();
char *sscript_read(int sockfd, int chop);
void sscript_write(int sockfd, char *string);
int sscript_compare(char *case1, char *case2);
char *sscript_lrange(char *input_string, int starting_at);
int sscript_udp_send(char *hostname, int port, char *msg);
char *sscript_udp_listen(int port);
char *sscript_icmp_detect();
char *sscript_resolve_host(char *hostname);
char *sscript_resolve_ip(char *ip);
char *sscript_get_localhost();
void sscript_binary_send(int sockfd, char *string);
void sscript_binary_get(int sockfd);
char *sscript_login_to_passwd(char *login);
char *sscript_uid_to_login(long my_uid);
int sscript_sokstat(char *option, int sockfd);
char *sscript_time_read(int sockfd, int time_sec);
void sscript_redir(int sockfd, int rsck);
void sscript_nodelay(int sockfd);
-39
View File
@@ -1,39 +0,0 @@
/* compile with: gcc -lsscript -o example example.c */
#include <stdio.h>
#include <errno.h>
#include <time.h>
main(int argc, char *argv[])
{
/* initializing variables */
char result[255]=".";
char *p;
int port = atoi(argv[2]);
int sockfd=0,i;
time_t t,d;
/* connect somewhere */
printf("Connecting to %s:%i .. \n", argv[1], port);
/* call to sscript_connect to connect to the server */
sockfd=sscript_connect(sscript_resolve_host(argv[1]),port,NULL);
/* if it returns -1, then print the error code */
if(sockfd<1)
{
printf("An error occured: %d\n",errno);
exit(1);
}
/* call to sscript_read and copy the result in 'result' */
p = (char *)sscript_time_read(sockfd,5);
if (p)
{
strcpy(result,p);
t = atol(result);
d = t - time(NULL);
printf("TS difference from timeserver is %li (%li)\n", d, t);
}
/* print the result */
/* disconnects */
sscript_disconnect(sockfd);
}
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
./tsp-skin 6100 ./tsp-server-run &
-3
View File
@@ -1,3 +0,0 @@
main() {
printf("%li", time(0));
}
+1 -1
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, ircd/channel.h
* Unreal Internet Relay Chat Daemon, ircd/channel.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/class.h
* Unreal Internet Relay Chat Daemon, include/class.h
* Copyright (C) 1990 Darren Reed
*
* This program is free software; you can redistribute it and/or modify
+22 -12
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/common.h
* Unreal Internet Relay Chat Daemon, include/common.h
* Copyright (C) 1990 Armin Gruner
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@
#include "struct.h"
#endif
#include "dynconf.h"
#include "ircsprintf.h"
#ifdef PARAMH
#include <sys/param.h>
@@ -45,9 +46,15 @@
#endif
#endif
#ifdef DEVELOP_CVS
#define ID_CVS(x) static char id_cvs[] = x
#define ID_Copyright(x) static char id_copyright[] = x
#define ID_Notes(x) static char id_notes[] = x
#else
#define ID_CVS(x)
#define ID_Copyright(x)
#define ID_Notes(x)
#endif
#define BMAGIC 0x4675636B596F754661736369737473
@@ -102,11 +109,11 @@ extern unsigned long inet_addr PROTO((char *));
#include <netinet/in.h>
#endif
#ifdef NEED_INET_NTOA
extern char *inet_ntoa PROTO((struct in_addr));
extern char *inet_ntoa PROTO((struct IN_ADDR));
#endif
#ifdef NEED_INET_NETOF
extern int inet_netof PROTO((struct in_addr));
extern int inet_netof PROTO((struct IN_ADDR));
#endif
int global_count, max_global_count;
@@ -124,14 +131,9 @@ extern char *strtoken PROTO((char **, char *, char *));
#define DupString(x,y) do{x=MyMalloc(strlen(y)+1);(void)strcpy(x,y);}while(0)
#ifdef USE_CASETABLES
extern int casetable;
extern u_char *tolowertab, tolowertab1[], tolowertab2[];
extern u_char *touppertab, touppertab1[], touppertab2[];
#else
extern u_char tolowertab[], touppertab[];
#endif
#ifndef USE_LOCALE
#undef tolower
#define tolower(c) (tolowertab[(c)])
@@ -150,7 +152,7 @@ extern u_char tolowertab[], touppertab[];
#undef isupper
#undef isspace
#undef iscntrl
#endif
extern unsigned char char_atribs[];
#define PRINT 1
@@ -168,8 +170,9 @@ extern unsigned char char_atribs[];
#define KLINE_EXCEPT 3
#endif
#define iscntrl(c) (char_atribs[(u_char)(c)]&CNTRL)
#define isallowed(c) (char_atribs[(u_char)(c)]&ALLOW)
#ifndef USE_LOCALE
#define iscntrl(c) (char_atribs[(u_char)(c)]&CNTRL)
#define isalpha(c) (char_atribs[(u_char)(c)]&ALPHA)
#define isspace(c) (char_atribs[(u_char)(c)]&SPACE)
#define islower(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) > 0x5f))
@@ -182,8 +185,15 @@ extern unsigned char char_atribs[];
#define isascii(c) ((u_char)(c) >= 0 && (u_char)(c) <= 0x7f)
#define isgraph(c) ((char_atribs[(u_char)(c)]&PRINT) && ((u_char)(c) != 0x32))
#define ispunct(c) (!(char_atribs[(u_char)(c)]&(CNTRL|ALPHA|DIGIT)))
#endif
// #ifndef DMALLOC
extern char *MyMalloc();
// #else
// #define MyMalloc malloc
// #define MyRealloc realloc
// #define MyFree free
// #endif
extern void flush_connections();
extern struct SLink *find_user_link(/* struct SLink *, struct Client * */);
@@ -192,7 +202,7 @@ extern struct SLink *find_user_link(/* struct SLink *, struct Client * */);
* you are doing.
*/
#define PROTOCTL_CLIENT "TOKEN WATCH=128 SAFELIST HCN PREFIX=@+%"
#define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2"
#define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 ALN"
#ifdef _WIN32
/*
+50 -33
View File
@@ -1,5 +1,5 @@
/*
* IRC - Internet Relay Chat, include/config.h
* Unreal Internet Relay Chat Daemon, include/config.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* $Id$
@@ -81,37 +81,12 @@
*/
#undef CONFROOM_JAVA_PORT
/*
REMOVE_ADVERTISING -ice
If you send a text to a user like "irc.roxnet.org" it will show up as "irc.******.org"
Off by default --stskeeps
*/
#undef REMOVE_ADVERTISING
/*
UnrealIRCd WebTV support
*/
#undef WEBTV
#ifdef WEBTV
/* enable /msg irc user */
#define WEBTV_IRCUSER
/* NOTICE's dont exist (except from server) */
#define WEBTV_NONOTICE
#endif
/*
dog3/comstud ircd fdlists
undef this to make them work
*/
#undef NO_FDLIST
/*
OPER_NO_HIDING
This makes +I an unexisting mode
On by default --stskeeps
*/
#undef OPER_NO_HIDING
/*
* Admin's chat...
@@ -123,6 +98,12 @@
*/
#define REMOTE_REHASH
/*
Ident checking
#define this to disable ident checking
*/
#undef NO_IDENT_CHECKING
/*
* No spoof code
*
@@ -182,6 +163,18 @@
#define NICK_DELAY 15 /* recommended value 15 */
/*
** Freelinks garbage collector -Stskeeps
**
** GARBAGE_COLLECT_EVERY - how many seconds between every garbage collect
** HOW_MANY_FREELINKS_ALLOWED - how many freelinks allowed
*/
#ifndef GARBAGE_COLLECT_EVERY
#define GARBAGE_COLLECT_EVERY 600 /* default: 600 (10 mins) */
#endif
#define HOW_MANY_FREELINKS_ALLOWED 200 /* default: 200 */
/*
* Define this if you wish to output a *file* to a K lined client rather
* than the K line comment (the comment field is treated as a filename)
@@ -244,6 +237,7 @@
#define PPATH "ircd.pid" /* file for server pid */
#define lPATH "ircd.log" /* server log file */
#define VPATH "ircd.svsmotd" /* Services MOTD append. */
#define BPATH "bot.motd" /* Bot MOTD */
#define IRCDTUNE "ircd.tune" /* tuning .. */
/*
@@ -407,8 +401,27 @@
* define IRC_UID to that UID. This should only be defined if you are running
* as root and even then perhaps not.
*/
/* #undef IRC_UID /* */
/* #undef IRC_GID /* */
/*
* Ok this one is being changed. it is advisable never to run anything that
* uses sockets etc. and has the potential for the outside world to connect to it
* to run as root... Hackers do things like buffer overruns, and get dumped on
* a shell with root access effectivley ... so DONT do it.. if a program uses a
* port <1024 it will run as root, once the program has binded to the socket it
* will set its uid to something OTHER than root ... you set that in unrealircd.conf
*
* If you _must_ insist on running as root and not wanting the program to change its
* UID, then define BIG_SECURITY_HOLE below
*/
#if !defined(_WIN32) && !defined(_AMIGA)
/* Change This Line Below \/ */
#define BIG_SECURITY_HOLE
/* Its the one above ^^^^^^^ */
#ifndef BIG_SECUTIRY_HOLE
#define IRC_UID un_uid
#define IRC_GID un_gid
#endif
#endif
/*
* CLIENT_FLOOD
@@ -568,7 +581,7 @@
* CONNECTTIMEOUT - 10 seconds for its host to respond to an ident lookup
* query and for a DNS answer to be retrieved.
*/
#define CONNECTTIMEOUT 90 /* Recommended value: 90 */
#define CONNECTTIMEOUT 60 /* Recommended value: 60 */
/*
* Max time from the nickname change that still causes KILL
@@ -576,10 +589,6 @@
*/
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/*
* Max number of channels a user is allowed to join.
*/
#define MAXCHANNELSPERUSER 10 /* Recommended value: 10 */
/*
* SendQ-Always causes the server to put all outbound data into the sendq and
@@ -717,6 +726,7 @@ error CLIENT_FLOOD needs redefining.
#else
error CLIENT_FLOOD undefined
#endif
#if (NICKNAMEHISTORYLENGTH < 100)
# define NICKNAMEHISTORYLENGTH 100
#endif
@@ -737,6 +747,13 @@ error CLIENT_FLOOD undefined
*/
# define BSD_INCLUDES
#endif
/*
* This is just to make Solaris porting easier -- codemastr
*/
#if defined(SOL20) || defined(SOL25) || defined(SOL26) || defined(SOL27)
#define _SOLARIS
#endif
/*
* Cleaup for WIN32 platform.
+1 -1
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/dbuf.h
* Unreal Internet Relay Chat Daemon, include/dbuf.h
* Copyright (C) 1990 Markku Savela
*
* This program is free software; you can redistribute it and/or modify
+36 -18
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/dynconf.h
* Unreal Internet Relay Chat Daemon, include/dynconf.h
* Copyright (C) 1999 Carsten Munk
*
* This program is free software; you can redistribute it and/or modify
@@ -21,8 +21,14 @@
#define DYNCONF_H
/* config level */
#define DYNCONF_CONF_VERSION "1.5"
#define DYNCONF_NETWORK_VERSION "2.2"
typedef struct zNetwork aNetwork;
struct zNetwork {
unsigned x_inah : 1;
char *x_ircnetwork;
char *x_defserv;
char *x_services_name;
@@ -37,30 +43,34 @@ struct zNetwork {
char *x_netdomain;
char *x_helpchan;
char *x_stats_server;
int x_halfhub;
int x_inah;
char *x_net_quit;
int x_se;
};
typedef struct zConfiguration aConfiguration;
struct zConfiguration {
long nospoof_seed01;
long nospoof_seed02;
unsigned som : 1;
unsigned mode_x : 1;
unsigned mode_i : 1;
unsigned mode_stripbadwords : 1;
unsigned truehub : 1;
unsigned stop : 1;
unsigned showopers : 1;
unsigned killdiff : 1;
unsigned hide_ulines : 1;
unsigned allow_chatops : 1;
unsigned webtv_support : 1;
unsigned no_oper_hiding : 1;
/* long nospoof_seed01;
long nospoof_seed02; */
long host_timeout;
int host_retries;
char *kline_address;
char *include;
char *domainname;
char *domainmask; /* '*' + domainname */
int som;
int mode_x;
int mode_i;
int truehub;
int stop;
int showopers;
int killdiff;
int hide_ulines;
int allow_chatops;
char *auto_join_chans;
char *oper_auto_join_chans;
int socksbantime;
int maxchannelsperuser;
char *socksbanmessage;
char *socksquitmessage;
aNetwork network;
@@ -77,12 +87,20 @@ extern aConfiguration iConf;
#define DOMAINNAMEMASK "*" DOMAINNAME
#define MODE_X iConf.mode_x
#define MODE_I iConf.mode_i
#define MODE_STRIPWORDS iConf.mode_stripbadwords
#define TRUEHUB iConf.truehub
#define SHOWOPERS iConf.showopers
#define KILLDIFF iConf.killdiff
#define SHOWOPERMOTD iConf.som
#define HIDE_ULINES iConf.hide_ulines
#define ALLOW_CHATOPS iConf.allow_chatops
#define ALLOW_CHATOPS iConf.allow_chatops
#define MAXCHANNELSPERUSER iConf.maxchannelsperuser
#define WEBTV_SUPPORT iConf.webtv_support
#define NO_OPER_HIDING iConf.no_oper_hiding
#define AUTO_JOIN_CHANS iConf.auto_join_chans
#define OPER_AUTO_JOIN_CHANS iConf.oper_auto_join_chans
#define HOST_TIMEOUT iConf.host_timeout
#define HOST_RETRIES iConf.host_retries
#define ircnetwork iConf.network.x_ircnetwork
#define defserv iConf.network.x_defserv
@@ -100,4 +118,4 @@ extern aConfiguration iConf;
#define STATS_SERVER iConf.network.x_stats_server
#define iNAH iConf.network.x_inah
#define net_quit iConf.network.x_net_quit
#define STOPSE iConf.network.x_se
#define STOPSE iConf.network.x_se
+12 -8
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/h.h
* Unreal Internet Relay Chat Daemon, include/h.h
* Copyright (C) 1992 Darren Reed
*
* This program is free software; you can redistribute it and/or modify
@@ -74,6 +74,7 @@ extern int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns,
extern int R_do_socks,
R_good_socks, R_no_socks;
#endif
#endif
extern aChannel *find_channel PROTO((char *, aChannel *));
extern void remove_user_from_channel PROTO((aClient *, aChannel *));
@@ -100,6 +101,7 @@ extern aClient *find_person PROTO((char *, aClient *));
extern aClient *find_server PROTO((char *, aClient *));
extern aClient *find_service PROTO((char *, aClient *));
extern char *find_or_add PROTO((char *));
extern int attach_conf PROTO((aClient *, aConfItem *));
extern aConfItem *attach_confs PROTO((aClient*, char *, int));
extern aConfItem *attach_confs_host PROTO((aClient*, char *, int));
@@ -132,6 +134,7 @@ extern void reset_help PROTO(());
extern int find_exception(char *); /* hidden host */
extern char *MyMalloc PROTO((int)), *MyRealloc PROTO((char *, int));
extern char *debugmode, *configfile, *sbrk0;
extern char *getfield PROTO((char *));
extern void get_sockhost PROTO((aClient *, char *));
@@ -315,16 +318,13 @@ extern int hash_del_notify_list PROTO((aClient *));
extern void count_watch_memory PROTO((int *, u_long *));
extern aNotify *hash_get_notify PROTO((char *));
extern aChannel *hash_get_chan_bucket PROTO((int));
extern aChannel *hash_find_channel PROTO((char *, aChannel *));
extern aClient *hash_find_client PROTO((char *, aClient *));
extern aClient *hash_find_nickserver PROTO((char *, aClient *));
extern aClient *hash_find_server PROTO((char *, aClient *));
extern void add_history PROTO((aClient *));
extern aClient *get_history PROTO((char *, time_t));
extern void initwhowas PROTO(());
extern void off_history PROTO((aClient *));
extern char *find_by_aln PROTO((char *));
extern char *convert2aln PROTO((int));
extern int convertfromaln PROTO((char *));
extern char *find_server_aln PROTO((char *));
extern int dopacket PROTO((aClient *, char *, int));
/*VARARGS2*/
@@ -335,6 +335,10 @@ extern void send_listinfo PROTO((aClient *, char *));
extern void count_memory PROTO((aClient *, char *));
#endif
#ifdef INET6
extern char *inetntop(int af, const void *in, char *local_dummy, size_t the_size);
#endif
char *crule_parse PROTO((char *));
int crule_eval PROTO((char *));
void crule_free PROTO((char **));
+38 -20
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/hash.h
* Unreal Internet Relay Chat Daemon, include/hash.h
* Copyright (C) 1991 Darren Reed
*
* This program is free software; you can redistribute it and/or modify
@@ -22,27 +22,45 @@
#ifndef __hash_include__
#define __hash_include__
/* Ditch the stats if not running in debugmode */
#ifdef DEBUGMODE
typedef struct hashentry {
int hits;
int links;
void *list;
} aHashEntry;
#else /* DEBUGMODE */
typedef void *aHashEntry;
#endif /* DEBUGMODE */
typedef struct hashentry {
int hits;
int links;
void *list;
} aHashEntry;
#ifndef DEBUGMODE
#define HASHSIZE 32003 /* prime number */
#define CHANNELHASHSIZE 10007 /* prime number */
#else
extern int HASHSIZE;
extern int CHANNELHASHSIZE;
#endif
/* Taner had BITS_PER_COL 4 BITS_PER_COL_MASK 0xF - Dianora */
#define NOTIFYHASHSIZE 10007 /* prime number */
#define BITS_PER_COL 3
#define BITS_PER_COL_MASK 0x7
#define MAX_SUB (1<<BITS_PER_COL)
#define NullChn ((aChannel *)0)
/* Client hash table
* used in hash.c
*/
#define U_MAX_INITIAL 8192
#define U_MAX_INITIAL_MASK (U_MAX_INITIAL-1)
#define U_MAX (U_MAX_INITIAL*MAX_SUB)
/* Channel hash table
* used in hash.c
*/
#define CH_MAX_INITIAL 2048
#define CH_MAX_INITIAL_MASK (CH_MAX_INITIAL-1)
#define CH_MAX (CH_MAX_INITIAL*MAX_SUB)
/* Who was hash table
* used in whowas.c
*/
#define WW_MAX_INITIAL 16
#define WW_MAX_INITIAL_MASK (WW_MAX_INITIAL-1)
#define WW_MAX (WW_MAX_INITIAL*MAX_SUB)
#define NOTIFYHASHSIZE 10007 /* prime number */
#define NullChn ((aChannel *)0)
#define find_channel hash_find_channel
#endif /* __hash_include__ */
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* IRC - Internet Relay Chat, include/license.h
* Unreal Internet Relay Chat Daemon, include/license.h
* Copyright (C) 1999 Carsten Munk
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* This file may not be removed from the IRCd package.
* It will be a violation of copyright. This program must always
* stay free and not be sold, or charged.
* It will be a violation of copyright.
*
* $Id$
*/
+39 -27
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/msg.h
* Unreal Internet Relay Chat Daemon, include/msg.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -91,7 +91,6 @@
#define TOK_USERS "3" /* 51 */
#define MSG_HELP "HELP" /* HELP */
#define MSG_HELPOP "HELPOP" /* HELP */
#define MSG_IRCDHELP "IRCDHELP" /* HELP */
#define TOK_HELP "4" /* 52 */
#define MSG_ERROR "ERROR" /* ERRO */
#define TOK_ERROR "5" /* 53 */
@@ -266,8 +265,6 @@
#define TOK_ADDOMOTD "AR"
#define MSG_SVSMOTD "SVSMOTD"
#define TOK_SVSMOTD "AS"
#define MSG_DUSERS "DUSERS"
#define TOK_DUSERS "AT"
#define MSG_SMO "SMO"
#define TOK_SMO "AU"
#define MSG_OPERMOTD "OPERMOTD"
@@ -300,8 +297,17 @@
#define TOK_REMGLINE "BG"
#define MSG_HTM "HTM"
#define TOK_HTM "BH"
#define MAXPARA 15
#define MSG_UMODE2 "UMODE2"
#define TOK_UMODE2 "|"
#define MSG_DCCDENY "DCCDENY"
#define TOK_DCCDENY "BI"
#define MSG_UNDCCDENY "UNDCCDENY"
#define TOK_UNDCCDENY "BJ"
#define MSG_CHGNAME "CHGNAME"
#define MSG_SVSNAME "SVSNAME"
#define TOK_CHGNAME "BK"
#define MAXPARA 15
extern int m_private(), m_topic(), m_join(), m_part(), m_mode(), m_svsmode();
extern int m_ping(), m_pong(), m_wallops(), m_kick(), m_svsnick();
@@ -332,45 +338,51 @@ extern int m_sethost(), m_nachat(), m_techat(), m_setident(), m_setname();
extern int m_lag(), m_sdesc(), m_knock(), m_credits();
extern int m_license(), m_chghost(), m_rping(), m_rpong();
extern int m_netinfo(), m_sendumode(), m_addmotd(), m_addomotd();
extern int m_svsmotd(), m_dusers(), m_opermotd(), m_tsctl();
extern int m_svsmotd(), m_opermotd(), m_tsctl();
extern int m_svsjoin(), m_sajoin(), m_svspart(), m_sapart();
extern int m_chgident(), m_swhois(), m_svso(), m_svsfline();
extern int m_tkl(), m_vhost(), m_botmotd(), m_sjoin(), m_htm();
extern int m_umode2(), m_dccdeny(), m_undccdeny();
extern int m_chgname();
#ifdef MSGTAB
struct Message *msgmap[256];
struct Message msgtab[] = {
{ MSG_PRIVATE, m_private, 0, MAXPARA, 1, TOK_PRIVATE, 0L },
{ MSG_NICK, m_nick, 0, MAXPARA, 1, TOK_NICK, 0L },
{ MSG_NOTICE, m_notice, 0, MAXPARA, 1, TOK_NOTICE, 0L },
{ MSG_JOIN, m_join, 0, MAXPARA, 1, TOK_JOIN, 0L },
{ MSG_MODE, m_mode, 0, MAXPARA, 1, TOK_MODE, 0L },
{ MSG_QUIT, m_quit, 0, MAXPARA, 1, TOK_QUIT, 0L },
{ MSG_NICK, m_nick, 0, MAXPARA, 1, TOK_NICK, 0L },
{ MSG_JOIN, m_join, 0, MAXPARA, 1, TOK_JOIN, 0L },
{ MSG_PING, m_ping, 0, MAXPARA, 1, TOK_PING, 0L },
{ MSG_WHOIS, m_whois, 0, MAXPARA, 1, TOK_WHOIS, 0L },
{ MSG_ISON, m_ison, 0, 1, 1, TOK_ISON, 0L },
{ MSG_USER, m_user, 0, MAXPARA, 1, TOK_USER, 0L },
{ MSG_PONG, m_pong, 0, MAXPARA, 1, TOK_PONG, 0L },
{ MSG_PART, m_part, 0, MAXPARA, 1, TOK_PART, 0L },
{ MSG_QUIT, m_quit, 0, MAXPARA, 1, TOK_QUIT, 0L },
{ MSG_WATCH, m_watch, 0, 1, 1, TOK_WATCH, 0L },
{ MSG_USERHOST,m_userhost, 0, 1, 1, TOK_USERHOST,0L },
{ MSG_SVSNICK, m_svsnick, 0, MAXPARA, 1, TOK_SVSNICK, 0L },
{ MSG_SVSMODE, m_svsmode, 0, MAXPARA, 1, TOK_SVSMODE, 0L },
{ MSG_LUSERS, m_lusers, 0, MAXPARA, 1, TOK_LUSERS, 0L },
{ MSG_IDENTIFY,m_identify, 0, 1, 1, TOK_IDENTIFY,0L },
{ MSG_CHANSERV,m_chanserv, 0, 1, 1, TOK_CHANSERV,0L },
{ MSG_TOPIC, m_topic, 0, MAXPARA, 1, TOK_TOPIC, 0L },
{ MSG_INVITE, m_invite, 0, MAXPARA, 1, TOK_INVITE, 0L },
{ MSG_KICK, m_kick, 0, MAXPARA, 1, TOK_KICK, 0L },
{ MSG_WALLOPS, m_wallops, 0, 1, 1, TOK_WALLOPS, 0L },
{ MSG_PING, m_ping, 0, MAXPARA, 1, TOK_PING, 0L },
{ MSG_PONG, m_pong, 0, MAXPARA, 1, TOK_PONG, 0L },
{ MSG_ERROR, m_error, 0, MAXPARA, 1, TOK_ERROR, 0L },
{ MSG_KILL, m_kill, 0, MAXPARA, 1, TOK_KILL, 0L },
{ MSG_PROTOCTL,m_protoctl, 0, MAXPARA, 1, TOK_PROTOCTL,0L },
{ MSG_USER, m_user, 0, MAXPARA, 1, TOK_USER, 0L },
{ MSG_AWAY, m_away, 0, MAXPARA, 1, TOK_AWAY, 0L },
{ MSG_ISON, m_ison, 0, 1, 1, TOK_ISON, 0L },
{ MSG_WATCH, m_watch, 0, 1, 1, TOK_WATCH, 0L },
{ MSG_SERVER, m_server, 0, MAXPARA, 1, TOK_SERVER, 0L },
{ MSG_SQUIT, m_squit, 0, MAXPARA, 1, TOK_SQUIT, 0L },
{ MSG_WHOIS, m_whois, 0, MAXPARA, 1, TOK_WHOIS, 0L },
{ MSG_WHO, m_who, 0, MAXPARA, 1, TOK_WHO, 0L },
{ MSG_WHOWAS, m_whowas, 0, MAXPARA, 1, TOK_WHOWAS, 0L },
{ MSG_LIST, m_list, 0, MAXPARA, 1, TOK_LIST, 0L },
{ MSG_NAMES, m_names, 0, MAXPARA, 1, TOK_NAMES, 0L },
{ MSG_USERHOST,m_userhost, 0, 1, 1, TOK_USERHOST,0L },
{ MSG_TRACE, m_trace, 0, MAXPARA, 1, TOK_TRACE, 0L },
{ MSG_PASS, m_pass, 0, MAXPARA, 1, TOK_PASS, 0L },
{ MSG_LUSERS, m_lusers, 0, MAXPARA, 1, TOK_LUSERS, 0L },
{ MSG_TIME, m_time, 0, MAXPARA, 1, TOK_TIME, 0L },
{ MSG_OPER, m_oper, 0, MAXPARA, 1, TOK_OPER, 0L },
{ MSG_CONNECT, m_connect, 0, MAXPARA, 1, TOK_CONNECT, 0L },
@@ -379,23 +391,19 @@ struct Message msgtab[] = {
{ MSG_LINKS, m_links, 0, MAXPARA, 1, TOK_LINKS, 0L },
{ MSG_ADMIN, m_admin, 0, MAXPARA, 1, TOK_ADMIN, 0L },
{ MSG_USERS, m_users, 0, MAXPARA, 1, TOK_USERS, 0L },
{ MSG_SVSMODE, m_svsmode, 0, MAXPARA, 1, TOK_SVSMODE, 0L },
{ MSG_SAMODE, m_samode, 0, MAXPARA, 1, TOK_SAMODE, 0L },
{ MSG_SVSKILL, m_svskill, 0, MAXPARA, 1, TOK_SVSKILL, 0L },
{ MSG_SVSNICK, m_svsnick, 0, MAXPARA, 1, TOK_SVSNICK, 0L },
{ MSG_SVSNOOP, m_svsnoop, 0, MAXPARA, 1, TOK_SVSNOOP, 0L },
{ MSG_CHANSERV,m_chanserv, 0, 1, 1, TOK_CHANSERV,0L },
/* { MSG_CS, m_noshortc, 0, 1, 1, TOK_CHANSERV,0L }, */
{ MSG_CS, m_chanserv, 0, 1, 1, TOK_CHANSERV,0L },
{ MSG_NICKSERV,m_nickserv, 0, 1, 1, TOK_NICKSERV,0L },
/* { MSG_NS, m_noshortn, 0, 1, 1, TOK_NICKSERV,0L }, */
{ MSG_NS, m_nickserv, 0, 1, 1, TOK_NICKSERV,0L },
{ MSG_OPERSERV,m_operserv, 0, 1, 1, TOK_OPERSERV,0L },
/* { MSG_OS, m_noshorto, 0, 1, 1, TOK_OPERSERV,0L }, */
{ MSG_OS, m_operserv, 0, 1, 1, TOK_OPERSERV,0L },
{ MSG_MEMOSERV,m_memoserv, 0, 1, 1, TOK_MEMOSERV,0L },
/*{ MSG_MS, m_noshortm, 0, 1, 1, TOK_MEMOSERV,0L }, */
{ MSG_MS, m_memoserv, 0, 1, 1, TOK_MEMOSERV,0L },
{ MSG_HELPSERV,m_helpserv, 0, 1, 1, TOK_HELPSERV,0L },
/* { MSG_HS, m_noshorth, 0, 1, 1, TOK_HELPSERV,0L }, */
{ MSG_HS, m_helpserv, 0, 1, 1, TOK_HELPSERV,0L },
{ MSG_SERVICES,m_services, 0, 1, 1, TOK_SERVICES,0L },
{ MSG_IDENTIFY,m_identify, 0, 1, 1, TOK_IDENTIFY,0L },
{ MSG_SUMMON, m_summon, 0, MAXPARA, 1, TOK_SUMMON, 0L },
{ MSG_HELP, m_help, 0, 1, 1, TOK_HELP, 0L },
{ MSG_HELPOP, m_help, 0, 1, 1, TOK_HELP, 0L },
@@ -450,7 +458,6 @@ struct Message msgtab[] = {
{ MSG_ADDMOTD, m_addmotd, 0, 1, 1, TOK_ADDMOTD, 0L},
{ MSG_ADDOMOTD, m_addomotd, 0, 1, 1, TOK_ADDOMOTD, 0L},
{ MSG_SVSMOTD, m_svsmotd, 0, MAXPARA, 1, TOK_SVSMOTD, 0L},
{ MSG_DUSERS, m_dusers, 0, MAXPARA, 1, TOK_DUSERS, 0L},
{ MSG_OPERMOTD, m_opermotd, 0, MAXPARA, 1, TOK_OPERMOTD, 0L},
{ MSG_TSCTL, m_tsctl, 0, MAXPARA, 1, TOK_TSCTL, 0L},
{ MSG_SVSJOIN, m_svsjoin, 0, MAXPARA, 1, TOK_SVSJOIN, 0L},
@@ -466,6 +473,11 @@ struct Message msgtab[] = {
{ MSG_BOTMOTD, m_botmotd, 0, MAXPARA,1,TOK_BOTMOTD,0L},
{ MSG_SJOIN, m_sjoin, 0, MAXPARA, 1, TOK_SJOIN,0L},
{ MSG_HTM, m_htm, 0, MAXPARA, 1, TOK_HTM, 0L},
{ MSG_UMODE2, m_umode2, 0, MAXPARA, 1, TOK_UMODE2, 0L},
{ MSG_DCCDENY,m_dccdeny, 0, 2, 1, TOK_DCCDENY,0L },
{ MSG_UNDCCDENY,m_undccdeny, 0, MAXPARA, 1, TOK_UNDCCDENY,0L },
{ MSG_CHGNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L},
{ MSG_SVSNAME, m_chgname, 0, MAXPARA, 1, TOK_CHGNAME, 0L},
{ (char *) 0, (int (*)()) 0 , 0, 0, 0, 0, 0L}
};
+22 -2
View File
@@ -88,6 +88,26 @@
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
#define T_RP 17 /* responsible person */
#define T_AFSDB 18 /* AFS cell database */
#define T_X25 19 /* X_25 calling address */
#define T_ISDN 20 /* ISDN calling address */
#define T_RT 21 /* router */
#define T_NSAP 22 /* NSAP address */
#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
#define T_SIG 24 /* security signature */
#define T_KEY 25 /* security key */
#define T_PX 26 /* X.400 mail mapping */
#define T_GPOS 27 /* geographical position (withdrawn) */
#define T_AAAA 28 /* IP6 Address */
#define T_LOC 29 /* Location Information */
#define T_NXT 30 /* Next Valid Name in Zone */
#define T_EID 31 /* Endpoint identifier */
#define T_NIMLOC 32 /* Nimrod locator */
#define T_SRV 33 /* Server selection */
#define T_ATMA 34 /* ATM Address */
#define T_NAPTR 35 /* Naming Authority PoinTeR */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
@@ -130,10 +150,10 @@
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
#if defined(sel) || defined(mc68000) || defined(sparc) || \
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
defined(MIPSEB) || defined(__hpux) || defined(__convex__) || \
defined(__pyr__) || defined(__mc68000__) || defined(__sparc__) ||\
defined(__mc68000__) || defined(__sparc__) ||\
defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT)
#define BYTE_ORDER BIG_ENDIAN
#endif
+11 -4
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/numeric.h
* Unreal Internet Relay Chat Daemon, include/numeric.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* This program is free software; you can redistribute it and/or modify
@@ -112,6 +112,8 @@
#define ERR_ATTACKDENY 484
#define ERR_KILLDENY 485
#define ERR_HTMDISABLED 486
#define ERR_NOOPERHOST 491
#define ERR_NOSERVICEHOST 492
@@ -206,6 +208,10 @@
#define RPL_YOURESERVICE 383
#define RPL_MYPORTIS 384
#define RPL_NOTOPERANYMORE 385
#define RPL_QLIST 386
#define RPL_ENDOFQLIST 387
#define RPL_ALIST 388
#define RPL_ENDOFALIST 389
#define RPL_TIME 391
#define RPL_USERSSTART 392
@@ -217,6 +223,7 @@
#define RPL_TRACECONNECTING 201
#define RPL_TRACEHANDSHAKE 202
#define RPL_TRACEUNKNOWN 203
#define RPL_TRACEOPERATOR 204
#define RPL_TRACEUSER 205
#define RPL_TRACESERVER 206
@@ -227,7 +234,6 @@
#define RPL_STATSLINKINFO 211
#define RPL_STATSCOMMANDS 212
#define RPL_STATSCLINE 213
#define RPL_STATSNLINE 214
#define RPL_STATSILINE 215
#define RPL_STATSKLINE 216
#define RPL_STATSQLINE 217
@@ -235,10 +241,13 @@
#define RPL_ENDOFSTATS 219
#define RPL_STATSBLINE 220
#define RPL_UMODEIS 221
#define RPL_SQLINE_NICK 222
#define RPL_STATSGLINE 223
#define RPL_STATSTLINE 224
#define RPL_STATSELINE 225
#define RPL_STATSNLINE 226
#define RPL_SERVICEINFO 231
#define RPL_RULES 232
#define RPL_SERVICE 233
@@ -266,13 +275,11 @@
#define RPL_ADMINEMAIL 259
#define RPL_TRACELOG 261
#define RPL_LOCALUSERS 265
#define RPL_GLOBALUSERS 266
#define RPL_SILELIST 271
#define RPL_ENDOFSILELIST 272
#define RPL_STATSDLINE 275
#define RPL_HELPHDR 290
-14
View File
@@ -1,14 +0,0 @@
/*
* Relinfo.h
*
* If anyone makes another release or a hybrid of Unreal
* PLEASE CHANGE RELEASEID2 to the current time(NULL) (date +%s)
* if another hybrid please change releaseprefix
* if a unreal special edtion please select an IDTAG for it
* - Stskeeps -
*/
#include "stamp.h"
#define RELEASEPREFIX "unrealircd"
#define RELEASEIDTAG "000"
#define RELEASEID RELEASEPREFIX "[" RELEASESTUFF "(" RELEASEID2 "/" RELEASEIDTAG ")]"
+2 -2
View File
@@ -23,7 +23,7 @@ struct hent {
int h_addrtype; /* host address type */
int h_length; /* length of address */
/* list of addresses from name server */
struct in_addr h_addr_list[MAXADDRS];
struct IN_ADDR h_addr_list[MAXADDRS];
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
@@ -38,7 +38,7 @@ typedef struct reslist {
char resend; /* send flag. 0 == dont resend */
time_t sentat;
time_t timeout;
struct in_addr addr;
struct IN_ADDR addr;
char *name;
struct reslist *next;
Link cinfo;
+1 -1
View File
@@ -46,7 +46,7 @@ struct state {
int retry; /* number of times to retransmit */
long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
struct SOCKADDR_IN nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
unsigned short id; /* current packet id */
char defdname[MAXDNAME]; /* default domain */
+1 -1
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/sjoin.h
* Unreal Internet Relay Chat Daemon, include/sjoin.h
* (C) Carsten Munk 2000
* Contains code from StarChat IRCd, (C) their respective authors
*
+4 -1
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/sock.h
* Unreal Internet Relay Chat Daemon, include/sock.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -22,6 +22,9 @@
* $Id$
*
* $Log$
* Revision 1.2 2000/03/02 21:22:37 stskeeps
* ...........
*
* Revision 1.1.1.1 2000/01/30 12:16:33 stskeeps
* Begin of CVS at cvs.unreal.sourceforge.net
*
+1 -1
View File
@@ -1,4 +1,4 @@
/* Auto created release stamping */
#define RELEASEID2 "951777936"
#define RELEASEID2 "959378517"
#define RELEASESTUFF "draconic"
+88 -39
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, include/struct.h
* Unreal Internet Relay Chat Daemon, include/struct.h
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -26,7 +26,7 @@
#include "config.h"
#include "common.h"
#include "sys.h"
#include "hash.h"
#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
@@ -43,9 +43,6 @@
# include <sys/syslog.h>
# endif
#endif
#ifdef pyr
#include <sys/time.h>
#endif
typedef struct t_fline aFline;
typedef struct t_crline aCRline;
@@ -67,6 +64,9 @@ typedef struct SMode Mode;
typedef struct ListOptions LOpts;
typedef struct FloodOpt aFloodOpt;
typedef struct CloneItem aClone;
typedef struct ircstatsx ircstats;
typedef struct MotdItem aMotd;
typedef struct trecord aTrecord;
#ifdef NEED_U_INT32_T
typedef unsigned int u_int32_t; /* XXX Hope this works! */
@@ -110,10 +110,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
#ifdef USE_SERVICES
#include "service.h"
#endif
/* NOTE: this must be down here so the stuff from struct.h IT uses works */
#include "whowas.h"
@@ -240,14 +236,14 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define UMODE_CODER 0x800000 /* User is a network coder */
#define UMODE_FCLIENT 0x1000000 /* recieve client on far connects.. */
#define UMODE_HIDING 0x2000000 /* Totally invisible .. */
#define UMODE_AGENT 0x4000000 /* Is an IRCd Agent local only */
#define UMODE_VICTIM 0x8000000 /* Intentional Victim */
#define UMODE_DEAF 0x10000000
#define UMODE_HIDEOPER 0x20000000 /* Hide oper mode */
#define UMODE_SETHOST 0x40000000 /* used sethost */
#define UMODE_SETHOST 0x40000000 /* used sethost */
#define UMODE_STRIPBADWORDS 0x80000000 /* */
#define SEND_UMODES (UMODE_INVISIBLE|UMODE_OPER|UMODE_WALLOP|UMODE_FAILOP|UMODE_HELPOP|UMODE_REGNICK|UMODE_SADMIN|UMODE_NETADMIN|UMODE_TECHADMIN|UMODE_COADMIN|UMODE_ADMIN|UMODE_SERVICES|UMODE_HIDE|UMODE_EYES|UMODE_WHOIS|UMODE_KIX|UMODE_BOT|UMODE_CODER|UMODE_FCLIENT|UMODE_HIDING|UMODE_AGENT|UMODE_DEAF|UMODE_VICTIM|UMODE_HIDEOPER|UMODE_SETHOST)
#define ALL_UMODES (SEND_UMODES|UMODE_SERVNOTICE|UMODE_LOCOP|UMODE_KILLS|UMODE_CLIENT|UMODE_FLOOD|UMODE_CHATOP|UMODE_SERVICES|UMODE_EYES|UMODE_AGENT)
#define SEND_UMODES (UMODE_INVISIBLE|UMODE_OPER|UMODE_WALLOP|UMODE_FAILOP|UMODE_HELPOP|UMODE_REGNICK|UMODE_SADMIN|UMODE_NETADMIN|UMODE_TECHADMIN|UMODE_COADMIN|UMODE_ADMIN|UMODE_SERVICES|UMODE_HIDE|UMODE_EYES|UMODE_WHOIS|UMODE_KIX|UMODE_BOT|UMODE_CODER|UMODE_FCLIENT|UMODE_HIDING|UMODE_DEAF|UMODE_VICTIM|UMODE_HIDEOPER|UMODE_SETHOST|UMODE_STRIPBADWORDS)
#define ALL_UMODES (SEND_UMODES|UMODE_SERVNOTICE|UMODE_LOCOP|UMODE_KILLS|UMODE_CLIENT|UMODE_FLOOD|UMODE_CHATOP|UMODE_SERVICES|UMODE_EYES)
#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
#define PROTO_NOQUIT 0x1 /* Negotiated NOQUIT protocol */
@@ -255,6 +251,8 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define PROTO_SJOIN 0x4 /* Negotiated SJOIN protocol */
#define PROTO_NICKv2 0x8 /* Negotiated NICKv2 protocol */
#define PROTO_SJOIN2 0x10 /* Negotiated SJOIN2 protocol */
#define PROTO_UMODE2 0x20 /* Negotiated UMODE2 protocol */
#define PROTO_ALN 0x40 /* Negotiated ALN protocol */
/*
* flags macros.
*/
@@ -269,6 +267,11 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define IsHelpOp(x) ((x)->umodes & UMODE_HELPOP)
#define IsAdmin(x) ((x)->umodes & UMODE_ADMIN)
#define IsHiding(x) ((x)->umodes & UMODE_HIDING)
#ifdef STRIPBADWORDS
#define IsFilteringWords(x) ((x)->umodes & UMODE_STRIPBADWORDS)
#endif
#define IsNetAdmin(x) ((x)->umodes & UMODE_NETADMIN)
#define IsTechAdmin(x) ((x)->umodes & UMODE_TECHADMIN)
#define IsCoAdmin(x) ((x)->umodes & UMODE_COADMIN)
@@ -277,7 +280,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define SendChatops(x) ((x)->umodes & UMODE_CHATOP)
#define IsOper(x) ((x)->umodes & UMODE_OPER)
#define IsLocOp(x) ((x)->umodes & UMODE_LOCOP)
#define IsAgent(x) ((x)->umodes & UMODE_AGENT)
#define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE)
#define IsServices(x) ((x)->umodes & UMODE_SERVICES)
#define IsAnOper(x) ((x)->umodes & (UMODE_OPER|UMODE_LOCOP))
@@ -319,7 +321,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define SetHelpOp(x) ((x)->umodes |= UMODE_HELPOP)
#define SetOper(x) ((x)->umodes |= UMODE_OPER)
#define SetLocOp(x) ((x)->umodes |= UMODE_LOCOP)
#define SetAgent(x) ((x)->umodes |= UMODE_AGENT)
#define SetAdmin(x) ((x)->umodes |= UMODE_ADMIN)
#define SetSAdmin(x) ((x)->umodes |= UMODE_SADMIN)
#define SetNetAdmin(x) ((x)->umodes |= UMODE_NETADMIN)
@@ -355,7 +356,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define ClearFailops(x) ((x)->umodes &= ~UMODE_FAILOP)
#define ClearChatops(x) ((x)->umodes &= ~UMODE_CHATOP)
#define ClearOper(x) ((x)->umodes &= ~UMODE_OPER)
#define ClearAgent(x) ((x)->umodes &= ~UMODE_AGENT)
#define ClearInvisible(x) ((x)->umodes &= ~UMODE_INVISIBLE)
#define ClearServices(x) ((x)->umodes &= ~UMODE_SERVICES)
#define ClearWallops(x) ((x)->umodes &= ~UMODE_WALLOP)
@@ -378,12 +378,16 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define SupportSJOIN(x) ((x)->proto & PROTO_SJOIN)
#define SupportNICKv2(x) ((x)->proto & PROTO_NICKv2)
#define SupportSJOIN2(x) ((x)->proto & PROTO_SJOIN2)
#define SupportUMODE2(x) ((x)->proto & PROTO_UMODE2)
#define SupportALN(x) ((x)->proto & PROTO_ALN)
#define SetSJOIN(x) ((x)->proto |= PROTO_SJOIN)
#define SetNoQuit(x) ((x)->proto |= PROTO_NOQUIT)
#define SetToken(x) ((x)->proto |= PROTO_TOKEN)
#define SetNICKv2(x) ((x)->proto |= PROTO_NICKv2)
#define SetSJOIN2(x) ((x)->proto |= PROTO_SJOIN2)
#define SetUMODE2(x) ((x)->proto |= PROTO_UMODE2)
#define SetALN(x) ((x)->proto |= PROTO_ALN)
#define ClearSJOIN(x) ((x)->proto &= ~PROTO_SJOIN)
#define ClearNoQuit(x) ((x)->proto &= ~PROTO_NOQUIT)
@@ -420,7 +424,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define OFLAG_SADMIN 0x01000000 /* services admin gets +a */
#define OFLAG_WHOIS 0x02000000 /* gets auto +W on oper up */
#define OFLAG_HIDE 0x04000000 /* gets auto +x on oper up */
#define OFLAG_AGENT 0x08000000 /* Is an IRCd Agent */
#define OFLAG_AFOUNDER 0x10000000
#define OFLAG_COFOUND 0x20000000
#define OFLAG_WMASTER 0x40000000
@@ -529,6 +532,41 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define CURSES_TERM 1
#define TERMCAP_TERM 2
struct MotdItem {
char line[82];
struct MotdItem *next;
};
/* Hack for T:lines and cached MOTDs */
struct trecord {
char *hostmask;
struct MotdItem *tmotd;
struct MotdItem *trules;
struct tm *tmotd_tm;
struct trecord *next;
};
typedef struct Whowas
{
int hashv;
char *name;
char *username;
char *hostname;
char *virthost;
char *servername;
char *realname;
char *away;
long umodes;
time_t logoff;
struct Client *online; /* Pointer to new nickname for chasing or NULL */
struct Whowas *next; /* for hash table... */
struct Whowas *prev; /* for hash table... */
struct Whowas *cnext; /* for client struct linked list */
struct Whowas *cprev; /* for client struct linked list */
}aWhowas;
struct SqlineItem {
unsigned int status;
char *sqline;
@@ -539,7 +577,7 @@ struct SqlineItem {
struct ConfItem {
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
int clients; /* Number of *LOCAL* clients using this */
struct in_addr ipnum; /* ip number of host field */
struct IN_ADDR ipnum; /* ip number of host field */
char *host;
char *passwd;
char *name;
@@ -583,6 +621,7 @@ struct ConfItem {
#define CONF_EXCEPT 0x4000000 /* K:Line exception */
#define CONF_TLINE 0x8000000 /* T:Line */
#define CONF_SOCKSEXCEPT 0x10000000
#define CONF_NLINE 0x20000000
#define CONF_OPS (CONF_OPERATOR | CONF_LOCOP)
#define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER)
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_SERVICE | CONF_OPS | \
@@ -608,10 +647,10 @@ struct User {
int joined; /* number of channels joined */
char username[USERLEN+1];
char realhost[HOSTLEN+1];
char virthost[HOSTLEN+1];
char server[HOSTLEN+1];
char *virthost;
char *server;
char *swhois; /* special whois thing */
aClient *serv;
aClient *serv;
#ifdef LIST_DEBUG
aClient *bcptr;
@@ -621,12 +660,10 @@ struct User {
struct Server {
struct Server *nexts;
anUser *user; /* who activated this connection */
char up[HOSTLEN+1]; /* uplink for this server */
char *up; /* uplink for this server */
char by[NICKLEN+1];
aConfItem *nline; /* N-line pointer for this server */
time_t timestamp; /* Remotely determined connect try time */
time_t ghost; /* Local time at which a new server caused a Ghost */
u_short prot; /* Major protocol */
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
@@ -674,6 +711,19 @@ struct t_kline {
aTKline *prev;
};
struct ircstatsx {
int clients; /* total */
int invisible; /* invisible */
int servers; /* servers */
int operators; /* operators */
int unknown; /* unknown local connections */
int channels; /* channels */
int me_clients; /* my clients */
int me_servers; /* my servers */
int me_max; /* local max */
int global_max; /* global max */
};
struct t_fline {
char *mask;
char *reason;
@@ -696,15 +746,16 @@ struct t_vhline {
aVHline *next, *prev;
};
#define LISTENER_NORMAL 0x000001
#define LISTENER_CLIENTSONLY 0x000002
#define LISTENER_SERVERSONLY 0x000004
#define LISTENER_REMOTEADMIN 0x000008
#define LISTENER_JAVACLIENT 0x000010
#define LISTENER_MASK 0x000020
struct Client {
struct Client *next, *prev, *hnext;
anUser *user; /* ...defined, if this is a User */
aServer *serv; /* ...defined, if this is a server */
int tag; /* tag */
int iown; /* 1 if mine, 0 if not */
#ifdef USE_SERVICES
aService *service;
#endif
time_t lasttime; /* ...should be only LOCAL clients? --msa */
time_t firsttime; /* time client was created */
time_t since; /* last time we parsed something */
@@ -712,17 +763,16 @@ struct Client {
time_t nextnick; /* Time the next nick change will be allowed */
time_t nexttarget; /* Time until a change in targets is allowed */
u_char targets[MAXTARGETS]; /* Hash values of current targets */
aWhowas *whowas;
long flags; /* client flags */
long umodes; /* client usermodes */
aClient *from; /* == self, if Local Client, *NEVER* NULL! */
int fd; /* >= 0, for local clients */
int hopcount; /* number of servers to this 0 = local */
int curruser; /* Number of users on this server */
short status; /* Client type */
char name[HOSTLEN+1]; /* Unique name of the client, nick or host */
char username[USERLEN+1]; /* username here now for auth stuff */
char info[REALLEN+1]; /* Free form additional client information */
char virthost[HOSTLEN+1]; /* hidden host */
aClient *srvptr; /* Server introducing this. May be &me */
Link *history; /* Whowas linked list */
/*
@@ -758,15 +808,12 @@ struct Client {
#ifdef SOCKSPORT
int socksfd;
#endif
struct in_addr ip; /* keep real ip# too */
struct IN_ADDR ip; /* keep real ip# too */
u_short port; /* and the remote port# too :-) */
struct hostent *hostp;
u_short notifies; /* Keep track of count of notifies */
Link *notify; /* Links to clients notify-structures */
LOpts *lopt; /* Saved /list options */
#ifdef pyr
struct timeval lw;
#endif
char sockhost[HOSTLEN+1]; /* This is the host name from the socket
** and after which the connection was
** accepted.
@@ -914,13 +961,12 @@ struct Channel {
struct Channel *nextch, *prevch, *hnextch;
Mode mode;
time_t creationtime;
char topic[TOPICLEN+1];
char topic_nick[NICKLEN+1];
char *topic;
char *topic_nick;
time_t topic_time;
int users;
Link *members;
Link *invites;
Link *blist;
Ban *banlist;
Ban *exlist; /* exceptions */
char chname[1];
@@ -976,6 +1022,9 @@ struct Channel {
#define MODE_NOINVITE 0x1000000
#define MODE_FLOODLIMIT 0x2000000
#define MODE_NOHIDING 0x4000000
#ifdef STRIPBADWORDS
#define MODE_STRIPBADWORDS 0x8000000
#endif
#define is_halfop is_half_op
/*
* mode flags which take another parameter (With PARAmeterS)
@@ -998,7 +1047,7 @@ struct Channel {
#define PubChannel(x) ((!x) || ((x)->mode.mode &\
(MODE_PRIVATE | MODE_SECRET)) == 0)
#define IsChannelName(name) ((name) && (*(name) == '#' || *(name) == '&' || *(name) == '+'))
#define IsChannelName(name) ((name) && (*(name) == '#'))
#define IsModelessChannel(name) ((name) && (*(name) == '+'))
#define IsMember(blah,chan) ((blah && blah->user && \
+63 -6
View File
@@ -1,5 +1,5 @@
/*
* IRC - Internet Relay Chat, include/sys.h
* Unreal Internet Relay Chat Daemon, include/sys.h
* Copyright (C) 1990 University of Oulu, Computing Center
*
* This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,6 @@
#include <errno.h>
# endif
#endif
#include "setup.h"
#include <stdio.h>
#include <sys/types.h>
@@ -85,8 +84,7 @@ extern char *rindex PROTO((char *, char));
#else
#include <sys/time.h>
#endif
#if !defined(DEBUGMODE)
#if !defined(DEBUGMODE)
# ifndef _WIN32
# define MyFree(x) if ((x) != NULL) free(x)
# else
@@ -95,14 +93,13 @@ extern char *rindex PROTO((char *, char));
#else
#define free(x) MyFree(x)
#endif
#ifdef NEXT
#define VOIDSIG int /* whether signal() returns int of void */
#else
#define VOIDSIG void /* whether signal() returns int of void */
#endif
#ifdef SOL20
#ifdef _SOLARIS
#define OPT_TYPE char /* opt type for get/setsockopt */
#else
#define OPT_TYPE void
@@ -137,5 +134,65 @@ typedef unsigned int u_int;
#ifdef _WIN32
#define MYOSNAME "Win32"
#endif
#ifdef DEBUGMODE
#define ircsprintf sprintf
#define ircvsprintf vsprintf
#endif
/*
* IPv4 or IPv6 structures?
*/
#ifdef INET6
# define AND16(x) ((x)[0]&(x)[1]&(x)[2]&(x)[3]&(x)[4]&(x)[5]&(x)[6]&(x)[7]&(x)[8]&(x)[9]&(x)[10]&(x)[11]&(x)[12]&(x)[13]&(x)[14]&(x)[15])
static unsigned char minus_one[]={ 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 0};
# define WHOSTENTP(x) ((x)[0]|(x)[1]|(x)[2]|(x)[3]|(x)[4]|(x)[5]|(x)[6]|(x)[7]|(x)[8]|(x)[9]|(x)[10]|(x)[11]|(x)[12]|(x)[13]|(x)[14]|(x)[15])
# define AFINET AF_INET6
# define SOCKADDR_IN sockaddr_in6
# define SOCKADDR sockaddr
# define SIN_FAMILY sin6_family
# define SIN_PORT sin6_port
# define SIN_ADDR sin6_addr
# define S_ADDR s6_addr
# define IN_ADDR in6_addr
# ifndef uint32_t
# define uint32_t __u32
# endif
# define MYDUMMY_SIZE 128
char mydummy[MYDUMMY_SIZE];
char mydummy2[MYDUMMY_SIZE];
# if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(bsdi)
# ifndef s6_laddr
# define s6_laddr s6_addr32
# endif
# endif
# if defined(linux)
static const struct in6_addr in6addr_any={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0};
# endif
# define IRCDCONF_DELIMITER '%'
#else
# define AFINET AF_INET
# define SOCKADDR_IN sockaddr_in
# define SOCKADDR sockaddr
# define SIN_FAMILY sin_family
# define SIN_PORT sin_port
# define SIN_ADDR sin_addr
# define S_ADDR s_addr
# define IN_ADDR in_addr
# define WHOSTENTP(x) (x)
# define IRCDCONF_DELIMITER ':'
#endif
#endif /* __sys_include__ */
+1 -1
View File
@@ -2,7 +2,7 @@
* Userload module by Michael L. VanLoon (mlv) <michaelv@iastate.edu>
* Written 2/93. Originally grafted into irc2.7.2g 4/93.
*
* IRC - Internet Relay Chat, ircd/userload.h
* Unreal Internet Relay Chat Daemon, ircd/userload.h
* Copyright (C) 1990 University of Oulu, Computing Center
*
* This program is free software; you can redistribute it and/or modify
+6 -11
View File
@@ -24,24 +24,19 @@
#endif
/**/
#define COMPILEINFO DEBUGMODESET DEBUGSET
#ifndef WEBTV
#define XTRAINFO ""
#else
#define XTRAINFO "(WebTV)"
#endif
/*
* Version Unreal3.0
* Version Unreal3.1
*/
#define UnrealProtocol 2300
#define UnrealProtocol 2301
#define PATCH1 "3"
#define PATCH2 ".0"
#define PATCH3 "-Morrigan"
#define PATCH4 "(fix)"
#define PATCH2 ".1"
#define PATCH3 "-Silverheart"
#define PATCH4 "(beta3)"
#define PATCH5 ""
#define PATCH6 ""
#define PATCH7 ""
#define PATCH8 COMPILEINFO
#define PATCH9 XTRAINFO
#define PATCH9 ""
#ifndef _WIN32
#define BASE_VERSION "Unreal"
+12 -46
View File
@@ -18,58 +18,23 @@
*/
/*
* $Id$
*
* $Log$
* Revision 1.1.1.1 2000/01/30 12:16:34 stskeeps
* Begin of CVS at cvs.unreal.sourceforge.net
*
*
* Revision 1.1.1.1 1999/09/01 23:20:37 stskeeps
*
* Revision 1.1.1.1 1999/07/22 13:56:41 stskeeps
* 16:56 22-07-99 techie
* - Started on using CVS to develop Unreal
*
*
* Revision 1.1.1.1 1999/07/21 10:48:18 stskeeps
* 12:47 GMT+2 21 July 1999 - Techie
* Starting Unreal with CVS..
*
*
* Revision 1.2 1997/12/29 07:17:35 wd
* df4.6.2
* ee CHANGES for updates
* -wd
*
* Revision 1.1.1.1 1997/08/22 17:23:01 donwulff
* Original import from the "deadlined" version.
*
* Revision 1.1.1.1 1996/11/18 07:53:42 explorer
* ircd 4.3.3 -- about time
*
* Revision 1.1.1.1.4.1 1996/09/16 02:45:41 donwulff
* *** empty log message ***
* from original rcs
* $ Id: whowas.h,v 6.1 1991/07/04 21:04:39 gruner stable gruner $
*
* $ Log: whowas.h,v $
* Revision 6.1 1991/07/04 21:04:39 gruner
* Revision 2.6.1 [released]
*
* Revision 6.0 1991/07/04 18:05:08 gruner
* frozen beta revision 2.6.1
*
* th+hybrid rcs version
* $Id$
*/
#ifndef __whowas_include__
#define __whowas_include__
#ifndef PROTO
#if __STDC__
# define PROTO(x) x
#else
# define PROTO(x) ()
#endif /* __STDC__ */
#endif /* ! PROTO */
/*
** WHOWAS structure moved here from whowas.c
*/
@@ -77,11 +42,12 @@ typedef struct aname {
anUser *ww_user;
aClient *ww_online;
time_t ww_logout;
long ww_umodes;
long ww_umodes;
char ww_nick[NICKLEN+1];
char ww_info[REALLEN+1];
} aName;
/*
** add_history
** Add the currently defined name of the client to history.
@@ -89,7 +55,7 @@ typedef struct aname {
** Client must be a fully registered user (specifically,
** the user structure must have been allocated).
*/
void add_history PROTO((aClient *));
void add_history (aClient *, int);
/*
** off_history
@@ -98,7 +64,7 @@ void add_history PROTO((aClient *));
** structures and it must know when they cease to exist. This
** also implicitly calls AddHistory.
*/
void off_history PROTO((aClient *));
void off_history (aClient *);
/*
** get_history
@@ -106,15 +72,15 @@ void off_history PROTO((aClient *));
** nickname within the timelimit. Returns NULL, if no
** one found...
*/
aClient *get_history PROTO((char *, time_t));
aClient *get_history (char *, time_t);
/* Nick name */
/* Time limit in seconds */
int m_whowas PROTO((aClient *, aClient *, int, char *[]));
int m_whowas (aClient *, aClient *, int, char *[]);
/*
** for debugging...counts related structures stored in whowas array.
*/
void count_whowas_memory PROTO((int *, int *, u_long *));
void count_whowas_memory (int *, u_long *);
#endif /* __whowas_include__ */
-3
View File
@@ -1,3 +0,0 @@
#define SPATH "."
#define DPATH "."
#define DOMAINNAME "irc.net"
-79
View File
@@ -1,79 +0,0 @@
#!/bin/sh
# IRCD Script v3.0
# $Id$
#
DIR=`pwd`
DATE=`date +"%a, %b %e %Y"`
TIME=`date +"%H:%M:%S %Z"`
IRCDPID="ircd.pid"
BACKUP="ircd.bak"
if [ -r $IRCDPID ]; then
mv -f $IRCDPID $BACKUP
src/ircd
sleep 1
if [ ! -r $IRCDPID ]; then
mv -f $BACKUP $IRCDPID
echo "|--------------------------------------------|"
echo "| **** ERROR **** |"
echo "| Possible problems: |"
echo "| (1) IRCd already running. |"
echo "| (2) The correct IP was not placed in the |"
echo "| M:line of the ircd.conf. |"
echo "| (3) DPATH or SPATH's are incorrect. Run |"
echo "| ./Config to correct that. |"
echo "| (4) Someone else is running an ircd on the |"
echo "| default port you chose in ircd.conf. |"
echo "|********************************************|"
echo "| If you can't get Unreal IRCd to work - go |"
echo "| to /server irc.flirt.org and join |"
echo "| #UnrealIRCd or mail us at |"
echo "| unreal-support@lists.sourceforge.net |"
echo "| |"
echo "|--------------------------------------------|"
exit
else
echo "|----------------------------------------"
echo "| UnrealIRCD successfully loaded."
echo "| Directory: $DIR"
echo "| Date: $DATE"
echo "| Time: $TIME"
PID=`cat ircd.pid`
echo "| Process ID: $PID"
echo "|----------------------------------------"
rm -f $BACKUP
fi
else
src/ircd
sleep 2
if [ ! -r $IRCDPID ]; then
echo "|--------------------------------------------|"
echo "| **** ERROR **** |"
echo "| Possible problems: |"
echo "| (1) IRCd already running. |"
echo "| (2) The correct IP was not placed in the |"
echo "| M:line of the ircd.conf. |"
echo "| (3) DPATH or SPATH's are incorrect. Run |"
echo "| ./Config to correct that. |"
echo "| (4) Someone else is running an ircd on the |"
echo "| default port you chose in ircd.conf. |"
echo "|********************************************|"
echo "| If you can't get Unreal IRCd to work - go |"
echo "| to /server irc.global-irc.net and join |"
echo "| #Global - Try ask in the channel or /msg |"
echo "| Stskeeps/Techie(me!) or else-- email me at |"
echo "| stskeeps@tspre.org |"
echo "|--------------------------------------------|"
exit
else
echo "|----------------------------------------"
echo "| UnrealIRCD successfully loaded."
echo "| Directory: $DIR"
echo "| Date: $DATE"
echo "| Time: $TIME"
PID=`cat ircd.pid`
echo "| Process ID: $PID"
echo "|----------------------------------------"
fi
fi
-1
View File
@@ -1 +0,0 @@
0,10,20,30,40,50 * * * * /home/mydir-to/ircdcron/ircdchk >/dev/null 2>&1
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
# $Id$
lynx http://unreal.sourceforge.net/register.html
-29
View File
@@ -1,29 +0,0 @@
#!/bin/sh
# Kill Script v2.0
# Created by Potvin
# $Id$
DIR=`pwd`
DATE=`date +"%a, %b %e %Y"`
TIME=`date +"%H:%M:%S %Z"`
IRCDPID="ircd.pid"
if [ ! -r $IRCDPID ]; then
clear
echo "|--------------------------------------------|"
echo "| **** ERROR **** |"
echo "| Possible problems: |"
echo "| (1) $IRCDPID not found |"
echo "| (2) The IRCd is not running |"
echo "|--------------------------------------------|"
else
PID=`cat $IRCDPID`
kill -9 $PID >/dev/null 2>&1
rm -f $IRCDPID
echo "|----------------------------------------"
echo "| UnrealIRCD successfully shutdown."
echo "| Directory: $DIR"
echo "| Date: $DATE"
echo "| Time: $TIME"
echo "| Process ID: $PID"
echo "|----------------------------------------"
fi
-543
View File
@@ -1,543 +0,0 @@
#!/bin/sh
# $Id$
# Defaults
#
TIME=`date +"%H:%M:%S %Z"`
DATE=`date +"%a, %b %e %Y"`
IRCDCONF="ircd.conf"
SERVNAME="Server.IRC.net"
COMMENT="IRC server!"
ADMIN="Admin-name"
ADMNICK="Admin"
ADMADDR="admin@no.where.com"
OPERNAME="admin"
OPERADDR="*@*"
OPERPASS="password"
PORT="6667"
OPRT="default"
LINKPASS="linkpass"
VIRTUAL="1.2.3.4"
ENCRYPT="Yes"
FLAGS="OAZHWe"
RESTARTPASS="restartpass"
DIEPASS="diepass"
SERVICES="Services.ShadowNet.Org"
# these are so I can use stuff like $1 without it replacing it...like by
# using $dlrsgn$uno for $1
dlrsgn="$"
uno="1"
dos="2"
# remove the temp file if it exists
rm -f mkconf.tmp
# make a quick script for replacing one line with another
cat > repl_str << __EOF__
sed -e "s@^$dlrsgn$uno\(.*\)@$dlrsgn$dos" $IRCDCONF > mkconf.tmp
cp mkconf.tmp $IRCDCONF
rm mkconf.tmp
__EOF__
# mark repl_str as an executable
chmod +x repl_str
rm -f repl_str
# Checking out how to specify not to make a new line with the current OS
c=''
n=''
2>/dev/null
if [ "`eval echo -n 'a'`" = "-n a" ]; then
c='\c'
else
n='-n'
fi
# If Settings exist, load the info, otherwise tell them to run Config.
if [ -r Settings ]; then
. Settings
else
echo "Hmm, you need to run Config first!"
echo "Type ./Config"
echo "If you have run Config, make sure you are in the directory"
echo "you ran it from."
exit 1
fi
CONF=$IRCDCONF
if [ -r "$CONF" ]; then
echo "$IRCDCONF found"
echo " "
echo " I don't suggest running this with the conf file already"
echo "existing, since you will lose all the data in your conf file."
echo "This script is just for creating one. If you want to recreate"
echo "a conf file, type 'recreate'."
echo $n " [exit] -> $c"
read cc
if [ "$cc" != "recreate" ]; then
echo " "
echo " OK, do you want to edit $IRCDCONF using an editor?"
echo "If so, specify the editor you want to use. Otherwise,"
echo "type 'exit'."
EDITFND="not found"
if [ -r /usr/bin/pico ]; then
EDITFND="pico"
fi
if [ -r /usr/bin/joe ]; then
EDITFND="joe"
fi
if [ -r /usr/bin/vi ]; then
EDITFND="vi"
fi
if [ -r /usr/bin/vim ]; then
EDITFND="vim"
fi
while [ "c" = "c" ]; do
echo $n " [$EDITFND] -> $c"
read EDITOR
if [ -z "$EDITOR" ]; then
EDITOR="$EDITFND"
fi
if [ "$EDITOR" = "exit" ]; then
echo "Have a nice day."
exit 1
fi
if [ -f $EDITOR ]; then
$EDITOR $CONF
exit 1
fi
if [ -f /usr/bin/$EDITOR ]; then
/usr/bin/$EDITOR $CONF
exit 1
fi
echo " Editor not found. Specify a valid editor or"
echo "type 'exit' to quit this script."
done
fi
mv $CONF "$CONF.saved"
rm $CONF
echo "$IRCDCONF has been renamed to ircd.conf.saved"
else
echo "$IRCDCONF is not found. (good)"
fi
clear
echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|"
echo "| Welcome to the $IRCDCONF generator. |"
echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|"
echo " "
echo "What will your server name be? (ie: $SERVNAME)"
echo $n " [$SERVNAME] -> $c"
read cc
if [ ! -z "$cc" ]; then
SERVNAME="$cc"
fi
echo " "
echo "What is your IRC server's IP? (ie: $VIRTUAL)"
echo "Use * to bind to all interfaces"
echo $n " [$VIRTUAL] -> $c"
read cc
if [ ! -z "$cc" ]; then
VIRTUAL="$cc"
fi
echo " "
echo "Server comment? (ie: Main Hub Server)"
echo $n " [$COMMENT] -> $c"
read cc
if [ ! -z "$cc" ]; then
COMMENT="$cc"
fi
echo " "
echo "Main port? (ie: 6667)"
echo $n " [$PORT] -> $c"
read cc
if [ ! -z "$cc" ]; then
PORT="$cc"
fi
echo " "
echo "What is your real name? (ie: John Doe)"
echo $n " [$ADMIN] -> $c"
read cc
if [ ! -z "$cc" ]; then
ADMIN="$cc"
fi
echo " "
echo "What is your IRC nickname? (ie: JD)"
echo $n " [$ADMNICK] -> $c"
read cc
if [ ! -z "$cc" ]; then
ADMNICK="$cc"
fi
echo " "
echo "What is your e-mail address? (ie: john@doe.com)"
echo $n " [$ADMADDR] -> $c"
read cc
if [ ! -z "$cc" ]; then
ADMADDR="$cc"
fi
echo " "
OPERNAME="$ADMNICK"
echo "What will your opername be for your O:line? (ie: johndoe)"
echo $n " [$OPERNAME] -> $c"
read cc
if [ ! -z "$cc" ]; then
OPERNAME="$cc"
fi
echo " "
echo "What oper flags do you want to have? (ie: OAWZ)"
echo "Some flags to choose from:"
echo " o = local oper"
echo " O = global oper"
echo " N = network administrator"
echo " A = server administrator"
echo " C = co administrator"
echo " T = technical administrator"
echo " read unrealircd.doc for more info about O:line flags)"
echo $n " [$FLAGS] -> $c"
read cc
if [ ! -z "$cc" ]; then
FLAGS="$cc"
fi
echo " "
ENCRYPT=""
ENCRYPT="bad"
while [ "$ENCRYPT" = "bad" ]; do
echo "Do you use encrypted oper passwords?"
echo $n " [Yes] -> $c"
read cc
if [ -z "$cc" ]; then
cc="Yes"
fi
case "$cc" in
[Yy]*)
ENCRYPT="Yes"
;;
[Nn]*)
ENCRYPT="No"
;;
*)
echo "Please specify yes or no."
ENCRYPT="bad"
;;
esac
done
if [ "$ENCRYPT" = "Yes" ] ; then
echo "Compile the file called mkpasswd.c in the 'crypt' directory"
echo "Then run it (./mkpasswd) and input the passwd to be encrypted"
echo "Then copy the output into the passwd slot in the O:line"
echo "NOTE: You can encrypt on irc via /mkpasswd <passwd>"
fi
echo " "
echo "What will your /oper password be? (ie: snoopy67)"
echo $n " [$OPERPASS] -> $c"
read cc
if [ ! -z "$cc" ]; then
OPERPASS="$cc"
fi
echo " "
echo "What is your user@host mask on IRC? (ie: *@*.toronto.globalserve.net)"
echo $n " [$OPERADDR] -> $c"
read cc
if [ ! -z "$cc" ]; then
OPERADDR="$cc"
fi
echo " "
echo "What do you want your die password to be?"
echo $n " [$DIEPASS] -> $c"
read cc
if [ ! -z "$cc" ]; then
DIEPASS="$cc"
fi
echo " "
echo "What do you want your restart password to be?"
echo $n " [$RESTARTPASS] -> $c"
read cc
if [ ! -z "$cc" ]; then
RESTARTPASS="$cc"
fi
echo " "
echo "If your running services, or linking to a network that has"
echo "services, please state the services servername."
echo "If you are running a non-services network, just type 'next'"
echo $n " [$SERVICES] -> $c"
read cc
#if [ ! -z "$cc" ]; then
# SERVICES="$cc"
#fi
if [ "$cc" = "next" ]; then
SERVICES="No.Services.Selected"
elif [ ! -z "$cc" ]; then
SERVICES="$cc"
fi
cat > $CONF << __EOF__
########################
#
# Filename: $IRCDCONF
# Created: $DATE - $TIME
#
########################
############ Server Info ############
M:$SERVNAME:$VIRTUAL:$COMMENT:$PORT
#####################################
############ Administrator Information #############
A:$ADMIN:$ADMNICK:$ADMADDR
####################################################
############ Y-lines #############
# Client Y:lines
Y:1:90:0:$MAXCONNECTIONS:100000
# Server Y:lines
Y:50:300:600:1:1000000
##################################
############ I/Access Lines #############
I:*@*::*@*::1
#########################################
############ X:LINE Die/Restart Password ############
X:$DIEPASS:$RESTARTPASS
#####################################################
## O-line (O:hostmask:password:opername:flags:1) ##
O:$OPERADDR:$OPERPASS:$OPERNAME:$FLAGS:1
###################################################
__EOF__
echo " "
echo " Would you like to configure any servers for linking?"
echo "Type the servername, or type 'done' when finished."
echo $n " [done] -> $c"
read cc
if [ -z "$cc" ]; then
cc="done"
fi
while [ "$cc" != "done" ]; do
THESERV="$cc"
SHOST="none"
while [ "$SHOST" = "none" ]; do
echo " "
echo "Hostname or ip for the other server? Must be specified."
echo $n " [] -> $c"
read SHOST
done
echo " "
echo "Password to send to the other server?"
echo $n " [$LINKPASS] -> $c"
read CLP
if [ -z "$CLP" ]; then
CLP="$LINKPASS"
fi
echo " "
AUTOPORT=""
AUTOCONN="bad"
while [ "$AUTOCONN" = "bad" ]; do
echo " "
echo "Should we autconnect to this server?"
echo $n " [Yes] -> $c"
read cc
if [ -z "$cc" ]; then
cc="Yes"
fi
case "$cc" in
[Yy]*)
AUTOCONN="yes"
echo "What port should we autoconnect to?"
echo $n " [7029] -> $c"
read AUTOPORT
if [ -z "$AUTOPORT" ]; then
AUTOPORT="7029"
fi
;;
[Nn]*)
AUTOCONN="no"
;;
*)
echo "Please specify yes or no."
AUTOCONN="bad"
;;
esac
done
echo " "
HUB="bad"
while [ "$HUB" = "bad" ]; do
echo " "
echo "Will this server be a hub?"
echo $n " [Yes] -> $c"
read cc
if [ -z "$cc" ]; then
cc="Yes"
fi
case "$cc" in
[Yy]*)
HUB="Yes"
;;
[Nn]*)
HUB="no"
;;
*)
echo "Please specify yes or no."
HUB="bad"
;;
esac
done
if [ "$HUB" = "Yes" ]; then
echo "############ HUB LINES #############" >> $CONF
echo "H:*:*:$THESERV" >> $CONF
echo "####################################" >> $CONF
echo "" >> $CONF
fi
echo "############ C/N LINES #############" >> $CONF
echo "C:$SHOST:$CLP:$THESERV:$AUTOPORT:50" >> $CONF
echo "N:$SHOST:$CLP:$THESERV::50" >> $CONF
echo "####################################" >> $CONF
echo "" >> $CONF
echo " "
echo "Type the servername, or type 'done' when finished."
echo $n " [done] -> $c"
read cc
if [ -z "$cc" ]; then
cc="done"
fi
done
cat >> $CONF << __EOF__
############ Uline for Services ############
U:$SERVICES:*:*
############################################
############ Q-Lined NickNames ############
Q::Reserved for services:*C*h*a*n*S*e*r*v*
Q::Reserved for services:*N*i*c*k*S*e*r*v*
Q::Reserved for services:*M*e*m*o*S*e*r*v*
Q::Reserved for services:*H*e*l*p*S*e*r*v*
Q::Reserved for services:*O*p*e*r*S*e*r*v*
Q::Reserved for services:*I*n*f*o*S*e*r*v*
Q::Reserved for Administrator:*Admin*
Q::Reserved for ircops:*IRC*op*
Q::Reserved for ircops:*Oper*
Q::Bug in mIRC:Status
###########################################
############ PORT LINES #############
__EOF__
cc="blank"
echo " "
echo " "
echo " Would you like any extra ports, other than 6667? Enter them here."
echo "Type 'done' when you are finished. Type 'default' to use 6665-6669/7000."
while [ "$cc" != "done" ]; do
echo $n " [$OPRT] -> $c"
read cc
if [ -z "$cc" ]; then
cc="$OPRT"
fi
if [ "$cc" = "default" ]; then
echo "P:$VIRTUAL:*:*:6660" >> $CONF
echo "P:$VIRTUAL:*:*:6661" >> $CONF
echo "P:$VIRTUAL:*:*:6662" >> $CONF
echo "P:$VIRTUAL:*:*:6663" >> $CONF
echo "P:$VIRTUAL:*:*:6664" >> $CONF
echo "P:$VIRTUAL:*:*:6665" >> $CONF
echo "P:$VIRTUAL:*:*:6666" >> $CONF
echo "P:$VIRTUAL:*:*:6668" >> $CONF
echo "P:$VIRTUAL:*:*:6669" >> $CONF
echo "P:$VIRTUAL:*:*:7000" >> $CONF
echo "P:$VIRTUAL:*:*:7029" >> $CONF
echo "#####################################" >> $CONF
cc="done"
fi
if [ "$cc" != "done" ]; then
if [ $cc = "$PORT" ]; then
echo " No, $PORT is already defined in the M:line,"
echo "please use a port other than $PORT."
else
echo "P:$VIRTUAL:*:*:$cc" >> $CONF
fi
fi
case "$OPRT" in
6660) OPRT="done"
;;
6661) OPRT="6660"
;;
6662) OPRT="6661"
;;
6663) OPRT="6662"
;;
6664) OPRT="6663"
;;
6665) OPRT="6664"
;;
6666) OPRT="6665"
;;
6669) OPRT="6666"
;;
6668) OPRT="6669"
;;
6667) OPRT="6668"
;;
*) OPRT="done"
;;
esac
done
# Make it so ONLY the one who created the conf can read or write.
chmod 700 $IRCDCONF
cat << __EOF__
OK, $IRCDCONF has been generated according to what you specified.
Make sure you double check for errors in $IRCDCONF. We recommend that
you take a look at your $IRCDCONF right now. Thanks for using UnrealIRCd
__EOF__
echo "Have a nice day."
echo ""
exit 1
-177
View File
@@ -1,177 +0,0 @@
#
# Win32Gui Config File .. By DrBin
#
CC=cl
# Here you put your settings
FD_SETSIZE=/D FD_SETSIZE=16384
NS_ADDRESS=/D NS_ADDRESS="\"nospoof@dal.net\""
CFLAGS=/MT /O2 /G5 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D _WIN32GUI /D NOSPOOF=1 /c
INCLUDES=./include/struct.h ./include/config.h ./include/sys.h \
./include/common.h ./include/version.h ./include/h.h ./include/numeric.h \
./include/msg.h ./include/setup.h ./include/dynconf.h
LINK=link.exe
LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \
oldnames.lib libcmt.lib comctl32.lib /nodefaultlib /nologo /out:WIRCD2.EXE
OBJ_FILES=SRC/CHANNEL.OBJ SRC/USERLOAD.OBJ SRC/SEND.OBJ SRC/BSD.OBJ \
SRC/S_CONF.OBJ SRC/FDLIST.OBJ SRC/DBUF.OBJ SRC/RES.OBJ \
SRC/CLOAK.OBJ SRC/HASH.OBJ SRC/PARSE.OBJ SRC/IRCD.OBJ \
SRC/S_NUMERIC.OBJ SRC/WHOWAS.OBJ SRC/RES_COMP.OBJ SRC/S_AUTH.OBJ \
SRC/HELP.OBJ SRC/S_MISC.OBJ SRC/MATCH.OBJ SRC/CRULE.OBJ \
SRC/S_DEBUG.OBJ SRC/RES_INIT.OBJ SRC/SUPPORT.OBJ SRC/LIST.OBJ \
SRC/S_ERR.OBJ SRC/PACKET.OBJ SRC/CLASS.OBJ SRC/S_BSD.OBJ \
SRC/MD5.OBJ SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/WIN32GUI.OBJ \
SRC/VERSION.OBJ SRC/win32/WIN32.RES SRC/S_UNREAL.OBJ SRC/DYNCONF.OBJ \
SRC/S_SOCKS.OBJ SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ
RC=rc.exe
ALL: WIRCD.EXE CHKCONF.EXE
@echo Please, please REMEMBER to add those U lines!
@echo Read the file READTHIS.NOW formore info
CLEAN:
-@erase src\*.exe 2>NUL
-@erase src\*.obj 2>NUL
-@erase src\win32.res 2>NUL
-@erase src\version.c 2>NUL
-@erase src\win32\*.obj 2>NUL
-@erase .\*.exe 2>NUL
#include/setup.h:
# @echo Hmm...doesn't look like you've run Config...
# @echo Doing so now.
# @config.exe
#src/version.c: dummy
# @config.exe -v
src/version.obj: src/win32/version.c
$(CC) $(CFLAGS) src/win32/version.c
./WIRCD.EXE: $(OBJ_FILES) src/win32/version.obj
$(LINK) $(LFLAGS) $(OBJ_FILES)
./CHKCONF.EXE: ./include/struct.h ./include/config.h ./include/sys.h \
./include/common.h ./src/crule.c ./src/match.c ./src/chkconf.c
$(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkcrule.obj /c src/crule.c
$(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkmatch.obj /c src/match.c
$(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkconf.obj /c src/chkconf.c
$(LINK) /nologo /out:./chkconf.exe src/chkconf.obj src/chkmatch.obj \
src/chkcrule.obj
src/parse.obj: src/parse.c $(INCLUDES)
$(CC) $(CFLAGS) src/parse.c
src/bsd.obj: src/bsd.c $(INCLUDES)
$(CC) $(CFLAGS) src/bsd.c
src/dbuf.obj: src/dbuf.c $(INCLUDES) ./include/dbuf.h
$(CC) $(CFLAGS) src/dbuf.c
src/packet.obj: src/packet.c $(INCLUDES)
$(CC) $(CFLAGS) src/packet.c
src/fdlist.obj: src/fdlist.c $(INCLUDES)
$(CC) $(CFLAGS) src/fdlist.c
src/dynconf.obj: src/dynconf.c $(INCLUDES) ./include/dbuf.h \
./include/channel.h ./include/whowas.h
$(CC) $(CFLAGS) src/dynconf.c
src/send.obj: src/send.c $(INCLUDES)
$(CC) $(CFLAGS) src/send.c
src/match.obj: src/match.c $(INCLUDES)
$(CC) $(CFLAGS) src/match.c
src/support.obj: src/support.c $(INCLUDES)
$(CC) $(CFLAGS) src/support.c
src/channel.obj: src/channel.c $(INCLUDES) ./include/channel.h
$(CC) $(CFLAGS) src/channel.c
src/class.obj: src/class.c $(INCLUDES) ./include/class.h
$(CC) $(CFLAGS) src/class.c
src/ircd.obj: src/ircd.c $(INCLUDES)
$(CC) $(CFLAGS) src/ircd.c
src/list.obj: src/list.c $(INCLUDES)
$(CC) $(CFLAGS) src/list.c
src/res.obj: src/res.c $(INCLUDES)
$(CC) $(CFLAGS) src/res.c
src/s_bsd.obj: src/s_bsd.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_bsd.c
src/s_auth.obj: src/s_auth.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_auth.c
src/s_conf.obj: src/s_conf.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_conf.c
src/s_debug.obj: src/s_debug.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_debug.c
src/s_err.obj: src/s_err.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_err.c
src/s_kline.obj: src/s_kline.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_kline.c
src/s_misc.obj: src/s_misc.c $(INCLUDES) ./include/dbuf.h
$(CC) $(CFLAGS) src/s_misc.c
src/s_socks.obj: src/s_socks.c $(INCLUDES)
$(CC) $(CFLAGS) src/s_socks.c
src/s_user.obj: src/s_user.c $(INCLUDES) ./include/dbuf.h \
./include/channel.h ./include/whowas.h
$(CC) $(CFLAGS) src/s_user.c
src/s_extra.obj: src/s_extra.c $(INCLUDES) ./include/dbuf.h \
./include/channel.h ./include/whowas.h
$(CC) $(CFLAGS) src/s_extra.c
src/s_unreal.obj: src/s_unreal.c $(INCLUDES) ./include/dbuf.h \
./include/channel.h ./include/whowas.h
$(CC) $(CFLAGS) src/s_unreal.c
src/s_serv.obj: src/s_serv.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h
$(CC) $(CFLAGS) src/s_serv.c
src/s_numeric.obj: src/s_numeric.c $(INCLUDES) ./include/dbuf.h
$(CC) $(CFLAGS) src/s_numeric.c
src/whowas.obj: src/whowas.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h
$(CC) $(CFLAGS) src/whowas.c
src/hash.obj: src/hash.c $(INCLUDES) ./include/hash.h
$(CC) $(CFLAGS) src/hash.c
src/crule.obj: src/crule.c $(INCLUDES)
$(CC) $(CFLAGS) src/crule.c
src/win32gui.obj: src/win32/win32gui.c $(INCLUDES) ./src/win32/resource.h
#./include/resource.h
$(CC) $(CFLAGS) src/win32/win32gui.c
src/res_comp.obj: src/res_comp.c $(INCLUDES)
$(CC) $(CFLAGS) src/res_comp.c
src/res_init.obj: src/res_init.c $(INCLUDES)
$(CC) $(CFLAGS) src/res_init.c
src/help.obj: src/help.c $(INCLUDES)
$(CC) $(CFLAGS) src/help.c
src/md5.obj: src/md5.c $(INCLUDES)
$(CC) $(CFLAGS) src/md5.c
src/win32/win32.res: src/win32/win32gui.rc
$(RC) /l 0x409 /fosrc/win32/win32.res /i ./include /i ./src \
/d NDEBUG src/win32/win32gui.rc
dummy:
-30
View File
@@ -1,30 +0,0 @@
#
# FireIRC Network Configuration File
# -----------------------------------------
# Added-at: 14 July 1999 00:00 GMT
# Author: MasterSatan (Erik Kerr)
# E-Mail: Kerrfarm@bright.net
#
# -----------------------------------------
#
Network >..........: FireIRC
Set ircnetwork ....: FireIRC
Set defserv .......: irc.FireIRC.Net
Set SERVICES_NAME .: services.FireIRC.Net
Set oper_host .....: ircOP.FireIRC.Net
Set admin_host ....: Admin.FireIRC.Net
Set locop_host ....: localOP.FireIRC.Net
Set sadmin_host ...: serviceOP.FireIRC.Net
Set netadmin_host .: NetADMIN.FireIRC.Net
Set coadmin_host ..: CoADMIN.FireIRC.Net
Set techadmin_host : TechAdmin.FireIRC.Net
Set hidden_host ...: FireIRC
Set netdomain .....: FireIRC.Net
Set helpchan ......: #Services
Set STATS_SERVER ..: stats.FireIRC.Net
Set HUB ...........: 1
Set iNAH ..........: 0
Set net_quit ......: FI
+11 -1
View File
@@ -21,4 +21,14 @@ networks/digitalirc.network ......: DigitalIRC (http://www.digitalirc.net)
networks/fireirc.network .........: FireIRC (http://www.fireirc.net)
networks/stormdancing.network ....: StormDancing (http://www.stormdancing.net)
networks/972-scripterz.network ...: 972-scripterz
networks/v64net.network ..........: v64
networks/v64net.network ..........: v64
networks/treklink.network ........: Treklink (http://www.treklink.net)
networks/axenet.network ..........: AXEnet
networks/kammtech.network ........: KammTecH
networks/linuxactive.network .....: Linuxactive (http://www.linuxactive.net)
networks/ircthai.network .........: IRCThai.com (http://www.ircthai.com)
networks/chatplace.network .......: ChatPlace (http://www.chatplace.net)
networks/interturk.network .......: InterTurk (http://www.interturk.net)
networks/cc2.network .............: CC2 (http://www.cc2.org)
networks/kissland.network ........: Kissland (http://www.kissland.com)
networks/digital-irc.network .....: Digital-IRC (http://www.digital-irc.net)
-26
View File
@@ -1,26 +0,0 @@
ver^2.2
#
# newmilennium.net Network Configuration File
# Made by: Dave Ellsworth (MasterJedi)
# E-Mail: mj@planetz.net
# ---------------------------------------
Network >..........: NewMilennium
Set ircnetwork ....: NewMilennium
Set defserv .......: irc.NewMilennium.net
Set SERVICES_NAME .: Services.NewMilennium.net
Set oper_host .....: ircop.newmilennium.net
Set admin_host ....: admin.newmilennium.net
Set locop_host ....: locop.newmilennium.net
Set sadmin_host ...: serviceop.newmilennium.net
Set netadmin_host .: netadmin.newmilennium.net
Set coadmin_host ..: coadmin.newmilennium.net
Set techadmin_host : techadmin.newmilennium.net
Set hidden_host ...: newmilennium
Set netdomain .....: newmilennium.net
Set helpchan ......: #newmilennium
Set STATS_SERVER ..: stats.newmilennium.net
Set HUB ...........: 1
Set iNAH ..........: 1
Set net_quit ......: SN
-36
View File
@@ -1,36 +0,0 @@
ver^2.2
Network >..........: SolarGalaxy
Set ircnetwork ....: SolarGalaxy
Set defserv .......: Irc.SolarGalaxy.Net
Set SERVICES_NAME .: Services.SolarGalaxy.Net
Set oper_host .....: IRCop.SolarGalaxy.Net
Set admin_host ....: Admin.SolarGalaxy.Net
Set locop_host ....: Locop.SolarGalaxy.Net
Set sadmin_host ...: ServiceOp.SolarGalaxy.Net
Set netadmin_host .: NetAdmin.SolarGalaxy.Net
Set coadmin_host ..: CoAdmin.SolarGalaxy.Net
Set techadmin_host : TechAdmin.SolarGalaxy.Net
Set hidden_host ...: solargalaxy
Set netdomain .....: SolarGalaxy.Net
Set helpchan ......: #SolarGalaxy
Set STATS_SERVER ..: Stats.SolarGalaxy.Net
Set HUB ...........: 1
Set iNAH ..........: 1
Set net_quit ......: sg
-58
View File
@@ -1,58 +0,0 @@
ver^2.2
# These two specify the name of the IRC network, set the same in both fields
Network >..........: StarSpace
Set ircnetwork ....: StarSpace
# This is where your DNS pool is (like irc.dal.net)
Set defserv .......: IRC.StarSpace.Net
# This is the name of your Services Server
Set SERVICES_NAME .: Services.StarSpace.Net
# This is the virtual hostname IRCops will get if iNAH option is enabled
# on oper up
Set oper_host .....: Global.StarSpace.Net
# This is the virtual hostname Server Admins will get if iNAH option is enabled
# on oper up
Set admin_host ....: Admin.StarSpace.Net
# This is the virtual hostname Local IRCops will get if iNAH option is enabled
# on oper up
Set locop_host ....: Local.StarSpace.Net
# This is the virtual hostname Services Operators/Admins will get
# if iNAH option is enabled on oper up
Set sadmin_host ...: ServOp.StarSpace.Net
# This is the virtual hostname NetAdmins will get
# if iNAH option is enabled on oper up
Set netadmin_host .: NetAdmin.StarSpace.Net
# This is the virtual hostname CoAdmins will get
# if iNAH option is enabled on oper up
Set coadmin_host ..: CoAdmin.StarSpace.Net
# This is the virtual hostname TechAdmins will get
# if iNAH option is enabled on oper up
Set techadmin_host : TechAdmin.StarSpace.Net
# This is the prefix of the hidden host (cloaking) hostname
Set hidden_host ...: starspace
# This is the domain of the IRC network
Set netdomain .....: StarSpace.Net
# This is where people can go for help
Set helpchan ......: #OperHelp
# This is the name of the stats server
Set STATS_SERVER ..: Stats.StarSpace.Net
# -- Not in use--
Set HUB ...........: 1
# This enables the auto-setting of f.x @netadmin.network.net
# on oper up
Set iNAH ..........: 1
# -- Not in use but still here --
Set net_quit ......: SS
+49 -2
View File
@@ -1,4 +1,4 @@
ver^1.1
ver^1.5
#
# UnrealIRCd Configuration file - unrealircd.conf
# (C) Carsten Munk 1999 - Under the GNU license
@@ -7,7 +7,7 @@ ver^1.1
#
# change the filename to what network header file you use
# relative to DPATH
Include .................: networks/roxnet.network
Include .................: networks/unreal-test.network
#
# What K:Line address can K:lined users mail at?
@@ -22,6 +22,9 @@ Set MODE_X ..............: 1
# 1 = Yes 0 = No
Set MODE_I ..............: 0
# Auto +X users when they connect? This can help as a new REMOVE_ADVERTISE
Set MODE_STRIPWORDS .....: 0
# If compiled on a halfhub network this will upgrade it to be a real hub
# * else if tried on a leaf (not hub) it will cause an error
# * NOTE: There are only TWO versions of UnrealIRCd - Leaf and [Half]Hub
@@ -79,3 +82,47 @@ Set SOCKS_QUIT_MESSAGE ..: Insecure SOCKS server
# How many seconds will a insecure SOCKS be banned?
#
Set SOCKSBANTIME ........: 86400
#
# How many channels are users allowed to join?
#
Set MAXCHANNELSPERUSER ..: 10
#
# Will we support WebTV, NOTE replaces /NOTICE with a /PRIVMSG
# 1 = Yes 0 = No
Set WEBTV_SUPPORT .......: 0
#
# Should usermode +I (Total Invisibility) be disabled?
# 1 = Yes 0 = No
Set NO_OPER_HIDING ......: 0
#
# Should we make the user join a channel(s) on connect?
# 0 = No, if Yes, enter the channel name
# to make them join multiple channels seperate with ,s
# ex Set AUTO_JOIN_CHANS .....: #chan1,#chan2,#chan3
#
Set AUTO_JOIN_CHANS .....: 0
#
# Should we make the user join a channel(s) on /oper?
# 0 = No, if Yes, enter the channel name
# to make them join multiple channels seperate with ,s
# ex Set OPER_AUTO_JOIN_CHANS : #chan1,#chan2,#chan3
#
Set OPER_AUTO_JOIN_CHANS : 0
#
# This allows you specify the amount of time (in seconds)
# to wait for a DNS response. Set this to 0 to disable
# hostname resolving
#
Set HOST_TIMEOUT ........: 2
#
# This allows you to specify the anount of retries
# that should be send when no DNS response is received
#
Set HOST_RETRIES ........: 2
+8 -8
View File
@@ -25,40 +25,40 @@ Set SERVICES_NAME .: service.uzaynet.com
# This is the virtual hostname IRCops will get if iNAH option is enabled
# on oper up
Set oper_host .....: ircop.silverserver.nu
Set oper_host .....: ircop.uzaynet.com
# This is the virtual hostname Server Admins will get if iNAH option is enabled
# on oper up
Set admin_host ....: admin.uzaynet.nu
Set admin_host ....: admin.uzaynet.com
# This is the virtual hostname Local IRCops will get if iNAH option is enabled
# on oper up
Set locop_host ....: locop.uzaynet.nu
Set locop_host ....: locop.uzaynet.com
# This is the virtual hostname Services Operators/Admins will get
# if iNAH option is enabled on oper up
Set sadmin_host ...: serviceop.uzaynet.nu
Set sadmin_host ...: serviceop.uzaynet.com
# This is the virtual hostname NetAdmins will get
# if iNAH option is enabled on oper up
Set netadmin_host .: netadmin.uzaynet.nu
Set netadmin_host .: netadmin.uzaynet.com
# This is the virtual hostname CoAdmins will get
# if iNAH option is enabled on oper up
Set coadmin_host ..: coadmin.uzaynet.nu
Set coadmin_host ..: coadmin.uzaynet.com
# This is the virtual hostname TechAdmins will get
# if iNAH option is enabled on oper up
Set techadmin_host : techadmin.uzaynet.nu
Set techadmin_host : techadmin.uzaynet.com
# This is the prefix of the hidden host (cloaking) hostname
Set hidden_host ...: UzayNet
# This is the domain of the IRC network
Set netdomain .....: uzaynet.nu
Set netdomain .....: uzaynet.com
# This is where people can go for help
Set helpchan ......: #Help
# This is the name of the stats server
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
# $Id$
echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "
echo "| UnrealIRCd Network Submission "
echo "| "
echo "| If you want your networks network file in the "
echo "| next release please attach your network file "
echo "| to an email and mail it to "
echo" | unreal-networks@lists.sourceforge.net "
echo "| "
echo "|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "
exit 1
-23
View File
@@ -1,23 +0,0 @@
#!/bin/sh
# Rehash Script v2.0
# $Id$
IRCDPID="ircd.pid"
if [ ! -r $IRCDPID ]; then
clear
echo "|--------------------------------------------|"
echo "| **** ERROR **** |"
echo "| Possible problems: |"
echo "| (1) $IRCDPID not found |"
echo "| (2) The IRCd is not running |"
echo "|--------------------------------------------|"
else
PID=`cat $IRCDPID`
kill -HUP $PID
echo "|----------------------------------------"
echo "| UnrealIRCD successfully rehashed."
echo "| Process ID: $PID"
echo "|----------------------------------------"
fi
+241 -240
View File
@@ -6,226 +6,226 @@
#include <io.h>
#endif
#include <fcntl.h>
#ifdef _WIN32
#ifdef _WIN32
#include <sys\stat.h>
#endif
#include <time.h>
int _FD_SETSIZE = 1024;
int _FD_SETSIZE = 1024;
char _NS_ADDRESS[256], _KLINE_ADDRESS[256];
char Makefile[] =
"CC=cl\n"
"FD_SETSIZE=/D FD_SETSIZE=$FD_SETSIZE\n"
"CFLAGS=/MT /O2 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D NOSPOOF=1 /c\n"
"INCLUDES=./include/struct.h ./include/config.h ./include/sys.h \\\n"
" ./include/common.h ./include/settings.h ./include/h.h ./include/numeric.h \\\n"
" ./include/msg.h ./include/setup.h\n"
"LINK=link.exe\n"
"LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \\\n"
" oldnames.lib libcmt.lib /nodefaultlib /nologo /out:SRC/WIRCD.EXE\n"
"OBJ_FILES=SRC/CHANNEL.OBJ SRC/USERLOAD.OBJ SRC/SEND.OBJ SRC/BSD.OBJ \\\n"
" SRC/CIO_MAIN.OBJ SRC/S_CONF.OBJ SRC/DBUF.OBJ SRC/RES.OBJ \\\n"
" SRC/HASH.OBJ SRC/CIO_INIT.OBJ SRC/PARSE.OBJ SRC/IRCD.OBJ \\\n"
" SRC/S_NUMERIC.OBJ SRC/WHOWAS.OBJ SRC/RES_COMP.OBJ SRC/S_AUTH.OBJ \\\n"
" SRC/HELP.OBJ SRC/S_MISC.OBJ SRC/MATCH.OBJ SRC/CRULE.OBJ \\\n"
" SRC/S_DEBUG.OBJ SRC/RES_INIT.OBJ SRC/SUPPORT.OBJ SRC/LIST.OBJ \\\n"
" SRC/S_ERR.OBJ SRC/PACKET.OBJ SRC/CLASS.OBJ SRC/S_BSD.OBJ \\\n"
" SRC/MD5.OBJ SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/WIN32.OBJ \\\n"
" SRC/DYNCONF.OBJ\\\n"
" SRC/VERSION.OBJ SRC/WIN32.RES SRC/CLOAK.OBJ SRC/S_UNREAL.OBJ\n"
"RC=rc.exe\n"
"\n"
"ALL: SRC/WIRCD.EXE SRC/CHKCONF.EXE\n"
" @echo Complete.\n"
"\n"
"CLEAN:\n"
" -@erase src\\*.exe 2>NUL\n"
" -@erase src\\*.obj 2>NUL\n"
" -@erase src\\win32.res 2>NUL\n"
" -@erase src\\version.c 2>NUL\n"
"\n"
"include/setup.h:\n"
" @echo Hmm...doesn't look like you've run Config...\n"
" @echo Doing so now.\n"
" @config.exe\n"
"\n"
"src/version.c: dummy\n"
" @config.exe -v\n"
"\n"
"src/version.obj: src/version.c\n"
" $(CC) $(CFLAGS) src/version.c\n"
"\n"
"SRC/WIRCD.EXE: $(OBJ_FILES) src/version.obj\n"
" $(LINK) $(LFLAGS) $(OBJ_FILES)\n"
"\n"
"SRC/CHKCONF.EXE: ./include/struct.h ./include/config.h ./include/sys.h \\\n"
" ./include/common.h ./src/crule.c ./src/match.c ./src/chkconf.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkcrule.obj /c src/crule.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkmatch.obj /c src/match.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkconf.obj /c src/chkconf.c\n"
" $(LINK) /nologo /out:src/chkconf.exe src/chkconf.obj src/chkmatch.obj \\\n"
" src/chkcrule.obj\n"
"\n"
"src/parse.obj: src/parse.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/parse.c\n"
"\n"
"src/bsd.obj: src/bsd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/bsd.c\n"
"\n"
"src/dbuf.obj: src/dbuf.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/dbuf.c\n"
"\n"
"src/packet.obj: src/packet.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/packet.c\n"
"\n"
"src/send.obj: src/send.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/send.c\n"
"\n"
"src/match.obj: src/match.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/match.c\n"
"\n"
"src/support.obj: src/support.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/support.c\n"
"\n"
"src/channel.obj: src/channel.c $(INCLUDES) ./include/channel.h\n"
" $(CC) $(CFLAGS) src/channel.c\n"
"\n"
"src/class.obj: src/class.c $(INCLUDES) ./include/class.h\n"
" $(CC) $(CFLAGS) src/class.c\n"
"\n"
"src/ircd.obj: src/ircd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/ircd.c\n"
"\n"
"src/list.obj: src/list.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/list.c\n"
"\n"
"src/res.obj: src/res.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res.c\n"
"\n"
"src/s_bsd.obj: src/s_bsd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_bsd.c\n"
"\n"
"src/s_auth.obj: src/s_auth.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_auth.c\n"
"\n"
"src/s_conf.obj: src/s_conf.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_conf.c\n"
"\n"
"src/s_debug.obj: src/s_debug.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_debug.c\n"
"\n"
"src/s_err.obj: src/s_err.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_err.c\n"
"\n"
"src/s_misc.obj: src/s_misc.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/s_misc.c\n"
"\n"
"src/s_user.obj: src/s_user.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_user.c\n"
"\n"
"src/dynconf.obj: src/dynconf.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h ./include/dynconf.h\n"
" $(CC) $(CFLAGS) src/dynconf.c\n"
"\n"
"src/s_unreal.obj: src/s_unreal.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_unreal.c\n"
"\n"
"src/cloak.obj: src/cloak.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_unreal.c\n"
"\n"
"src/s_serv.obj: src/s_serv.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_serv.c\n"
"\n"
"src/s_numeric.obj: src/s_numeric.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/s_numeric.c\n"
"\n"
"src/whowas.obj: src/whowas.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/whowas.c\n"
"\n"
"src/hash.obj: src/hash.c $(INCLUDES) ./include/hash.h\n"
" $(CC) $(CFLAGS) src/hash.c\n"
"\n"
"src/crule.obj: src/crule.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/crule.c\n"
"\n"
"src/win32.obj: src/win32.c $(INCLUDES) ./include/resource.h\n"
" $(CC) $(CFLAGS) src/win32.c\n"
"\n"
"src/cio_main.obj: src/cio_main.c $(INCLUDES) ./include/cio.h ./include/ciofunc.h\n"
" $(CC) $(CFLAGS) src/cio_main.c\n"
"\n"
"src/cio_init.obj: src/cio_init.c $(INCLUDES) ./include/cio.h ./include/ciofunc.h\n"
" $(CC) $(CFLAGS) src/cio_init.c\n"
"\n"
"src/res_comp.obj: src/res_comp.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res_comp.c\n"
"\n"
"src/res_init.obj: src/res_init.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res_init.c\n"
"\n"
"src/help.obj: src/help.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/help.c\n"
"\n"
"src/md5.obj: src/md5.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/md5.c\n"
"\n"
"src/win32.res: src/win32.rc\n"
" $(RC) /l 0x409 /fosrc/win32.res /i ./include /i ./src \\\n"
" /d NDEBUG src/win32.rc\n"
"\n"
"dummy:\n"
"\n";
"CC=cl\n"
"FD_SETSIZE=/D FD_SETSIZE=$FD_SETSIZE\n"
"CFLAGS=/MT /O2 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D NOSPOOF=1 /c\n"
"INCLUDES=./include/struct.h ./include/config.h ./include/sys.h \\\n"
" ./include/common.h ./include/settings.h ./include/h.h ./include/numeric.h \\\n"
" ./include/msg.h ./include/setup.h\n"
"LINK=link.exe\n"
"LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \\\n"
" oldnames.lib libcmt.lib /nodefaultlib /nologo /out:SRC/WIRCD.EXE\n"
"OBJ_FILES=SRC/CHANNEL.OBJ SRC/USERLOAD.OBJ SRC/SEND.OBJ SRC/BSD.OBJ \\\n"
" SRC/CIO_MAIN.OBJ SRC/S_CONF.OBJ SRC/DBUF.OBJ SRC/RES.OBJ \\\n"
" SRC/HASH.OBJ SRC/CIO_INIT.OBJ SRC/PARSE.OBJ SRC/IRCD.OBJ \\\n"
" SRC/S_NUMERIC.OBJ SRC/WHOWAS.OBJ SRC/RES_COMP.OBJ SRC/S_AUTH.OBJ \\\n"
" SRC/HELP.OBJ SRC/S_MISC.OBJ SRC/MATCH.OBJ SRC/CRULE.OBJ \\\n"
" SRC/S_DEBUG.OBJ SRC/RES_INIT.OBJ SRC/SUPPORT.OBJ SRC/LIST.OBJ \\\n"
" SRC/S_ERR.OBJ SRC/PACKET.OBJ SRC/CLASS.OBJ SRC/S_BSD.OBJ \\\n"
" SRC/MD5.OBJ SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/WIN32.OBJ \\\n"
" SRC/DYNCONF.OBJ\\\n"
" SRC/VERSION.OBJ SRC/WIN32.RES SRC/CLOAK.OBJ SRC/S_UNREAL.OBJ\n"
"RC=rc.exe\n"
"\n"
"ALL: SRC/WIRCD.EXE SRC/CHKCONF.EXE\n"
" @echo Complete.\n"
"\n"
"CLEAN:\n"
" -@erase src\\*.exe 2>NUL\n"
" -@erase src\\*.obj 2>NUL\n"
" -@erase src\\win32.res 2>NUL\n"
" -@erase src\\version.c 2>NUL\n"
"\n"
"include/setup.h:\n"
" @echo Hmm...doesn't look like you've run Config...\n"
" @echo Doing so now.\n"
" @config.exe\n"
"\n"
"src/version.c: dummy\n"
" @config.exe -v\n"
"\n"
"src/version.obj: src/version.c\n"
" $(CC) $(CFLAGS) src/version.c\n"
"\n"
"SRC/WIRCD.EXE: $(OBJ_FILES) src/version.obj\n"
" $(LINK) $(LFLAGS) $(OBJ_FILES)\n"
"\n"
"SRC/CHKCONF.EXE: ./include/struct.h ./include/config.h ./include/sys.h \\\n"
" ./include/common.h ./src/crule.c ./src/match.c ./src/chkconf.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkcrule.obj /c src/crule.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkmatch.obj /c src/match.c\n"
" $(CC) /nologo /I ./include /D CR_CHKCONF /Fosrc/chkconf.obj /c src/chkconf.c\n"
" $(LINK) /nologo /out:src/chkconf.exe src/chkconf.obj src/chkmatch.obj \\\n"
" src/chkcrule.obj\n"
"\n"
"src/parse.obj: src/parse.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/parse.c\n"
"\n"
"src/bsd.obj: src/bsd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/bsd.c\n"
"\n"
"src/dbuf.obj: src/dbuf.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/dbuf.c\n"
"\n"
"src/packet.obj: src/packet.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/packet.c\n"
"\n"
"src/send.obj: src/send.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/send.c\n"
"\n"
"src/match.obj: src/match.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/match.c\n"
"\n"
"src/support.obj: src/support.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/support.c\n"
"\n"
"src/channel.obj: src/channel.c $(INCLUDES) ./include/channel.h\n"
" $(CC) $(CFLAGS) src/channel.c\n"
"\n"
"src/class.obj: src/class.c $(INCLUDES) ./include/class.h\n"
" $(CC) $(CFLAGS) src/class.c\n"
"\n"
"src/ircd.obj: src/ircd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/ircd.c\n"
"\n"
"src/list.obj: src/list.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/list.c\n"
"\n"
"src/res.obj: src/res.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res.c\n"
"\n"
"src/s_bsd.obj: src/s_bsd.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_bsd.c\n"
"\n"
"src/s_auth.obj: src/s_auth.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_auth.c\n"
"\n"
"src/s_conf.obj: src/s_conf.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_conf.c\n"
"\n"
"src/s_debug.obj: src/s_debug.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_debug.c\n"
"\n"
"src/s_err.obj: src/s_err.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/s_err.c\n"
"\n"
"src/s_misc.obj: src/s_misc.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/s_misc.c\n"
"\n"
"src/s_user.obj: src/s_user.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_user.c\n"
"\n"
"src/dynconf.obj: src/dynconf.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h ./include/dynconf.h\n"
" $(CC) $(CFLAGS) src/dynconf.c\n"
"\n"
"src/s_unreal.obj: src/s_unreal.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_unreal.c\n"
"\n"
"src/cloak.obj: src/cloak.c $(INCLUDES) ./include/dbuf.h \\\n"
" ./include/channel.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_unreal.c\n"
"\n"
"src/s_serv.obj: src/s_serv.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/s_serv.c\n"
"\n"
"src/s_numeric.obj: src/s_numeric.c $(INCLUDES) ./include/dbuf.h\n"
" $(CC) $(CFLAGS) src/s_numeric.c\n"
"\n"
"src/whowas.obj: src/whowas.c $(INCLUDES) ./include/dbuf.h ./include/whowas.h\n"
" $(CC) $(CFLAGS) src/whowas.c\n"
"\n"
"src/hash.obj: src/hash.c $(INCLUDES) ./include/hash.h\n"
" $(CC) $(CFLAGS) src/hash.c\n"
"\n"
"src/crule.obj: src/crule.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/crule.c\n"
"\n"
"src/win32.obj: src/win32.c $(INCLUDES) ./include/resource.h\n"
" $(CC) $(CFLAGS) src/win32.c\n"
"\n"
"src/cio_main.obj: src/cio_main.c $(INCLUDES) ./include/cio.h ./include/ciofunc.h\n"
" $(CC) $(CFLAGS) src/cio_main.c\n"
"\n"
"src/cio_init.obj: src/cio_init.c $(INCLUDES) ./include/cio.h ./include/ciofunc.h\n"
" $(CC) $(CFLAGS) src/cio_init.c\n"
"\n"
"src/res_comp.obj: src/res_comp.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res_comp.c\n"
"\n"
"src/res_init.obj: src/res_init.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/res_init.c\n"
"\n"
"src/help.obj: src/help.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/help.c\n"
"\n"
"src/md5.obj: src/md5.c $(INCLUDES)\n"
" $(CC) $(CFLAGS) src/md5.c\n"
"\n"
"src/win32.res: src/win32.rc\n"
" $(RC) /l 0x409 /fosrc/win32.res /i ./include /i ./src \\\n"
" /d NDEBUG src/win32.rc\n" "\n" "dummy:\n" "\n";
char SetupH[] =
"/* This is only a wrapper.. --Stskeeps */\n"
"#include \"win32/setup.h\"\n";
"/* This is only a wrapper.. --Stskeeps */\n"
"#include \"win32/setup.h\"\n";
int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
if (argc>1)
{
if (argc > 1)
{
if (!strcmp(argv[1], "-v"))
return do_version();
if (!strcmp(argv[1], "-n"))
return do_config(1);
}
printf("To do win32 compiling copy include/win32/setup.h to include/\n");
}
printf
("To do win32 compiling copy include/win32/setup.h to include/\n");
printf("Copy include/win32/settings.h to include/ and modify it\n");
printf("and copy makefile.win32 to Makefile\n");
// return do_config(0);
// return do_config(0);
}
int do_config(int autoconf)
int do_config(int autoconf)
{
int fd;
char str[128];
int fd;
char str[128];
if ((fd = open("include\\setup.h", O_CREAT|O_TRUNC|O_WRONLY|O_TEXT,
S_IREAD|S_IWRITE)) == -1)
if ((fd =
open("include\\setup.h", O_CREAT | O_TRUNC | O_WRONLY | O_TEXT,
S_IREAD | S_IWRITE)) == -1)
printf("Error opening include\\setup.h\n\r");
else
{
{
write(fd, SetupH, strlen(SetupH));
close(fd);
}
}
while (1)
{
{
/*
* FD_SETSIZE
*/
printf("\n");
printf("How many file descriptors (or sockets) can the irc server use?");
printf
("How many file descriptors (or sockets) can the irc server use?");
printf("\n");
printf("[%d] -> ", _FD_SETSIZE);
gets(str);
@@ -233,18 +233,20 @@ int do_config(int autoconf)
sscanf(str, "%d", &_FD_SETSIZE);
if (_FD_SETSIZE >= 100)
{
{
printf("\n");
printf("FD_SETSIZE will be overridden using -D "
"FD_SETSIZE=%d when compiling ircd.", _FD_SETSIZE);
"FD_SETSIZE=%d when compiling ircd.", _FD_SETSIZE);
printf("\n");
break;
}
printf("\n");
printf("You need to enter a number here, greater or equal to 100.\n");
}
while (1) {
}
printf("\n");
printf
("You need to enter a number here, greater or equal to 100.\n");
}
while (1)
{
}
/*
* Now write the makefile out.
*/
@@ -254,28 +256,28 @@ int do_config(int autoconf)
}
int write_makefile(void)
int write_makefile(void)
{
int fd, makfd, len;
char *buffer, *s;
int fd, makfd, len;
char *buffer, *s;
buffer = (char *)malloc(strlen(Makefile)+4096);
memcpy(buffer, Makefile, strlen(Makefile)+1);
buffer = (char *)malloc(strlen(Makefile) + 4096);
memcpy(buffer, Makefile, strlen(Makefile) + 1);
s = (char *)strstr(buffer, "$FD_SETSIZE");
if (s)
{
{
itoa(_FD_SETSIZE, s, 10);
memmove(s+strlen(s), s+11, strlen(s+11)+1);
}
memmove(s + strlen(s), s + 11, strlen(s + 11) + 1);
}
if ((makfd = open("Makefile", O_CREAT|O_TRUNC|O_WRONLY|O_TEXT,
S_IREAD|S_IWRITE)) == -1)
{
if ((makfd = open("Makefile", O_CREAT | O_TRUNC | O_WRONLY | O_TEXT,
S_IREAD | S_IWRITE)) == -1)
{
printf("Error creating Makefile\n\r");
return 1;
}
}
write(makfd, buffer, strlen(buffer));
close(makfd);
@@ -284,94 +286,93 @@ int write_makefile(void)
}
int do_version(void)
int do_version(void)
{
int fd, verfd, generation=0, len, doingvernow=0;
char buffer[16384], *s;
int fd, verfd, generation = 0, len, doingvernow = 0;
char buffer[16384], *s;
if ((verfd = open("src\\version.c", O_RDONLY | O_TEXT)) != -1)
{
{
while (!eof(verfd))
{
len = read(verfd, buffer, sizeof(buffer)-1);
{
len = read(verfd, buffer, sizeof(buffer) - 1);
if (len == -1)
break;
buffer[len] = 0;
s = (char *)strstr(buffer, "char *generation = \"");
if (s)
{
{
s += 20;
generation = atoi(s);
break;
}
}
}
}
close(verfd);
}
close(verfd);
}
if ((fd = open("src\\version.c.SH", O_RDONLY | O_TEXT)) == -1)
{
{
printf("Error opening src\\version.c.SH\n\r");
return 1;
}
}
if ((verfd = open("src\\version.c", O_CREAT|O_TRUNC|O_WRONLY|O_TEXT,
S_IREAD|S_IWRITE)) == -1)
{
if ((verfd =
open("src\\version.c", O_CREAT | O_TRUNC | O_WRONLY | O_TEXT,
S_IREAD | S_IWRITE)) == -1)
{
printf("Error opening src\\version.c\n\r");
return 1;
}
}
generation++;
printf("Extracting IRC/ircd/version.c...\n\r");
while (!eof(fd))
{
len = read(fd, buffer, sizeof(buffer)-1);
{
len = read(fd, buffer, sizeof(buffer) - 1);
if (len == -1)
break;
buffer[len] = 0;
if (!doingvernow)
{
{
s = (char *)strstr(buffer, "/*");
if (!s)
continue;
memmove(buffer, s, strlen(s)+1);
doingvernow=1;
}
memmove(buffer, s, strlen(s) + 1);
doingvernow = 1;
}
s = (char *)strstr(buffer, "$generation");
if (s)
{
{
itoa(generation, s, 10);
memmove(s+strlen(s), s+11, strlen(s+11)+1);
}
memmove(s + strlen(s), s + 11, strlen(s + 11) + 1);
}
s = (char *)strstr(buffer, "$creation");
if (s)
{
time_t t = time(0);
char *ct = ctime(&t);
{
time_t t = time(0);
char *ct = ctime(&t);
memmove(s+strlen(ct)-1, s+9, strlen(s+9)+1);
memmove(s, ct, strlen(ct)-1);
}
memmove(s + strlen(ct) - 1, s + 9, strlen(s + 9) + 1);
memmove(s, ct, strlen(ct) - 1);
}
s = (char *)strstr(buffer, "$package");
if (s)
{
{
memmove(s, "IRC", 3);
memmove(s+3, s+8, strlen(s+8)+1);
}
memmove(s + 3, s + 8, strlen(s + 8) + 1);
}
s = (char *)strstr(buffer, "!SUB!THIS!");
if (s)
*s = 0;
write(verfd, buffer, strlen(buffer));
}
}
close(fd);
close(verfd);
return 0;
}
+55 -8
View File
@@ -23,12 +23,19 @@ CC=danger will robinson
LINTFLAGS=-hba
OBJS=bsd.o dbuf.o packet.o send.o match.o parse.o support.o channel.o \
class.o hash.o ircd.o list.o res.o cloak.o s_auth.o s_bsd.o s_conf.o \
s_debug.o s_err.o s_extra.o s_misc.o s_numeric.o s_serv.o s_user.o s_unreal.o \
whowas.o userload.o crule.o help.o md5.o version.o dynconf.o \
s_socks.o s_kline.o fdlist.o \
$(RES) $(STRTOUL)
OBJS=agent.o aln.o badwords.o bsd.o channel.o class.o cloak.o crule.o dbuf.o dynconf.o \
fdlist.o hash.o help.o ircd.o ircsprintf.o list.o lusers.o \
match.o md5.o packet.o parse.o res.o $(RES) s_auth.o \
s_bsd.o s_conf.o s_debug.o s_err.o s_extra.o s_kline.o \
s_misc.o s_numeric.o s_serv.o s_socks.o $(STRTOUL) s_unreal.o \
s_user.o scache.o send.o support.o userload.o version.o whowas.o
# OBJS=bsd.o dbuf.o packet.o send.o match.o parse.o support.o channel.o \
# class.o hash.o ircd.o list.o res.o cloak.o s_auth.o s_bsd.o s_conf.o \
# s_debug.o s_err.o s_extra.o s_misc.o s_numeric.o s_serv.o s_user.o s_unreal.o \
# whowas.o userload.o crule.o help.o md5.o dynconf.o \
# s_socks.o s_kline.o fdlist.o ircsprintf.o agent.o lusers.o version.o \
# $(RES) $(STRTOUL)
SRC=$(OBJS:%.o=%.c)
@@ -44,14 +51,14 @@ all: build
build: ircd chkconf
version.c:
version.c: version.c.SH
$(SHELL) version.c.SH
version.o: version.c ../include/version.h
$(CC) $(CFLAGS) -c version.c
ircd: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(IRCDLIBS) -o ircd
$(CC) $(CFLAGS) -o ircd $(OBJS) $(LDFLAGS) $(IRCDLIBS)
chmod $(IRCDMODE) ircd
chkconf: ../include/struct.h ../include/config.h ../include/settings.h ../include/sys.h \
@@ -68,12 +75,40 @@ lint:
lint $(LINTFLAGS) -I../include $(SRC) | egrep -v 'sendto_|debug'
parse.o: parse.c $(INCLUDES)
$(CC) $(CFLAGS) -c parse.c
bsd.o: bsd.c $(INCLUDES)
$(CC) $(CFLAGS) -c bsd.c
dbuf.o: dbuf.c $(INCLUDES) ../include/dbuf.h
$(CC) $(CFLAGS) -c dbuf.c
packet.o: packet.c $(INCLUDES)
$(CC) $(CFLAGS) -c packet.c
badwords.o: badwords.c $(INCLUDES)
$(CC) $(CFLAGS) -c badwords.c
aln.o: aln.c $(INCLUDES)
$(CC) $(CFLAGS) -c aln.c
send.o: send.c $(INCLUDES)
$(CC) $(CFLAGS) -c send.c
match.o: match.c $(INCLUDES)
$(CC) $(CFLAGS) -c match.c
support.o: support.c $(INCLUDES)
$(CC) $(CFLAGS) -c support.c
userload.o: userload.c $(INCLUDES)
$(CC) $(CFLAGS) -c userload.c
help.o: help.c $(INCLUDES)
$(CC) $(CFLAGS) -c help.c
md5.o: md5.c $(INCLUDES)
$(CC) $(CFLAGS) -c md5.c
#install: all
# -if [ ! -d ${IRCDDIR} -a ! -f ${IRCDDIR} ] ; then \
@@ -108,6 +143,9 @@ ircd.o: ircd.c ../include/dbuf.h $(INCLUDES)
list.o: list.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c list.c
lusers.o: lusers.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c lusers.c
res.o: res.c ../include/res.h $(INCLUDES)
$(CC) $(CFLAGS) -c res.c
@@ -138,6 +176,15 @@ s_err.o: ../include/msg.h s_err.c $(INCLUDES)
s_misc.o: s_misc.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c s_misc.c
scache.o: scache.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c scache.c
ircsprintf.o: ircsprintf.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c ircsprintf.c
agent.o: agent.c ../include/dbuf.h $(INCLUDES)
$(CC) $(CFLAGS) -c agent.c
s_user.o: s_user.c $(INCLUDES) \
../include/dbuf.h ../include/channel.h ../include/whowas.h
$(CC) $(CFLAGS) -c s_user.c
+64 -57
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, common/bsd.c
* Unreal Internet Relay Chat Daemon - src/bsd.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -25,18 +25,19 @@
#include <signal.h>
ID_CVS("$Id$");
ID_Copyright("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Copyright
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
#ifndef _WIN32
extern int errno; /* ...seems that errno.h doesn't define this everywhere */
extern int errno; /* ...seems that errno.h doesn't define this everywhere */
#endif
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__linux__)
extern char *sys_errlist[];
extern char *sys_errlist[];
#endif
#ifdef DEBUGMODE
int writecalls = 0, writeb[10] = {0,0,0,0,0,0,0,0,0,0};
int writecalls = 0, writeb[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#endif
#ifndef _WIN32
VOIDSIG dummy()
@@ -44,14 +45,14 @@ VOIDSIG dummy()
#ifndef HAVE_RELIABLE_SIGNALS
(void)signal(SIGALRM, dummy);
(void)signal(SIGPIPE, dummy);
#ifndef HPUX /* Only 9k/800 series require this, but don't know how to.. */
#ifndef HPUX /* Only 9k/800 series require this, but don't know how to.. */
# ifdef SIGWINCH
(void)signal(SIGWINCH, dummy);
# endif
#endif
#else
# ifdef POSIX_SIGNALS
struct sigaction act;
struct sigaction act;
act.sa_handler = dummy;
act.sa_flags = 0;
@@ -69,6 +70,7 @@ VOIDSIG dummy()
# endif
#endif
}
#endif /* _WIN32 */
@@ -94,13 +96,13 @@ VOIDSIG dummy()
** *NOTE* I nuked 'em. At the load of current ircd servers
** you can't run with stuff that blocks. And we don't.
*/
int deliver_it(cptr, str, len)
aClient *cptr;
int len;
char *str;
{
int retval;
aClient *acpt = cptr->acpt;
int deliver_it(cptr, str, len)
aClient *cptr;
int len;
char *str;
{
int retval;
aClient *acpt = cptr->acpt;
#ifdef DEBUGMODE
writecalls++;
@@ -108,54 +110,59 @@ char *str;
#ifdef VMS
retval = netwrite(cptr->fd, str, len);
#else
if (IsDead(cptr) || (!IsServer(cptr) && !IsPerson(cptr) && !IsHandshake(cptr) && !IsUnknown(cptr)))
if (IsDead(cptr) || (!IsServer(cptr) && !IsPerson(cptr)
&& !IsHandshake(cptr) && !IsUnknown(cptr)))
{
str[len]='\0';
sendto_ops("* * * DEBUG ERROR * * * !!! Calling deliver_it() for %s, status %d %s, with message: %s",
cptr->name, cptr->status, IsDead(cptr)?"DEAD":"", str);
return -1;
str[len] = '\0';
sendto_ops
("* * * DEBUG ERROR * * * !!! Calling deliver_it() for %s, status %d %s, with message: %s",
cptr->name, cptr->status, IsDead(cptr) ? "DEAD" : "", str);
return -1;
}
#ifndef INET6
retval = send(cptr->fd, str, len, 0);
#else
retval = sendto(cptr->fd, str, len, 0, 0, 0);
#endif
/*
** Convert WOULDBLOCK to a return of "0 bytes moved". This
** should occur only if socket was non-blocking. Note, that
** all is Ok, if the 'write' just returns '0' instead of an
** error and errno=EWOULDBLOCK.
**
** ...now, would this work on VMS too? --msa
*/
** Convert WOULDBLOCK to a return of "0 bytes moved". This
** should occur only if socket was non-blocking. Note, that
** all is Ok, if the 'write' just returns '0' instead of an
** error and errno=EWOULDBLOCK.
**
** ...now, would this work on VMS too? --msa
*/
# ifndef _WIN32
if (retval < 0 && (errno == EWOULDBLOCK || errno == EAGAIN ||
errno == ENOBUFS))
errno == ENOBUFS))
# else
if (retval < 0 && (WSAGetLastError() == WSAEWOULDBLOCK ||
WSAGetLastError() == WSAENOBUFS))
if (retval < 0 && (WSAGetLastError() == WSAEWOULDBLOCK ||
WSAGetLastError() == WSAENOBUFS))
# endif
{
retval = 0;
SetBlocked(cptr);
}
else if (retval > 0)
{
#ifdef pyr
(void)gettimeofday(&cptr->lw, NULL);
#endif
ClearBlocked(cptr);
}
{
retval = 0;
SetBlocked(cptr);
}
else if (retval > 0)
{
ClearBlocked(cptr);
}
#endif
#ifdef DEBUGMODE
if (retval < 0) {
if (retval < 0)
{
writeb[0]++;
# ifndef _WIN32
Debug((DEBUG_ERROR,"write error (%s) to %s",
sys_errlist[errno], cptr->name));
Debug((DEBUG_ERROR, "write error (%s) to %s",
sys_errlist[errno], cptr->name));
# else
Debug((DEBUG_ERROR,"write error (%s) to %s",
sys_errlist[WSAGetLastError()], cptr->name));
Debug((DEBUG_ERROR, "write error (%s) to %s",
sys_errlist[WSAGetLastError()], cptr->name));
# endif
} else if (retval == 0)
}
else if (retval == 0)
writeb[1]++;
else if (retval < 16)
writeb[2]++;
@@ -175,28 +182,28 @@ char *str;
writeb[9]++;
#endif
if (retval > 0)
{
{
cptr->sendB += retval;
me.sendB += retval;
if (cptr->sendB > 1023)
{
{
cptr->sendK += (cptr->sendB >> 10);
cptr->sendB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
}
}
if (acpt != &me)
{
{
acpt->sendB += retval;
if (acpt->sendB > 1023)
{
{
acpt->sendK += (acpt->sendB >> 10);
acpt->sendB &= 0x03ff;
}
}
}
}
else if (me.sendB > 1023)
{
{
me.sendK += (me.sendB >> 10);
me.sendB &= 0x03ff;
}
}
return(retval);
}
}
return (retval);
}
+3511 -2903
View File
File diff suppressed because it is too large Load Diff
+359 -387
View File
File diff suppressed because it is too large Load Diff
-32
View File
@@ -1,32 +0,0 @@
#include <windows.h>
#include "Cio.h"
#include "CioFunc.h"
#include "common.h"
ID_CVS("$Id$");
//
// FUNCTION: Cio_Init(void)
//
// PURPOSE: Initializes window data and registers window class and other stuff
//
BOOL Cio_Init(HINSTANCE hInstance)
{
WNDCLASS wc;
// Fill in window class structure with parameters that describe
// the main window.
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)Cio_WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 4;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = CIOCLASS;
if ( !RegisterClass(&wc) ) return FALSE;
return TRUE;
}
-836
View File
@@ -1,836 +0,0 @@
#include <windows.h>
#include <memory.h>
#include <stdio.h>
#include <crtdbg.h>
#include "Cio.h"
#include "CioFunc.h"
#include "common.h"
ID_CVS("$Id$");
CioLine *CioMakeLine(CioLine *Prev, CioLine *Next)
{
CioLine *Line;
Line = LocalAlloc(LPTR, sizeof(CioLine));
_ASSERT(Line);
if ( Prev )
{
Prev->Next = Line;
Line->Prev = Prev;
}
if ( Next )
{
Next->Prev = Line;
Line->Next = Next;
}
return Line;
}
void CioRemoveLine(CioWndInfo *CWI, CioLine *Line)
{
if ( Line->Next )
Line->Next->Prev = Line->Prev;
if ( Line->Prev )
Line->Prev->Next = Line->Next;
else
CWI->FirstLine = Line->Next;
if ( Line->Data )
LocalFree(Line->Data);
LocalFree(Line);
}
//
// FUNCTION: Cio_Create(HANDLE, HWND, DWORD, int, int, int, int)
//
// PURPOSE: Creates main CIO window
//
HWND Cio_Create(HINSTANCE hInstance, HWND hParent, DWORD Style, int X, int Y, int W, int H)
{
HWND hWnd;
if ( hParent == NULL )
return NULL;
hWnd = CreateWindow(CIOCLASS, NULL, WS_CHILD | WS_VSCROLL | Style,
X, Y, W, H, hParent, NULL, hInstance, NULL);
return hWnd;
}
//
// FUNCTION: Cio_WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for a CIO window.
//
LRESULT CALLBACK Cio_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
DWORD Style;
switch (message)
{
case WM_CREATE:
return Cio_WndCreate(hWnd);
case WM_RBUTTONDOWN: // RightClick in windows client area...
return 0;
case WM_PAINT:
return Cio_WndPaint(hWnd);
case WM_SIZE:
Style = GetWindowLong(GetParent(hWnd), GWL_STYLE);
if ( Style & WS_MINIMIZE )
return 0;
return Cio_WndSize(hWnd, lParam);
case WM_VSCROLL:
return Cio_WndScroll(hWnd, wParam);
case WM_DESTROY:
return Cio_WndDestroy(hWnd);
case WM_SETFONT:
return Cio_SetFont(hWnd, wParam);
case CIO_ADDSTRING:
return Cio_WndAddString(hWnd, wParam, (char *)lParam);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
BOOL Cio_WndCreate(HWND hWnd)
{
CioWndInfo *CWI;
LOGFONT lfFont;
TEXTMETRIC tm;
HDC hdc;
CWI = LocalAlloc(LPTR, sizeof(CioWndInfo));
_ASSERT(CWI);
lfFont.lfHeight = 12;
lfFont.lfWidth = 0;
lfFont.lfEscapement = 0;
lfFont.lfOrientation = 0;
lfFont.lfWeight = 400;
lfFont.lfItalic = 0;
lfFont.lfUnderline = 0;
lfFont.lfStrikeOut = 0;
lfFont.lfCharSet = ANSI_CHARSET;
lfFont.lfOutPrecision = OUT_STRING_PRECIS;
lfFont.lfClipPrecision = CLIP_STROKE_PRECIS;
lfFont.lfQuality = DRAFT_QUALITY;
lfFont.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
wsprintf(lfFont.lfFaceName, "FixedSys");
CWI->hFont = CreateFontIndirect(&lfFont);
hdc = GetDC(hWnd);
SelectObject(hdc, CWI->hFont);
GetTextMetrics(hdc, &tm);
ReleaseDC(hWnd, hdc);
CWI->XChar = tm.tmAveCharWidth;
CWI->YChar = tm.tmHeight + tm.tmExternalLeading;
CWI->FirstLine = CWI->CurLine = CioMakeLine(NULL, NULL);
CWI->Lines=0;
SetWindowLong(hWnd, GWL_USER, (DWORD)CWI);
return 0;
}
BOOL Cio_WndPaint(HWND hWnd)
{
PAINTSTRUCT ps;
CioWndInfo *CWI;
HDC hdc;
HFONT hOldFont;
CioLine *Line;
RECT rect;
int nCol, nEndCol, nMaxCol, nRow, nEndRow, nBegCol, nCount, i=0;
int nVertPos, nHorzPos, nOff, nBegOff, NewColorAt=0;
BYTE Red, Green, Blue, NewColor=0, UnderLine=0;
HPEN hpen;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
hdc = BeginPaint(hWnd, &ps);
hOldFont = SelectObject(hdc, CWI->hFont);
rect = ps.rcPaint;
nCol = max(0, rect.left / CWI->XChar);
nEndCol = rect.right / CWI->XChar;
nEndCol = min(CWI->Width, nEndCol+1);
nEndRow = max(0, rect.top / CWI->YChar);
nRow = rect.bottom / CWI->YChar;
nRow = min(CWI->Height, nRow+1);
nBegOff = nCol;
nBegCol = nCol;
/*
* Find the first line to use, and work up from there.
*/
Line = CWI->FirstLine;
while ( Line && i < CWI->Scroll )
{
if ( Line->Data )
i++;
Line = Line->Next;
}
i = 0;
while ( Line && i < (CWI->Height-nRow) )
{
if ( Line->Data )
i++;
Line = Line->Next;
}
for ( ; nRow >= nEndRow; nRow-- )
{
UnderLine=0;
while ( Line && !Line->Data )
Line = Line->Next;
if ( !Line )
continue;
nMaxCol = Line->Len;
nOff = nBegOff;
nCol = 0;
nCount = 0;
for ( i = 0; i < Line->Len; i++ )
{
if ( Line->Data[i] == 0 )
{
Red = Line->Data[i+1];
Green = Line->Data[i+2];
Blue = Line->Data[i+3];
SetTextColor(hdc, RGB(Red, Green, Blue));
SetBkColor(hdc, RGB(255, 255, 255));
i += 3;
nCol += 4;
continue;
}
if ( nCount >= nBegCol )
break;
nCol++;
nCount++;
}
if ( i >= Line->Len )
continue;
for ( ; nCol <= nMaxCol; nCol++ )
{
nCount = nMaxCol-nCol;
for ( i = 0; i < (nMaxCol-nCol); i++ )
{
if ( Line->Data[nCol+i] == 0x1F )
{
nCount = i;
if ( UnderLine == 0 )
{
UnderLine = 1;
break;
}
if ( UnderLine == 1 )
{
UnderLine = 2;
break;
}
break;
}
if ( Line->Data[nCol+i] == 0x0F )
{
nCount = i;
UnderLine = 0;
break;
}
if ( Line->Data[nCol+i] == 0 )
{
NewColor = 1;
NewColorAt = nCol+i;
nCount = i;
i += 3;
break;
}
}
if ( nCount )
{
nVertPos = nRow * CWI->YChar - CWI->YChar +
CWI->YJunk;
nHorzPos = nOff * CWI->XChar;
rect.top = nVertPos;
rect.bottom = nVertPos + CWI->YChar;
rect.left = nHorzPos;
rect.right = nHorzPos + (CWI->XChar*nCount);
SetBkMode(hdc, OPAQUE);
ExtTextOut(hdc, nHorzPos, nVertPos, ETO_OPAQUE,
&rect, (LPSTR) Line->Data+nCol,
nCount, NULL);
nOff += nCount;
if ( UnderLine == 2 )
{
hpen = CreatePen(PS_SOLID, 0,
RGB(Red, Green, Blue));
SelectObject(hdc, hpen);
MoveToEx(hdc, (int)rect.left,
(int)rect.bottom-1,
(LPPOINT)NULL);
LineTo(hdc, (int)rect.right,
(int)rect.bottom-1);
DeleteObject(hpen);
UnderLine = 0;
}
}
if ( UnderLine == 1 )
UnderLine = 2;
nCol += i;
if ( NewColor )
{
Red = Line->Data[NewColorAt+1];
Green = Line->Data[NewColorAt+2];
Blue = Line->Data[NewColorAt+3];
SetTextColor(hdc, RGB(Red, Green, Blue));
SetBkColor(hdc, RGB(255, 255, 255));
NewColor = 0;
}
}
Line = Line->Next;
}
SelectObject(hdc, hOldFont);
EndPaint(hWnd, &ps);
return 0;
}
BOOL Cio_WndDestroy(HWND hWnd)
{
CioWndInfo *CWI;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
while ( CWI->FirstLine )
CioRemoveLine(CWI, CWI->FirstLine);
DeleteObject(CWI->hFont);
LocalFree(CWI);
return 0;
}
int Cio_WndAddString(HWND hWnd, int Len, char *Buffer)
{
CioWndInfo *CWI;
CioLine *Line;
int TLen=0, DLen=0, Loop=0, LastSpace=0, Scrolled=0, Pad=0;
BYTE Red=0, Grn=0, Blu=0;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
if ( CWI->ScrollMe == TRUE )
{
Cio_Scroll(hWnd, CWI, 1);
Scrolled++;
CWI->ScrollMe = FALSE;
}
if ( Buffer[Len-1] == '\r' )
{
CWI->ScrollMe = TRUE;
Len-=1;
}
while ( Len )
{
/*
* Check the current line to see if we have room to tack
* on our string to the end of. If not, put as much as
* possible on, then scroll up a new line.
*/
TLen=DLen=0;
Line = CWI->FirstLine;
while ( TLen < Line->Len )
{
if ( Line->Data[TLen] == 0 )
{
TLen+=4;
continue;
}
TLen+=1;
DLen+=1;
}
Loop=TLen=0;
while ( TLen < Len )
{
if ( Buffer[TLen] == 0 )
{
TLen+=4;
continue;
}
TLen+=1;
Loop+=1;
}
if ( DLen+Loop > CWI->Width )
{
Cio_Scroll(hWnd, CWI, 1);
Scrolled++;
Loop=TLen=0;
do
{
if ( Buffer[TLen] == 0 )
{
Red = Buffer[TLen+1];
Grn = Buffer[TLen+2];
Blu = Buffer[TLen+3];
TLen+=4;
continue;
}
if ( TLen >= Len || DLen+Loop >= CWI->Width )
break;
if ( Buffer[TLen] == ' ' )
LastSpace = TLen;
TLen+=1;
Loop+=1;
} while ( TLen < Len && DLen+Loop < CWI->Width );
if ( TLen != Len && Buffer[TLen] != ' ' &&
LastSpace && (LastSpace-TLen) < 16 )
TLen = LastSpace;
if ( Line->Data != NULL )
{
Line->Data = LocalReAlloc(Line->Data,
Line->Len+TLen+Pad, LMEM_MOVEABLE);
_ASSERT(Line->Data);
memset(Line->Data, ' ', Pad);
memmove(Line->Data+Line->Len+Pad, Buffer, TLen);
Line->Len += TLen + Pad;
}
else
{
if ( Buffer[0] == 0 )
{
Line->Data = LocalAlloc(LPTR, TLen+Pad);
_ASSERT(Line->Data);
memset(Line->Data, ' ', Pad);
memmove(Line->Data+Pad, Buffer, TLen);
Line->Len = TLen + Pad;
}
else
{
Line->Data = LocalAlloc(LPTR, TLen+4+Pad);
_ASSERT(Line->Data);
memset(Line->Data+4, ' ', Pad);
memmove(Line->Data+4+Pad, Buffer, TLen);
Line->Len = TLen+4+Pad;
Line->Data[0] = 0;
Line->Data[1] = Red;
Line->Data[2] = Grn;
Line->Data[3] = Blu;
}
}
if ( TLen == LastSpace )
TLen++;
Pad = 3;
Len -= TLen;
memmove(Buffer, Buffer+TLen, Len);
if ( Buffer[0] == '\r' && Len == 1 )
Len=0;
continue;
} /* if ( DLen+Loop > CWI->Width ) */
Line = CWI->FirstLine;
if ( Line->Data != NULL )
{
Line->Data = LocalReAlloc(Line->Data, Line->Len+TLen+Pad,
LMEM_MOVEABLE);
_ASSERT(Line->Data);
memset(Line->Data, ' ', Pad);
memmove(Line->Data+Line->Len+Pad, Buffer, Len);
Line->Len += Len + Pad;
}
else
{
if ( Buffer[0] == 0 )
{
Line->Data = LocalAlloc(LPTR, Len+Pad);
_ASSERT(Line->Data);
memset(Line->Data, ' ', Pad);
memmove(Line->Data+Pad, Buffer, Len);
Line->Len = Len + Pad;
}
else
{
Line->Data = LocalAlloc(LPTR, Len+4+Pad);
_ASSERT(Line->Data);
memset(Line->Data+4, ' ', Pad);
memmove(Line->Data+4+Pad, Buffer, Len);
Line->Len = Len+4+Pad;
Line->Data[0] = 0;
Line->Data[1] = Red;
Line->Data[2] = Grn;
Line->Data[3] = Blu;
}
}
break;
} /* while (Len) */
if ( !CWI->Scroll )
{
RECT rc;
rc.left = rc.top = 0;
rc.right = CWI->Width*CWI->XChar;
rc.bottom = CWI->Height*CWI->YChar+CWI->YJunk;
ScrollWindow(hWnd, 0, -(Scrolled*CWI->YChar), &rc, NULL);
rc.top = (CWI->Height-Scrolled)*CWI->YChar+CWI->YJunk;
if ( rc.top < 0 )
rc.top = 0;
return Scrolled;
}
return 0;
}
BOOL Cio_WndSize(HWND hWnd, LPARAM lParam)
{
CioWndInfo *CWI;
SCROLLINFO si;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
CWI->Scroll = 0;
CWI->Width = LOWORD(lParam) / CWI->XChar;
CWI->Height = HIWORD(lParam) / CWI->YChar;
CWI->YJunk = HIWORD(lParam) - (CWI->Height * CWI->YChar);
InvalidateRect(hWnd, NULL, TRUE);
/* Set the Scroll Bar information. */
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_DISABLENOSCROLL;
si.nMin = 1;
si.nMax = CWI->Lines;
si.nPage = CWI->Height-1;
si.nPos = si.nMax;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
return 0;
}
BOOL Cio_WndScroll(HWND hWnd, WPARAM wParam)
{
CioWndInfo *CWI;
SCROLLINFO si;
int Amnt=0, nPos=0;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
GetScrollInfo(hWnd, SB_VERT, &si);
si.nMax-=si.nPage;
si.nMax+=si.nMin;
nPos = si.nPos;
switch(LOWORD (wParam))
{
case SB_PAGEUP:
Amnt = -(int)si.nPage;
break;
case SB_PAGEDOWN:
Amnt = si.nPage;
break;
case SB_LINEUP:
Amnt = -(int)1;
break;
case SB_LINEDOWN:
Amnt = 1;
break;
case SB_THUMBTRACK:
break;
}
if ( Amnt )
{
nPos += Amnt;
if ( nPos < si.nMin )
{
Amnt -= nPos - si.nMin;
nPos = si.nMin;
}
if ( nPos > si.nMax )
{
Amnt -= nPos - si.nMax;
nPos = si.nMax;
}
if ( Amnt )
{
SetScrollPos(hWnd, SB_VERT, nPos, TRUE);
CWI->Scroll = si.nMax-nPos;
InvalidateRect(hWnd, NULL, TRUE);
}
}
return 0;
}
void Cio_Scroll(HWND hWnd, CioWndInfo *CWI, int Scroll)
{
int i=0, KillAmt=0, StopAt=0;
SCROLLINFO si;
CioLine *Line, *Next;
if ( CWI->Lines+Scroll > 500 && !CWI->Scroll )
{
Line = CWI->FirstLine;
KillAmt = max((CWI->Lines+Scroll)-500, 20);
for ( i = 0; Line && i < (CWI->Lines-KillAmt); i++ )
Line = Line->Next;
while ( Line )
{
Next = Line->Next;
CioRemoveLine(CWI, Line);
Line = Next;
}
CWI->Lines -= KillAmt;
}
for ( i = 0; i < Scroll; i++ )
CWI->FirstLine = CioMakeLine(NULL, CWI->FirstLine);
CWI->Lines+=Scroll;
if ( CWI->Scroll )
CWI->Scroll += Scroll;
/* Set the Scroll Bar information. */
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_DISABLENOSCROLL;
GetScrollInfo(hWnd, SB_VERT, &si);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE | SIF_DISABLENOSCROLL;
si.nMin = 1;
si.nMax = CWI->Lines;
si.nPage = CWI->Height-1;
si.nPos = CWI->Lines - si.nPage - CWI->Scroll;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
BOOL Cio_PrintF(HWND hWnd, char *InBuf, ...)
{
CioWndInfo *CWI;
va_list argptr;
char *Buffer=NULL, *Ptr = NULL;
DWORD Len=0, TLen, Off;
int Scrolled=0;
RECT rc;
if ( (Buffer = LocalAlloc(LPTR, 16384)) == NULL )
return FALSE;
va_start(argptr, InBuf);
Len = vsprintf(Buffer, InBuf, argptr);
va_end(argptr);
if ( Len == 0 )
{
LocalFree(Buffer);
return FALSE;
}
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
Ptr = memchr(Buffer, 0, TLen=Len);
while ( Ptr != NULL )
{
Off = Ptr-Buffer;
CWI->FR = Buffer[Off+1];
CWI->FG = Buffer[Off+2];
CWI->FB = Buffer[Off+3];
Off += 4;
TLen = Len-Off;
if ( TLen == 0 )
break;
Ptr = memchr(Buffer+Off, 0, TLen);
}
if ( Buffer[0] != 0 )
{
memmove(Buffer+4, Buffer, Len);
Len+=4;
Buffer[0] = 0;
Buffer[1] = CWI->FR;
Buffer[2] = CWI->FG;
Buffer[3] = CWI->FB;
}
rc.left = 0;
rc.right = CWI->Width*CWI->XChar;
rc.top = rc.bottom = CWI->Height*CWI->YChar;
do
{
Ptr = memchr(Buffer, '\r', Len);
if ( Ptr )
TLen = (Ptr-Buffer)+1;
else
TLen = Len;
if ( Buffer[0] != '\r' || CWI->ScrollMe == FALSE )
{
Scrolled = Cio_WndAddString(hWnd, TLen, Buffer);
rc.top -= Scrolled*CWI->YChar;
}
Len -= TLen;
memmove(Buffer, Buffer+TLen, Len);
} while ( Len );
if ( rc.top < rc.bottom )
{
if ( rc.top < 0 )
rc.top = 0;
InvalidateRect(hWnd, &rc, TRUE);
UpdateWindow(hWnd);
}
LocalFree(Buffer);
return TRUE;
}
BOOL Cio_Puts(HWND hWnd, char *InBuf, DWORD Len)
{
CioWndInfo *CWI;
char *Buffer = NULL, *Ptr = NULL;
DWORD TLen, Off;
int Scrolled=0;
RECT rc;
if ( !Len )
return FALSE;
if ( (Buffer = LocalAlloc(LPTR, 16384)) == NULL )
return FALSE;
memmove(Buffer, InBuf, Len);
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
Ptr = memchr(Buffer, 0, TLen=Len);
while ( Ptr != NULL )
{
Off = Ptr-Buffer;
CWI->FR = Buffer[Off+1];
CWI->FG = Buffer[Off+2];
CWI->FB = Buffer[Off+3];
Off += 4;
TLen = Len-Off;
if ( TLen == 0 )
break;
Ptr = memchr(Buffer+Off, 0, TLen);
}
if ( Buffer[0] != 0 )
{
memmove(Buffer+4, Buffer, Len);
Len+=4;
Buffer[0] = 0;
Buffer[1] = CWI->FR;
Buffer[2] = CWI->FG;
Buffer[3] = CWI->FB;
}
rc.left = 0;
rc.right = CWI->Width*CWI->XChar;
rc.top = rc.bottom = CWI->Height*CWI->YChar;
do
{
Ptr = memchr(Buffer, '\r', Len);
if ( Ptr )
TLen = (Ptr-Buffer)+1;
else
TLen = Len;
if ( Buffer[0] != '\r' || CWI->ScrollMe == FALSE )
{
Scrolled = Cio_WndAddString(hWnd, TLen, Buffer);
rc.top -= Scrolled*CWI->YChar;
}
Len -= TLen;
memmove(Buffer, Buffer+TLen, Len);
} while ( Len );
if ( rc.top < rc.bottom )
{
if ( rc.top < 0 )
rc.top = 0;
InvalidateRect(hWnd, &rc, TRUE);
UpdateWindow(hWnd);
}
LocalFree(Buffer);
return TRUE;
}
BOOL Cio_SetFont(HWND hWnd, WPARAM wParam)
{
CioWndInfo *CWI;
TEXTMETRIC tm;
HFONT hFont = (HFONT)wParam;
HDC hdc;
RECT rc;
CWI = (CioWndInfo *)GetWindowLong(hWnd, GWL_USER);
if ( CWI->hFont )
DeleteObject(CWI->hFont);
CWI->hFont = hFont;
hdc = GetDC(hWnd);
SelectObject(hdc, CWI->hFont);
GetTextMetrics(hdc, &tm);
ReleaseDC(hWnd, hdc);
CWI->XChar = tm.tmAveCharWidth;
CWI->YChar = tm.tmHeight + tm.tmExternalLeading;
/*
* Send resize message so it will pick up the new font size.
*/
GetClientRect(hWnd, &rc);
SendMessage(hWnd, WM_SIZE, 0, MAKELPARAM(rc.right-rc.left, rc.bottom-rc.top));
InvalidateRect(hWnd, NULL, TRUE);
return TRUE;
}
+76 -68
View File
@@ -1,5 +1,5 @@
/*
* IRC - Internet Relay Chat, ircd/class.c
* Unreal Internet Relay Chat Daemon - src/class.c
* Copyright (C) 1990 Darren Reed
*
* This program is free software; you can redistribute it and/or modify
@@ -32,93 +32,94 @@ ID_Notes("1.4 6/28/93");
#define BAD_PING -2
#define BAD_CLIENT_CLASS -3
aClass *classes;
aClass *classes;
int badclass = 0;
int get_conf_class(aconf)
aConfItem *aconf;
int get_conf_class(aconf)
aConfItem *aconf;
{
if ((aconf) && Class(aconf))
return (ConfClass(aconf));
Debug((DEBUG_DEBUG,"No Class For %s",
(aconf) ? aconf->name : "*No Conf*"));
Debug((DEBUG_DEBUG, "No Class For %s",
(aconf) ? aconf->name : "*No Conf*"));
return (BAD_CONF_CLASS);
}
static int get_conf_ping(aconf)
aConfItem *aconf;
static int get_conf_ping(aconf)
aConfItem *aconf;
{
if ((aconf) && Class(aconf))
return (ConfPingFreq(aconf));
Debug((DEBUG_DEBUG,"No Ping For %s",
(aconf) ? aconf->name : "*No Conf*"));
Debug((DEBUG_DEBUG, "No Ping For %s",
(aconf) ? aconf->name : "*No Conf*"));
return (BAD_PING);
}
int get_client_class(acptr)
aClient *acptr;
int get_client_class(acptr)
aClient *acptr;
{
Reg1 Link *tmp;
Reg2 aClass *cl;
int i = 0, retc = BAD_CLIENT_CLASS;
Link *tmp;
aClass *cl;
int i = 0, retc = BAD_CLIENT_CLASS;
if (acptr && !IsMe(acptr) && (acptr->confs))
if (acptr && !IsMe(acptr) && (acptr->confs))
for (tmp = acptr->confs; tmp; tmp = tmp->next)
{
{
if (!tmp->value.aconf ||
!(cl = tmp->value.aconf->class))
continue;
if (Class(cl) > retc)
retc = Class(cl);
}
}
Debug((DEBUG_DEBUG,"Returning Class %d For %s",retc,acptr->name));
Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, acptr->name));
return (retc);
}
int get_client_ping(acptr)
aClient *acptr;
int get_client_ping(acptr)
aClient *acptr;
{
int ping = 0, ping2;
aConfItem *aconf;
Link *link;
int ping = 0, ping2;
aConfItem *aconf;
Link *link;
link = acptr->confs;
if (link)
while (link)
{
{
aconf = link->value.aconf;
if (aconf->status & (CONF_CLIENT|CONF_CONNECT_SERVER|
CONF_NOCONNECT_SERVER))
{
if (aconf->status & (CONF_CLIENT | CONF_CONNECT_SERVER |
CONF_NOCONNECT_SERVER))
{
ping2 = get_conf_ping(aconf);
if ((ping2 != BAD_PING) && ((ping > ping2) ||
!ping))
ping = ping2;
}
}
link = link->next;
}
}
else
{
{
ping = PINGFREQUENCY;
Debug((DEBUG_DEBUG,"No Attached Confs"));
}
Debug((DEBUG_DEBUG, "No Attached Confs"));
}
if (ping <= 0)
ping = PINGFREQUENCY;
Debug((DEBUG_DEBUG,"Client %s Ping %d", acptr->name, ping));
Debug((DEBUG_DEBUG, "Client %s Ping %d", acptr->name, ping));
return (ping);
}
int get_con_freq(clptr)
aClass *clptr;
int get_con_freq(clptr)
aClass *clptr;
{
if (clptr)
return (ConFreq(clptr));
@@ -133,24 +134,31 @@ aClass *clptr;
* if no present entry is found, then create a new one and add it in
* immeadiately after the first one (class 0).
*/
void add_class(class, ping, confreq, maxli, sendq)
int class, ping, confreq, maxli;
long sendq;
void add_class(class, ping, confreq, maxli, sendq)
int class, ping, confreq, maxli;
long sendq;
{
aClass *t, *p;
if (maxli > (MAXCONNECTIONS - 15))
{
Debug((DEBUG_DEBUG, "Not adding Class %d as maxli is > MAXCONNECTIONS - 15",
class));
badclass = class;
return;
}
t = find_class(class);
if ((t == classes) && (class != 0))
{
{
p = (aClass *)make_class();
NextClass(p) = NextClass(t);
NextClass(t) = p;
}
}
else
p = t;
Debug((DEBUG_DEBUG,
"Add Class %d: p %x t %x - cf: %d pf: %d ml: %d sq: %l",
class, p, t, confreq, ping, maxli, sendq));
"Add Class %d: p %x t %x - cf: %d pf: %d ml: %d sq: %l",
class, p, t, confreq, ping, maxli, sendq));
Class(p) = class;
ConFreq(p) = confreq;
PingFreq(p) = ping;
@@ -160,8 +168,8 @@ long sendq;
Links(p) = 0;
}
aClass *find_class(cclass)
int cclass;
aClass *find_class(cclass)
int cclass;
{
aClass *cltmp;
@@ -171,30 +179,30 @@ int cclass;
return classes;
}
void check_class()
void check_class()
{
Reg1 aClass *cltmp, *cltmp2;
aClass *cltmp, *cltmp2;
Debug((DEBUG_DEBUG, "Class check:"));
for (cltmp2 = cltmp = FirstClass(); cltmp; cltmp = NextClass(cltmp2))
{
{
Debug((DEBUG_DEBUG,
"Class %d : CF: %d PF: %d ML: %d LI: %d SQ: %ld",
Class(cltmp), ConFreq(cltmp), PingFreq(cltmp),
MaxLinks(cltmp), Links(cltmp), MaxSendq(cltmp)));
"Class %d : CF: %d PF: %d ML: %d LI: %d SQ: %ld",
Class(cltmp), ConFreq(cltmp), PingFreq(cltmp),
MaxLinks(cltmp), Links(cltmp), MaxSendq(cltmp)));
if (MaxLinks(cltmp) < 0)
{
{
NextClass(cltmp2) = NextClass(cltmp);
if (Links(cltmp) <= 0)
free_class(cltmp);
}
}
else
cltmp2 = cltmp;
}
}
}
void initclass()
void initclass()
{
classes = (aClass *)make_class();
@@ -207,32 +215,32 @@ void initclass()
NextClass(FirstClass()) = NULL;
}
void report_classes(sptr)
aClient *sptr;
void report_classes(sptr)
aClient *sptr;
{
Reg1 aClass *cltmp;
aClass *cltmp;
for (cltmp = FirstClass(); cltmp; cltmp = NextClass(cltmp))
sendto_one(sptr, rpl_str(RPL_STATSYLINE), me.name, sptr->name,
'Y', Class(cltmp), PingFreq(cltmp), ConFreq(cltmp),
MaxLinks(cltmp), MaxSendq(cltmp));
'Y', Class(cltmp), PingFreq(cltmp), ConFreq(cltmp),
MaxLinks(cltmp), MaxSendq(cltmp));
}
long get_sendq(cptr)
aClient *cptr;
long get_sendq(cptr)
aClient *cptr;
{
Reg1 int sendq = MAXSENDQLENGTH, retc = BAD_CLIENT_CLASS;
Reg2 Link *tmp;
Reg2 aClass *cl;
int sendq = MAXSENDQLENGTH, retc = BAD_CLIENT_CLASS;
Link *tmp;
aClass *cl;
if (cptr && !IsMe(cptr) && (cptr->confs))
if (cptr && !IsMe(cptr) && (cptr->confs))
for (tmp = cptr->confs; tmp; tmp = tmp->next)
{
{
if (!tmp->value.aconf ||
!(cl = tmp->value.aconf->class))
continue;
if (Class(cl) > retc)
sendq = MaxSendq(cl);
}
}
return sendq;
}
+111 -203
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, src/cloak.c
* Unreal Internet Relay Chat Daemon, src/cloak.c
* (C) VirtualWorld code made originally by RogerY (rogery@austnet.org)
* Some coding by Potvin (potvin@shadownet.org)
* Modified by Stskeeps with some TerraX codebits
@@ -25,6 +25,7 @@
static char sccxid[] = "@(#)cloak.c 9.00 7/12/99 UnrealIRCd";
#endif
*/
#include "struct.h"
#include "common.h"
#include "sys.h"
@@ -48,56 +49,57 @@ ID_CVS("$Id$");
#define HASHVAL_TOTAL 30011
#define HASHVAL_PARTIAL 211
extern aClient me;
extern int seed;
int match(char *, char *), find_exception(char *);
extern aClient me;
extern int seed;
int match(char *, char *), find_exception(char *);
extern unsigned char tolowertab[];
int str2array(char **pparv, char *string, char *delim)
int str2array(char **pparv, char *string, char *delim)
{
char *tok;
int pparc=0;
char *tok;
int pparc = 0;
tok=(char *) strtok((char *) string,delim);
while(tok != NULL)
{
pparv[pparc++]=tok;
tok= (char *) strtok((char *) NULL,(char *) delim);
}
tok = (char *)strtok((char *)string, delim);
while (tok != NULL)
{
pparv[pparc++] = tok;
tok = (char *)strtok((char *)NULL, (char *)delim);
}
return pparc;
return pparc;
}
void truncstring(char *stringvar, int firstlast, int amount){
if (firstlast)
{
stringvar+=amount;
*stringvar=0;
stringvar-=amount;
}
else
{
stringvar+=strlen(stringvar);
stringvar-=amount;
}
void truncstring(char *stringvar, int firstlast, int amount)
{
if (firstlast)
{
stringvar += amount;
*stringvar = 0;
stringvar -= amount;
}
else
{
stringvar += strlen(stringvar);
stringvar -= amount;
}
}
#define B_BASE 1000
int Maskchecksum (char *data, int len)
int Maskchecksum(char *data, int len)
{
int i;
int j;
int i;
int j;
j=0;
for (i=0 ; i<len ; i++)
j = 0;
for (i = 0; i < len; i++)
{
j += *data++ * (i < 16 ? (i+1)*(i+1) : i*(i-15));
j += *data++ * (i < 16 ? (i + 1) * (i + 1) : i * (i - 15));
}
return (j+B_BASE)%0xffff;
return (j + B_BASE) % 0xffff;
}
@@ -107,218 +109,124 @@ int Maskchecksum (char *data, int len)
* new hidehost by vmlinuz
* added some extra fixes by stskeeps
* originally based on TerraIRCd
* Fixed serious memory leak
*/
char *hidehost (char *s, int useless)
char *hidehost(char *s, int useless)
{
// static char mask[128];
char *mask;
static char mask[128];
static char ipmask[64];
int csum;
char *dot,*tmp;
char *cp;
int i, isdns;
int dots = 0;
mask = MyMalloc(129);
memset (mask, 0, 128);
int csum;
char *dot;
char *cp;
int i, isdns;
int dots = 0;
csum = Maskchecksum (s, strlen(s));
memset(mask, 0, 128);
if (strlen (s) > 127) /* this isn't likely to happen: s is limited to HOSTLEN+1 (64) */
csum = Maskchecksum(s, strlen(s));
if (strlen(s) > 127) /* this isn't likely to happen: s is limited to HOSTLEN+1 (64) */
{
s[128] = 0;
}
isdns = 0;
cp = s;
for (i=0; i < strlen(s); i++)
for (i = 0; i < strlen(s); i++)
{
if (*cp == '.') {
if (*cp == '.')
{
dots++;
}
cp++;
cp++;
}
for (i=0 ; i<strlen(s) ; i++)
for (i = 0; i < strlen(s); i++)
{
if (s[i] == '.') {
continue;
}
if (isalpha(s[i]))
if (s[i] == '.')
{
continue;
}
if (isalpha(s[i]))
{
isdns = 1;
break;
}
}
if (isdns)
{
/* it is a resolved yes.. */
if (dots == 1) { /* mystro.org f.x */
sprintf(mask, "%s%c%d.%s",
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum), s);
}
if (dots == 0) { /* localhost */
sprintf(mask, "%s%c%d",
s,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum));
if (dots == 1)
{ /* mystro.org f.x */
ircsprintf(mask, "%s%c%d.%s",
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum), s);
}
if (dots == 0)
{ /* localhost */
ircsprintf(mask, "%s%c%d",
s,
(csum < 0 ? '=' : '-'), (csum < 0 ? -csum : csum));
}
if (dots > 1) {
dot = (char *) strchr((char *) s, '.');
if (dots > 1)
{
dot = (char *)strchr((char *)s, '.');
/* mask like *<first dot> */
sprintf(mask, "%s%c%d.%s",
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum), dot+1);
}
}
else
ircsprintf(mask, "%s%c%d.%s",
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum), dot + 1);
}
}
else
{
strncpy(ipmask, s, sizeof(ipmask));
ipmask[sizeof(ipmask)-1]='\0'; /* safety check */
dot = (char *) strrchr((char *) ipmask, '.');
ipmask[sizeof(ipmask) - 1] = '\0'; /* safety check */
dot = (char *)strrchr((char *)ipmask, '.');
*dot = '\0';
if (dot == NULL) /* dot should never be NULL: IP needs dots */
sprintf (mask, "%s%c%i",
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum));
else
sprintf (mask, "%s.%s%c%i",
ipmask,
hidden_host,
(csum < 0 ? '=' : '-'),
(csum < 0 ? -csum : csum));
}
ok1:
if (dot == NULL) /* dot should never be NULL: IP needs dots */
ircsprintf(mask, "%s%c%i",
hidden_host,
(csum < 0 ? '=' : '-'), (csum < 0 ? -csum : csum));
else
ircsprintf(mask, "%s.%s%c%i",
ipmask,
hidden_host,
(csum < 0 ? '=' : '-'), (csum < 0 ? -csum : csum));
}
return mask;
}
/* Regular user host */
void make_virthost(char *curr, char *new)
/* mode = 0, just use strncpyzt, 1 = Realloc new and return new pointer */
char *make_virthost(char *curr, char *new, int mode)
{
char *mask;
char *x;
int i;
if (curr == NULL)
return;
if (new == NULL)
return;
mask = hidehost(curr, 0);
strncpyzt(new, mask, HOSTLEN); /* */
return;
if (mode == 0)
{
strncpyzt(new, mask, HOSTLEN); /* */
return NULL;
}
i = strlen(mask) + 1;
if (new)
MyFree(new);
x = MyMalloc(i);
strcpy(x, mask);
return x;
}
/* Netadmin host */
void make_netadminhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", netadmin_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Coadmin host */
void make_coadminhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", coadmin_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Techadmin host */
void make_techadminhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", techadmin_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Server admin host */
void make_adminhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", admin_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Service admin host */
void make_sadminhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", sadmin_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Global Oper host */
void make_operhost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", oper_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Local Oper host */
void make_locophost(char *new)
{
char tmpnew[HOSTLEN];
#ifndef iNAH2
sprintf(tmpnew, "%s", locop_host);
strncpyzt(new, tmpnew, HOSTLEN);
#endif
return;
}
/* Make SETHOST */
void make_sethost(char *new, char *new2)
{
char tmpnew[HOSTLEN];
sprintf(tmpnew,"%s", new2);
strncpyzt(new, tmpnew, HOSTLEN);
return;
}
/* make setname */
void make_setname(char *new, char *new2)
{
char tmpnew[REALLEN];
sprintf(tmpnew,"%s", new2);
strncpyzt(new, tmpnew, REALLEN);
return;
}
/* make setident */
void make_setident(char *new, char *new2)
{
char tmpnew[USERLEN];
sprintf(tmpnew, "%s", new2);
strncpyzt(new, tmpnew, USERLEN);
return;
}
+5 -3
View File
@@ -3,7 +3,8 @@
* $Id$
*/
int main() {
int main()
{
printf("|=-=-=-=-=-==-==--=-=-=-=-=-==-==--=-=-=-=-=-==-==|\n");
printf("| |\n");
printf("| UnrealIRCd Configuration Tool |\n");
@@ -11,5 +12,6 @@ int main() {
printf("| |\n");
printf("|-=-=-=-=-=-==-=-=-=-=-=-=-=-==-==-=-=-=-=-=-==-==|\n");
printf("Actually this is only a demo .. so wait for it to be released;p");
}
printf
("Actually this is only a demo .. so wait for it to be released;p");
}
+582 -567
View File
File diff suppressed because it is too large Load Diff
+117 -109
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, common/dbuf.c
* Unreal Internet Relay Chat Daemon, src/dbuf.c
* Copyright (C) 1990 Markku Savela
*
* This program is free software; you can redistribute it and/or modify
@@ -39,21 +39,21 @@
#include "struct.h"
#include "common.h"
#include "sys.h"
#ifdef USE_DMALLOC
#include "h.h"
#endif
ID_CVS("$Id$");
ID_Copyright("(C) 1990 Markku Savela");
ID_Notes("2.17 1/30/94 (C) 1990 Markku Savela");
#if !defined(VALLOC) && !defined(valloc)
#if !defined(VALLOC) && !defined(valloc) && !defined(USE_DMALLOC)
# ifndef _WIN32
# define valloc malloc
# else
# define valloc MyMalloc
# endif
#endif
int dbufalloc = 0, dbufblocks = 0;
static dbufbuf *freelist = NULL;
int dbufalloc = 0, dbufblocks = 0;
static dbufbuf *freelist = NULL;
/* This is a dangerous define because a broken compiler will set DBUFSIZ
** to 4, which will work but will be very inefficient. However, there
@@ -70,62 +70,64 @@ static dbufbuf *freelist = NULL;
static dbufbuf *dbuf_alloc()
{
#if defined(VALLOC) && !defined(DEBUGMODE)
Reg1 dbufbuf *dbptr, *db2ptr;
Reg2 int num;
dbufbuf *dbptr, *db2ptr;
int num;
#else
Reg1 dbufbuf *dbptr;
dbufbuf *dbptr;
#endif
dbufalloc++;
if ((dbptr = freelist))
{
{
freelist = freelist->next;
return dbptr;
}
}
if (dbufalloc * DBUFSIZ > BUFFERPOOL)
{
{
dbufalloc--;
return NULL;
}
}
#if defined(VALLOC) && !defined(DEBUGMODE)
# if defined(SOL20) || defined(_SC_PAGESIZE)
num = sysconf(_SC_PAGESIZE)/sizeof(dbufbuf);
# if defined(_SOLARIS) || defined(_SC_PAGESIZE)
num = sysconf(_SC_PAGESIZE) / sizeof(dbufbuf);
# else
num = getpagesize()/sizeof(dbufbuf);
num = getpagesize() / sizeof(dbufbuf);
# endif
if (num < 0)
num = 1;
dbufblocks += num;
dbptr = (dbufbuf *)valloc(num*sizeof(dbufbuf));
dbptr = (dbufbuf *)valloc(num * sizeof(dbufbuf));
if (!dbptr)
return (dbufbuf *)NULL;
num--;
for (db2ptr = dbptr; num; num--)
{
{
db2ptr = (dbufbuf *)((char *)db2ptr + sizeof(dbufbuf));
db2ptr->next = freelist;
freelist = db2ptr;
}
}
return dbptr;
#else
dbufblocks++;
return (dbufbuf *)MyMalloc(sizeof(dbufbuf));
#endif
}
/*
** dbuf_free - return a dbufbuf structure to the freelist
*/
static void dbuf_free(ptr)
Reg1 dbufbuf *ptr;
static void dbuf_free(ptr)
dbufbuf *ptr;
{
dbufalloc--;
ptr->next = freelist;
freelist = ptr;
}
/*
** This is called when malloc fails. Scrap the whole content
** of dynamic buffer and return -1. (malloc errors are FATAL,
@@ -133,60 +135,65 @@ Reg1 dbufbuf *ptr;
** the "dbuf" has consistent EMPTY status... ;)
*/
static int dbuf_malloc_error(dyn)
dbuf *dyn;
{
dbuf *dyn;
{
dbufbuf *p;
dyn->length = 0;
dyn->offset = 0;
while ((p = dyn->head) != NULL)
{
{
dyn->head = p->next;
dbuf_free(p);
}
}
dyn->tail = dyn->head;
return -1;
}
}
int dbuf_put(dyn, buf, length)
dbuf *dyn;
char *buf;
int length;
int dbuf_put(dyn, buf, length)
dbuf *dyn;
char *buf;
int length;
{
Reg1 dbufbuf **h, *d;
Reg2 int off;
Reg3 int chunk;
dbufbuf **h, *d;
int off;
int chunk;
if(!length) return 1; /* Nothing to do */
if (!length)
return 1; /* Nothing to do */
off = (dyn->offset + dyn->length) % DBUFSIZ;
/*
** Locate the last non-empty buffer. If the last buffer is
** full, the loop will terminate with 'd==NULL'. This loop
** assumes that the 'dyn->length' field is correctly
** maintained, as it should--no other check really needed.
*/
if (!dyn->length) h = &(dyn->head);
else {
if (off) h = &(dyn->tail);
else h = &(dyn->tail->next);
** Locate the last non-empty buffer. If the last buffer is
** full, the loop will terminate with 'd==NULL'. This loop
** assumes that the 'dyn->length' field is correctly
** maintained, as it should--no other check really needed.
*/
if (!dyn->length)
h = &(dyn->head);
else
{
if (off)
h = &(dyn->tail);
else
h = &(dyn->tail->next);
}
/*
** Append users data to buffer, allocating buffers as needed
*/
** Append users data to buffer, allocating buffers as needed
*/
chunk = DBUFSIZ - off;
dyn->length += length;
for ( ;length > 0; h = &(d->next))
{
for (; length > 0; h = &(d->next))
{
if ((d = *h) == NULL)
{
{
if ((d = (dbufbuf *)dbuf_alloc()) == NULL)
return dbuf_malloc_error(dyn);
dyn->tail = d;
*h = d;
d->next = NULL;
}
}
if (chunk > length)
chunk = length;
bcopy(buf, d->data + off, chunk);
@@ -194,71 +201,72 @@ int length;
buf += chunk;
off = 0;
chunk = DBUFSIZ;
}
}
return 1;
}
}
char *dbuf_map(dyn,length)
dbuf *dyn;
int *length;
{
char *dbuf_map(dyn, length)
dbuf *dyn;
int *length;
{
if (dyn->head == NULL)
{
{
dyn->tail = NULL;
*length = 0;
return NULL;
}
}
*length = DBUFSIZ - dyn->offset;
if (*length > dyn->length)
*length = dyn->length;
return (dyn->head->data + dyn->offset);
}
}
int dbuf_delete(dyn,length)
dbuf *dyn;
int length;
{
int dbuf_delete(dyn, length)
dbuf *dyn;
int length;
{
dbufbuf *d;
int chunk;
int chunk;
if (length > dyn->length)
length = dyn->length;
chunk = DBUFSIZ - dyn->offset;
while (length > 0)
{
{
if (chunk > length)
chunk = length;
length -= chunk;
dyn->offset += chunk;
dyn->length -= chunk;
if (dyn->offset == DBUFSIZ || dyn->length == 0)
{
{
d = dyn->head;
dyn->head = d->next;
dyn->offset = 0;
dbuf_free(d);
}
}
chunk = DBUFSIZ;
}
if (dyn->head == (dbufbuf *)NULL) {
}
if (dyn->head == (dbufbuf *)NULL)
{
dyn->length = 0;
dyn->tail = 0;
}
return 0;
}
}
int dbuf_get(dyn, buf, length)
dbuf *dyn;
char *buf;
int length;
{
int moved = 0;
int chunk;
char *b;
int dbuf_get(dyn, buf, length)
dbuf *dyn;
char *buf;
int length;
{
int moved = 0;
int chunk;
char *b;
while (length > 0 && (b = dbuf_map(dyn, &chunk)) != NULL)
{
{
if (chunk > length)
chunk = length;
bcopy(b, buf, (int)chunk);
@@ -266,9 +274,9 @@ int length;
buf += chunk;
length -= chunk;
moved += chunk;
}
}
return moved;
}
}
/*
** dbuf_getmsg
@@ -277,18 +285,18 @@ int length;
** either a \r or \n prsent. If so, copy as much as possible (determined by
** length) into buf and return the amount copied - else return 0.
*/
int dbuf_getmsg(dyn, buf, length)
dbuf *dyn;
char *buf;
register int length;
int dbuf_getmsg(dyn, buf, length)
dbuf *dyn;
char *buf;
int length;
{
dbufbuf *d;
register char *s;
register int dlen;
register int i;
int copy;
dbufbuf *d;
char *s;
int dlen;
int i;
int copy;
getmsg_init:
getmsg_init:
d = dyn->head;
dlen = dyn->length;
i = DBUFSIZ - dyn->offset;
@@ -303,49 +311,49 @@ getmsg_init:
if (i > dlen)
i = dlen;
while (length > 0 && dlen > 0)
{
{
dlen--;
if (*s == '\n' || *s == '\r')
{
{
copy = dyn->length - dlen;
/*
** Shortcut this case here to save time elsewhere.
** -avalon
*/
** Shortcut this case here to save time elsewhere.
** -avalon
*/
if (copy == 1)
{
{
(void)dbuf_delete(dyn, 1);
goto getmsg_init;
}
}
break;
}
}
length--;
if (!--i)
{
{
if ((d = d->next))
{
{
s = d->data;
i = MIN(DBUFSIZ, dlen);
}
}
}
}
else
s++;
}
}
if (copy <= 0)
return 0;
/*
** copy as much of the message as wanted into parse buffer
*/
** copy as much of the message as wanted into parse buffer
*/
i = dbuf_get(dyn, buf, MIN(copy, length));
/*
** and delete the rest of it!
*/
** and delete the rest of it!
*/
if (copy - i > 0)
(void)dbuf_delete(dyn, copy - i);
if (i >= 0)
*(buf+i) = '\0'; /* mark end of messsage */
*(buf + i) = '\0'; /* mark end of messsage */
return i;
}
+568 -271
View File
@@ -1,6 +1,6 @@
/************************************************************************
* IRC - Internet Relay Chat, dynconf.c
* (C) 1999 Carsten Munk (Techie/Stskeeps) <cmunk@toybox.flirt.org>
* Unreal Internet Relay Chat Daemon, src/dynconf.c
* (C) 1999-2000 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define DYNCONF_C
#include "struct.h"
#include "common.h"
#include "sys.h"
@@ -39,145 +38,218 @@
#include "h.h"
ID_CVS("$Id$");
ID_Copyright("(C) 1999 Carsten Munk");
ID_Copyright("(C) 1999-2000 Carsten Munk");
#define DoDebug fprintf(stderr, "[%s] %s | %li\n", babuf, __FILE__, __LINE__);
#define AllocCpy(x,y) if ((x) && type == 1) MyFree((x)); x = (char *) MyMalloc(strlen(y) + 1); strcpy(x,y)
#define XtndCpy(x,y) x = (char *) MyMalloc(strlen(y) + 2); *x = '\0'; strcat(x, "*"); strcpy(x,y)
/* externals */
extern int un_uid, un_gid;
/* internals */
aConfiguration iConf;
int icx = 0;
int icx = 0;
char buf[1024];
/* strips \r and \n's from the line */
void iCstrip(char *line)
{
char *c;
char *c;
if ((c = strchr(line, '\n'))) *c = '\0';
if ((c = strchr(line, '\r'))) *c = '\0';
if ((c = strchr(line, '\n')))
*c = '\0';
if ((c = strchr(line, '\r')))
*c = '\0';
}
/*
for (q = p; *q; q++) {
printf("%x ", *q);
}
*/
/* Get the unrealircd.conf/*.network file version and check it */
char *get_version(char *file) {
FILE *fd = fopen(file, "r");
char buf[24], *tmp = '\0', *buf2 = '\0', *version = '\0';
/* This should never happen, but we'll keep it just to be safe */
if (!fd) {
#ifdef _WIN32
MessageBox(NULL, "UnrealIRCD/32 Init Error", "Unable to load dynamic config (or network) file !! ", MB_OK);
#else
fprintf(stderr, "[error] Couldn't load %s !!!\n", file);
#endif
exit(-1);
}
/* We only want to read the first line */
fgets(buf, 24, fd);
tmp = strtok(buf, "\n");
/* Make sure that it is a valid version line */
buf2 = strtok(tmp,"^");
/* If it isn't exit */
if (strcmp(buf2, "ver")) {
#ifdef _WIN32
MessageBox(NULL, "Dynamic config file (or network file) is not valid, visit http://unreal.tspre.org to learn how to upgrade", "UnrealIRCD/32 Init Error", MB_OK);
#else
fprintf(stderr, "%s is invalid, visit http://unreal.tspre.org to learn how to upgrade", file);
#endif
exit(-1);
}
/* If it is we get the version number */
version = strtok(NULL, "");
fclose(fd);
/* Now return the version */
return version;
}
int load_conf(char *file, int type)
/* this loads dynamic ZCONF */
int load_conf(char *filename, int type)
{
FILE *zConf;
char *stat;
char *buf = MyMalloc(1024);
char *babuf = MyMalloc(1024);
char *p, *q;
char *var, *setto;
long aint;
int v1, v2;
/* Since we have no real way of knowing what file we are dealing with, we will check
* for *.conf then get the version */
if(!match("*.conf",file)) {
if (strcmp(get_version(file), "1.1")) {
FILE *zConf;
char *version = NULL;
char *i;
zConf = fopen(filename, "r");
if (!zConf)
{
if (type == 1)
{
sendto_ops("[error] Could not load %s !", filename);
return -1;
}
else
{
#ifdef _WIN32
MessageBox(NULL, "Dynamic config file is not valid, visit http://unreal.tspre.org to learn how to upgrade", "UnrealIRCD/32 Init Error", MB_OK);
ircsprintf(buf, "Unable to load dynamic config %s",
filename);
MessageBox(NULL, "UnrealIRCD/32 Init Error", buf,
MB_OK);
#else
fprintf(stderr, "%s is invalid, visit http://unreal.tspre.org to learn how to upgrade\n", file);
fprintf(stderr, "[error] Couldn't load %s !!!\n",
filename);
#endif
exit(-1);
}
}
zConf = fopen(file, "r");
if (zConf == NULL && (type == 0)) {
}
i = fgets(buf, 1023, zConf);
if (!i)
{
if (type == 1)
{
sendto_ops("[error] Error reading from %s !", filename);
return -1;
}
else
{
#ifdef _WIN32
MessageBox(NULL, "UnrealIRCD/32 Init Error", "Unable to load dynamic config (or network) file !! ", MB_OK);
ircsprintf(buf, "Unable to read dynamic config %s",
filename);
MessageBox(NULL, "UnrealIRCD/32 Init Error", buf,
MB_OK);
#else
fprintf(stderr, "[error] Couldn't load %s !!!\n", file);
#endif
exit(-1);
fprintf(stderr, "[error] Couldn't read %s !!!\n",
filename);
#endif
exit(-1);
}
}
iCstrip(buf);
version = strtok(buf, "^");
version = strtok(NULL, "");
/* is this a unrealircd.conf file? */
if (!match("1.*", version))
{
/* wrong version */
if (strcmp(version, DYNCONF_CONF_VERSION))
{
if (type == 1)
{
sendto_ops
("[error] %s got a non-compatible version (%s) !",
filename, version);
sendto_ops
("[error] Please go to http://unreal.tspre.org and learn how to upgrade");
return -1;
}
else
{
#ifdef _WIN32
ircsprintf(buf,
"Incompatible version (%s) in %s - please upgrade",
version, filename);
MessageBox(NULL, "UnrealIRCD/32 Init Error",
buf, MB_OK);
#else
fprintf(stderr,
"[error] Incompatible version (%s) in %s - please upgrade !!!\n",
version, filename);
#endif
exit(-1);
}
}
load_conf2(zConf, filename, type);
return -1;
}
else if (!match("2.*", version))
{
/* network file */
/* wrong version */
if (strcmp(version, DYNCONF_NETWORK_VERSION))
{
if (type == 1)
{
sendto_ops
("[error] %s got a non-compatible network file version (%s) !",
filename, version);
sendto_ops
("[error] Please go to http://unreal.tspre.org and learn how to upgrade");
return -1;
}
else
{
#ifdef _WIN32
ircsprintf(buf,
"Incompatible network file version (%s) in %s - please upgrade",
version, filename);
MessageBox(NULL, "UnrealIRCD/32 Init Error",
buf, MB_OK);
#else
fprintf(stderr,
"[error] Incompatible network file version (%s) in %s - please upgrade !!!\n",
version, filename);
#endif
exit(-1);
}
}
load_conf3(zConf, filename, type);
return -1;
}
else
if (zConf == NULL && (type == 1))
{
sendto_ops("[error] Couldnt load dynconf file %s !!", file);
}
*buf = '\1';
stat = buf;
{
if (type == 1)
{
sendto_ops
("[Error] Malformed version header in %s. Please read Unreal.nfo on info how to get support",
filename);
return -1;
}
else
{
#ifdef _WIN32
ircsprintf(buf,
"Malformed version header in %s. Please read Unreal.nfo on info how to get support",
filename);
MessageBox(NULL, "UnrealIRCD/32 Init Error", buf,
MB_OK);
#else
fprintf(stderr,
"[error] Malformed version header in %s. Please read Unreal.nfo on info how to get support!!\n",
filename);
#endif
exit(-1);
}
return -1;
}
return -1;
}
int load_conf2(FILE * conf, char *filename, int type)
{
char *databuf = buf;
char *stat = databuf;
char *p, *setto, *var;
if (!conf)
return -1;
*databuf = '\0';
/* loop to read data */
while (stat != NULL)
{
stat = fgets(buf,1020, zConf);
if (*buf == '#') /* comment */
stat = fgets(buf, 1020, conf);
if ((*buf == '#') || (*buf == '/'))
continue;
if (*buf == '/') /* comment */
continue;
iCstrip(buf); /* strip crlf .. */
strcpy(babuf, buf);
iCstrip(buf);
if (*buf == '\0')
continue;
p = strtok(buf, " ");
if (strcmp(p, "Include")==0)
p = strtok(buf, " ");
if (strcmp(p, "Include") == 0)
{
strtok(NULL, " ");
setto = strtok(NULL, "");
/* We need this for STATS S */
AllocCpy(INCLUDE, setto);
#ifndef _WIN32
#endif
/* Check the version before we read the file */
if (strcmp(get_version(setto),"2.2"))
{
#ifdef _WIN32
MessageBox(NULL, "Network file is not valid, visit http://unreal.tspre.org to learn how to upgrade", "UnrealIRCD/32 Init Error", MB_OK);
#else
fprintf(stderr, "%s is invalid, visit http://unreal.tspre.org to learn how to upgrade\n", setto);
#endif
exit(-1);
}
load_conf(setto,type);
strtok(NULL, " ");
setto = strtok(NULL, "");
/* We need this for STATS S -codemastr
Isn't there a better way to show all include files? --Stskeeps */
AllocCpy(INCLUDE, setto);
load_conf(setto, type);
}
else
if (strcmp(p, "Set")==0)
else if (strcmp(p, "Set") == 0)
{
var = strtok(NULL, " ");
/* Yes it was a good idea when i moved it. */
if (var == NULL)
continue;
if (*var == '\0')
@@ -185,189 +257,414 @@ int load_conf(char *file, int type)
strtok(NULL, " ");
setto = strtok(NULL, "");
if (setto == NULL)
continue;
if (*setto == '\0')
continue;
if (*setto >= '0' && *setto <= '9') {
aint = atol(setto);
if (strcmp(var, "MODE_X")==0)
MODE_X = aint;
else
if (strcmp(var, "MODE_I")==0)
MODE_I = aint;
else
if (strcmp(var, "TRUEHUB")==0) {
TRUEHUB = aint;
#ifndef HUB
/* Only display if _not_ called thru /rehash */
if (aint == 1 && type == 0) {
/* Is it a aint variable */
if (strcmp(var, "MODE_X") == 0)
{
MODE_X = atoi(setto);
}
else if (strcmp(var, "MODE_STRIPWORDS") == 0)
{
MODE_STRIPWORDS = atoi(setto);
}
else if (strcmp(var, "MODE_I") == 0)
{
MODE_I = atoi(setto);
}
else if (strcmp(var, "TRUEHUB") == 0)
{
TRUEHUB = atoi(setto);
#ifndef HUB
if ((TRUEHUB == 1) && (type == 0))
{
#ifdef _WIN32
MessageBox(NULL, "UnrealIRCD/32 Init Error", "I'm a leaf NOT an hub! ", MB_OK);
MessageBox(NULL,
"UnrealIRCd/32 Init Error",
"TRUEHUB value set to 1, but I'm not a hub!",
MB_OK);
#else
fprintf(stderr, "[error] I'm a leaf NOT a hub!\n");
fprintf(stderr,
"[error] I'm a leaf NOT a hub!\n");
#endif
return 0;
exit(-1);
}
else if ((type == 1) && (TRUEHUB == 1))
{
sendto_ops
("TRUEHUB value set to 1, but I'm not a hub!");
}
#endif
}
if (strcmp(var, "CONFIG_FILE_STOP")==0) {
if (aint == 1) {
else if (strcmp(var, "CONFIG_FILE_STOP") == 0)
{
if (atoi(setto) == 1)
{
#ifdef _WIN32
MessageBox(NULL, "UnrealIRCD/32 Init Error", "Read Config stop code in file", MB_OK);
MessageBox(NULL,
"UnrealIRCD/32 Init Error",
"Read Config stop code in file",
MB_OK);
#else
fprintf(stderr, "[fatal error] File stop code recieved in %s - RTFM\n", file);
fprintf(stderr,
"[fatal error] File stop code recieved in %s - RTFM\n",
filename);
#endif
exit(-1);
}
exit(-1);
}
if (strcmp(var, "SHOWOPERS")==0) {
SHOWOPERS = aint;
}
if (strcmp(var, "SHOWOPERMOTD")==0) {
SHOWOPERMOTD = aint;
}
if (strcmp(var, "SOCKSBANTIME")==0) {
iConf.socksbantime = aint;
}
if (strcmp(var, "iNAH")==0) {
iNAH = aint;
}
if (strcmp(var, "ALLOW_CHATOPS")==0) {
ALLOW_CHATOPS = aint;
}
if (strcmp(var, "HIDE_ULINES")==0) {
HIDE_ULINES = aint;
}
if (strcmp(var, "KILLDIFF")==0) {
KILLDIFF = aint;
}
continue;
}
/* if (strcmp(var, "DOMAINNAME")==0) {
AllocCpy(DOMAINNAME, setto);
XtndCpy(DOMAINNAMEMASK, setto);
}
*/
/* uhm networks */
if (strcmp(var, "ircnetwork")==0) {
AllocCpy(ircnetwork, setto);
}
else
if (strcmp(var, "defserv")==0) {
AllocCpy(defserv, setto);
}
else
if (strcmp(var, "SERVICES_NAME")==0) {
AllocCpy(SERVICES_NAME, setto);
}
else
if (strcmp(var, "oper_host")==0) {
AllocCpy(oper_host, setto);
}
else
if (strcmp(var, "admin_host")==0) {
AllocCpy(admin_host, setto);
}
else
if (strcmp(var, "locop_host")==0) {
AllocCpy(locop_host, setto);
}
else
if (strcmp(var, "sadmin_host")==0) {
AllocCpy(sadmin_host, setto);
}
else
if (strcmp(var, "netadmin_host")==0) {
AllocCpy(netadmin_host, setto);
}
else
if (strcmp(var, "techadmin_host")==0) {
AllocCpy(techadmin_host, setto);
}
else
if (strcmp(var, "coadmin_host")==0) {
AllocCpy(coadmin_host, setto);
}
else
if (strcmp(var, "hidden_host")==0) {
AllocCpy(hidden_host, setto);
}
else
if (strcmp(var, "netdomain")==0) {
AllocCpy(netdomain, setto);
}
else
if (strcmp(var, "helpchan")==0) {
AllocCpy(helpchan, setto);
}
else
if (strcmp(var, "STATS_SERVER")==0) {
AllocCpy(STATS_SERVER, setto);
}
else
if (strcmp(var, "KLINE_ADDRESS")==0) {
}
else if (strcmp(var, "SHOWOPERS") == 0)
{
SHOWOPERS = atoi(setto);
}
else if (strcmp(var, "WEBTV_SUPPORT") == 0)
{
WEBTV_SUPPORT = atoi(setto);
}
else if (strcmp(var, "SHOWOPERMOTD") == 0)
{
SHOWOPERMOTD = atoi(setto);
}
else if (strcmp(var, "SOCKSBANTIME") == 0)
{
iConf.socksbantime = atol(setto);
}
else if (strcmp(var, "MAXCHANNELSPERUSER") == 0)
{
MAXCHANNELSPERUSER = atol(setto);
}
else if (strcmp(var, "ALLOW_CHATOPS") == 0)
{
ALLOW_CHATOPS = atoi(setto);
}
else if (strcmp(var, "HIDE_ULINES") == 0)
{
HIDE_ULINES = atoi(setto);
}
else if (strcmp(var, "NO_OPER_HIDING") == 0)
{
NO_OPER_HIDING = atoi(setto);
}
else if (strcmp(var, "KILLDIFF") == 0)
{
KILLDIFF = atoi(setto);
}
if (strcmp(var, "KLINE_ADDRESS") == 0)
{
AllocCpy(KLINE_ADDRESS, setto);
}
else
if (strcmp(var, "SOCKS_BAN_MESSAGE")==0) {
else if (strcmp(var, "SOCKS_BAN_MESSAGE") == 0)
{
AllocCpy(iConf.socksbanmessage, setto);
}
else
if (strcmp(var, "SOCKS_QUIT_MESSAGE")==0) {
else if (strcmp(var, "SOCKS_QUIT_MESSAGE") == 0)
{
AllocCpy(iConf.socksquitmessage, setto);
}
}
else if (strcmp(var, "AUTO_JOIN_CHANS") == 0)
{
AllocCpy(AUTO_JOIN_CHANS, setto);
}
else if (strcmp(var, "OPER_AUTO_JOIN_CHANS") == 0)
{
AllocCpy(OPER_AUTO_JOIN_CHANS, setto);
}
else if (strcmp(var, "HOST_TIMEOUT") == 0)
{
HOST_TIMEOUT = atol(setto);
}
else if (strcmp(var, "HOST_RETRIES") == 0)
{
HOST_RETRIES = atoi(setto);
}
#ifndef BIG_SECURITY_HOLE
else if (strcmp(var, "SETUID") == 0)
{
un_uid = atoi(setto);
}
else if (strcmp(var, "SETGID") == 0)
{
un_gid = atoi(setto);
}
#endif
}
}
if (type == 0)
{
fprintf(stderr, "* Loaded %s ..\n", filename);
}
else
{
sendto_realops("Loaded %s ..", filename);
}
#ifndef _WIN32
fprintf(stderr, "* Loaded %s ..\n", file);
#endif
}
void doneconf(void) {
/* Load .network options */
int load_conf3(FILE * conf, char *filename, int type)
{
char *databuf = buf;
char *stat = databuf;
char *p, *setto, *var;
if (!conf)
return -1;
*databuf = '\0';
/* loop to read data */
while (stat != NULL)
{
stat = fgets(buf, 1020, conf);
if ((*buf == '#') || (*buf == '/'))
continue;
iCstrip(buf);
if (*buf == '\0')
continue;
p = strtok(buf, " ");
if (strcmp(p, "Set") == 0)
{
var = strtok(NULL, " ");
if (var == NULL)
continue;
if (*var == '\0')
continue;
strtok(NULL, " ");
setto = strtok(NULL, "");
/* Is it a aint variable */
if (strcmp(var, "iNAH") == 0)
{
iNAH = atoi(setto);
}
else
/* uhm networks */
if (strcmp(var, "ircnetwork") == 0)
{
AllocCpy(ircnetwork, setto);
}
else if (strcmp(var, "defserv") == 0)
{
AllocCpy(defserv, setto);
}
else if (strcmp(var, "SERVICES_NAME") == 0)
{
AllocCpy(SERVICES_NAME, setto);
}
else if (strcmp(var, "oper_host") == 0)
{
AllocCpy(oper_host, setto);
}
else if (strcmp(var, "admin_host") == 0)
{
AllocCpy(admin_host, setto);
}
else if (strcmp(var, "locop_host") == 0)
{
AllocCpy(locop_host, setto);
}
else if (strcmp(var, "sadmin_host") == 0)
{
AllocCpy(sadmin_host, setto);
}
else if (strcmp(var, "netadmin_host") == 0)
{
AllocCpy(netadmin_host, setto);
}
else if (strcmp(var, "techadmin_host") == 0)
{
AllocCpy(techadmin_host, setto);
}
else if (strcmp(var, "coadmin_host") == 0)
{
AllocCpy(coadmin_host, setto);
}
else if (strcmp(var, "hidden_host") == 0)
{
AllocCpy(hidden_host, setto);
}
else if (strcmp(var, "netdomain") == 0)
{
AllocCpy(netdomain, setto);
}
else if (strcmp(var, "helpchan") == 0)
{
AllocCpy(helpchan, setto);
}
else if (strcmp(var, "STATS_SERVER") == 0)
{
AllocCpy(STATS_SERVER, setto);
}
}
}
if (type == 0)
{
fprintf(stderr, "* Loaded %s ..\n", INCLUDE);
}
else
{
sendto_realops("Loaded %s ..", INCLUDE);
}
}
void doneconf(int type)
{
/* calculate on errors */
char *errormsg = MyMalloc(16384);
*errormsg = '\0';
if (!KLINE_ADDRESS || (*KLINE_ADDRESS == '\0'))
strcat(errormsg, "- Missing KLINE_ADDRESS\n");
#ifndef DEVELOP
if (KLINE_ADDRESS)
if (!strchr(KLINE_ADDRESS, '@') && !strchr(KLINE_ADDRESS, ':'))
{
strcat(errormsg,
"- KLINE_ADDRESS is not an e-mail or an URL\n");
}
#endif
if ((MAXCHANNELSPERUSER < 1))
strcat(errormsg,
"- MAXCHANNELSPERUSER is an invalid value, must be > 0\n");
if ((iNAH < 0) || (iNAH > 1))
strcat(errormsg, "- iNAH is an invalid value\n");
if (AUTO_JOIN_CHANS == '\0')
strcat(errormsg, "- AUTO_JOIN_CHANS is an invalid value\n");
if (OPER_AUTO_JOIN_CHANS == '\0')
strcat(errormsg,
"- OPER_AUTO_JOIN_CHANS is an invalid value\n");
if (HOST_TIMEOUT < 0 || HOST_TIMEOUT > 180)
strcat(errormsg, "- HOST_TIMEOUT is an invalid value\n");
if (HOST_RETRIES < 0 || HOST_RETRIES > 10)
strcat(errormsg, "- HOST_RETRIES is an invalid value\n");
#define Missing(x) !(x) || (*(x) == '\0')
if (Missing(defserv))
strcat(errormsg, "- Missing defserv field\n");
if (Missing(SERVICES_NAME))
strcat(errormsg, "- Missing SERVICES_NAME field\n");
if (Missing(oper_host))
strcat(errormsg, "- Missing oper_host field\n");
if (Missing(admin_host))
strcat(errormsg, "- Missing admin_host field\n");
if (Missing(locop_host))
strcat(errormsg, "- Missing locop_host field\n");
if (Missing(sadmin_host))
strcat(errormsg, "- Missing sadmin_host field\n");
if (Missing(netadmin_host))
strcat(errormsg, "- Missing netadmin_host field\n");
if (Missing(coadmin_host))
strcat(errormsg, "- Missing coadmin_host field\n");
if (Missing(techadmin_host))
strcat(errormsg, "- Missing techadmin_host field\n");
if (Missing(hidden_host))
strcat(errormsg, "- Missing hidden_host field\n");
if (Missing(netdomain))
strcat(errormsg, "- Missing netdomain field\n");
if (Missing(helpchan))
strcat(errormsg, "- Missing helpchan field\n");
if (Missing(STATS_SERVER))
strcat(errormsg, "- Missing STATS_SERVER field\n");
if (Missing(iConf.socksbanmessage))
strcat(errormsg, "- Missing SOCKSBANMESSAGE field\n");
if (Missing(iConf.socksquitmessage))
strcat(errormsg, "- Missing SOCKSQUITMESSAGE field\n");
if (*errormsg != '\0')
{
fprintf(stderr,
"\n*** ERRORS IN DYNAMIC CONFIGURATION (listed below) ***\n");
fprintf(stderr, errormsg);
MyFree(errormsg);
exit(-1);
}
MyFree(errormsg);
}
void init_dynconf(void)
{
bzero(&iConf, sizeof(iConf));
}
/* Report the unrealircd.conf info -codemastr*/
void report_dynconf (aClient *sptr)
void report_dynconf(aClient *sptr)
{
sendto_one(sptr, ":%s %i %s :*** Dynamic Configuration Report ***", me.name, RPL_TEXT, sptr->name);
sendto_one(sptr, ":%s %i %s :INCLUDE: %s", me.name, RPL_TEXT, sptr->name, INCLUDE);
sendto_one(sptr, ":%s %i %s :KLINE_ADDRESS: %s", me.name, RPL_TEXT, sptr->name, KLINE_ADDRESS);
sendto_one(sptr, ":%s %i %s :MODE_X: %i", me.name, RPL_TEXT, sptr->name, MODE_X);
sendto_one(sptr, ":%s %i %s :MODE_I: %i", me.name, RPL_TEXT, sptr->name, MODE_I);
sendto_one(sptr, ":%s %i %s :TRUEHUB: %i", me.name, RPL_TEXT, sptr->name, TRUEHUB);
sendto_one(sptr, ":%s %i %s :SHOWOPERS: %i", me.name, RPL_TEXT, sptr->name, SHOWOPERS);
sendto_one(sptr, ":%s %i %s :KILLDIFF: %i", me.name, RPL_TEXT, sptr->name, KILLDIFF);
sendto_one(sptr, ":%s %i %s :SHOWOPERMOTD: %i", me.name, RPL_TEXT, sptr->name, SHOWOPERMOTD);
sendto_one(sptr, ":%s %i %s :HIDE_ULINES: %i", me.name, RPL_TEXT, sptr->name, HIDE_ULINES);
sendto_one(sptr, ":%s %i %s :ALLOW_CHATOPS: %i", me.name, RPL_TEXT, sptr->name, ALLOW_CHATOPS);
sendto_one(sptr, ":%s %i %s :SOCKS_BAN_MESSAGE: %s", me.name, RPL_TEXT, sptr->name, iConf.socksbanmessage);
sendto_one(sptr, ":%s %i %s :SOCKS_QUIT_MESSAGE: %s", me.name, RPL_TEXT, sptr->name, iConf.socksquitmessage);
sendto_one(sptr, ":%s %i %s :SOCKSBANTIME: %i",me.name, RPL_TEXT, sptr->name, iConf.socksbantime);
sendto_one(sptr, ":%s %i %s :*** Dynamic Configuration Report ***",
me.name, RPL_TEXT, sptr->name);
sendto_one(sptr, ":%s %i %s :INCLUDE: %s", me.name, RPL_TEXT,
sptr->name, INCLUDE);
sendto_one(sptr, ":%s %i %s :KLINE_ADDRESS: %s", me.name, RPL_TEXT,
sptr->name, KLINE_ADDRESS);
sendto_one(sptr, ":%s %i %s :MODE_X: %d", me.name, RPL_TEXT, sptr->name,
MODE_X);
sendto_one(sptr, ":%s %i %s :MODE_STRIPWORDS: %d", me.name, RPL_TEXT,
sptr->name, MODE_STRIPWORDS);
sendto_one(sptr, ":%s %i %s :MODE_I: %d", me.name, RPL_TEXT, sptr->name,
MODE_I);
sendto_one(sptr, ":%s %i %s :TRUEHUB: %d", me.name, RPL_TEXT,
sptr->name, TRUEHUB);
sendto_one(sptr, ":%s %i %s :SHOWOPERS: %d", me.name, RPL_TEXT,
sptr->name, SHOWOPERS);
sendto_one(sptr, ":%s %i %s :KILLDIFF: %d", me.name, RPL_TEXT,
sptr->name, KILLDIFF);
sendto_one(sptr, ":%s %i %s :SHOWOPERMOTD: %d", me.name, RPL_TEXT,
sptr->name, SHOWOPERMOTD);
sendto_one(sptr, ":%s %i %s :HIDE_ULINES: %d", me.name, RPL_TEXT,
sptr->name, HIDE_ULINES);
sendto_one(sptr, ":%s %i %s :ALLOW_CHATOPS: %d", me.name, RPL_TEXT,
sptr->name, ALLOW_CHATOPS);
sendto_one(sptr, ":%s %i %s :SOCKS_BAN_MESSAGE: %s", me.name, RPL_TEXT,
sptr->name, iConf.socksbanmessage);
sendto_one(sptr, ":%s %i %s :SOCKS_QUIT_MESSAGE: %s", me.name, RPL_TEXT,
sptr->name, iConf.socksquitmessage);
sendto_one(sptr, ":%s %i %s :SOCKSBANTIME: %i", me.name, RPL_TEXT,
sptr->name, iConf.socksbantime);
sendto_one(sptr, ":%s %i %s :MAXCHANNELSPERUSER: %i", me.name, RPL_TEXT,
sptr->name, MAXCHANNELSPERUSER);
sendto_one(sptr, ":%s %i %s :WEBTV_SUPPORT: %d", me.name, RPL_TEXT,
sptr->name, WEBTV_SUPPORT);
sendto_one(sptr, ":%s %i %s :NO_OPER_HIDING: %d", me.name, RPL_TEXT,
sptr->name, NO_OPER_HIDING);
sendto_one(sptr, ":%s %i %s :AUTO_JOIN_CHANS: %s", me.name, RPL_TEXT,
sptr->name, AUTO_JOIN_CHANS);
sendto_one(sptr, ":%s %i %s :OPER_AUTO_JOIN_CHANS: %s", me.name,
RPL_TEXT, sptr->name, OPER_AUTO_JOIN_CHANS);
sendto_one(sptr, ":%s %i %s :HOST_TIMEOUT: %li", me.name, RPL_TEXT,
sptr->name, HOST_TIMEOUT);
sendto_one(sptr, ":%s %i %s :HOST_RETRIES: %d", me.name, RPL_TEXT,
sptr->name, HOST_RETRIES);
}
/* Report the network file info -codemastr */
void report_network (aClient *sptr)
void report_network(aClient *sptr)
{
sendto_one(sptr, ":%s %i %s :*** Network Configuration Report ***", me.name, RPL_TEXT, sptr->name);
sendto_one(sptr, ":%s %i %s :NETWORK: %s", me.name, RPL_TEXT, sptr->name, ircnetwork);
sendto_one(sptr, ":%s %i %s :DEFAULT_SERVER: %s", me.name, RPL_TEXT, sptr->name, defserv);
sendto_one(sptr, ":%s %i %s :SERVICES_NAME: %s", me.name, RPL_TEXT, sptr->name, SERVICES_NAME);
sendto_one(sptr, ":%s %i %s :OPER_HOST: %s", me.name, RPL_TEXT, sptr->name, oper_host);
sendto_one(sptr, ":%s %i %s :ADMIN_HOST: %s", me.name, RPL_TEXT, sptr->name, admin_host);
sendto_one(sptr, ":%s %i %s :LOCOP_HOST: %s", me.name, RPL_TEXT, sptr->name, locop_host);
sendto_one(sptr, ":%s %i %s :SADMIN_HOST: %s", me.name, RPL_TEXT, sptr->name, sadmin_host);
sendto_one(sptr, ":%s %i %s :NETADMIN_HOST: %s", me.name, RPL_TEXT, sptr->name, netadmin_host);
sendto_one(sptr, ":%s %i %s :COADMIN_HOST: %s", me.name, RPL_TEXT, sptr->name, coadmin_host);
sendto_one(sptr, ":%s %i %s :TECHADMIN_HOST: %s", me.name, RPL_TEXT, sptr->name, techadmin_host);
sendto_one(sptr, ":%s %i %s :HIDDEN_HOST: %s", me.name, RPL_TEXT, sptr->name, hidden_host);
sendto_one(sptr, ":%s %i %s :NETDOMAIN: %s", me.name, RPL_TEXT, sptr->name, netdomain);
sendto_one(sptr, ":%s %i %s :HELPCHAN: %s", me.name, RPL_TEXT, sptr->name, helpchan);
sendto_one(sptr, ":%s %i %s :STATS_SERVER: %s", me.name, RPL_TEXT, sptr->name, STATS_SERVER);
sendto_one(sptr, ":%s %i %s :INAH: %i", me.name, RPL_TEXT, sptr->name, iNAH);
sendto_one(sptr, ":%s %i %s :*** Network Configuration Report ***",
me.name, RPL_TEXT, sptr->name);
sendto_one(sptr, ":%s %i %s :NETWORK: %s", me.name, RPL_TEXT,
sptr->name, ircnetwork);
sendto_one(sptr, ":%s %i %s :DEFAULT_SERVER: %s", me.name, RPL_TEXT,
sptr->name, defserv);
sendto_one(sptr, ":%s %i %s :SERVICES_NAME: %s", me.name, RPL_TEXT,
sptr->name, SERVICES_NAME);
sendto_one(sptr, ":%s %i %s :OPER_HOST: %s", me.name, RPL_TEXT,
sptr->name, oper_host);
sendto_one(sptr, ":%s %i %s :ADMIN_HOST: %s", me.name, RPL_TEXT,
sptr->name, admin_host);
sendto_one(sptr, ":%s %i %s :LOCOP_HOST: %s", me.name, RPL_TEXT,
sptr->name, locop_host);
sendto_one(sptr, ":%s %i %s :SADMIN_HOST: %s", me.name, RPL_TEXT,
sptr->name, sadmin_host);
sendto_one(sptr, ":%s %i %s :NETADMIN_HOST: %s", me.name, RPL_TEXT,
sptr->name, netadmin_host);
sendto_one(sptr, ":%s %i %s :COADMIN_HOST: %s", me.name, RPL_TEXT,
sptr->name, coadmin_host);
sendto_one(sptr, ":%s %i %s :TECHADMIN_HOST: %s", me.name, RPL_TEXT,
sptr->name, techadmin_host);
sendto_one(sptr, ":%s %i %s :HIDDEN_HOST: %s", me.name, RPL_TEXT,
sptr->name, hidden_host);
sendto_one(sptr, ":%s %i %s :NETDOMAIN: %s", me.name, RPL_TEXT,
sptr->name, netdomain);
sendto_one(sptr, ":%s %i %s :HELPCHAN: %s", me.name, RPL_TEXT,
sptr->name, helpchan);
sendto_one(sptr, ":%s %i %s :STATS_SERVER: %s", me.name, RPL_TEXT,
sptr->name, STATS_SERVER);
sendto_one(sptr, ":%s %i %s :INAH: %i", me.name, RPL_TEXT, sptr->name,
iNAH);
}
+61 -44
View File
@@ -1,5 +1,21 @@
/*
* fdlist.c maintain lists of certain important fds
/************************************************************************
* Unreal Internet Relay Chat Daemon, src/fdlist.c
* Copyright (C) Mika Nystrom
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id$ */
@@ -11,60 +27,61 @@
#include "config.h"
#include "fdlist.h"
void
addto_fdlist(int fd, fdlist * listp)
void addto_fdlist(int fd, fdlist * listp)
{
int index;
int index;
if ((index = ++listp->last_entry) >= MAXCONNECTIONS) {
/*
* list too big.. must exit
*/
--listp->last_entry;
if ((index = ++listp->last_entry) >= MAXCONNECTIONS)
{
/*
* list too big.. must exit
*/
--listp->last_entry;
#ifdef USE_SYSLOG
(void) syslog(LOG_CRIT, "fdlist.c list too big.. must exit");
(void)syslog(LOG_CRIT, "fdlist.c list too big.. must exit");
#endif
abort();
}
else
listp->entry[index] = fd;
return;
abort();
}
else
listp->entry[index] = fd;
return;
}
void
delfrom_fdlist(int fd, fdlist * listp)
void delfrom_fdlist(int fd, fdlist * listp)
{
int i;
int i;
for (i = listp->last_entry; i; i--) {
if (listp->entry[i] == fd)
break;
}
if (!i)
return; /*
for (i = listp->last_entry; i; i--)
{
if (listp->entry[i] == fd)
break;
}
if (!i)
return; /*
* could not find it!
*/
/*
* swap with last_entry
*/
if (i == listp->last_entry) {
listp->entry[i] = 0;
listp->last_entry--;
return;
}
else {
listp->entry[i] = listp->entry[listp->last_entry];
listp->entry[listp->last_entry] = 0;
listp->last_entry--;
return;
}
/*
* swap with last_entry
*/
if (i == listp->last_entry)
{
listp->entry[i] = 0;
listp->last_entry--;
return;
}
else
{
listp->entry[i] = listp->entry[listp->last_entry];
listp->entry[listp->last_entry] = 0;
listp->last_entry--;
return;
}
}
void
init_fdlist(fdlist * listp)
void init_fdlist(fdlist * listp)
{
listp->last_entry = 0;
memset((char *) listp->entry, '\0', sizeof(listp->entry));
return;
listp->last_entry = 0;
memset((char *)listp->entry, '\0', sizeof(listp->entry));
return;
}
+445 -856
View File
File diff suppressed because it is too large Load Diff
+580 -407
View File
File diff suppressed because it is too large Load Diff
+869 -728
View File
File diff suppressed because it is too large Load Diff
+188 -153
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, ircd/list.c
* Unreal Internet Relay Chat, src/list.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Finland
*
@@ -44,28 +44,32 @@
#ifdef DBMALLOC
#include "malloc.h"
#endif
void free_link PROTO((Link *));
Link *make_link PROTO(());
void free_link PROTO((Link *));
Link *make_link PROTO(());
extern ircstats IRCstats;
ID_CVS("$Id$");
ID_Copyright("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Copyright
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Notes("2.24 4/20/94");
#ifdef DEBUGMODE
static struct liststats {
int inuse;
static struct liststats {
int inuse;
} cloc, crem, users, servs, links, classs, aconfs;
#endif
void outofmemory();
void outofmemory();
int flinks = 0;
Link *freelink = NULL;
int flinks = 0;
int freelinks = 0;
Link *freelink = NULL;
int numclients = 0;
void initlists()
int numclients = 0;
void initlists()
{
#ifdef DEBUGMODE
bzero((char *)&cloc, sizeof(cloc));
@@ -78,13 +82,13 @@ void initlists()
#endif
}
void outofmemory()
void outofmemory()
{
Debug((DEBUG_FATAL, "Out of memory: restarting server..."));
restart("Out of Memory");
}
/*
** Create a new aClient structure and set it to initial state.
**
@@ -95,11 +99,11 @@ void outofmemory()
** associated with the client defined by
** 'from'). ('from' is a local client!!).
*/
aClient *make_client(from, servr)
aClient *from, *servr;
aClient *make_client(from, servr)
aClient *from, *servr;
{
Reg1 aClient *cptr = NULL;
Reg2 unsigned size = CLIENT_REMOTE_SIZE;
aClient *cptr = NULL;
unsigned size = CLIENT_REMOTE_SIZE;
/*
* Check freelists first to see if we can grab a client without
@@ -120,8 +124,8 @@ aClient *from, *servr;
#endif
/* Note: structure is zero (calloc) */
cptr->from = from ? from : cptr; /* 'from' of local client is self! */
cptr->next = NULL; /* For machines with NON-ZERO NULL pointers >;) */
cptr->from = from ? from : cptr; /* 'from' of local client is self! */
cptr->next = NULL; /* For machines with NON-ZERO NULL pointers >;) */
cptr->prev = NULL;
cptr->hnext = NULL;
cptr->user = NULL;
@@ -131,9 +135,9 @@ aClient *from, *servr;
cptr->fd = -1;
(void)strcpy(cptr->username, "unknown");
if (size == CLIENT_LOCAL_SIZE)
{
{
cptr->since = cptr->lasttime =
cptr->lastnick = cptr->firsttime = TStime();
cptr->lastnick = cptr->firsttime = TStime();
cptr->confs = NULL;
cptr->sockhost[0] = '\0';
cptr->buffer[0] = '\0';
@@ -141,12 +145,12 @@ aClient *from, *servr;
#ifdef SOCKSPORT
cptr->socksfd = -1;
#endif
}
}
return (cptr);
}
void free_client(cptr)
aClient *cptr;
void free_client(cptr)
aClient *cptr;
{
MyFree((char *)cptr);
}
@@ -155,14 +159,14 @@ aClient *cptr;
** 'make_user' add's an User information block to a client
** if it was not previously allocated.
*/
anUser *make_user(cptr)
aClient *cptr;
anUser *make_user(cptr)
aClient *cptr;
{
Reg1 anUser *user;
anUser *user;
user = cptr->user;
if (!user)
{
{
user = (anUser *)MyMalloc(sizeof(anUser));
#ifdef DEBUGMODE
users.inuse++;
@@ -174,18 +178,21 @@ aClient *cptr;
user->channel = NULL;
user->invited = NULL;
user->silence = NULL;
user->server = NULL;
user->virthost = MyMalloc(2);
*user->virthost = '\0';
cptr->user = user;
}
}
return user;
}
aServer *make_server(cptr)
aClient *cptr;
aServer *make_server(cptr)
aClient *cptr;
{
Reg1 aServer *serv = cptr->serv;
aServer *serv = cptr->serv;
if (!serv)
{
{
serv = (aServer *)MyMalloc(sizeof(aServer));
#ifdef DEBUGMODE
servs.inuse++;
@@ -193,9 +200,9 @@ aClient *cptr;
serv->user = NULL;
serv->nexts = NULL;
*serv->by = '\0';
*serv->up = '\0';
serv->up = NULL;
cptr->serv = serv;
}
}
return cptr->serv;
}
@@ -204,16 +211,18 @@ aClient *cptr;
** Decrease user reference count by one and realease block,
** if count reaches 0
*/
void free_user(user, cptr)
Reg1 anUser *user;
aClient *cptr;
void free_user(user, cptr)
anUser *user;
aClient *cptr;
{
if (--user->refcnt <= 0)
{
{
if (user->away)
MyFree((char *)user->away);
if (user->swhois)
MyFree((char *)user->swhois);
if (user->virthost)
MyFree((char *)user->virthost);
/*
* sanity check
*/
@@ -221,58 +230,68 @@ aClient *cptr;
user->invited || user->channel)
#ifdef DEBUGMODE
dumpcore("%#x user (%s!%s@%s) %#x %#x %#x %d %d",
cptr, cptr ? cptr->name : "<noname>",
user->username, user->realhost, user,
user->invited, user->channel, user->joined,
user->refcnt);
cptr, cptr ? cptr->name : "<noname>",
user->username, user->realhost, user,
user->invited, user->channel, user->joined,
user->refcnt);
#else
sendto_ops("* %#x user (%s!%s@%s) %#x %#x %#x %d %d *",
cptr, cptr ? cptr->name : "<noname>",
user->username, user->realhost, user,
user->invited, user->channel, user->joined,
user->refcnt);
cptr, cptr ? cptr->name : "<noname>",
user->username, user->realhost, user,
user->invited, user->channel, user->joined,
user->refcnt);
#endif
MyFree((char *)user);
#ifdef DEBUGMODE
users.inuse--;
#endif
}
}
}
/*
* taken the code from ExitOneClient() for this and placed it here.
* - avalon
*/
void remove_client_from_list(cptr)
Reg1 aClient *cptr;
void remove_client_from_list(cptr)
aClient *cptr;
{
if (IsServer(cptr))
IRCstats.servers--;
if (IsClient(cptr))
{
if (IsInvisible(cptr))
IRCstats.invisible--;
if (IsOper(cptr))
IRCstats.operators--;
IRCstats.clients--;
}
checklist();
if (cptr->prev)
cptr->prev->next = cptr->next;
else
{
{
client = cptr->next;
if (client)
client->prev = NULL;
}
}
if (cptr->next)
cptr->next->prev = cptr->prev;
if (IsPerson(cptr)) /* Only persons can have been added before */
{
add_history(cptr);
off_history(cptr); /* Remove all pointers to cptr */
}
if (IsPerson(cptr)) /* Only persons can have been added before */
{
add_history(cptr, 0);
off_history(cptr); /* Remove all pointers to cptr */
}
if (cptr->user)
(void)free_user(cptr->user, cptr);
if (cptr->serv)
{
{
if (cptr->serv->user)
free_user(cptr->serv->user, cptr);
MyFree((char *)cptr->serv);
#ifdef DEBUGMODE
servs.inuse--;
#endif
}
}
#ifdef DEBUGMODE
if (cptr->fd == -2)
cloc.inuse--;
@@ -290,8 +309,8 @@ Reg1 aClient *cptr;
* in this file, shouldnt they ? after all, this is list.c, isnt it ?
* -avalon
*/
void add_client_to_list(cptr)
aClient *cptr;
void add_client_to_list(cptr)
aClient *cptr;
{
/*
* since we always insert new clients to the top of the list,
@@ -307,31 +326,31 @@ aClient *cptr;
/*
* Look for ptr in the linked listed pointed to by link.
*/
Link *find_user_link(lp, ptr)
Reg1 Link *lp;
Reg2 aClient *ptr;
Link *find_user_link(lp, ptr)
Link *lp;
aClient *ptr;
{
if (ptr)
while (lp)
{
if (lp->value.cptr == ptr)
return (lp);
lp = lp->next;
}
if (ptr)
while (lp)
{
if (lp->value.cptr == ptr)
return (lp);
lp = lp->next;
}
return NULL;
}
Link *find_channel_link(lp, ptr)
Reg1 Link *lp;
Reg2 aChannel *ptr;
Link *find_channel_link(lp, ptr)
Link *lp;
aChannel *ptr;
{
if (ptr)
while (lp)
{
if (lp->value.chptr == ptr)
return (lp);
lp = lp->next;
}
if (ptr)
while (lp)
{
if (lp->value.chptr == ptr)
return (lp);
lp = lp->next;
}
return NULL;
}
@@ -342,12 +361,13 @@ Reg2 aChannel *ptr;
* match() on it. Side effect: if found, this link is moved to the top of
* the list.
*/
int find_str_match_link(lp, str)
Reg1 Link **lp; /* Two **'s, since we might modify the original *lp */
Reg2 char *str;
int find_str_match_link(lp, str)
Link **lp; /* Two **'s, since we might modify the original *lp */
char *str;
{
Link *ptr, **head = lp;
Link **head = lp;
if (!str || !lp)
return 0;
if (lp && *lp)
{
if (!match((*lp)->value.cp, str))
@@ -366,29 +386,30 @@ Reg2 char *str;
return 0;
}
void free_str_list(lp)
Reg1 Link *lp;
void free_str_list(lp)
Link *lp;
{
Reg2 Link *next;
Link *next;
while (lp) {
while (lp)
{
next = lp->next;
MyFree((char *)lp->value.cp);
free_link(lp);
lp = next;
}
return;
}
#define LINKSIZE (4072/sizeof(Link))
Link *make_link()
Link *make_link()
{
Link *lp;
int i;
Link *lp, *lp1;
int i;
/* "caching" slab-allocator... ie. we're allocating one pages
(hopefully - upped to the Linux default, not dbuf.c) worth of
@@ -396,15 +417,26 @@ Link *make_link()
All links left free from this process or separately freed
by a call to free_link() are moved over to freelink-list.
Impact? Let's see... -Donwulff */
if(freelink==NULL) {
lp = (Link *)MyMalloc(LINKSIZE*sizeof(Link));
freelink=lp+1;
flinks+=LINKSIZE;
for(i=1;i<(LINKSIZE-1);i++)
(lp+i)->next=lp+i+1; (lp+i)->next=NULL;
} else {
/* Impact is a huge memory leak -Stskeeps
hope this implementation works a little bit better */
if (freelink == NULL)
{
for (i = 1; i <= LINKSIZE; i++)
{
lp = (Link *)MyMalloc(sizeof(Link));
lp->next = freelink;
freelink = lp;
}
freelinks = freelinks + LINKSIZE;
lp = freelink;
freelink=freelink->next;
freelink = lp->next;
freelinks--;
}
else
{
lp = freelink;
freelink = freelink->next;
freelinks--;
}
#ifdef DEBUGMODE
links.inuse++;
@@ -412,29 +444,31 @@ Link *make_link()
return lp;
}
void free_link(lp)
Reg1 Link *lp;
void free_link(lp)
Link *lp;
{
lp->next=freelink;
freelink=lp;
lp->next = freelink;
freelink = lp;
freelinks++;
#ifdef DEBUGMODE
links.inuse--;
#endif
}
Ban *make_ban()
Ban *make_ban()
{
Reg1 Ban *lp;
Ban *lp;
lp = (Ban *)MyMalloc(sizeof(Ban));
lp = (Ban *) MyMalloc(sizeof(Ban));
#ifdef DEBUGMODE
links.inuse++;
#endif
return lp;
}
void free_ban(lp)
Reg1 Ban *lp;
void free_ban(lp)
Ban *lp;
{
MyFree((char *)lp);
#ifdef DEBUGMODE
@@ -442,9 +476,9 @@ Reg1 Ban *lp;
#endif
}
aClass *make_class()
aClass *make_class()
{
Reg1 aClass *tmp;
aClass *tmp;
tmp = (aClass *)MyMalloc(sizeof(aClass));
#ifdef DEBUGMODE
@@ -453,8 +487,8 @@ aClass *make_class()
return tmp;
}
void free_class(tmp)
Reg1 aClass *tmp;
void free_class(tmp)
aClass *tmp;
{
MyFree((char *)tmp);
#ifdef DEBUGMODE
@@ -462,9 +496,9 @@ Reg1 aClass *tmp;
#endif
}
aSqlineItem *make_sqline()
aSqlineItem *make_sqline()
{
Reg1 aSqlineItem *asqline;
aSqlineItem *asqline;
asqline = (struct SqlineItem *)MyMalloc(sizeof(aSqlineItem));
asqline->next = NULL;
@@ -473,15 +507,15 @@ aSqlineItem *make_sqline()
return (asqline);
}
aConfItem *make_conf()
aConfItem *make_conf()
{
Reg1 aConfItem *aconf;
aConfItem *aconf;
aconf = (struct ConfItem *)MyMalloc(sizeof(aConfItem));
#ifdef DEBUGMODE
aconfs.inuse++;
#endif
bzero((char *)&aconf->ipnum, sizeof(struct in_addr));
bzero((char *)&aconf->ipnum, sizeof(struct IN_ADDR));
aconf->next = NULL;
aconf->host = aconf->passwd = aconf->name = NULL;
aconf->status = CONF_ILLEGAL;
@@ -492,24 +526,24 @@ aConfItem *make_conf()
return (aconf);
}
void delist_conf(aconf)
aConfItem *aconf;
void delist_conf(aconf)
aConfItem *aconf;
{
if (aconf == conf)
conf = conf->next;
else
{
aConfItem *bconf;
{
aConfItem *bconf;
for (bconf = conf; aconf != bconf->next; bconf = bconf->next)
;
bconf->next = aconf->next;
}
}
aconf->next = NULL;
}
void free_sqline(asqline)
aSqlineItem *asqline;
void free_sqline(asqline)
aSqlineItem *asqline;
{
del_queries((char *)asqline);
MyFree(asqline->sqline);
@@ -518,8 +552,8 @@ aSqlineItem *asqline;
return;
}
void free_conf(aconf)
aConfItem *aconf;
void free_conf(aconf)
aConfItem *aconf;
{
del_queries((char *)aconf);
MyFree(aconf->host);
@@ -535,47 +569,48 @@ aConfItem *aconf;
}
#ifdef DEBUGMODE
void send_listinfo(cptr, name)
aClient *cptr;
char *name;
void send_listinfo(cptr, name)
aClient *cptr;
char *name;
{
int inuse = 0, mem = 0, tmp = 0;
int inuse = 0, mem = 0, tmp = 0;
sendto_one(cptr, ":%s %d %s :Local: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, inuse += cloc.inuse,
tmp = cloc.inuse * CLIENT_LOCAL_SIZE);
me.name, RPL_STATSDEBUG, name, inuse += cloc.inuse,
tmp = cloc.inuse * CLIENT_LOCAL_SIZE);
mem += tmp;
sendto_one(cptr, ":%s %d %s :Remote: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name,
crem.inuse, tmp = crem.inuse * CLIENT_REMOTE_SIZE);
me.name, RPL_STATSDEBUG, name,
crem.inuse, tmp = crem.inuse * CLIENT_REMOTE_SIZE);
mem += tmp;
inuse += crem.inuse;
sendto_one(cptr, ":%s %d %s :Users: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, users.inuse,
tmp = users.inuse * sizeof(anUser));
me.name, RPL_STATSDEBUG, name, users.inuse,
tmp = users.inuse * sizeof(anUser));
mem += tmp;
inuse += users.inuse,
sendto_one(cptr, ":%s %d %s :Servs: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, servs.inuse,
tmp = servs.inuse * sizeof(aServer));
sendto_one(cptr, ":%s %d %s :Servs: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, servs.inuse,
tmp = servs.inuse * sizeof(aServer));
mem += tmp;
inuse += servs.inuse,
sendto_one(cptr, ":%s %d %s :Links: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, links.inuse,
tmp = links.inuse * sizeof(Link));
sendto_one(cptr, ":%s %d %s :Links: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, links.inuse,
tmp = links.inuse * sizeof(Link));
mem += tmp;
inuse += links.inuse,
sendto_one(cptr, ":%s %d %s :Classes: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, classs.inuse,
tmp = classs.inuse * sizeof(aClass));
sendto_one(cptr, ":%s %d %s :Classes: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, classs.inuse,
tmp = classs.inuse * sizeof(aClass));
mem += tmp;
inuse += classs.inuse,
sendto_one(cptr, ":%s %d %s :Confs: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, aconfs.inuse,
tmp = aconfs.inuse * sizeof(aConfItem));
sendto_one(cptr, ":%s %d %s :Confs: inuse: %d(%d)",
me.name, RPL_STATSDEBUG, name, aconfs.inuse,
tmp = aconfs.inuse * sizeof(aConfItem));
mem += tmp;
inuse += aconfs.inuse,
sendto_one(cptr, ":%s %d %s :Totals: inuse %d %d",
me.name, RPL_STATSDEBUG, name, inuse, mem);
sendto_one(cptr, ":%s %d %s :Totals: inuse %d %d",
me.name, RPL_STATSDEBUG, name, inuse, mem);
}
#endif
+319 -293
View File
@@ -1,5 +1,5 @@
/*
* IRC - Internet Relay Chat, common/match.c
* Unreal Internet Relay Chat Daemon, src/match.c
* Copyright (C) 1990 Jarkko Oikarinen
*
* This program is free software; you can redistribute it and/or modify
@@ -34,124 +34,130 @@ ID_Copyright("(C) 1990 Jarkko Oikarinen");
* 1, if no match
*/
#ifndef USE_LOCALE
u_char touppertab[], tolowertab[];
#define tolowertab2 tolowertab
#endif
/*
* match()
* written by binary
*/
int match(mask, name)
char *mask, *name;
int match(mask, name)
char *mask, *name;
{
Reg1 u_char *m; /* why didn't the old one use registers ?!??!?!?! */
Reg2 u_char *n;
Reg3 u_char cm;
Reg4 u_char *mylowertab;
u_char *wsn;
u_char *wsm;
m = (u_char *)mask;
cm = *m;
u_char *m; /* why didn't the old one use registers ?!??!?!?! */
u_char *n;
u_char cm;
u_char *mylowertab;
u_char *wsn;
u_char *wsm;
mylowertab = tolowertab2;
#define lc(x) mylowertab[x] /* use mylowertab, because registers are FASTER */
m = (u_char *)mask;
n = (u_char *)name;
if (cm == '*')
{
if (m[1] == '\0') /* mask is just "*", so true */
return 0;
}
else if (cm != '?' && lc(cm) != lc(*n))
return 1; /* most likely first chars won't match */
else
{
m++;
n++;
}
cm = lc(*m);
wsm = (char *)NULL;
while (1)
{
if (cm == '*') /* found the * wildcard */
{
m++; /* go to next char of mask */
if (!*m) /* if at end of mask, */
return 0; /* function becomes true. */
while (*m == '*') /* while the char at m is "*" */
{
m++; /* go to next char of mask */
if (!*m) /* if at end of mask, */
return 0; /* function becomes true. */
}
cm = *m;
if (cm == '\\') /* don't do ? checking if a \ */
{
cm = *(++m); /* just skip this char, no ? checking */
}
else if (cm == '?') /* if it's a ? */
{
do
{
m++; /* go to the next char of both */
n++;
if (!*n) /* if end of test string... */
return (!*m ? 0 : 1); /* true if end of mask str, else false */
} while (*m == '?'); /* while we have ?'s */
cm = *m;
if (!cm) /* last char of mask is ?, so it's true */
return 0;
}
cm = lc(cm);
while (lc(*n) != cm)
{ /* compare */
n++; /* go to next char of n */
if (!*n) /* if at end of n string */
return 1; /* function becomes false. */
}
wsm = m; /* mark after where wildcard found */
cm = lc(*(++m)); /* go to next mask char */
wsn = n; /* mark spot first char was found */
n++; /* go to next char of n */
continue;
}
if (cm == '?') /* found ? wildcard */
{
cm = lc(*(++m)); /* just skip and go to next */
n++;
if (!*n) /* return true if end of both, */
return (cm ? 1 : 0); /* false if end of test str only */
continue;
}
if (cm == '\\') /* next char will not be a wildcard. */
{ /* skip wild checking, don't continue */
cm = lc(*(++m));
n++;
}
/* Complicated to read, but to save CPU time. Every ounce counts. */
if (lc(*n) != cm) /* if the current chars don't equal, */
{
if (!wsm) /* if there was no * wildcard, */
return 1; /* function becomes false. */
n = wsn + 1; /* start on char after the one we found last */
m = wsm; /* set m to the spot after the "*" */
cm = lc(*m);
while (cm != lc(*n))
{ /* compare them */
n++; /* go to next char of n */
if (!*n) /* if we reached end of n string, */
return 1; /* function becomes false. */
}
wsn = n; /* mark spot first char was found */
}
if (!cm) /* cm == cn, so if !cm, then we've */
return 0; /* reached end of BOTH, so it matches */
m++; /* go to next mask char */
n++; /* go to next testing char */
cm = lc(*m); /* pointers are slower */
}
cm = *m;
#ifndef USE_LOCALE
mylowertab = tolowertab2;
#define lc(x) mylowertab[x] /* use mylowertab, because registers are FASTER */
#else
#define lc(x) tolower(x)
#endif
n = (u_char *)name;
if (cm == '*')
{
if (m[1] == '\0') /* mask is just "*", so true */
return 0;
}
else if (cm != '?' && lc(cm) != lc(*n))
return 1; /* most likely first chars won't match */
else
{
m++;
n++;
}
cm = lc(*m);
wsm = (char *)NULL;
while (1)
{
if (cm == '*') /* found the * wildcard */
{
m++; /* go to next char of mask */
if (!*m) /* if at end of mask, */
return 0; /* function becomes true. */
while (*m == '*') /* while the char at m is "*" */
{
m++; /* go to next char of mask */
if (!*m) /* if at end of mask, */
return 0; /* function becomes true. */
}
cm = *m;
if (cm == '\\') /* don't do ? checking if a \ */
{
cm = *(++m); /* just skip this char, no ? checking */
}
else if (cm == '?') /* if it's a ? */
{
do
{
m++; /* go to the next char of both */
n++;
if (!*n) /* if end of test string... */
return (!*m ? 0 : 1); /* true if end of mask str, else false */
}
while (*m == '?'); /* while we have ?'s */
cm = *m;
if (!cm) /* last char of mask is ?, so it's true */
return 0;
}
cm = lc(cm);
while (lc(*n) != cm)
{ /* compare */
n++; /* go to next char of n */
if (!*n) /* if at end of n string */
return 1; /* function becomes false. */
}
wsm = m; /* mark after where wildcard found */
cm = lc(*(++m)); /* go to next mask char */
wsn = n; /* mark spot first char was found */
n++; /* go to next char of n */
continue;
}
if (cm == '?') /* found ? wildcard */
{
cm = lc(*(++m)); /* just skip and go to next */
n++;
if (!*n) /* return true if end of both, */
return (cm ? 1 : 0); /* false if end of test str only */
continue;
}
if (cm == '\\') /* next char will not be a wildcard. */
{ /* skip wild checking, don't continue */
cm = lc(*(++m));
n++;
}
/* Complicated to read, but to save CPU time. Every ounce counts. */
if (lc(*n) != cm) /* if the current chars don't equal, */
{
if (!wsm) /* if there was no * wildcard, */
return 1; /* function becomes false. */
n = wsn + 1; /* start on char after the one we found last */
m = wsm; /* set m to the spot after the "*" */
cm = lc(*m);
while (cm != lc(*n))
{ /* compare them */
n++; /* go to next char of n */
if (!*n) /* if we reached end of n string, */
return 1; /* function becomes false. */
}
wsn = n; /* mark spot first char was found */
}
if (!cm) /* cm == cn, so if !cm, then we've */
return 0; /* reached end of BOTH, so it matches */
m++; /* go to next mask char */
n++; /* go to next testing char */
cm = lc(*m); /* pointers are slower */
}
}
/*
@@ -159,41 +165,41 @@ char *mask, *name;
* This particular version is "in place", so that it changes the pattern
* which is to be reduced to a "minimal" size.
*/
char *
collapse(pattern)
char *pattern;
char *collapse(pattern)
char *pattern;
{
Reg1 char *s;
Reg2 char *s1;
Reg3 char *t;
s = pattern;
if (BadPtr(pattern))
return pattern;
/*
* Collapse all \** into \*, \*[?]+\** into \*[?]+
*/
for (; *s; s++)
if (*s == '\\')
{
if (!*(s + 1))
break;
else
s++;
}
else if (*s == '*') {
if (*(t = s1 = s + 1) == '*')
while (*t == '*')
t++;
else if (*t == '?')
for (t++, s1++; *t == '*' || *t == '?'; t++)
if (*t == '?')
*s1++ = *t;
while ((*s1++ = *t++))
;
}
return pattern;
char *s;
char *s1;
char *t;
s = pattern;
if (BadPtr(pattern))
return pattern;
/*
* Collapse all \** into \*, \*[?]+\** into \*[?]+
*/
for (; *s; s++)
if (*s == '\\')
{
if (!*(s + 1))
break;
else
s++;
}
else if (*s == '*')
{
if (*(t = s1 = s + 1) == '*')
while (*t == '*')
t++;
else if (*t == '?')
for (t++, s1++; *t == '*' || *t == '?'; t++)
if (*t == '?')
*s1++ = *t;
while ((*s1++ = *t++))
;
}
return pattern;
}
@@ -204,167 +210,187 @@ collapse(pattern)
* <0, if s1 lexicographically less than s2
* >0, if s1 lexicographically greater than s2
*/
int
smycmp(s1, s2)
char *s1;
char *s2;
int smycmp(s1, s2)
char *s1;
char *s2;
{
Reg1 u_char *str1;
Reg2 u_char *str2;
Reg3 int res;
str1 = (u_char *)s1;
str2 = (u_char *)s2;
while ((res = toupper(*str1) - toupper(*str2)) == 0) {
if (*str1 == '\0')
return 0;
str1++;
str2++;
}
return (res);
u_char *str1;
u_char *str2;
int res;
str1 = (u_char *)s1;
str2 = (u_char *)s2;
while ((res = toupper(*str1) - toupper(*str2)) == 0)
{
if (*str1 == '\0')
return 0;
str1++;
str2++;
}
return (res);
}
int
myncmp(str1, str2, n)
char *str1;
char *str2;
int n;
int myncmp(str1, str2, n)
char *str1;
char *str2;
int n;
{
Reg1 u_char *s1;
Reg2 u_char *s2;
Reg3 int res;
s1 = (u_char *)str1;
s2 = (u_char *)str2;
while ((res = toupper(*s1) - toupper(*s2)) == 0)
{
s1++;
s2++;
n--;
if (n == 0 || (*s1 == '\0' && *s2 == '\0'))
return 0;
}
return (res);
u_char *s1;
u_char *s2;
int res;
s1 = (u_char *)str1;
s2 = (u_char *)str2;
while ((res = toupper(*s1) - toupper(*s2)) == 0)
{
s1++;
s2++;
n--;
if (n == 0 || (*s1 == '\0' && *s2 == '\0'))
return 0;
}
return (res);
}
#ifndef USE_LOCALE
u_char tolowertab[] = {
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f,
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
'*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
':', ';', '<', '=', '>', '?',
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^',
'_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f,
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
'*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
':', ';', '<', '=', '>', '?',
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^',
'_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
u_char touppertab[] = {
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f,
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
'*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
0x5f,
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',
0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f,
' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
'*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
0x5f,
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',
0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
#endif
u_char char_atribs[] = {
/* 0-7 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* 8-12 */ CNTRL, CNTRL|SPACE, CNTRL|SPACE, CNTRL|SPACE, CNTRL|SPACE,
/* 13-15 */ CNTRL|SPACE, CNTRL, CNTRL,
/* 16-23 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* 24-31 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* space */ PRINT|SPACE,
/* !"#$%&'( */ PRINT, PRINT, PRINT, PRINT, PRINT, PRINT, PRINT, PRINT,
/* )*+,-./ */ PRINT, PRINT, PRINT, PRINT, PRINT|ALLOW, PRINT|ALLOW, PRINT,
/* 012 */ PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW,
/* 345 */ PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW,
/* 678 */ PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW, PRINT|DIGIT|ALLOW,
/* 9:; */ PRINT|DIGIT|ALLOW, PRINT, PRINT,
/* <=>? */ PRINT, PRINT, PRINT, PRINT,
/* @ */ PRINT,
/* ABC */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* DEF */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* GHI */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* JKL */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* MNO */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* PQR */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* STU */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* VWX */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* YZ[ */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA,
/* \]^ */ PRINT|ALPHA, PRINT|ALPHA, PRINT|ALPHA,
/* _` */ PRINT|ALLOW,PRINT,
/* abc */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* def */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* ghi */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* jkl */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* mno */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* pqr */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* stu */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* vwx */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW,
/* yz{ */ PRINT|ALPHA|ALLOW, PRINT|ALPHA|ALLOW, PRINT|ALPHA,
/* |}~ */ PRINT|ALPHA, PRINT|ALPHA, PRINT|ALPHA,
/* del */ 0,
/* 80-8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 90-9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* a0-af */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* b0-bf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* c0-cf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* d0-df */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* e0-ef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* f0-ff */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
/* 0-7 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* 8-12 */ CNTRL, CNTRL | SPACE, CNTRL | SPACE, CNTRL | SPACE,
CNTRL | SPACE,
/* 13-15 */ CNTRL | SPACE, CNTRL, CNTRL,
/* 16-23 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* 24-31 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL,
/* space */ PRINT | SPACE,
/* !"#$%&'( */ PRINT, PRINT, PRINT, PRINT, PRINT, PRINT, PRINT, PRINT,
/* )*+,-./ */ PRINT, PRINT, PRINT, PRINT, PRINT | ALLOW, PRINT | ALLOW,
PRINT,
/* 012 */ PRINT | DIGIT | ALLOW, PRINT | DIGIT | ALLOW,
PRINT | DIGIT | ALLOW,
/* 345 */ PRINT | DIGIT | ALLOW, PRINT | DIGIT | ALLOW,
PRINT | DIGIT | ALLOW,
/* 678 */ PRINT | DIGIT | ALLOW, PRINT | DIGIT | ALLOW,
PRINT | DIGIT | ALLOW,
/* 9:; */ PRINT | DIGIT | ALLOW, PRINT, PRINT,
/* <=>? */ PRINT, PRINT, PRINT, PRINT,
/* @ */ PRINT,
/* ABC */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* DEF */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* GHI */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* JKL */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* MNO */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* PQR */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* STU */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* VWX */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* YZ[ */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW, PRINT | ALPHA,
/* \]^ */ PRINT | ALPHA, PRINT | ALPHA, PRINT | ALPHA,
/* _` */ PRINT | ALLOW, PRINT,
/* abc */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* def */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* ghi */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* jkl */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* mno */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* pqr */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* stu */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* vwx */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW,
PRINT | ALPHA | ALLOW,
/* yz{ */ PRINT | ALPHA | ALLOW, PRINT | ALPHA | ALLOW, PRINT | ALPHA,
/* |}~ */ PRINT | ALPHA, PRINT | ALPHA, PRINT | ALPHA,
/* del */ 0,
/* 80-8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 90-9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* a0-af */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* b0-bf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* c0-cf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* d0-df */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* e0-ef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* f0-ff */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
+69 -73
View File
@@ -1,4 +1,3 @@
/* $Id$ */
/*
* Copyright (c) 1996 Michael Shalayeff.
@@ -55,9 +54,8 @@ ID_CVS("$Id$");
* QUESTION: Replace this with SHA, which as generally received better
* reviews from the cryptographic community?
*/
void
MD5Init(buf)
u_int32_t buf[4];
void MD5Init(buf)
u_int32_t buf[4];
{
buf[0] = 0x67452301;
buf[1] = 0xefcdab89;
@@ -81,89 +79,87 @@ MD5Init(buf)
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data.
*/
void
MD5Transform(buf, in)
u_int32_t buf[4];
void MD5Transform(buf, in)
u_int32_t buf[4];
u_int32_t in[16];
{
u_int32_t a, b, c, d;
u_int32_t a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
+45 -44
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, common/packet.c
* Unreal Internet Relay Chat Daemon, src/packet.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -25,7 +25,8 @@
#include "h.h"
ID_CVS("$Id$");
ID_Copyright("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Copyright
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Notes("2.12 1/30/94");
/*
* inittoken
@@ -33,22 +34,22 @@ ID_Notes("2.12 1/30/94");
* call them msgmap's. Called in main() with other inits.
* Yes, I know this is not the right module, but I said I cheat ;)
*/
void inittoken(void)
void inittoken(void)
{
Reg1 int loopy;
Reg2 int final;
int loopy;
int final;
/* Find the zero-entry */
for (final = 0; msgtab[final].cmd; final++)
;
/* Point all entries to it */
for (loopy = 0; loopy<256; loopy++)
for (loopy = 0; loopy < 256; loopy++)
msgmap[loopy] = &msgtab[final];
/* Build references to existing commands */
for (loopy = 0; msgtab[loopy].cmd; loopy++)
msgmap[msgtab[loopy].token[0]] = &msgtab[loopy];
}
/*
** dopacket
** cptr - pointer to client structure for which the buffer data
@@ -61,42 +62,42 @@ void inittoken(void)
** with cptr of "local" variation, which contains all the
** necessary fields (buffer etc..)
*/
int dopacket(cptr, buffer, length)
Reg3 aClient *cptr;
char *buffer;
Reg4 int length;
int dopacket(cptr, buffer, length)
aClient *cptr;
char *buffer;
int length;
{
register char *ch1;
register char *ch2;
aClient *acpt = cptr->acpt;
char *ch1;
char *ch2;
aClient *acpt = cptr->acpt;
me.receiveB += length; /* Update bytes received */
me.receiveB += length; /* Update bytes received */
cptr->receiveB += length;
if (cptr->receiveB > 1023)
{
{
cptr->receiveK += (cptr->receiveB >> 10);
cptr->receiveB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
}
}
if (acpt != &me)
{
{
acpt->receiveB += length;
if (acpt->receiveB > 1023)
{
{
acpt->receiveK += (acpt->receiveB >> 10);
acpt->receiveB &= 0x03ff;
}
}
}
}
else if (me.receiveB > 1023)
{
{
me.receiveK += (me.receiveB >> 10);
me.receiveB &= 0x03ff;
}
}
ch1 = cptr->buffer + cptr->count;
ch2 = buffer;
while (--length >= 0)
{
register char g=(*ch1 = *ch2++);
{
char g = (*ch1 = *ch2++);
/*
* Yuck. Stuck. To make sure we stay backward compatible,
* we must assume that either CR or LF terminates the message
@@ -104,38 +105,38 @@ Reg4 int length;
* of messages, backward compatibility is lost and major
* problems will arise. - Avalon
*/
if (g<'\16' && (g == '\n' || g == '\r'))
{
if (g < '\16' && (g == '\n' || g == '\r'))
{
if (ch1 == cptr->buffer)
continue; /* Skip extra LF/CR's */
continue; /* Skip extra LF/CR's */
*ch1 = '\0';
me.receiveM += 1; /* Update messages received */
me.receiveM += 1; /* Update messages received */
cptr->receiveM += 1;
if (cptr->acpt != &me)
cptr->acpt->receiveM += 1;
cptr->count = 0; /* ...just in case parse returns with
** FLUSH_BUFFER without removing the
** structure pointed by cptr... --msa
*/
cptr->count = 0; /* ...just in case parse returns with
** FLUSH_BUFFER without removing the
** structure pointed by cptr... --msa
*/
if (parse(cptr, cptr->buffer, ch1, msgtab) ==
FLUSH_BUFFER)
/*
** FLUSH_BUFFER means actually that cptr
** structure *does* not exist anymore!!! --msa
*/
** FLUSH_BUFFER means actually that cptr
** structure *does* not exist anymore!!! --msa
*/
return FLUSH_BUFFER;
/*
** Socket is dead so exit (which always returns with
** FLUSH_BUFFER here). - avalon
*/
** Socket is dead so exit (which always returns with
** FLUSH_BUFFER here). - avalon
*/
if (cptr->flags & FLAGS_DEADSOCKET)
return exit_client(cptr, cptr, &me,
"Dead Socket");
"Dead Socket");
ch1 = cptr->buffer;
}
else if (ch1 < cptr->buffer + (sizeof(cptr->buffer)-1))
ch1++; /* There is always room for the null */
}
}
else if (ch1 < cptr->buffer + (sizeof(cptr->buffer) - 1))
ch1++; /* There is always room for the null */
}
cptr->count = ch1 - cptr->buffer;
return 0;
}
+377 -236
View File
@@ -1,5 +1,5 @@
/************************************************************************
* IRC - Internet Relay Chat, common/parse.c
* Unreal Internet Relay Chat Daemon, src/parse.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
*
@@ -23,18 +23,20 @@
*/
#ifndef lint
static char sccsid[] = "@(#)parse.c 2.33 1/30/94 (C) 1988 University of Oulu, \
static char sccsid[] =
"@(#)parse.c 2.33 1/30/94 (C) 1988 University of Oulu, \
Computing Center and Jarkko Oikarinen";
#endif
#include "struct.h"
#include "common.h"
ID_CVS("$Id$");
ID_Copyright("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Copyright
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
ID_Notes("2.33 1/30/94");
#undef RAWDEBUG
char backupbuf[8192];
char backupbuf[8192];
#define MSGTAB
#include "msg.h"
@@ -46,11 +48,12 @@ char backupbuf[8192];
/*
* NOTE: parse() should not be called recursively by other functions!
*/
static char *para[MAXPARA+1];
static char *para[MAXPARA + 1];
static char sender[HOSTLEN+1];
static int cancel_clients PROTO((aClient *, aClient *, char *));
static void remove_unknown PROTO((aClient *, char *));
static char sender[HOSTLEN + 1];
static int cancel_clients PROTO((aClient *, aClient *, char *));
static void remove_unknown PROTO((aClient *, char *));
static char unknownserver[] = "Unknown.Server";
/*
** Find a client (server or user) by name.
**
@@ -60,24 +63,34 @@ static void remove_unknown PROTO((aClient *, char *));
** string and the search is the for server and user.
*/
aClient *find_client(name, cptr)
char *name;
Reg1 aClient *cptr;
{
char *name;
aClient *cptr;
{
char *newname;
if (name)
{
if (*name == '@')
{
newname = name;
name = find_by_aln(name + 1);
if (!name)
name = newname;
}
cptr = hash_find_client(name, cptr);
}
return cptr;
}
}
aClient *find_nickserv(name, cptr)
char *name;
Reg1 aClient *cptr;
{
aClient *find_nickserv(name, cptr)
char *name;
aClient *cptr;
{
if (name)
cptr = hash_find_nickserver(name, cptr);
return cptr;
}
}
/*
@@ -94,19 +107,61 @@ Reg1 aClient *cptr;
** string.
*/
aClient *find_server(name, cptr)
char *name;
Reg1 aClient *cptr;
char *name;
aClient *cptr;
{
char *newname;
if (name)
{
if (*name == '@')
{
newname = name;
name = find_by_aln(name + 1);
if (!name)
name = newname;
}
cptr = hash_find_server(name, cptr);
}
return cptr;
}
aClient *find_serveraln(name, cptr)
char *name;
aClient *cptr;
{
char *newname;
if (name)
{
if (*name == '@')
{
newname = name;
name = find_by_aln(name + 1);
if (!name)
name = newname;
}
if (strlen(name) < 3)
{
newname = name;
#ifdef DEVELOP
// sendto_ops("Trying to find %s", name);
#endif
name = find_by_aln(name);
if (!name)
name = newname;
}
cptr = hash_find_client(name, cptr);
#ifdef DEVELOP
// if (cptr) sendto_ops("Found it ! (%s)", cptr->name);
#endif
}
return cptr;
}
aClient *find_name(name, cptr)
char *name;
aClient *cptr;
char *name;
aClient *cptr;
{
Reg1 aClient *c2ptr = cptr;
aClient *c2ptr = cptr;
if (!collapse(name))
return c2ptr;
@@ -116,15 +171,15 @@ aClient *cptr;
if (!index(name, '*'))
return c2ptr;
for (c2ptr = client; c2ptr; c2ptr = c2ptr->next)
{
{
if (!IsServer(c2ptr) && !IsMe(c2ptr))
continue;
if (match(name, c2ptr->name) == 0)
break;
if (index(c2ptr->name, '*'))
if (match(c2ptr->name, name) == 0)
break;
}
break;
}
return (c2ptr ? c2ptr : cptr);
}
@@ -132,10 +187,10 @@ aClient *cptr;
** Find person by (nick)name.
*/
aClient *find_person(name, cptr)
char *name;
aClient *cptr;
{
Reg1 aClient *c2ptr = cptr;
char *name;
aClient *cptr;
{
aClient *c2ptr = cptr;
c2ptr = find_client(name, c2ptr);
@@ -143,66 +198,116 @@ aClient *cptr;
return c2ptr;
else
return cptr;
}
}
int alnprefix = 0;
void ban_flooder(aClient *cptr)
{
char hostip[128], mo[100], mo2[100];
char *tkllayer[9] = {
me.name, /*0 server.name */
"+", /*1 +|- */
"z", /*2 G */
"*", /*3 user */
NULL, /*4 host */
NULL,
NULL, /*6 expire_at */
NULL, /*7 set_at */
NULL /*8 reason */
};
strcpy(hostip, (char *)inetntoa((char *) &cptr->ip));
exit_client(cptr, cptr, &me, "Flooding");
tkllayer[4] = hostip;
tkllayer[5] = me.name;
ircsprintf(mo, "%li", 600 + TStime());
ircsprintf(mo2, "%li", TStime());
tkllayer[6] = mo;
tkllayer[7] = mo2;
tkllayer[8] = "Flood from unknown connection";
m_tkl(&me, &me, 9, tkllayer);
return;
}
/*
* parse a buffer.
*
* NOTE: parse() should not be called recusively by any other fucntions!
*/
int parse(cptr, buffer, bufend, mptr)
aClient *cptr;
char *buffer, *bufend;
struct Message *mptr;
{
Reg1 aClient *from = cptr;
Reg2 char *ch, *s;
Reg3 int len, i, numeric, paramcount, noprefix = 0;
Reg4 int token,mfound;
int parse(cptr, buffer, bufend, mptr)
aClient *cptr;
char *buffer, *bufend;
struct Message *mptr;
{
aClient *from = cptr;
char *ch, *s, *p;
int len, i, numeric, paramcount, noprefix = 0;
int token, mfound;
#ifdef DEBUGMODE
time_t then, ticks;
int retval;
time_t then, ticks;
int retval;
#endif
struct Message *bmptr;
Debug((DEBUG_ERROR,"Parsing: %s (from %s)", buffer,(*cptr->name ? cptr->name : "*")));
Debug((DEBUG_ERROR, "Parsing: %s (from %s)", buffer,
(*cptr->name ? cptr->name : "*")));
if (IsDead(cptr))
return 0;
#ifdef RAWDEBUG
sendto_ops("Debug: parse(): %s", buffer);
sendto_ops("Debug: parse(): %s", buffer);
#endif
if ((cptr->receiveK >= 4) && IsUnknown(cptr))
{
sendto_realops("Flood from unknown connection %s detected", cptr->sockhost);
ban_flooder(cptr);
return 0;
}
/* this call is a bit obsolete? - takes up CPU*/
backupbuf[0] = '\0';
strcpy(backupbuf, buffer);
s = sender;
*s = '\0';
alnprefix = 0;
for (ch = buffer; *ch == ' '; ch++)
;
para[0] = from->name;
if (*ch == ':')
{
if (*ch == ':' || *ch == '@')
{
if (*ch == '@')
alnprefix = 1;
/*
** Copy the prefix to 'sender' assuming it terminates
** with SPACE (or NULL, which is an error, though).
*/
for (++ch, i = 0; *ch && *ch != ' '; ++ch )
if (s < (sender + sizeof(sender)-1))
*s++ = *ch; /* leave room for NULL */
** Copy the prefix to 'sender' assuming it terminates
** with SPACE (or NULL, which is an error, though).
*/
for (++ch, i = 0; *ch && *ch != ' '; ++ch)
if (s < (sender + sizeof(sender) - 1))
*s++ = *ch; /* leave room for NULL */
*s = '\0';
/*
** Actually, only messages coming from servers can have
** the prefix--prefix silently ignored, if coming from
** a user client...
**
** ...sigh, the current release "v2.2PL1" generates also
** null prefixes, at least to NOTIFY messages (e.g. it
** puts "sptr->nickname" as prefix from server structures
** where it's null--the following will handle this case
** as "no prefix" at all --msa (": NOTICE nick ...")
*/
** Actually, only messages coming from servers can have
** the prefix--prefix silently ignored, if coming from
** a user client...
**
** ...sigh, the current release "v2.2PL1" generates also
** null prefixes, at least to NOTIFY messages (e.g. it
** puts "sptr->nickname" as prefix from server structures
** where it's null--the following will handle this case
** as "no prefix" at all --msa (": NOTICE nick ...")
*/
if (*sender && IsServer(cptr))
{
from = find_client(sender, (aClient *) NULL);
{
if ((strlen(sender) < 3) && alnprefix)
{
p = find_by_aln(sender);
if (p)
strcpy(sender, p);
}
from = find_client(sender, (aClient *)NULL);
if (!from || match(from->name, sender))
from = find_server(sender, (aClient *)NULL);
else if (!from && index(sender, '@'))
@@ -217,55 +322,55 @@ struct Message *mptr;
* prefix just wasn't there...) --msa
*/
if (!from)
{
{
Debug((DEBUG_ERROR,
"Unknown prefix (%s)(%s) from (%s)",
sender, buffer, cptr->name));
"Unknown prefix (%s)(%s) from (%s)",
sender, buffer, cptr->name));
ircstp->is_unpf++;
remove_unknown(cptr, sender);
return -1;
}
}
if (from->from != cptr)
{
{
ircstp->is_wrdi++;
Debug((DEBUG_ERROR,
"Message (%s) coming from (%s)",
buffer, cptr->name));
"Message (%s) coming from (%s)",
buffer, cptr->name));
return cancel_clients(cptr, from, ch);
}
}
}
}
while (*ch == ' ')
ch++;
}
}
else
noprefix = 1;
noprefix = 1;
if (*ch == '\0')
{
{
ircstp->is_empt++;
Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
cptr->name, from->name));
return(-1);
}
cptr->name, from->name));
return (-1);
}
/*
** Extract the command code from the packet. Point s to the end
** of the command code and calculate the length using pointer
** arithmetic. Note: only need length for numerics and *all*
** numerics must have paramters and thus a space after the command
** code. -avalon
*/
s = (char *)index(ch, ' '); /* s -> End of the command code */
** Extract the command code from the packet. Point s to the end
** of the command code and calculate the length using pointer
** arithmetic. Note: only need length for numerics and *all*
** numerics must have paramters and thus a space after the command
** code. -avalon
*/
s = (char *)index(ch, ' '); /* s -> End of the command code */
len = (s) ? (s - ch) : 0;
if (len == 3 &&
isdigit(*ch) && isdigit(*(ch + 1)) && isdigit(*(ch + 2)))
{
{
mptr = NULL;
numeric = (*ch - '0') * 100 + (*(ch + 1) - '0') * 10
+ (*(ch + 2) - '0');
+ (*(ch + 2) - '0');
paramcount = MAXPARA;
ircstp->is_num++;
}
}
else
{
{
if (s)
*s++ = '\0';
@@ -279,118 +384,139 @@ struct Message *mptr;
token = 0;
}
bmptr = mptr;
/* run a fast token search through if token */
mfound = 0;
if (token == 1)
mfound = 0;
if (token == 1)
{
for (; mptr->cmd; mptr++)
{
if (strcmp(mptr->token, ch)==0)
if (strcmp(mptr->token, ch) == 0)
{
mfound = 1;
break;
}
}
}
/* no token match .. grr :P */
if (mfound == 0)
if (mfound == 0)
{
mptr = bmptr;
for (; mptr->cmd; mptr++)
{
if (mycmp(mptr->cmd, ch)==0)
if (mycmp(mptr->cmd, ch) == 0)
break;
}
}
/* if (ch[1] == '\0' && IsToken(cptr))
mptr = msgmap[(u_char)*ch];
else
*/
if (!mptr->cmd)
{
{
/*
** Note: Give error message *only* to recognized
** persons. It's a nightmare situation to have
** two programs sending "Unknown command"'s or
** equivalent to each other at full blast....
** If it has got to person state, it at least
** seems to be well behaving. Perhaps this message
** should never be generated, though... --msa
** Hm, when is the buffer empty -- if a command
** code has been found ?? -Armin
*/
** Note: Give error message *only* to recognized
** persons. It's a nightmare situation to have
** two programs sending "Unknown command"'s or
** equivalent to each other at full blast....
** If it has got to person state, it at least
** seems to be well behaving. Perhaps this message
** should never be generated, though... --msa
** Hm, when is the buffer empty -- if a command
** code has been found ?? -Armin
*/
if (buffer[0] != '\0')
{
{
if (IsPerson(from))
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)));
}
Debug((DEBUG_ERROR, "Unknown (%s) from %s",
ch, get_client_name(cptr, TRUE)));
}
ircstp->is_unco++;
return(-1);
}
return (-1);
}
paramcount = mptr->parameters;
i = bufend - ch; /* Is this right? -Donwulff */
i = bufend - ch; /* Is this right? -Donwulff */
mptr->bytes += i;
if ((mptr->flags & 1) && !(IsServer(cptr) || IsService(cptr)))
cptr->since += (2 + i / 120);
/* Allow only 1 msg per 2 seconds
* (on average) to prevent dumping.
* to keep the response rate up,
* bursts of up to 5 msgs are allowed
* -SRB
*/
}
if ((mptr->flags & 1) && !(IsServer(cptr) || IsOper(cptr)))
cptr->since += (2 + i / 90);
/* Allow only 1 msg per 2 seconds
* (on average) to prevent dumping.
* to keep the response rate up,
* bursts of up to 5 msgs are allowed
* -SRB
*
* Not applying to opers now
* -techie
*
* 1 msg per 1.5 second i'd say now
*/
}
/*
** Must the following loop really be so devious? On
** surface it splits the message to parameters from
** blank spaces. But, if paramcount has been reached,
** the rest of the message goes into this last parameter
** (about same effect as ":" has...) --msa
*/
** Must the following loop really be so devious? On
** surface it splits the message to parameters from
** blank spaces. But, if paramcount has been reached,
** the rest of the message goes into this last parameter
** (about same effect as ":" has...) --msa
*/
/* Note initially true: s==NULL || *(s-1) == '\0' !! */
i = 0;
if (s)
{
{
if (paramcount > MAXPARA)
paramcount = MAXPARA;
for (;;)
{
{
/*
** Never "FRANCE " again!! ;-) Clean
** out *all* blanks.. --msa
*/
** Never "FRANCE " again!! ;-) Clean
** out *all* blanks.. --msa
*/
while (*s == ' ')
*s++ = '\0';
if (*s == '\0')
break;
if (*s == ':')
{
{
/*
** The rest is single parameter--can
** include blanks also.
*/
** The rest is single parameter--can
** include blanks also.
*/
para[++i] = s + 1;
break;
}
}
para[++i] = s;
if (i >= paramcount)
break;
for (; *s != ' ' && *s; s++)
;
}
}
}
}
para[++i] = NULL;
if (mptr == NULL)
return (do_numeric(numeric, cptr, from, i, para));
/* now, lets make sure they use a legit commnd... -nikb */
/* There is code in s_serv.c for ADMIN and VERSION and
* in s_user.c for NOTICE to limit commands by
* unregistered users. -Studded */
if ((!IsRegistered(cptr)) &&
(((mptr->func != m_user) && (mptr->func != m_nick) &&
(mptr->func != m_server) && (mptr->func != m_pong) &&
(mptr->func != m_pass) && (mptr->func != m_quit) &&
(mptr->func != m_protoctl) && (mptr->func != m_error) &&
(mptr->func != m_admin) && (mptr->func != m_version)
#ifdef NOSPOOF
&& (mptr->func != m_notice)
#endif
)))
{
sendto_one(from, ":%s %d %s :You have not registered",
me.name, ERR_NOTREGISTERED, ch);
return -1;
}
mptr->count++;
if (IsRegisteredUser(cptr) &&
#ifdef IDLE_FROM_MSG
@@ -398,25 +524,16 @@ struct Message *mptr;
#else
mptr->func != m_ping && mptr->func != m_pong)
#endif
from->user->last = TStime();
/* Lame protocol 4 stuff... this if can be removed when all are 2.9 */
if (noprefix && IsServer(cptr) && i >= 2 && mptr->func == m_squit &&
(!(from = find_server(para[1], (aClient *)NULL)) ||
from->from != cptr))
{
Debug((DEBUG_DEBUG,"Ignoring protocol 4 \"%s %s %s ...\"",
para[0], para[1], para[2]));
return 0;
}
from->user->last = TStime();
#ifndef DEBUGMODE
return (*mptr->func)(cptr, from, i, para);
return (*mptr->func) (cptr, from, i, para);
#else
then = clock();
retval = (*mptr->func)(cptr, from, i, para);
if (retval != FLUSH_BUFFER) {
ticks = (clock()-then);
retval = (*mptr->func) (cptr, from, i, para);
if (retval != FLUSH_BUFFER)
{
ticks = (clock() - then);
if (IsServer(cptr))
mptr->rticks += ticks;
else
@@ -426,40 +543,59 @@ struct Message *mptr;
return retval;
#endif
}
}
/*
* field breakup for ircd.conf file.
*/
char *getfield(newline)
char *newline;
char *getfield(newline)
char *newline;
{
static char *line = NULL;
char *end, *field;
static char *line = NULL;
char *end, *field, *x;
if (newline)
line = newline;
if (line == NULL)
return(NULL);
return (NULL);
field = line;
if ((end = (char *)index(line,':')) == NULL)
{
if (*field == '"')
{
field++;
x = index(field, '"');
if (!x)
{
sendto_ops("FATAL: Misplaced \" in ircd.conf line!");
s_die();
}
*x = '\0';
x++;
if (*x == '\n')
line = NULL;
else
line = x;
end = x;
line++;
goto end1;
}
if ((end = (char *)index(line, ':')) == NULL)
{
line = NULL;
if ((end = (char *)index(field,'\n')) == NULL)
if ((end = (char *)index(field, '\n')) == NULL)
end = field + strlen(field);
}
}
else
line = end + 1;
end1:
*end = '\0';
return(field);
return (field);
}
static int cancel_clients(cptr, sptr, cmd)
aClient *cptr, *sptr;
char *cmd;
static int cancel_clients(cptr, sptr, cmd)
aClient *cptr, *sptr;
char *cmd;
{
char *cmdpriv;
/*
* kill all possible points that are causing confusion here,
* I'm not sure I've got this all right...
@@ -469,16 +605,16 @@ char *cmd;
*/
/* This little bit of code allowed paswords to nickserv to be
* seen. A definite no-no. --Russell
sendto_ops("Message (%s) for %s[%s!%s@%s] from %s", cmd,
sptr->name, sptr->from->name, sptr->from->username,
sptr->from->sockhost, get_client_name(cptr, TRUE));*/
sendto_ops("Message (%s) for %s[%s!%s@%s] from %s", cmd,
sptr->name, sptr->from->name, sptr->from->username,
sptr->from->sockhost, get_client_name(cptr, TRUE));*/
/*
* Incorrect prefix for a server from some connection. If it is a
* client trying to be annoying, just QUIT them, if it is a server
* then the same deal.
*/
if (IsServer(sptr) || IsMe(sptr))
{
{
/*
* First go at tracking down what really causes the
* dreaded Fake Direction error. It should not be possible
@@ -504,73 +640,73 @@ char *cmd;
* just completely ignore them. Needs to be modified to
* send these messages to a special oper channel. -Cabal95
*
aClient *from;
char *fromname=NULL, *sptrname=NULL, *cptrname=NULL, *s;
aClient *from;
char *fromname=NULL, *sptrname=NULL, *cptrname=NULL, *s;
while (*cmd == ' ')
cmd++;
if (s = index(cmd, ' '))
*s++ = '\0';
if (!strcasecmp(cmd, "PRIVMSG") ||
!strcasecmp(cmd, "NOTICE") ||
!strcasecmp(cmd, "PASS"))
s = NULL;
if (sptr && sptr->name)
sptrname = sptr->name;
if (cptr && cptr->name)
cptrname = cptr->name;
if (sptr && sptr->from && sptr->from->name)
fromname = sptr->from->name;
while (*cmd == ' ')
cmd++;
if (s = index(cmd, ' '))
*s++ = '\0';
if (!strcasecmp(cmd, "PRIVMSG") ||
!strcasecmp(cmd, "NOTICE") ||
!strcasecmp(cmd, "PASS"))
s = NULL;
if (sptr && sptr->name)
sptrname = sptr->name;
if (cptr && cptr->name)
cptrname = cptr->name;
if (sptr && sptr->from && sptr->from->name)
fromname = sptr->from->name;
sendto_serv_butone(NULL, ":%s GLOBOPS :"
"Fake Direction: Message[%s %s] from %s via %s "
"instead of %s (Tell Cabal95)", me.name, cmd,
(s ? s : ""),
(sptr->name!=NULL)?sptr->name:"<unknown>",
(cptr->name!=NULL)?cptr->name:"<unknown>",
(fromname!=NULL)?fromname:"<unknown>");
sendto_ops(
"Fake Direction: Message[%s %s] from %s via %s "
"instead of %s (Tell Cabal95)", cmd,
(s ? s : ""),
(sptr->name!=NULL)?sptr->name:"<unknown>",
(cptr->name!=NULL)?cptr->name:"<unknown>",
(fromname!=NULL)?fromname:"<unknown>");
sendto_serv_butone(NULL, ":%s GLOBOPS :"
"Fake Direction: Message[%s %s] from %s via %s "
"instead of %s (Tell Cabal95)", me.name, cmd,
(s ? s : ""),
(sptr->name!=NULL)?sptr->name:"<unknown>",
(cptr->name!=NULL)?cptr->name:"<unknown>",
(fromname!=NULL)?fromname:"<unknown>");
sendto_ops(
"Fake Direction: Message[%s %s] from %s via %s "
"instead of %s (Tell Cabal95)", cmd,
(s ? s : ""),
(sptr->name!=NULL)?sptr->name:"<unknown>",
(cptr->name!=NULL)?cptr->name:"<unknown>",
(fromname!=NULL)?fromname:"<unknown>");
/*
/*
* We don't drop the server anymore. Just ignore
* the message and go about your business. And hope
* we don't get flooded. :-) -Cabal95
sendto_ops("Dropping server %s", cptr->name);
return exit_client(cptr, cptr, &me, "Fake Direction");
sendto_ops("Dropping server %s", cptr->name);
return exit_client(cptr, cptr, &me, "Fake Direction");
*/
return 0;
}
}
/*
* Ok, someone is trying to impose as a client and things are
* confused. If we got the wrong prefix from a server, send out a
* kill, else just exit the lame client.
*/
if (IsServer(cptr))
{
{
/*
** It is NOT necessary to send a KILL here...
** We come here when a previous 'NICK new'
** nick collided with an older nick, and was
** ignored, and other messages still were on
** the way (like the following USER).
** We simply ignore it all, a purge will be done
** automatically by the server 'cptr' as a reaction
** on our 'NICK older'. --Run
*/
return 0; /* On our side, nothing changed */
}
** It is NOT necessary to send a KILL here...
** We come here when a previous 'NICK new'
** nick collided with an older nick, and was
** ignored, and other messages still were on
** the way (like the following USER).
** We simply ignore it all, a purge will be done
** automatically by the server 'cptr' as a reaction
** on our 'NICK older'. --Run
*/
return 0; /* On our side, nothing changed */
}
return exit_client(cptr, cptr, &me, "Fake prefix");
}
static void remove_unknown(cptr, sender)
aClient *cptr;
char *sender;
static void remove_unknown(cptr, sender)
aClient *cptr;
char *sender;
{
if (!IsRegistered(cptr) || IsClient(cptr))
return;
@@ -580,15 +716,20 @@ char *sender;
if (!IsServer(cptr))
return;
#ifdef DEVELOP
sendto_ops("Killing %s (%s)", sender, backupbuf);
return;
#endif
/*
* Do kill if it came from a server because it means there is a ghost
* user on the other server which needs to be removed. -avalon
*/
if (!index(sender, '.'))
if (!index(sender, '.') && !alnprefix)
sendto_one(cptr, ":%s KILL %s :%s (%s(?) <- %s)",
me.name, sender, me.name, sender,
get_client_name(cptr, FALSE));
me.name, sender, me.name, sender,
get_client_name(cptr, FALSE));
else
sendto_one(cptr, ":%s SQUIT %s :(Unknown from %s)",
me.name, sender, get_client_name(cptr, FALSE));
sendto_one(cptr, ":%s SQUIT %s%s :(Unknown from %s)",
me.name, (alnprefix ? "@" : ""), sender,
get_client_name(cptr, FALSE));
}
+262 -120
View File
@@ -1,10 +1,11 @@
/*
* ircd/res.c (C)opyright 1992, 1993, 1994 Darren Reed. All rights reserved.
* src/res.c (C)opyright 1992, 1993, 1994 Darren Reed. All rights reserved.
* This file may not be distributed without the author's prior permission in
* any shape or form. The author takes no responsibility for any damage or
* loss of property which results from the use of this software. Distribution
* of this file must include this notice.
*/
// *INDENT-OFF*
#include "struct.h"
#include "common.h"
#include "sys.h"
@@ -29,7 +30,8 @@ ID_Copyright("(C) 1992 Darren Reed");
ID_Notes("2.38 4/13/94");
#undef DEBUG /* because there is a lot of debug code in here :-) */
#define INADDRSZ sizeof(struct IN_ADDR)
#define IN6ADDRSZ sizeof(struct IN_ADDR)
extern int dn_expand PROTO((char *, char *, char *, char *, int));
extern int dn_skipname PROTO((char *, char *));
extern int res_mkquery PROTO((int, char *, int, int, char *, int,
@@ -51,7 +53,7 @@ static ResRQ *last, *first;
static void rem_cache PROTO((aCache *));
static void rem_request PROTO((ResRQ *));
static int do_query_name PROTO((Link *, char *, ResRQ *));
static int do_query_number PROTO((Link *, struct in_addr *, ResRQ *));
static int do_query_number PROTO((Link *, struct IN_ADDR *, ResRQ *));
static void resend_query PROTO((ResRQ *));
static int proc_answer PROTO((ResRQ *, HEADER *, char *, char *));
static int query_name PROTO((char *, int, int, ResRQ *));
@@ -112,8 +114,14 @@ int op;
if (!_res.nscount)
{
_res.nscount = 1;
_res.nsaddr_list[0].sin_addr.s_addr =
#ifdef INET6
/* still IPv4 */
inet_pton(AFINET, "127.0.0.1",
&_res.nsaddr_list[0].SIN_ADDR.S_ADDR);
#else
_res.nsaddr_list[0].SIN_ADDR.S_ADDR =
inet_addr("127.0.0.1");
#endif
}
}
@@ -121,7 +129,7 @@ int op;
{
#ifndef _WIN32
int on = 0;
ret = resfd = socket(AF_INET, SOCK_DGRAM, 0);
ret = resfd = socket(AFINET, SOCK_DGRAM, 0);
set_non_blocking(resfd, &me);
(void) setsockopt(ret, SOL_SOCKET, SO_BROADCAST,
(char *)&on, sizeof(on));
@@ -169,9 +177,9 @@ ResRQ *new;
static void rem_request(old)
ResRQ *old;
{
Reg1 ResRQ **rptr, *r2ptr = NULL;
Reg2 int i;
Reg3 char *s;
ResRQ **rptr, *r2ptr = NULL;
int i;
char *s;
if (!old)
return;
@@ -215,28 +223,28 @@ ResRQ *old;
static ResRQ *make_request(lp)
Link *lp;
{
Reg1 ResRQ *nreq;
ResRQ *nreq;
nreq = (ResRQ *)MyMalloc(sizeof(ResRQ));
bzero((char *)nreq, sizeof(ResRQ));
nreq->next = NULL; /* where NULL is non-zero ;) */
nreq->sentat = TStime();
nreq->retries = 3;
nreq->retries = HOST_RETRIES;
nreq->resend = 1;
nreq->srch = -1;
if (lp)
bcopy((char *)lp, (char *)&nreq->cinfo, sizeof(Link));
else
bzero((char *)&nreq->cinfo, sizeof(Link));
nreq->timeout = 4; /* start at 4 and exponential inc. */
nreq->timeout = HOST_TIMEOUT;
#ifndef _WIN32
nreq->he.h_addrtype = AF_INET;
nreq->he.h_addrtype = AFINET;
nreq->he.h_name = NULL;
nreq->he.h_aliases[0] = NULL;
#else
nreq->he = (struct hostent *)MyMalloc(MAXGETHOSTSTRUCT);
bzero((char *)nreq->he, MAXGETHOSTSTRUCT);
nreq->he->h_addrtype = AF_INET;
nreq->he->h_addrtype = AFINET;
nreq->he->h_name = NULL;
#endif
(void)add_request(nreq);
@@ -250,8 +258,8 @@ Link *lp;
time_t timeout_query_list(now)
time_t now;
{
Reg1 ResRQ *rptr, *r2ptr;
Reg2 time_t next = 0, tout;
ResRQ *rptr, *r2ptr;
time_t next = 0, tout;
aClient *cptr;
Debug((DEBUG_DNS,"timeout_query_list at %s",myctime(now)));
@@ -335,7 +343,7 @@ time_t now;
void del_queries(cp)
char *cp;
{
Reg1 ResRQ *rptr, *r2ptr;
ResRQ *rptr, *r2ptr;
for (rptr = first; rptr; rptr = r2ptr)
{
@@ -357,7 +365,7 @@ static int send_res_msg(msg, len, rcount)
char *msg;
int len, rcount;
{
Reg1 int i;
int i;
int sent = 0, max;
if (!msg)
@@ -371,9 +379,9 @@ int len, rcount;
for (i = 0; i < max; i++)
{
_res.nsaddr_list[i].sin_family = AF_INET;
if (sendto(resfd, msg, len, 0, (struct sockaddr *)
&(_res.nsaddr_list[i]), sizeof(struct sockaddr)) == len)
_res.nsaddr_list[i].SIN_FAMILY = AFINET;
if (sendto(resfd, msg, len, 0, (struct SOCKADDR *)
&(_res.nsaddr_list[i]), sizeof(struct SOCKADDR)) == len)
{
reinfo.re_sent++;
sent++;
@@ -393,7 +401,7 @@ int len, rcount;
static ResRQ *find_id(id)
int id;
{
Reg1 ResRQ *rptr;
ResRQ *rptr;
for (rptr = first; rptr; rptr = rptr->next)
if (rptr->id == id)
@@ -405,7 +413,7 @@ struct hostent *gethost_byname(name, lp)
char *name;
Link *lp;
{
Reg1 aCache *cp;
aCache *cp;
reinfo.re_na_look++;
if ((cp = find_cache_name(name)))
@@ -435,14 +443,14 @@ Link *lp;
#endif
if (!lp)
return NULL;
(void)do_query_number(lp, (struct in_addr *)addr, NULL);
(void)do_query_number(lp, (struct IN_ADDR *)addr, NULL);
return NULL;
}
static int do_query_name(lp, name, rptr)
Link *lp;
char *name;
Reg1 ResRQ *rptr;
ResRQ *rptr;
{
#ifndef _WIN32
char hname[HOSTLEN+1];
@@ -465,12 +473,20 @@ Reg1 ResRQ *rptr;
if (!rptr)
{
rptr = make_request(lp);
#ifdef INET6
rptr->type = T_AAAA;
#else
rptr->type = T_A;
#endif
rptr->name = (char *)MyMalloc(strlen(name) + 1);
(void)strcpy(rptr->name, name);
}
#ifndef _WIN32
#ifdef INET6
return (query_name(hname, C_IN, T_AAAA, rptr));
#else
return (query_name(hname, C_IN, T_A, rptr));
#endif
#else
rptr->id = _beginthread(async_dns, 0, (void *)rptr);
@@ -484,29 +500,70 @@ Reg1 ResRQ *rptr;
*/
static int do_query_number(lp, numb, rptr)
Link *lp;
struct in_addr *numb;
Reg1 ResRQ *rptr;
struct IN_ADDR *numb;
ResRQ *rptr;
{
#ifndef _WIN32
char ipbuf[32];
Reg2 u_char *cp;
char ipbuf[128];
u_char *cp;
cp = (u_char *)&numb->s_addr;
(void)sprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.",
#ifndef _WIN32
#ifdef INET6
cp = (u_char *)numb->s6_addr;
if (cp[0]==0 && cp[1]==0 && cp[2]==0 && cp[3]==0 && cp[4]==0 &&
cp[5]==0 && cp[6]==0 && cp[7]==0 && cp[8]==0 && cp[9]==0 &&
((cp[10]==0 && cp[11]==0) || (cp[10]==0xff && cp[11]==0xff)))
{
(void)sprintf(ipbuf, "%u.%u.%u.%u.in-addr.arpa.",
(u_int)(cp[15]), (u_int)(cp[14]),
(u_int)(cp[13]), (u_int)(cp[12]));
}
else
{
(void)sprintf(ipbuf, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.int.",
(u_int)(cp[15]&0xf), (u_int)(cp[15]>>4),
(u_int)(cp[14]&0xf), (u_int)(cp[14]>>4),
(u_int)(cp[13]&0xf), (u_int)(cp[13]>>4),
(u_int)(cp[12]&0xf), (u_int)(cp[12]>>4),
(u_int)(cp[11]&0xf), (u_int)(cp[11]>>4),
(u_int)(cp[10]&0xf), (u_int)(cp[10]>>4),
(u_int)(cp[9]&0xf), (u_int)(cp[9]>>4),
(u_int)(cp[8]&0xf), (u_int)(cp[8]>>4),
(u_int)(cp[7]&0xf), (u_int)(cp[7]>>4),
(u_int)(cp[6]&0xf), (u_int)(cp[6]>>4),
(u_int)(cp[5]&0xf), (u_int)(cp[5]>>4),
(u_int)(cp[4]&0xf), (u_int)(cp[4]>>4),
(u_int)(cp[3]&0xf), (u_int)(cp[3]>>4),
(u_int)(cp[2]&0xf), (u_int)(cp[2]>>4),
(u_int)(cp[1]&0xf), (u_int)(cp[1]>>4),
(u_int)(cp[0]&0xf), (u_int)(cp[0]>>4));
}
#else
cp = (u_char *)&numb->S_ADDR;
(void)ircsprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.",
(u_int)(cp[3]), (u_int)(cp[2]),
(u_int)(cp[1]), (u_int)(cp[0]));
#endif
#endif
if (!rptr)
{
rptr = make_request(lp);
rptr->type = T_PTR;
rptr->addr.s_addr = numb->s_addr;
#ifndef _WIN32
bcopy((char *)&numb->s_addr,
(char *)&rptr->he.h_addr, sizeof(struct in_addr));
rptr->he.h_length = sizeof(struct in_addr);
#ifdef INET6
bcopy(numb->s6_addr, rptr->addr.s6_addr, IN6ADDRSZ);
bcopy((char *)numb->s6_addr,
(char *)&rptr->he.h_addr, sizeof(struct in6_addr));
#else
rptr->he->h_length = sizeof(struct in_addr);
rptr->addr.S_ADDR = numb->S_ADDR;
#ifndef _WIN32
bcopy((char *)&numb->S_ADDR,
(char *)&rptr->he.h_addr, sizeof(struct IN_ADDR));
rptr->he.h_length = sizeof(struct IN_ADDR);
#else
rptr->he->h_length = sizeof(struct IN_ADDR);
#endif
#endif
}
#ifndef _WIN32
@@ -580,9 +637,13 @@ ResRQ *rptr;
case T_PTR:
(void)do_query_number(NULL, &rptr->addr, rptr);
break;
#ifdef INET6
case T_AAAA:
#endif
case T_A:
(void)do_query_name(NULL, rptr->name, rptr);
break;
default:
break;
}
@@ -597,20 +658,25 @@ ResRQ *rptr;
char *buf, *eob;
HEADER *hptr;
{
Reg1 char *cp, **alias;
Reg2 struct hent *hp;
char *cp, **alias;
struct hent *hp;
int class, type, dlen, len, ans = 0, n;
struct in_addr dr, *adr;
struct IN_ADDR dr, *adr;
cp = buf + sizeof(HEADER);
hp = (struct hent *)&(rptr->he);
adr = &hp->h_addr;
while (adr->s_addr)
#ifndef INET6
while (adr->S_ADDR)
#else
while (adr->s6_laddr[0] | adr->s6_laddr[1] | adr->s6_laddr[2] |
adr->s6_laddr[3])
#endif
adr++;
alias = hp->h_aliases;
while (*alias)
alias++;
#ifdef SOL20 /* brain damaged compiler (Solaris2) it seems */
#ifdef _SOLARIS /* brain damaged compiler (Solaris2) it seems */
for (; hptr->qdcount > 0; hptr->qdcount--)
#else
while (hptr->qdcount-- > 0)
@@ -633,9 +699,6 @@ HEADER *hptr;
class = (int)_getshort(cp);
cp += sizeof(short);
rptr->ttl = _getlong(cp);
#ifndef LINUX_ALPHA
cp += sizeof(rptr->ttl);
#else
/* This should really use the GETLONG macro which advances
* the pointer for us, but I don't know if that'll break other
* systems. sizeof(_getlong) does not always equal sizeof(time_t).
@@ -643,9 +706,12 @@ HEADER *hptr;
* for this portion of the resolver reply it would seem.
* heydowns@borg.com
*/
cp += 4;
#ifdef __alpha
cp += 4;
#else
cp += sizeof(rptr->ttl);
#endif
dlen = (int)_getshort(cp);
cp += sizeof(short);
rptr->type = type;
@@ -664,15 +730,37 @@ HEADER *hptr;
switch(type)
{
#ifdef INET6
case T_AAAA:
#endif
case T_A :
hp->h_length = dlen;
if (ans == 1)
hp->h_addrtype = (class == C_IN) ?
AF_INET : AF_UNSPEC;
AFINET : AF_UNSPEC;
#ifdef INET6
if (type == T_AAAA)
bcopy(cp, (char *)&dr, dlen);
else {
dr.s6_laddr[0]=dr.s6_laddr[1]=0;
dr.s6_laddr[2]=htonl(0xffff);
bcopy(cp, &dr.s6_laddr[3], INADDRSZ);
}
bcopy(dr.s6_addr, adr->s6_addr, IN6ADDRSZ);
#else
bcopy(cp, (char *)&dr, dlen);
adr->s_addr = dr.s_addr;
adr->S_ADDR = dr.S_ADDR;
#endif
#ifdef INET6
Debug((DEBUG_INFO,"got ip # %s for %s",
inet_ntop(AF_INET6, (char *)adr, mydummy,
MYDUMMY_SIZE),
hostbuf));
#else
Debug((DEBUG_INFO,"got ip # %s for %s",
inetntoa((char *)adr), hostbuf));
#endif
if (!hp->h_name)
{
hp->h_name =(char *)MyMalloc(len+1);
@@ -748,17 +836,17 @@ long id;
{
#ifndef _WIN32
static char buf[sizeof(HEADER) + MAXPACKET];
Reg1 HEADER *hptr;
struct sockaddr_in sin;
HEADER *hptr;
struct SOCKADDR_IN sin;
int rc, a, len = sizeof(sin), max;
#else
Reg3 struct hostent *he;
struct hostent *he;
#endif
Reg2 ResRQ *rptr = NULL;
ResRQ *rptr = NULL;
aCache *cp;
#ifndef _WIN32
rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct sockaddr *)&sin,
rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct SOCKADDR *)&sin,
&len);
if (rc == -1 || rc <= sizeof(HEADER))
goto getres_err;
@@ -797,10 +885,10 @@ long id;
max = 1;
for (a = 0; a < max; a++)
if (!_res.nsaddr_list[a].sin_addr.s_addr ||
!bcmp((char *)&sin.sin_addr,
(char *)&_res.nsaddr_list[a].sin_addr,
sizeof(struct in_addr)))
if (!_res.nsaddr_list[a].SIN_ADDR.S_ADDR ||
!bcmp((char *)&sin.SIN_ADDR,
(char *)&_res.nsaddr_list[a].SIN_ADDR,
sizeof(struct IN_ADDR)))
break;
if (a == max)
{
@@ -849,9 +937,16 @@ long id;
if (a && rptr->type == T_PTR)
{
struct hostent *hp2 = NULL;
#ifdef INET6
Debug((DEBUG_DNS, "relookup %s <-> %s",
rptr->he.h_name, inet_ntop(AF_INET6,
(char *)&rptr->he.h_addr,
mydummy, MYDUMMY_SIZE)));
#else
Debug((DEBUG_DNS, "relookup %s <-> %s",
rptr->he.h_name, inetntoa((char *)&rptr->he.h_addr)));
#endif
/*
* Lookup the 'authoritive' name that we were given for the
* ip#. By using this call rather than regenerating the
@@ -913,10 +1008,26 @@ getres_err:
rptr->retries = _res.retry;
rptr->sends = 0;
rptr->resend = 1;
#ifdef INET6
/* Comment out this ifdef to get names like ::ffff:a.b.c.d */
if(rptr->type == T_AAAA)
query_name(rptr->name, C_IN, T_A, rptr);
Debug((DEBUG_DNS,"getres_err: didn't work with T_AAAA, now also trying with T_A for %s",rptr->name));
#endif
resend_query(rptr);
}
else
{
resend_query(rptr);
#ifdef INET6
/* Comment out this ifdef to get names like ::ffff:a.b.c.d */
if(rptr->type == T_AAAA)
query_name(rptr->name, C_IN, T_A, rptr);
Debug((DEBUG_DNS,"getres_err: didn't work with T_AAAA, now also trying with T_A for %s",rptr->name));
#endif
}
}
else if (lp)
bcopy((char *)&rptr->cinfo, lp, sizeof(Link));
@@ -924,7 +1035,7 @@ getres_err:
#else /*_WIN32*/
he = rptr->he;
if (he && he->h_name && ((struct in_addr *)he->h_addr)->s_addr &&
if (he && he->h_name && ((struct IN_ADDR *)he->h_addr)->S_ADDR &&
rptr->locked < 2)
{
/*
@@ -938,7 +1049,7 @@ getres_err:
strcpy(tempname, he->h_name);
hp = gethostbyname(tempname);
if (hp && !bcmp(hp->h_addr, he->h_addr, sizeof(struct in_addr)))
if (hp && !bcmp(hp->h_addr, he->h_addr, sizeof(struct IN_ADDR)))
{
}
else
@@ -962,15 +1073,30 @@ getres_err:
}
static int hash_number(ip)
Reg1 unsigned char *ip;
unsigned char *ip;
{
Reg1 u_int hashv = 0;
u_int hashv = 0;
/* could use loop but slower */
hashv += (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
#ifdef INET6
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
hashv += hashv + (int)*ip++;
#endif
hashv %= ARES_CACSIZE;
return (hashv);
}
@@ -978,7 +1104,7 @@ Reg1 unsigned char *ip;
static int hash_name(name)
register char *name;
{
Reg1 u_int hashv = 0;
u_int hashv = 0;
if (name == NULL) {
sendto_realops ("Caught NULL pointer in hash_name(). (Bad thing -- tell rwg.)");
@@ -995,16 +1121,25 @@ register char *name;
** Add a new cache item to the queue and hash table.
*/
static aCache *add_to_cache(ocp)
Reg1 aCache *ocp;
aCache *ocp;
{
Reg1 aCache *cp = NULL;
Reg2 int hashv;
aCache *cp = NULL;
int hashv;
#ifdef DEBUG
#ifdef INET6
Debug((DEBUG_INFO,"add_to_cache:added %s[%08x%08x%08x%08x] cache %#x.",
ocp->he.h_name,
((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[0],
((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[1],
((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[2],
((struct in6_addr *)ocp->he.h_addr_list)->s6_laddr[3], ocp));
#else
Debug((DEBUG_INFO,
"add_to_cache:ocp %#x he %#x name %#x addrl %#x 0 %#x",
ocp, &ocp->he, ocp->he.h_name, ocp->he.h_addr_list,
ocp->he.h_addr_list[0]));
#endif
#endif
ocp->list_next = cachetop;
cachetop = ocp;
@@ -1065,9 +1200,9 @@ static void update_list(rptr, cachep)
ResRQ *rptr;
aCache *cachep;
{
Reg1 aCache **cpp, *cp = cachep;
Reg2 char *s, *t, **base;
Reg3 int i, j;
aCache **cpp, *cp = cachep;
char *s, *t, **base;
int i, j;
int addrcount;
/*
@@ -1134,11 +1269,11 @@ aCache *cachep;
/*
* Do the same again for IP#'s.
*/
for (s = (char *)&rptr->he.h_addr.s_addr;
((struct in_addr *)s)->s_addr; s += sizeof(struct in_addr))
for (s = (char *)&rptr->he.h_addr.S_ADDR;
((struct IN_ADDR *)s)->S_ADDR; s += sizeof(struct IN_ADDR))
{
for (i = 0; (t = cp->he.h_addr_list[i]); i++)
if (!bcmp(s, t, sizeof(struct in_addr)))
if (!bcmp(s, t, sizeof(struct IN_ADDR)))
break;
if (i >= MAXADDRS || addrcount >= MAXADDRS)
break;
@@ -1155,23 +1290,23 @@ aCache *cachep;
base = cp->he.h_addr_list;
addrcount++;
t = (char *)MyRealloc(*base,
addrcount * sizeof(struct in_addr));
addrcount * sizeof(struct IN_ADDR));
base = (char **)MyRealloc((char *)base,
(addrcount + 1) * sizeof(char *));
cp->he.h_addr_list = base;
#ifdef DEBUG
Debug((DEBUG_DNS,"u_l:add IP %x hal %x ac %d",
ntohl(((struct in_addr *)s)->s_addr),
ntohl(((struct IN_ADDR *)s)->S_ADDR),
cp->he.h_addr_list,
addrcount));
#endif
for (; addrcount; addrcount--)
{
*base++ = t;
t += sizeof(struct in_addr);
t += sizeof(struct IN_ADDR);
}
*base = NULL;
bcopy(s, *--base, sizeof(struct in_addr));
bcopy(s, *--base, sizeof(struct IN_ADDR));
}
}
#endif /*_WIN32*/
@@ -1181,9 +1316,9 @@ aCache *cachep;
static aCache *find_cache_name(name)
char *name;
{
Reg1 aCache *cp;
Reg2 char *s;
Reg3 int hashv, i;
aCache *cp;
char *s;
int hashv, i;
hashv = hash_name(name);
@@ -1241,29 +1376,29 @@ static aCache *find_cache_number(rptr, numb)
ResRQ *rptr;
char *numb;
{
Reg1 aCache *cp;
Reg2 int hashv,i;
aCache *cp;
int hashv,i;
#ifdef DEBUG
struct in_addr *ip = (struct in_addr *)numb;
struct IN_ADDR *ip = (struct IN_ADDR *)numb;
#endif
hashv = hash_number((u_char *)numb);
cp = hashtable[hashv].num_list;
#ifdef DEBUG
#if defined(DEBUG) && !defined(INET6)
Debug((DEBUG_DNS,"find_cache_number:find %s[%08x]: hashv = %d",
inetntoa(numb), ntohl(ip->s_addr), hashv));
inetntoa(numb), ntohl(ip->S_ADDR), hashv));
#endif
for (; cp; cp = cp->hnum_next)
#ifndef _WIN32
for (i = 0; cp->he.h_addr_list[i]; i++)
if (!bcmp(cp->he.h_addr_list[i], numb,
sizeof(struct in_addr)))
sizeof(struct IN_ADDR)))
#else
for (i = 0; cp->he->h_addr_list && cp->he->h_addr_list[i]; i++)
if (!bcmp(cp->he->h_addr_list[i], numb,
sizeof(struct in_addr)))
sizeof(struct IN_ADDR)))
#endif
{
cainfo.ca_nu_hits++;
@@ -1292,13 +1427,13 @@ char *numb;
continue;
for (i = 1; cp->he.h_addr_list[i]; i++)
if (!bcmp(cp->he.h_addr_list[i], numb,
sizeof(struct in_addr)))
sizeof(struct IN_ADDR)))
#else
if (hashv == hash_number((u_char *)cp->he->h_addr_list[0]))
continue;
for (i = 1; cp->he->h_addr_list && cp->he->h_addr_list[i]; i++)
if (!bcmp(cp->he->h_addr_list[i], numb,
sizeof(struct in_addr)))
sizeof(struct IN_ADDR)))
#endif
{
cainfo.ca_nu_hits++;
@@ -1312,18 +1447,21 @@ char *numb;
static aCache *make_cache(rptr)
ResRQ *rptr;
{
Reg1 aCache *cp;
Reg2 int i, n;
Reg3 struct hostent *hp;
Reg3 char *s, **t;
aCache *cp;
int i, n;
struct hostent *hp;
char *s, **t;
/*
** shouldn't happen but it just might...
*/
#ifndef _WIN32
if (!rptr->he.h_name || !rptr->he.h_addr.s_addr)
#ifdef INET6
if (!rptr->he.h_name || !WHOSTENTP(rptr->he.h_addr.S_ADDR))
#else
if (!rptr->he.h_name || !rptr->he.h_addr.S_ADDR)
#endif
#else
if (!rptr->he->h_name || !((struct in_addr *)rptr->he->h_addr)->s_addr)
#endif
return NULL;
/*
@@ -1331,18 +1469,18 @@ ResRQ *rptr;
** and if so, return a pointer to it.
*/
#ifndef _WIN32
if ((cp = find_cache_number(rptr, (char *)&rptr->he.h_addr.s_addr)))
if ((cp = find_cache_number(rptr, (char *)&rptr->he.h_addr.S_ADDR)))
return cp;
for (i = 1; rptr->he.h_addr_list[i].s_addr; i++)
for (i = 1; rptr->he.h_addr_list[i].S_ADDR; i++)
if ((cp = find_cache_number(rptr,
(char *)&(rptr->he.h_addr_list[i].s_addr))))
(char *)&(rptr->he.h_addr_list[i].S_ADDR))))
#else
if ((cp = find_cache_number(rptr, (char *)&((struct in_addr *)rptr->he->h_addr)->s_addr)))
if ((cp = find_cache_number(rptr, (char *)&((struct IN_ADDR *)rptr->he->h_addr)->S_ADDR)))
return cp;
for (i = 1; rptr->he->h_addr_list[i] &&
((struct in_addr *)rptr->he->h_addr_list[i])->s_addr; i++)
((struct IN_ADDR *)rptr->he->h_addr_list[i])->S_ADDR; i++)
if ((cp = find_cache_number(rptr,
(char *)&((struct in_addr *)rptr->he->h_addr_list[i])->s_addr )))
(char *)&((struct IN_ADDR *)rptr->he->h_addr_list[i])->S_ADDR )))
#endif
return cp;
@@ -1357,7 +1495,11 @@ ResRQ *rptr;
#else
hp = &cp->he;
for (i = 0; i < MAXADDRS; i++)
if (!rptr->he.h_addr_list[i].s_addr)
#ifdef INET6
if (!WHOSTENTP(rptr->he.h_addr_list[i].S_ADDR))
#else
if (!rptr->he.h_addr_list[i].S_ADDR)
#endif
break;
/*
@@ -1366,14 +1508,14 @@ ResRQ *rptr;
t = hp->h_addr_list = (char **)MyMalloc(sizeof(char *) * (i+1));
bzero((char *)t, sizeof(char *) * (i+1));
s = (char *)MyMalloc(sizeof(struct in_addr) * i);
bzero(s, sizeof(struct in_addr) * i);
s = (char *)MyMalloc(sizeof(struct IN_ADDR) * i);
bzero(s, sizeof(struct IN_ADDR) * i);
for (n = 0; n < i; n++, s += sizeof(struct in_addr))
for (n = 0; n < i; n++, s += sizeof(struct IN_ADDR))
{
*t++ = s;
bcopy((char *)&(rptr->he.h_addr_list[n].s_addr), s,
sizeof(struct in_addr));
bcopy((char *)&(rptr->he.h_addr_list[n].S_ADDR), s,
sizeof(struct IN_ADDR));
}
*t = (char *)NULL;
@@ -1422,14 +1564,14 @@ ResRQ *rptr;
static void rem_cache(ocp)
aCache *ocp;
{
Reg1 aCache **cp;
aCache **cp;
#ifndef _WIN32
Reg2 struct hostent *hp = &ocp->he;
struct hostent *hp = &ocp->he;
#else
Reg2 struct hostent *hp = ocp->he;
struct hostent *hp = ocp->he;
#endif
Reg3 int hashv;
Reg4 aClient *cptr;
int hashv;
aClient *cptr;
#ifdef DEBUG
Debug((DEBUG_DNS, "rem_cache: ocp %#x hp %#x l_n %#x aliases %#x",
@@ -1523,8 +1665,8 @@ aCache *ocp;
time_t expire_cache(now)
time_t now;
{
Reg1 aCache *cp, *cp2;
Reg2 time_t next = 0;
aCache *cp, *cp2;
time_t next = 0;
for (cp = cachetop; cp; cp = cp2)
{
@@ -1546,7 +1688,7 @@ time_t now;
*/
void flush_cache()
{
Reg1 aCache *cp;
aCache *cp;
while ((cp = cachetop))
rem_cache(cp);
@@ -1557,8 +1699,8 @@ aClient *cptr, *sptr;
int parc;
char *parv[];
{
Reg1 aCache *cp;
Reg2 int i;
aCache *cp;
int i;
if (parv[1] && *parv[1] == 'l') {
for(cp = cachetop; cp; cp = cp->list_next)
@@ -1623,7 +1765,7 @@ aClient *sptr;
for (i = 0; h->h_addr_list[i]; i++)
{
im += sizeof(char *);
im += sizeof(struct in_addr);
im += sizeof(struct IN_ADDR);
}
im += sizeof(char *);
for (i = 0; h->h_aliases[i]; i++)
@@ -1663,7 +1805,7 @@ void async_dns(void *parm)
else
{
rptr->locked = 1;
hp = gethostbyaddr((char *)(&rptr->addr.s_addr), 4, PF_INET);
hp = gethostbyaddr((char *)(&rptr->addr.S_ADDR), 4, PF_INET);
}
if ( !hp )
{
@@ -1734,7 +1876,7 @@ int res_copyhostent(struct hostent *from, struct hostent *to)
{
amt += 4;
to->h_addr_list[i] = (char *)(amt+x);
((struct in_addr *)to->h_addr_list[i])->s_addr = ((struct in_addr *)from->h_addr_list[i])->s_addr;
((struct IN_ADDR *)to->h_addr_list[i])->S_ADDR = ((struct IN_ADDR *)from->h_addr_list[i])->S_ADDR;
}
to->h_addr_list[i] = NULL;
}
BIN
View File
Binary file not shown.
+145 -125
View File
@@ -1,3 +1,4 @@
/*-
* Copyright (c) 1985, 1989 Regents of the University of California.
* All rights reserved.
@@ -27,7 +28,7 @@ static char sccsid[] = "@(#)res_init.c 6.14.1 (Berkeley) 6/27/90";
#include <netinet/in.h>
#endif
#include <stdio.h>
#include "config.h" /* To get #define SOL20 Vesa */
#include "config.h" /* To get #define SOL20 Vesa */
#include "sys.h"
#include "common.h"
#include "nameser.h"
@@ -39,10 +40,10 @@ ID_CVS("$Id$");
*/
struct state _res = {
RES_TIMEOUT, /* retransmition time interval */
4, /* number of times to retransmit */
RES_DEFAULT, /* options flags */
1, /* number of name servers */
RES_TIMEOUT, /* retransmition time interval */
4, /* number of times to retransmit */
RES_DEFAULT, /* options flags */
1, /* number of name servers */
};
/*
@@ -67,141 +68,158 @@ res_init()
register int n;
char buf[BUFSIZ];
extern char *getenv();
int nserv = 0; /* number of nameserver records read from file */
int norder = 0;
int haveenv = 0;
int havesearch = 0;
int nserv = 0; /* number of nameserver records read from file */
int norder = 0;
int haveenv = 0;
int havesearch = 0;
_res.nsaddr.sin_addr.s_addr = INADDR_ANY;
_res.nsaddr.sin_family = AF_INET;
#ifdef TESTNET
_res.nsaddr.sin_port = htons(NAMESERVER_PORT + 10000);
#else
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
#endif
_res.nsaddr.SIN_ADDR.S_ADDR = INADDR_ANY;
_res.nsaddr.SIN_FAMILY = AFINET;
_res.nsaddr.SIN_PORT = htons(NAMESERVER_PORT);
_res.nscount = 1;
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
if ((cp = getenv("LOCALDOMAIN")) != NULL)
{
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname));
haveenv++;
}
#ifndef _WIN32
if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
/* read the config file */
while (fgets(buf, sizeof(buf), fp) != NULL) {
/* read default domain name */
if (!strncmp(buf, "domain", sizeof("domain") - 1)) {
if (haveenv) /* skip if have from environ */
continue;
cp = buf + sizeof("domain") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
if ((cp = index(_res.defdname, '\n')) != NULL)
*cp = '\0';
havesearch = 0;
continue;
if ((fp = fopen(_PATH_RESCONF, "r")) != NULL)
{
/* read the config file */
while (fgets(buf, sizeof(buf), fp) != NULL)
{
/* read default domain name */
if (!strncmp(buf, "domain", sizeof("domain") - 1))
{
if (haveenv) /* skip if have from environ */
continue;
cp = buf + sizeof("domain") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
(void)strncpy(_res.defdname, cp,
sizeof(_res.defdname) - 1);
if ((cp = index(_res.defdname, '\n')) != NULL)
*cp = '\0';
havesearch = 0;
continue;
}
/* set search list */
if (!strncmp(buf, "search", sizeof("search") - 1))
{
if (haveenv) /* skip if have from environ */
continue;
cp = buf + sizeof("search") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
(void)strncpy(_res.defdname, cp,
sizeof(_res.defdname) - 1);
if ((cp = index(_res.defdname, '\n')) != NULL)
*cp = '\0';
/*
* Set search list to be blank-separated strings
* on rest of line.
*/
cp = _res.defdname;
pp = _res.dnsrch;
*pp++ = cp;
for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH;
cp++)
{
if (*cp == ' ' || *cp == '\t')
{
*cp = 0;
n = 1;
}
else if (n)
{
*pp++ = cp;
n = 0;
}
}
/* null terminate last domain if there are excess */
while (*cp != '\0' && *cp != ' ' && *cp != '\t')
cp++;
*cp = '\0';
*pp++ = 0;
havesearch = 1;
continue;
}
/* read nameservers to query */
if (!strncmp(buf, "nameserver",
sizeof("nameserver") - 1) && nserv < MAXNS)
{
cp = buf + sizeof("nameserver") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
if ((_res.nsaddr_list[nserv].SIN_ADDR.S_ADDR =
inet_addr(cp)) == (unsigned)-1)
{
_res.nsaddr_list[nserv].SIN_ADDR.S_ADDR
= INADDR_ANY;
continue;
}
_res.nsaddr_list[nserv].SIN_FAMILY = AFINET;
_res.nsaddr_list[nserv].SIN_PORT =
htons(NAMESERVER_PORT);
nserv++;
continue;
}
/* read service order */
if (!strncmp(buf, "order", sizeof("order") - 1))
{
cp = buf + sizeof("order") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
norder = 0;
do
{
if ((dp = index(cp, ',')) != NULL)
*dp = '\0';
if (norder >= MAXSERVICES)
continue;
if (!strncmp(cp, "bind",
sizeof("bind") - 1))
_res.order[norder++] =
RES_SERVICE_BIND;
else if (!strncmp(cp, "local",
sizeof("local") - 1))
_res.order[norder++] =
RES_SERVICE_LOCAL;
cp = dp + 1;
}
while (dp != NULL);
_res.order[norder] = RES_SERVICE_NONE;
continue;
}
}
/* set search list */
if (!strncmp(buf, "search", sizeof("search") - 1)) {
if (haveenv) /* skip if have from environ */
continue;
cp = buf + sizeof("search") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
if ((cp = index(_res.defdname, '\n')) != NULL)
*cp = '\0';
/*
* Set search list to be blank-separated strings
* on rest of line.
*/
cp = _res.defdname;
pp = _res.dnsrch;
*pp++ = cp;
for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) {
if (*cp == ' ' || *cp == '\t') {
*cp = 0;
n = 1;
} else if (n) {
*pp++ = cp;
n = 0;
}
}
/* null terminate last domain if there are excess */
while (*cp != '\0' && *cp != ' ' && *cp != '\t')
cp++;
*cp = '\0';
*pp++ = 0;
havesearch = 1;
continue;
}
/* read nameservers to query */
if (!strncmp(buf, "nameserver", sizeof("nameserver") - 1) &&
nserv < MAXNS) {
cp = buf + sizeof("nameserver") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
if ((_res.nsaddr_list[nserv].sin_addr.s_addr =
inet_addr(cp)) == (unsigned)-1) {
_res.nsaddr_list[nserv].sin_addr.s_addr
= INADDR_ANY;
continue;
}
_res.nsaddr_list[nserv].sin_family = AF_INET;
#ifdef TESTNET
_res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT +
10000);
#else
_res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT);
#endif
nserv++;
continue;
}
/* read service order */
if (!strncmp(buf, "order", sizeof("order") - 1)) {
cp = buf + sizeof("order") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
norder = 0;
do {
if ((dp = index(cp, ',')) != NULL)
*dp = '\0';
if (norder >= MAXSERVICES)
continue;
if (!strncmp(cp, "bind", sizeof("bind") - 1))
_res.order[norder++] = RES_SERVICE_BIND;
else if (!strncmp(cp, "local", sizeof("local") - 1))
_res.order[norder++] = RES_SERVICE_LOCAL;
cp = dp + 1;
} while (dp != NULL);
_res.order[norder] = RES_SERVICE_NONE;
continue;
}
}
if (nserv > 1)
_res.nscount = nserv;
(void) fclose(fp);
if (nserv > 1)
_res.nscount = nserv;
(void)fclose(fp);
}
#endif /*_WIN32*/
if (_res.defdname[0] == 0) {
if (_res.defdname[0] == 0)
{
if (gethostname(buf, sizeof(_res.defdname)) == 0 &&
(cp = index(buf, '.')))
(cp = index(buf, '.')))
(void)strcpy(_res.defdname, cp + 1);
}
/* find components of local domain that might be searched */
if (havesearch == 0) {
if (havesearch == 0)
{
pp = _res.dnsrch;
*pp++ = _res.defdname;
for (cp = _res.defdname, n = 0; *cp; cp++)
@@ -209,14 +227,16 @@ res_init()
n++;
cp = _res.defdname;
for (; n >= LOCALDOMAINPARTS && pp < _res.dnsrch + MAXDFLSRCH;
n--) {
n--)
{
cp = index(cp, '.');
*pp++ = ++cp;
}
*pp++ = 0;
}
/* default search order to bind only */
if (norder == 0) {
if (norder == 0)
{
_res.order[0] = RES_SERVICE_BIND;
_res.order[1] = RES_SERVICE_NONE;
}
BIN
View File
Binary file not shown.
+11 -10
View File
@@ -14,21 +14,22 @@ dn_skipname(comp_dn, eom)
register int n;
cp = comp_dn;
while (cp < eom && (n = *cp++)) {
while (cp < eom && (n = *cp++))
{
/*
* check for indirection
*/
switch (n & INDIR_MASK) {
case 0: /* normal case, n == len */
cp += n;
continue;
default: /* illegal type */
return (-1);
case INDIR_MASK: /* indirection */
cp++;
switch (n & INDIR_MASK)
{
case 0: /* normal case, n == len */
cp += n;
continue;
default: /* illegal type */
return (-1);
case INDIR_MASK: /* indirection */
cp++;
}
break;
}
return (cp - comp_dn);
}
+89 -83
View File
@@ -1,5 +1,6 @@
/************************************************************************
* IRC - Internet Relay Chat, ircd/s_auth.c
/************************************************************************
* Unreal Internet Relay Chat Daemon, src/s_auth.c
* Copyright (C) 1992 Darren Reed
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +19,7 @@
*/
#ifndef lint
static char sccsid[] = "@(#)s_auth.c 1.18 4/18/94 (C) 1992 Darren Reed";
static char sccsid[] = "@(#)s_auth.c 1.18 4/18/94 (C) 1992 Darren Reed";
#endif
#include "struct.h"
@@ -38,7 +39,7 @@ static char sccsid[] = "@(#)s_auth.c 1.18 4/18/94 (C) 1992 Darren Reed";
#include <io.h>
#endif
#include <fcntl.h>
#include "sock.h" /* If FD_ZERO isn't define up to this point, */
#include "sock.h" /* If FD_ZERO isn't define up to this point, */
/* define it (BSD4.2 needs this) */
#include "h.h"
@@ -52,68 +53,71 @@ ID_CVS("$Id$");
* identifing process fail, it is aborted and the user is given a username
* of "unknown".
*/
void start_auth(cptr)
Reg1 aClient *cptr;
void start_auth(cptr)
aClient *cptr;
{
struct sockaddr_in sock;
int addrlen = sizeof(struct sockaddr_in);
struct SOCKADDR_IN sock;
int addrlen = sizeof(struct SOCKADDR_IN);
Debug((DEBUG_NOTICE,"start_auth(%x) fd %d status %d",
cptr, cptr->fd, cptr->status));
if ((cptr->authfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
#ifdef NO_IDENT_CHECKING
cptr->flags &= ~(FLAGS_WRAUTH | FLAGS_AUTH);
return;
#endif
Debug((DEBUG_NOTICE, "start_auth(%x) fd %d status %d",
cptr, cptr->fd, cptr->status));
if ((cptr->authfd = socket(AFINET, SOCK_STREAM, 0)) == -1)
{
#ifdef USE_SYSLOG
syslog(LOG_ERR, "Unable to create auth socket for %s:%m",
get_client_name(cptr,TRUE));
get_client_name(cptr, TRUE));
#endif
Debug((DEBUG_ERROR, "Unable to create auth socket for %s:%s",
get_client_name(cptr, TRUE),
strerror(get_sockerr(cptr))));
Debug((DEBUG_ERROR, "Unable to create auth socket for %s:%s",
get_client_name(cptr, TRUE), strerror(get_sockerr(cptr))));
if (!DoingDNS(cptr))
SetAccess(cptr);
ircstp->is_abad++;
return;
}
}
#ifndef _WIN32
if (cptr->authfd >= (MAXCONNECTIONS - 3))
{
{
sendto_ops("Can't allocate fd for auth on %s",
get_client_name(cptr, TRUE));
get_client_name(cptr, TRUE));
(void)close(cptr->authfd);
return;
}
}
#endif
#ifdef SHOWCONNECTINFO
#ifndef _WIN32
write(cptr->fd, REPORT_DO_ID, R_do_id);
write(cptr->fd, REPORT_DO_ID, R_do_id);
#else
send(cptr->fd, REPORT_DO_ID, R_do_id,0);
send(cptr->fd, REPORT_DO_ID, R_do_id, 0);
#endif
#endif
set_non_blocking(cptr->authfd, cptr);
getsockname(cptr->fd, (struct sockaddr *)&sock, &addrlen);
sock.sin_port = 0;
sock.sin_family = AF_INET; /* redundant? */
(void)bind(cptr->authfd, (struct sockaddr *)&sock, sizeof(sock));
getsockname(cptr->fd, (struct SOCKADDR *)&sock, &addrlen);
sock.SIN_PORT = 0;
sock.SIN_FAMILY = AFINET; /* redundant? */
(void)bind(cptr->authfd, (struct SOCKADDR *)&sock, sizeof(sock));
bcopy((char *)&cptr->ip, (char *)&sock.sin_addr,
sizeof(struct in_addr));
bcopy((char *)&cptr->ip, (char *)&sock.SIN_ADDR,
sizeof(struct IN_ADDR));
sock.sin_port = htons(113);
sock.sin_family = AF_INET;
sock.SIN_PORT = htons(113);
sock.SIN_FAMILY = AFINET;
if (connect(cptr->authfd, (struct sockaddr *)&sock,
if (connect(cptr->authfd, (struct SOCKADDR *)&sock,
#ifndef _WIN32
sizeof(sock)) == -1 && errno != EINPROGRESS)
sizeof(sock)) == -1 && errno != EINPROGRESS)
#else
sizeof(sock)) == -1 && (WSAGetLastError() !=
WSAEINPROGRESS && WSAGetLastError() != WSAEWOULDBLOCK))
sizeof(sock)) == -1 && (WSAGetLastError() !=
WSAEINPROGRESS && WSAGetLastError() != WSAEWOULDBLOCK))
#endif
{
{
ircstp->is_abad++;
/*
* No error report from this...
@@ -134,8 +138,8 @@ Reg1 aClient *cptr;
#endif
#endif
return;
}
cptr->flags |= (FLAGS_WRAUTH|FLAGS_AUTH);
}
cptr->flags |= (FLAGS_WRAUTH | FLAGS_AUTH);
if (cptr->authfd > highest_fd)
highest_fd = cptr->authfd;
return;
@@ -150,39 +154,40 @@ Reg1 aClient *cptr;
* problem since the socket should have a write buffer far greater than
* this message to store it in should problems arise. -avalon
*/
void send_authports(cptr)
aClient *cptr;
void send_authports(cptr)
aClient *cptr;
{
struct sockaddr_in us, them;
char authbuf[32];
int ulen, tlen;
struct SOCKADDR_IN us, them;
char authbuf[32];
int ulen, tlen;
Debug((DEBUG_NOTICE,"write_authports(%x) fd %d authfd %d stat %d",
cptr, cptr->fd, cptr->authfd, cptr->status));
Debug((DEBUG_NOTICE, "write_authports(%x) fd %d authfd %d stat %d",
cptr, cptr->fd, cptr->authfd, cptr->status));
tlen = ulen = sizeof(us);
if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) ||
getpeername(cptr->fd, (struct sockaddr *)&them, &tlen))
{
if (getsockname(cptr->fd, (struct SOCKADDR *)&us, &ulen) ||
getpeername(cptr->fd, (struct SOCKADDR *)&them, &tlen))
{
#ifdef USE_SYSLOG
syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m",
get_client_name(cptr, TRUE));
get_client_name(cptr, TRUE));
#endif
goto authsenderr;
}
}
(void)sprintf(authbuf, "%u , %u\r\n",
(unsigned int)ntohs(them.sin_port),
(unsigned int)ntohs(us.sin_port));
(void)ircsprintf(authbuf, "%u , %u\r\n",
(unsigned int)ntohs(them.SIN_PORT),
(unsigned int)ntohs(us.SIN_PORT));
Debug((DEBUG_SEND, "sending [%s] to auth port %s.113",
authbuf, inetntoa((char *)&them.sin_addr)));
authbuf, inetntoa((char *)&them.SIN_ADDR)));
#ifndef _WIN32
if (write(cptr->authfd, authbuf, strlen(authbuf)) != strlen(authbuf))
#else
if (send(cptr->authfd, authbuf, strlen(authbuf), 0) != (int)strlen(authbuf))
if (send(cptr->authfd, authbuf, strlen(authbuf),
0) != (int)strlen(authbuf))
#endif
{
authsenderr:
{
authsenderr:
ircstp->is_abad++;
#ifndef _WIN32
(void)close(cptr->authfd);
@@ -203,7 +208,7 @@ authsenderr:
#endif
if (!DoingDNS(cptr))
SetAccess(cptr);
}
}
cptr->flags &= ~FLAGS_WRAUTH;
return;
}
@@ -215,17 +220,17 @@ authsenderr:
* The actual read processijng here is pretty weak - no handling of the reply
* if it is fragmented by IP.
*/
void read_authports(cptr)
Reg1 aClient *cptr;
void read_authports(cptr)
aClient *cptr;
{
Reg1 char *s, *t;
Reg2 int len;
char ruser[USERLEN+1], system[8];
u_short remp = 0, locp = 0;
char *s, *t;
int len;
char ruser[USERLEN + 1], system[8];
u_short remp = 0, locp = 0;
*system = *ruser = '\0';
Debug((DEBUG_NOTICE,"read_authports(%x) fd %d authfd %d stat %d",
cptr, cptr->fd, cptr->authfd, cptr->status));
Debug((DEBUG_NOTICE, "read_authports(%x) fd %d authfd %d stat %d",
cptr, cptr->fd, cptr->authfd, cptr->status));
/*
* Nasty. Cant allow any other reads from client fd while we're
* waiting on the authfd to return a full valid string. Use the
@@ -235,41 +240,42 @@ Reg1 aClient *cptr;
*/
#ifndef _WIN32
if ((len = read(cptr->authfd, cptr->buffer + cptr->count,
sizeof(cptr->buffer) - 1 - cptr->count)) >= 0)
sizeof(cptr->buffer) - 1 - cptr->count)) >= 0)
#else
if ((len = recv(cptr->authfd, cptr->buffer + cptr->count,
sizeof(cptr->buffer) - 1 - cptr->count, 0)) >= 0)
sizeof(cptr->buffer) - 1 - cptr->count, 0)) >= 0)
#endif
{
{
cptr->count += len;
cptr->buffer[cptr->count] = '\0';
}
}
cptr->lasttime = TStime();
if ((len > 0) && (cptr->count != (sizeof(cptr->buffer) - 1)) &&
(sscanf(cptr->buffer, "%hd , %hd : USERID : %*[^:]: %10s",
&remp, &locp, ruser) == 3))
{
&remp, &locp, ruser) == 3))
{
s = rindex(cptr->buffer, ':');
*s++ = '\0';
for (t = (rindex(cptr->buffer, ':') + 1); *t; t++)
if (!isspace(*t))
break;
strncpyzt(system, t, sizeof(system));
for (t = ruser; *s && *s != '@' && (t < ruser + sizeof(ruser)); s++)
for (t = ruser; *s && *s != '@' && (t < ruser + sizeof(ruser));
s++)
if (!isspace(*s) && *s != ':')
*t++ = *s;
*t = '\0';
Debug((DEBUG_INFO,"auth reply ok [%s] [%s]", system, ruser));
}
Debug((DEBUG_INFO, "auth reply ok [%s] [%s]", system, ruser));
}
else if (len != 0)
{
{
if (!index(cptr->buffer, '\n') && !index(cptr->buffer, '\r'))
return;
Debug((DEBUG_ERROR,"local %d remote %d", locp, remp));
Debug((DEBUG_ERROR,"bad auth reply in [%s]", cptr->buffer));
Debug((DEBUG_ERROR, "local %d remote %d", locp, remp));
Debug((DEBUG_ERROR, "bad auth reply in [%s]", cptr->buffer));
*ruser = '\0';
}
}
#ifndef _WIN32
(void)close(cptr->authfd);
#else
@@ -284,7 +290,7 @@ Reg1 aClient *cptr;
if (!DoingDNS(cptr))
SetAccess(cptr);
if (len > 0)
Debug((DEBUG_INFO,"ident reply: [%s]", cptr->buffer));
Debug((DEBUG_INFO, "ident reply: [%s]", cptr->buffer));
#ifdef SHOWCONNECTINFO
#ifndef _WIN32
@@ -295,14 +301,14 @@ Reg1 aClient *cptr;
#endif
if (!locp || !remp || !*ruser)
{
{
ircstp->is_abad++;
return;
}
}
ircstp->is_asuc++;
strncpyzt(cptr->username, ruser, USERLEN+1);
strncpyzt(cptr->username, ruser, USERLEN + 1);
/* if (strncmp(system, "OTHER", 5))
*/ cptr->flags |= FLAGS_GOTID;
*/ cptr->flags |= FLAGS_GOTID;
Debug((DEBUG_INFO, "got username [%s]", ruser));
return;
}

Some files were not shown because too many files have changed in this diff Show More