1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-09-21 11:44:04 +00:00

Compare commits

...

262 Commits

Author SHA1 Message Date
Alexander Barton
479d7d99c1 ngIRCd Release 24~rc1 2017-01-08 02:15:52 +01:00
Alexander Barton
181da30997 Debian: Use "dh_prep" instead deprecated "dh_clean -k" 2017-01-08 02:15:52 +01:00
Alexander Barton
bfebdaece8 ngircd.conf.5.tmpl: Fix spelling
Thanks to Christoph Biedl.
2017-01-07 15:52:23 +01:00
Alexander Barton
d2a134b79c Platforms.txt: Add and update systems
- Add x86_64/apple/darwin16.3.0 (Apple clang 8.0)
- Update x86_64/pc/linux-gnu (gcc 4.9.2)
- Add x86_64/pc/linux-gnu (gcc 6.2.1.)
2017-01-06 22:51:46 +01:00
Alexander Barton
74f021fb44 Further enhance systemd unit file
- Add more comments/documentation.
- Add dependencies for services and proxy scanners.
- Add more limit configurations.
- Allow AF_UNIX address family, required for syslog!
2017-01-06 22:50:24 +01:00
Alexander Barton
8e09180295 Install systemd service file in Debian package 2017-01-06 00:38:05 +01:00
Alexander Barton
f0532c98cd Enhance systemd service file
- Add homepage :-)
- Remote CAP_SETUID and CAP_SETGID from CapabilityBoundingSet: This is
  nor needed, because the unit already sets User=irc and Group=irc.
- Add RestrictAddressFamilies, and restrict it to AF_INET and AF_INET6.
- Read in the Debian "default files", but note: only PARAMS is supported!
2017-01-06 00:34:51 +01:00
Alexander Barton
9e0e955daf Update Debian package
- Update debhelper compatibility to version 9.
- Update build-dependencies.
- Change group of ngircd.conf to "irc" in postinst script (this makes
  starting ngIRCd as user "irc" easier, for example when using systemd).
- Don't create /var/run/ircd during installation: this is handled by the
  SysV init script and the systemd service already.
2017-01-06 00:30:43 +01:00
Alexander Barton
3e44738416 Update NEWS and ChangeLog files 2016-12-11 00:15:50 +01:00
Alexander Barton
02c8887543 Log privilege violations and failed OPER as "error" and to &server 2016-12-08 01:34:33 +01:00
Alexander Barton
77861f6fe2 Immediately shut down connection on receiving ERROR
Don't wait for the peer to close the connection. This allows us to
forward the ERROR mesage in the network, instead of the very generic
"client closed connection" message.
2016-12-08 01:01:40 +01:00
Alexander Barton
e9e3df27b7 Xcode: Fix "duplicate symbols" error in current Xcode 2016-12-08 00:56:39 +01:00
Alexander Barton
0dc3c13469 x-Line synchronization: Don't send negative durations 2016-12-08 00:22:05 +01:00
Alexander Barton
d0d4de4980 List expiration: use same log level as when setting
And log this event to the &SERVER channel, too.
2016-12-08 00:20:38 +01:00
Alexander Barton
85df414907 Remove leftover debug message. Oops! 2016-12-08 00:18:57 +01:00
Alexander Barton
f5ff22d98f G-LINES: Forbid remote modifications if "AllowRemoteOper" is not set
Explicitely forbid remote servers to modify "x-lines" (G-LINES) when the
"AllowRemoteOper" configuration option isn't set, even when the command
seems to originate from the remote server itself: this prevents GLINE's
to become set during server handshake in this case (what wouldn't be
possible during regular runtime when a remote IRC Op sends the command)
and what can't be undone by IRC Ops later on (because of the missing
"AllowRemoteOper" option) ...
2016-12-08 00:14:00 +01:00
Alexander Barton
995bbfd627 Make scripts and init-files in ./contrib executable 2016-12-05 23:57:19 +01:00
Alexander Barton
dd6d75d37d autogen.sh: Fix some shellcheck(1) warning messages 2016-12-05 23:55:16 +01:00
Christoph Biedl
daa88b7651 Fix building ngIRCd with OpenSSL 1.1
At the moment, ngIRCd fails to build against OpenSSL 1.1 since the
configure check probes for the SSL_library_init symbol which was
removed, but probing for a different function availabe in both versions
solves that problem: SSL_new().

And as SSL_library_init is no longer needed, the patch boils down to
probing SSL_new to assert libssl is available, and disabling the
SSL_library_init invokation from OpenSSL 1.1 on, see also another
application[1] (NSCA-ng) that did pretty much the same.

Patch was compile-tested on both Debian jessie (OpenSSL 1.0.2) and
stretch (OpenSSL 1.1).

[1] <https://www.nsca-ng.org/cgi-bin/repository/nsca-ng/commit/?id=8afc22031ff174f02caad4afc83fa5dff2c29f8a>

(Patch by Christoph, commit message cherry-picked from the email thread
on the mailing list by Alex. Thanks!)
2016-12-05 23:51:07 +01:00
Alexander Barton
2924b3d52a gcc 6.2 warnings: fix code indentation
This fixes the following correct -Wmisleading-indentation warning
messages of gcc 6.2:

irc-write.c: In function ‘IRC_SendWallops’:
irc-write.c:521:4: warning: this ‘if’ clause does not guard...
irc-write.c:524:5: note: ...this statement, but the latter is
  misleadingly indented as if it is guarded by the ‘if’
irc-write.c:526:4: warning: this ‘if’ clause does not guard... []
irc-write.c:529:5: note: ...this statement, but the latter is
  misleadingly indented as if it is guarded by the ‘if’

irc-info.c: In function ‘IRC_STATS’:
irc-info.c:895:3: warning: this ‘else’ clause does not guard...
irc-info.c:897:4: note: ...this statement, but the latter is
  misleadingly indented as if it is guarded by the ‘else’

No functional changes, the code has been correct, but the indentation
was wrong ...
2016-12-05 23:33:12 +01:00
Alexander Barton
a335e480c5 Update config.guess and config.sub to recent versions
- config.guess: 2016-04-02
- config.sub: 2016-03-30
2016-11-05 16:50:55 +01:00
Alexander Barton
dde89b1267 Platforms.txt: Update systems
- Update x86_64/apple/darwin15.6.0 (Apple clang 8.0)
- Update x86_64/unknown/linux-gnu (gcc 4.9.2)
- Update i386/pc/solaris2.11 (gcc 4.8.2), tests have been run both on
  Solaris 11.2 and Solaris 11.3 successfully, but the system identifier
  is the same ... Thanks to Götz Hoffart <goetz@hoffart.de>!
2016-11-04 21:51:49 +01:00
Alexander Barton
455f073687 PAM.txt: Add note about /etc/pam.d/ngircd permissions 2016-10-24 19:24:21 +02:00
Alexander Barton
804c240320 autogen.sh, ngindent, platformtest.sh: Fix warnings of "shellcheck"
- SC2006: Use $(..) instead of legacy `..`.
- SC2015: Note that A && B || C is not if-then-else. C may run
          when A is true.
- SC2086: Double quote to prevent globbing and word splitting.
- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
2016-10-21 21:41:48 +02:00
Alexander Barton
fb99d7c92e Update Xcode project for latest Xcode version (8.0) 2016-10-21 21:34:48 +02:00
Alexander Barton
1d06ed02ce Update Xcode project for latest Xcode version (7.3) 2016-09-21 22:47:40 +02:00
Alexander Barton
c283b52a78 Updated config.sub to version 2014-09-11 2016-09-18 18:46:44 +02:00
Alexander Barton
b708c95173 Add "Documentation" variables to systemd configuration files 2016-09-18 18:10:45 +02:00
Alexander Barton
722afc1b81 Make sure that SYSCONFDIR is always set
This is useful when ./configure hasn't been run but some source code
linters are run in an editor, for example.
2016-07-22 19:01:04 +02:00
Alexander Barton
86a64ce6aa Add "PAMServiceName" configuration option
This setting allows to run multiple ngIRCd instances with separate PAM 
configurations on each instance. If one sets it to ngircd-foo, PAM will
use /etc/pam.d/ngircd-foo instead of the default /etc/pam.d/ngircd.

Thanks to "somechris" for the patch & pull request!

Closes #226.
2016-06-06 01:08:55 +02:00
Christian Aistleitner
e84000f7b8 Add PAMServiceName setting to specify the used PAM configuration
This setting allows to run multiple ngIRCd instances with
PAM configurations on each instance.
If one sets it to "ngircd-foo", PAM will use `/etc/pam.d/ngircd-foo`
instead of the default `/etc/pam.d/ngircd`.
2016-06-05 23:48:29 +02:00
Alexander Barton
a93247d32f Add an ".editorconfig" file to the project 2016-05-07 00:43:30 +02:00
Alexander Barton
a673a6e3af Platforms.txt: Remove x86_64/unknown/linux-gnu, tcc 0.9.25
This combination had been successfully tested with ngIRCd 21, but after
further investigation didn't build correctly: it seems as if tcc fails
to correctly link external libraries (e. g. ngipaddr).

Astonishingly the test suite passed nevertheless, with garbled output,
but without the daemon crashing!?

When using tcc with ngIRCd 23 (and current master), the test suite fails
completely because the daemon crashes ... (which actually is good!)
2016-01-16 14:42:53 +01:00
Alexander Barton
0ab4e7bffd Platforms.txt: Add systems
- Add armv7l/unk./linux-gnueabihf (gcc 4.9.2)
- Add x86_64/unknown/linux-gnu (icc 16)
2016-01-16 14:41:57 +01:00
Alexander Barton
8f0d24c831 Travis-CI: use "container-based infrastructure"
See <https://docs.travis-ci.com/user/migrating-from-legacy/> for
details.
2016-01-10 19:50:51 +01:00
Alexander Barton
0a6e284582 platformtest.sh: Delete ngIRCd binary before test run
This ensures that we definitely don't test an old binary later on ...
2016-01-10 17:45:47 +01:00
Alexander Barton
2254e92e60 platformtest.sh: Only show "runs=Y" when test suite succeeded
Display "?" in the "runs" colum when the simple "run test" succeeded but
the test suite failed. And display a message to double check the actual
status, because it is somewhat unclear, if the daemon actually "works"
or not in this case.
2016-01-10 17:39:43 +01:00
Alexander Barton
7cda2f13f4 Platforms.txt: Add and update systems
- Add i386/pc/minix (clang 3.4)
- Update i686/pc/cygwin (gcc 4.9.3)
- Add x86_64/apple/darwin15.2.0 (Apple clang 7.0)
2016-01-07 02:04:23 +01:00
Alexander Barton
7dba1a0766 Send_Message: Fix handling of "empty" targets
Clients can specify multiple targets for the "PRIVMSG", "NOTICE", and
"SQUERY" commands, separated by commas (e. g. "PRIVMSG a,#b,c :text").

Since commit 49ab79d0 ("Limit the number of message targes, and suppress
duplicates"), ngIRCd crashed when the client sent the separator character
only as target(s), e. g. "," or ",,,," etc.!

This patch fixes the bug and adds a test case for this issue.

Thanks to Florian Westphal <fw@strlen.de> for spotting the issue!
2016-01-07 01:54:11 +01:00
Alexander Barton
055d6e8056 Update README file 2016-01-06 19:01:48 +01:00
Alexander Barton
432a9297f8 Platforms.txt: Add and update systems
- Update i586/pc/interix3.5 (gcc 3.3)

- Add i686/pc/linux-gnu (gcc 2.6.3)
- Add i686/pc/linux-gnu (gcc 2.95.2)

Thanks to Götz Hoffart <goetz@hoffart.de>!
2016-01-06 17:21:54 +01:00
Alexander Barton
4dcd5f1225 platformtest.sh: Use $LOGNAME instead of $USER
LOGNAME is more standard than USER.
2016-01-06 15:47:31 +01:00
Alexander Barton
6a5569c27d Update copyright notices for 2016 2016-01-04 22:43:58 +01:00
Alexander Barton
49ab79d0e6 Limit the number of message targes, and suppress duplicates
This prevents an user from flooding the server using commands like this:

  PRIVMSG nick1,nick1,nick1,...

Duplicate targets are suppressed silently (channels and clients).

In addition, the maximum number of targets per PRIVMSG/NOTICE/... command
are limited to MAX_HNDL_TARGETS (25). If there are more, the daemon sends
the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing the first target
that hasn't been handled any more.

Closes #187.
2016-01-04 22:15:46 +01:00
Alexander Barton
cedba36965 Add "_MSG" postfix to ERR_WILDTOPLEVEL_MSG 2016-01-04 22:10:38 +01:00
Alexander Barton
40bea95c08 Commands.txt, PRIVMSG: Fix "server mask" description 2016-01-04 21:15:05 +01:00
Alexander Barton
7c7d03b730 Enahnce comments for Send_Message() and Send_Message_Mask()
No functional changes.
2016-01-04 20:45:49 +01:00
Alexander Barton
4693226d69 Get rid of unclever assert() in Send_Message_Mask()
Either we use assert() to _guarantee_ a certain condition, or we use
if(...) to test for it. But never both.

So get rid of the assert() in Send_Message_Mask() and handle the case
that the target mask doesn't contain a dot (".") as regular error,
don't require the caller to assure that any more.

This polishes commit 5a312824.

Please note:
The test in Send_Message() is still _required_ to detect whether the
target is a channel (no dot) or a "target mask" (at least one dot)!
2016-01-04 20:37:13 +01:00
Alexander Barton
afb59ab8e5 Test suite: Add new test for server-server logins
This test detects the recent NJOIN breakage, for example ...
2015-12-30 17:10:26 +01:00
Alexander Barton
d90f0323e5 Fix NJOIN handler killing all clients
This bug has been introduced by commit 1e386fb7ac which had
the logic reversed :-(

Reported by "ninguno" in #ngircd, thanks a lot!
2015-12-30 14:55:55 +01:00
Alexander Barton
01e590b007 contrib/ngindent: Fix shebang line 2015-12-19 19:21:45 +01:00
Alexander Barton
7b7ee6a3ca contrib/platformtest.sh: Warn when external tools are missing 2015-12-19 17:27:27 +01:00
Alexander Barton
46838510ab contrib/platformtest.sh: Make script more portable 2015-12-19 17:27:03 +01:00
Alexander Barton
0903343f85 Platforms.txt: Add and update systems
- Update i386/unknown/openbsd3.5 (gcc 2.95.3)
- Update i686/pc/linux-gnu (gcc 2.7.2.1)
- Add x86_64/unknown/linux-gnu (gcc 5.3.0)

Thanks to Götz Hoffart <goetz@hoffart.de>!
2015-12-19 17:08:55 +01:00
Alexander Barton
182bfac855 doc/Platforms.txt: Sort list 2015-12-19 17:02:10 +01:00
Alexander Barton
1e386fb7ac Make NJOIN handler more fault-tolerant
Don't crash the daemon when the NJOIN handler can't join the new client
to a channel (when the Channel_Join() function failed) but try to KILL this
client -- which is the only possible reaction besides crashing: otherwise
the network would get out of sync.
2015-12-13 21:56:07 +01:00
Alexander Barton
52ccba5d1e IRC_KillClient(): Don't break when called without "Client"
The IRC_KillClient() function is documented to handle the case that the
"Client" structure is NULL, so make sure that this actually works and
can't crash the daemon.

Please note:
The current code doesn't make use of this feature, so this fix is
definitely the "right" thing to do but doesn't fix an actual problem.
2015-12-13 21:53:53 +01:00
Alexander Barton
98e9467c85 IRC_NJOIN(): Code cleanup
No functional changes.
2015-12-13 21:00:46 +01:00
Alexander Barton
e8dacb68dc Modes.txt: Add "name prefixes" to channel user mode description 2015-12-13 20:19:05 +01:00
Alexander Barton
398022631a Fix NJOIN not propagating "half ops" status
ngIRCd tested for the wrong prefix of "half ops" when processing NJOIN
commands and therefore never classified a remote user as "half op".

Thanks to wowaname for pointing this out on #ngircd!
2015-12-13 19:55:47 +01:00
Alexander Barton
f2cef85fde ngIRCd Release 23 2015-11-16 21:33:15 +01:00
Alexander Barton
6ed59a8548 Update ChangeLog file 2015-11-15 17:07:56 +01:00
Alexander Barton
49acb68584 Update doc/Platforms.txt 2015-11-15 17:06:24 +01:00
Alexander Barton
d8aba40f07 Explicitly cast time_t to long when printing it out
This prevents wrong sizes data types on platforms where time_t doesn't
equal a long any more, for example on OpenBSD.
2015-11-15 15:14:12 +01:00
Alexander Barton
87887bc632 contrib/Debian/changelog: Fix email address 2015-09-11 21:11:38 +02:00
Alexander Barton
cb3a4321a2 Documentation: Spelling fixes 2015-09-06 19:38:16 +02:00
Alexander Barton
1e84b2640e ngIRCd Release 23~rc1 2015-09-06 16:57:01 +02:00
Alexander Barton
86d27eaf89 Update AUTHORS and .mailmap file
And add a note to doc/HowToRelease.txt to not forget to update the list
of authors in the future ...
2015-09-06 16:51:56 +02:00
Alexander Barton
4acf95ab61 Update ChangeLog file 2015-09-03 17:05:58 +02:00
Alexander Barton
57cd41d289 Add ".clang_complete" file
This file is used of the "linter-clang" package of the Atom editor,
for example.
2015-09-03 16:46:48 +02:00
Alexander Barton
eb9929e82c Make server-to-server protocol more robust
Now ngIRCd catches more errors on the server-to-server (S2S) protocol
that could crash the daemon before. This hasn't been a real problem
because the IRC S2S protocol is "trusted" by design, but the behavior
is much better now.

Thanks to wowaname on #ngircd for pointing this out!
2015-09-03 16:22:36 +02:00
Alexander Barton
c2e4c304e3 platformtest.sh: Fix quoting 2015-08-27 00:12:50 +02:00
Alexander Barton
c56138c280 autogen.sh: Fix parameter quoting 2015-08-27 00:10:41 +02:00
Alexander Barton
a1ce3fc779 ngircd.init: Fix non-POSIX "==" test operator 2015-08-27 00:10:18 +02:00
Christoph Biedl
ccc899c7f4 Reproducible builds
At the moment ngircd fails the tests for reproducible builds in Debian
since it uses the __DATE__ and __TIME__ macros for the INFO command.

Instead of patching this out I decided to implement an optional
constant BIRTHTIME that allows you to set a time stamp for the "Birth
Date" information, in seconds since the epoch, like in

    export CFLAGS += -DBIRTHTIME=$(shell date +%s --date="2015/08/15 23:42:22")

In the future, Debian will provide a SOURCE_DATE_EPOCH environment
variable, dealing with the situation until then will be my job.

The time format was taken from the NGIRCd_StartStr formatting in
ngircd.c so the "Birth Date" and "On-line since" lines in the INFO
output look similar:

    :irc.example.net 371 nick :ngIRCd 22.1-IDENT+IPv6+IRCPLUS+PAM+SSL+SYSLOG+ZLIB-x86_64/pc/linux-gnu
    :irc.example.net 371 nick :Birth Date: Tue Aug 25 2015 at 18:11:11 (CEST)
    :irc.example.net 371 nick :On-line since Tue Aug 25 2015 at 18:11:33 (CEST)
    :irc.example.net 374 nick :End of INFO list

The format of the time stamped is changed, but as far as I can tell, there's no
rule that is violated by that.

Bonus level: Reformat the messages so the time stamps are aligned.
2015-08-26 10:05:36 +02:00
Alexander Barton
2a52befa56 Update systemd service file 2015-08-14 19:55:32 +02:00
Alexander Barton
2c18e9a7f8 Update NEWS and ChangeLog files 2015-08-07 17:20:47 +02:00
Alexander Barton
9811223fb8 Whitespace fixes (no functional changes) 2015-08-01 15:15:30 +02:00
Alexander Barton
0083fe177f Fix debug message "Client ... is closing connection"
It should be "host:port"!
2015-08-01 15:14:23 +02:00
Alexander Barton
34578b8b30 INSTALL: Add deprecation notice for "PredefChannelsOnly"
Obviously I forgot to list this for ngIRCd 21 ... oops!
2015-08-01 14:52:11 +02:00
Alexander Barton
85dc4d8777 "NoticeAuth" configuration variable is deprecated now! 2015-08-01 14:52:07 +02:00
Alexander Barton
64c265cf33 Merge pull request #217 from SaberUK/master+notice-auth
Use "NOTICE *" before registration instead of "NOTICE AUTH".
2015-08-01 14:51:04 +02:00
Alexander Barton
b72a7a4b96 Channel mode "N" is targeted for ngIRCd 23. 2015-08-01 14:26:16 +02:00
Alexander Barton
b8482fd3cf First check if channel has mode "N", then check membership
This should be more efficient.
2015-08-01 14:26:11 +02:00
Alexander Barton
90ea23ab4f Merge pull request #214 from Flupsy/channel-mode-N
Channel mode N (users on this channel can't change their nick)
2015-08-01 14:24:20 +02:00
Alexander Barton
6e7e744cc6 Add "build+*" to .gitignore file 2015-07-20 09:34:39 +02:00
Alexander Barton
24cec978ee Remote GIT.txt from Makefile[.am], too! 2015-07-20 09:34:14 +02:00
Alexander Barton
a02524465e READNE, AUTHORS: Update mailing list and issue tracker URLs 2015-07-19 03:21:37 +02:00
Alexander Barton
813ea874f8 doc/Contributing.txt: Add note about using GitHub 2015-07-19 03:20:48 +02:00
Alexander Barton
813897023e Remove doc/GIT.txt: it is outdated
ngIRCd uses GitHub, and Git itself is quite common today. So don't
include an own Git "mini HowTo" any longer.
2015-07-19 03:19:41 +02:00
Alexander Barton
a5ca8be658 Streamline ".gitignore" files 2015-07-19 03:03:06 +02:00
Alexander Barton
c364d67f80 Update NEWS and ChangeLog files 2015-07-19 02:41:03 +02:00
Peter Powell
5545e1bebf Rename NoticeAuth to NoticeBeforeRegistration.
The old name is still supported for compatibility reasons.
2015-07-14 14:43:19 +01:00
Peter Powell
d118cd74b6 Use "NOTICE *" before registration instead of "NOTICE AUTH".
AUTH is a valid nickname so sending notices to it is probably not
a good idea. Use * as the target instead as done with numerics
when the nick is not available.

This mimics the behaviour in Charybdis, IRCD-Hybrid, InspIRCd 2.2,
Plexus 4, etc.
2015-07-14 14:37:42 +01:00
Ian Chard
599626d570 Only enforce channel mode N on users (not servers or services) 2015-06-26 10:36:57 +01:00
Alexander Barton
571b1a8b83 Merge pull request #215 from tejr/master
Specify session context for OpenSSL clients.

Closes #182.
2015-06-26 07:41:19 +02:00
Tom Ryder
b71a0ddbd5 Specify session context for OpenSSL clients
Reconnecting to ngIRCd 22.1 built with OpenSSL with some OpenSSL
clients, including Pidgin and stunnel 5.06, attempts to reuse a session
and fails due to the absence of this line.

The error message in syslog from ngIRCd is:

> SSL protocol error: SSL_accept (error:140D9115:SSL
> routines:SSL_GET_PREV_SESSION:session id context uninitialized)

This patch appears to fix the problem for both Pidgin and stunnel; it
may work for other OpenSSL clients that attempt to re-use sessions.

*   <https://github.com/ngircd/ngircd/issues/182>
*   <https://developer.pidgin.im/ticket/11568>
*   <https://www.openssl.org/docs/ssl/SSL_CTX_set_session_id_context.html>
2015-06-26 16:21:54 +12:00
Ian Chard
7ff16e8116 Don't bother looking for +N channels for an op 2015-06-24 20:28:27 +01:00
Unit 193
f6b7764eb5 Fix several broken URLs. 2015-06-24 21:15:44 +02:00
Ian Chard
adfe5affed Don't use a standard message number 2015-06-24 15:51:37 +01:00
Ian Chard
27934afd7e Add documentation for channel mode N 2015-06-24 15:41:31 +01:00
Ian Chard
f64cb901ef Add channel mode N (normal user can't change nick while on channel) 2015-06-24 15:37:56 +01:00
Alexander Barton
d28d838cb9 Merge remote-tracking branch 'LucentW/master'
* LucentW/master:
  Fix with oneshot invites
  Fixed building issues\
  Implement timestamp tracking of invites
  Keep track of who placed bans/invites/excepts
  IRC operators w/OperCanMode can kick anyone [already cherry-picked]

Closes #203, Closes #205.
2015-06-07 21:13:45 +02:00
Alexander Barton
2fc61ce8a6 Make setgroups(3) function optional
For example, Interix is missing this function, which prevented
ngIRCd to build on this platform. When setgroups(3) isn't available,
a warning message is issued when ngIRCd starts up.
2015-06-06 22:19:47 +02:00
LucentW
5c48d7e9c7 IRC operators w/OperCanMode can kick anyone
Closes #202.

(cherry picked from commit 10c7ba99e7)
2015-05-16 20:48:37 +02:00
LucentW
0f490b5cae Implement numeric RPL_LISTSTART(321)
lightIRC and other clients expecting RPL_LISTSTART should now behave correctly.

Closes #207.

(cherry picked from commit 0680ce5fd99bc643651d1433bcdaf271aeb73c46)
2015-05-16 20:29:10 +02:00
Alexander Barton
a43d79aeff Update ngircd.conf.5: "CloadUserToNick" hides user and real name
Closes #208.
2015-05-15 23:15:09 +02:00
LucentW
93a872a36b Fix with oneshot invites
This should finally implement correctly oneshot invites sent via /INVITE
2015-05-15 14:02:37 +02:00
Alexander Barton
c4245220de Fix MatchCaseInsensitive[List]](): lowercase string _and_ pattern
Up to now, only the the string ("haystack") became lowercased and was
the compared to the pattern ("needle") -- which failed, when the pattern
itself wasn't all lowercase ...
2015-05-13 23:47:53 +02:00
Alexander Barton
f8f7f83f5a Streamline effect of "MorePrivacy" option (WHOIS, LIST)
- Update documentation in ngircd.conf(5)
- LIST: Don't hide channels for IRC Ops when "MorePrivacy" is in effect
- WHOIS: Don't hide IP addresses/hostnames when "MorePrivacy" is in effect

Closes #198
2015-05-13 22:42:51 +02:00
LucentW
03c8997af3 Fixed building issues\
Now builds cleanly. Pass all tests from make check.
2015-05-13 20:08:26 +00:00
LucentW
4396936f38 Implement timestamp tracking of invites
Now lists nodes also have the "onlyonce" field, since the valid_until is
used to keep the timestamp of placing. Found no references to onlyonce
or about valid_until being == 1, though, so it might be unused, but
still available for other enhancements.
2015-05-11 22:15:01 +02:00
LucentW
4da04640e6 Keep track of who placed bans/invites/excepts
Implements #203.
WARNING: it does not track the time of placement of invites, since the
time_t is already used as a flag for single use invites!
2015-05-11 22:15:00 +02:00
LucentW
10c7ba99e7 IRC operators w/OperCanMode can kick anyone 2015-05-11 22:12:30 +02:00
Alexander Barton
1136b97690 doc/Modes.txt: Fix indentation 2015-04-30 09:29:41 +02:00
Alexander Barton
d9a97f2857 Merge pull request #197 from LucentW/master
Implement user mode "I": Hide channels on WHOIS

User mode +I prevents ngIRCd from showing channels on WHOIS.
IRC Operators can always see those.

Closes #197.
2015-04-30 09:28:15 +02:00
LucentW
a4af9024fd Fixed indents 2 2015-04-29 20:29:00 +02:00
LucentW
6fc53558ed Fixed indents and documentation
(also updated the copyright date on the txt I edited)
2015-04-29 20:25:18 +02:00
LucentW
21767c968d Implement +I (private channel list on whois)
Implements enhancement requested in issue #179
2015-04-29 14:04:06 +02:00
Alexander Barton
c5da483685 Make sure that the target user is able to join a local channel
Implement ERR_USERNOTONSERV(504) numeric and make sure that the
target user is on the same server when inviting other users to
local ("&") channels.

ircd-ratbox uses the ERR_USERNOTONSERV(504) numeric for this, and I
think this is a good idea -- other IRC daemons (like ircu) silently
drop such impossible invites, but thats not a big benefit ...

Idea by Cahata, thanks! Closes #183.
2015-04-12 20:59:43 +02:00
Alexander Barton
4330f5d1c9 INVITE command: Enforce 1 second penalty time
This prevents flooding of the target client.

This closes #186. Reported by Cahata, thanks!
2015-04-12 20:14:24 +02:00
Alexander Barton
81b81c818c MODE command: Always report channel creation time
Up to now when receiving a MODE command, ngIRCd only reported the channel
creation time to clients that were members of the channel. This patch
reports the channel creation time to all clients, regardless if they are
joined to that channel or not.

At least ircd-seven behaves like this.

This closes #188. Thanks Cahata!
2015-04-12 19:39:20 +02:00
Alexander Barton
52825cde29 Update Xcode project for latest Xcode version (6.3) 2015-04-10 22:30:17 +02:00
Alexander Barton
03e6568079 ngIRCd Release 22.1 2015-04-06 14:36:14 +02:00
Alexander Barton
7dacc314f9 Update NEWS and ChangeLog for ngIRCd 22.1 2015-04-06 14:33:23 +02:00
Alexander Barton
24adfb88b4 Update some copyright notices for 2015 2015-04-06 14:32:59 +02:00
Alexander Barton
6ed440a030 Platforms.txt: Add and update systems
- Update powerpc/apple/darwin7.9.0

Thanks to Götz Hoffart <goetz@hoffart.de>!
2015-04-06 14:07:16 +02:00
Alexander Barton
c7bbc9a390 Fix spelling of RPL_WHOISBOT message text 2015-03-27 22:51:21 +01:00
Alexander Barton
6171beb7ab Don't send nick name as default PART reason
No other IRC daemon seems to do this (today?), don't remember why
ngIRCd did it in the first place ...

Closes #185.

Reported by Cahata in #ngircd, thanks!
2015-03-14 11:13:50 +01:00
Alexander Barton
2196e945e4 Fix "WHO #<chan>" showing invisible users and hiding all visible
The logic is reversed ...

This bug has been introduced by commit c74115f2, "Simplify mode checking on
channels and users within a channel", ngIRCd releases 21, 21.1, and 22 are
affected :-(

Problem reported by Cahata in #ngircd, Thanks!
2015-03-14 10:16:16 +01:00
Alexander Barton
f16eb1b686 Fix typo in src/testsuite/README 2015-03-11 22:14:24 +01:00
Alexander Barton
c41f18e3f9 Auth PING: Fix our information text for manual sending of "PONG"
Up to now, ngIRCd doesn't send a valid IRC command at all, oops!
2015-01-20 22:50:13 +01:00
Alexander Barton
dbfe1beca8 Auth PING: The numeric ID is a "long", use atol() 2015-01-20 22:49:23 +01:00
Alexander Barton
6bdae55177 Auth PING: Don't send a prefix in our PING command
The prefix confuses WeeChat, at least, which doesn't send an appropriate
PONG in the case ...

Debugging and patch by "wowaname" on #ngircd, thanks!
2015-01-20 22:44:36 +01:00
Alexander Barton
fb5ae9e844 FAQ: How can I "auto-op" users in channels? 2015-01-13 12:44:29 +01:00
Alexander Barton
bd8d4e710c Fix syntax of ERR_LISTFULL_MSG(478) numeric
Pointed out by "wowaname" in #ngircd, thanks!
2014-12-27 01:50:27 +01:00
Alexander Barton
9a931a549b Enhance debug messages while sending CHANINFO commands 2014-12-20 15:35:49 +01:00
Alexander Barton
3c30490d54 Reset "last try" timer when enabling a passive server
This results in a new connection attempt as soon as possible.
2014-12-20 15:31:55 +01:00
Alexander Barton
6250335352 Change log message for "Can't resolve address" 2014-12-10 11:11:42 +01:00
Alexander Barton
7e14bd3b58 Change log messages issued for IP address forgeries 2014-12-10 11:02:03 +01:00
Alexander Barton
31b3c83c1f Merge remote-tracking branch 'alex/TestsuiteNoDNS'
* alex/TestsuiteNoDNS:
  Test suite: Don't use DNS lookups
2014-11-01 20:14:09 +01:00
Alexander Barton
6e4235443e Merge branch 'CipherListNoSSL3'
* CipherListNoSSL3:
  INSTALL: List the changed SSL CipherList default value.
  Update "CipherList" to not enable SSLv3 by default
2014-10-26 11:58:22 +01:00
Alexander Barton
cdcf474f15 INSTALL: List the changed SSL CipherList default value. 2014-10-26 11:55:28 +01:00
Alexander Barton
f33a4067a1 HowToRelease.txt: Add note about the bug tracker 2014-10-22 23:12:10 +02:00
Alexander Barton
100de3e4cc Update "CipherList" to not enable SSLv3 by default
Idea, initial patch, and testing by Christoph Biedl
<ngircd.anoy@manchmal.in-ulm.de>
2014-10-16 13:42:24 +02:00
Alexander Barton
7b58538074 ngIRCd Release 22 2014-10-11 20:30:42 +02:00
Alexander Barton
3f436e1810 Platforms.txt: Add and update systems
- Add armv7l/unk./linux-gnueabihf
- Update hppa/unknown/openbsd5.4
- Update i686/unknown/gnu0.5
- Update i686/pc/cygwin
- Add i386/pc/linux-gnu, gcc 4.4.5
- Update x86_64/apple/darwin14.0.0
- Update x86_64/unknown/freebsd8.4
- Update x86_64/unknown/freebsd9.2
- Add x86_64/unknown/freebsd10.0
- Add/update x86_64/unknown/linux-gnu, various compilers
- Update x86_64/unknown/openbsd4.8
- Add x86_64/unknown/openbsd5.5

Tested version is "rel-22-rc1-3-g967deeb".
2014-10-11 20:24:44 +02:00
Alexander Barton
967deebacd User mode "F": Fix description in NEWS and ChangeLog 2014-10-07 03:28:00 +02:00
Alexander Barton
74262a4093 Update NEWS and ChangeLog for ngIRCd 22 once more ... 2014-10-06 21:51:59 +02:00
Alexander Barton
be88707027 Match list patterns case-insensitive
The invite-, ban-, and except lists are affected by this change,
as well as G-Lines an K-Lines.

Problem pointed out by "wowaname" on #ngircd, thanks!
2014-10-06 21:47:34 +02:00
Alexander Barton
7d7eb735f0 ngIRCd Release 22~rc1 2014-09-29 17:09:51 +02:00
Alexander Barton
fa7fac88d2 Update NEWS and ChangeLog for ngIRCd 22 once more ... 2014-09-22 02:37:37 +02:00
Alexander Barton
84ff5a6eb9 Sync "except lists" between servers
Up to now, ban, invite, and G-Line lists have been synced between servers
while linking -- but obviously nobody noticed that except list have been
missing ever since. Until now.

Thanks to "j4jackj", who reported this issue in #ngircd.
2014-09-22 02:17:04 +02:00
Alexander Barton
bf2eae3249 Allow longer usernames for authentication 2014-09-11 22:04:31 +02:00
Alexander Barton
ffad2da835 Correctly check that a server has a valid hostname and port
David Binderman <dcb314@hotmail.com> reported the following compiler warning,
which is a real bug in ngIRCd, thanks!

conn.c:2077:55: warning: logical not is only applied to the left hand
                         side of comparison [-Wlogical-not-parentheses]
2014-09-10 13:03:30 +02:00
Alexander Barton
3f1547ecde Fix spelling and whitespaces in INSTALL 2014-09-04 18:28:33 +02:00
Alexander Barton
7893dc5241 Update NEWS and ChangeLog for ngIRCd 22 2014-09-04 18:28:17 +02:00
Alexander Barton
896d45471a Lists_MakeMask: Don't destroy source buffer 2014-08-08 13:50:48 +02:00
Alexander Barton
01c3552140 Initialize Conf_ScrubCTCP even when SYSLOG isn't #define'd
The "SYSLOG" #define isn't related to "Conf_ScrubCTCP" at all, so
initialize the latter even when "SYSLOG" isn't #define'd.

Pointed out by wowaname on #ngircd, thanks!
2014-07-29 23:08:18 +02:00
Alexander Barton
ce3c4074ba Platforms.txt: Add and update systems
- Add armv7l/unk./linux-gnueabihf
- Add x86_64/apple/darwin14.0.0

Thanks to Götz Hoffart <goetz@hoffart.de>!
2014-07-26 15:22:35 +02:00
Alexander Barton
40ed94a1f2 Increase MAX_SERVERS from 16 to 64
There are installations out there that would like to configure more
than 16 links per server, so increase this limit. Best would be to
get rid of MAX_SERVERS altogether and make if fully dynamic, but
start with this quick and dirty hack ...
2014-07-20 13:19:36 +02:00
Alexander Barton
c1f180b87b New "Debian release" 21.1-0ab2
(cherry picked from commit 48fcb97fa4)
2014-07-14 12:03:11 +02:00
Alexander Barton
f5944a17e4 Debian: Don't adjust path names that are correct by default 2014-07-14 11:40:38 +02:00
Alexander Barton
06920df4bb Debian: Correctly set and use "docdir" 2014-07-14 10:56:31 +02:00
Alexander Barton
e864b1f33e Update config.guess and config.sub to recent versions
- config.guess: 2014-03-23
- config.sub: 2014-05-01
2014-07-14 10:53:37 +02:00
Alexander Barton
3f807e1045 Test suite: Don't use DNS lookups
Different operating systems do behave quite differently when doing DNS
lookups, for example "127.0.0.1" sometimes resolves to "localhost" and
sometimes to "localhost.localdomain" (for example OpenBSD). And other
systems resolve "localhost" to the real host name (for example Cygwin).

So not using DNS at all makes the test site much more portable.
2014-06-09 02:15:52 +02:00
Alexander Barton
39b8fc65b6 Add "tests-skipped.lst" to src/testsuite/.gitignore 2014-06-04 12:20:31 +02:00
Alexander Barton
3de972e0bd Test suite/platformtest.sh: Detect when tests have been skipped
Detect if some tests have been skipped, for example when telnet(1) or expect(1)
is missing: ./contrib/platformtest.sh will echo a warning message now.
2014-06-04 12:15:23 +02:00
Alexander Barton
ec2bf5c5a2 Platforms.txt: Add and update systems
- Add sparc/unknown/openbsd5.5
- Update powerpc/apple/darwin7.9.0
- Update x86_64/unknown/linux-gnu, Open64
- Update x86_64/unknown/linux-gnu, Sun C 5.12/Solaris Studio 12.3
- Update x86_64/unknown/linux-gnu, tcc 0.9.25

Thanks to Götz Hoffart <goetz@hoffart.de>!
2014-05-05 22:44:04 +02:00
Alexander Barton
70160b3a5b Add "cov-int" directory (Coverity test tool) to .gitignore file 2014-05-01 15:07:56 +02:00
Alexander Barton
a90004b913 Test suite: Update file headers and comments 2014-04-17 23:56:36 +02:00
Alexander Barton
9e79ed8605 Update links to "Arthur" to use the HTTP protocol 2014-03-25 20:27:17 +01:00
Alexander Barton
cdd6b961af ngIRCd Release 21.1
(cherry picked from commit ee28e76df2)
2014-03-25 20:19:31 +01:00
Alexander Barton
bfc727ce49 Platforms.txt: Update i686/unknown/gnu0.5 2014-03-19 02:34:20 +01:00
Alexander Barton
dee824a3f0 Platforms.txt: Update powerpc/apple/darwin7.9.0
- Update powerpc/apple/darwin7.9.0, gcc 3.3

Thanks to Götz Hoffart <goetz@hoffart.de>!
2014-03-19 02:34:20 +01:00
Alexander Barton
f5ae1dd36c Platforms.txt: Update x86_64/unkn./linux-gnu, clang 3.x
- Update x86_64/unknown/linux-gnu, clang 3.2 => clang 3.3
2014-03-19 02:34:20 +01:00
Alexander Barton
794cb51e4b Platforms.txt: Add and update more systems
- update i686/pc/linux-gnu, gcc 2.7.2
- update powerpc/apple/darwin6.8, gcc 3.1
- add powerpc/apple/darwin9.8.0, gcc 4.0.1

Thanks to Götz Hoffart <goetz@hoffart.de>!
2014-03-19 02:34:20 +01:00
Alexander Barton
dd4b74e29b doc/Bopm.txt: Update file header 2014-03-19 00:59:01 +01:00
Alexander Barton
daed2467dd doc/Bopm.txt: Update "connregex" and "kline" for current ngIRCd
Thanks to "kerin" on IRC for pointing this out!
2014-03-19 00:55:00 +01:00
Alexander Barton
d314c75a37 Allow "DefaultUserModes" to set all possible modes
Let IRC_MODE() detect that the "fake" MODE command originated on the local
sever, which enables all modes to be settable using "DefaultUserModes"
that can be set by regular MODE commands, including modes only settable by
IRC Operators.
2014-03-18 16:43:21 +01:00
Alexander Barton
5009ab3e8c Spoofed prefixes: Really kill connection on non-server links
This fixes commit 6cbe1308 which only killed the connection when the
spoofed prefix itself belonged to a non-server client.
2014-03-18 16:30:38 +01:00
Alexander Barton
5713c49c84 Implement user mode "F": "relaxed flood protection"
ngIRCd relaxes its flood protection for users having the user mode "F" set
and allows them to rapidly send data to the daemon. This mode is only
settable by IRC Operators and can cause problems in the network -- so be
careful and only set it on "trusted" clients!

User mode "F" is used by Bahamut for this purpose, for example, see
<http://docs.dal.net/docs/modes.html#4.9>.
2014-03-18 14:55:38 +01:00
Alexander Barton
35f1db5f28 Handle "throttling" in a single function
ngIRCd uses "command throttling" and "bps throttling" (bytes per second).
The states are detected in different functions, Conn_Handler() and
Read_Request(), but handle the actual "throttling" in a common function:
this enables us to guarantee consistent behavior and to disable throttling
for special connections in only one place, eventually.
2014-03-18 14:53:29 +01:00
Alexander Barton
4c2acd55c6 Updated config.{guess|sub} to version 2014-03-13 2014-03-18 14:42:11 +01:00
Alexander Barton
f547981188 Streamline DEBUG_ARRAY, DEBUG_BUFFER, DEBUG_IO, DEBUG_ZIP
Change all #define's to follow the form
	#define DEBUG_xxx {0|1}
to disable (0, default) or enable (1) additional debug messages.

And somewhat enhance some DEBUG_BUFFER messages.
2014-03-17 23:54:44 +01:00
Alexander Barton
b35f8916a5 conn.c: Code cleanup
Reformat and restructure some code, move all SSL related code into
one single #ifdef block, for example.
2014-03-17 22:59:58 +01:00
Alexander Barton
3d7aa9f906 Xcode: remove imp.h and exp.h from project file
These files have been removed from ngIRCd in commit 259c314d,
"Remove imp.h and exp.h header files".
2014-03-17 18:07:51 +01:00
Alexander Barton
a534e71e8d Re-add #include's for header files of the C file itself
This partially reverts commit b130b35f4, "Update #include's: remove
unused and add missing ones", but fixes the following compiler and
analyzer warnings of Apple Xcode 5:

 "Semantic issue: No previous prototype for function 'yyy'"
2014-03-17 18:02:57 +01:00
Alexander Barton
a13bb78b1e Update copyright notices of recently changed files 2014-03-17 12:22:00 +01:00
Alexander Barton
b130b35f48 Update #include's: remove unused and add missing ones
The "deheader" tool (<http://www.catb.org/~esr/deheader/>) has been
used to find unused #include directives as well as missing ones.

Tested on:

- A/UX 3.1.1
- ArchLinux (2014-03-17)
- Debian GNU/Hurd
- Debian GNU/Linux 6.0.9
- Debian GNU/Linux 7.4
- Fedora 20
- FreeBSD 9.2
- OpenBSD 4.8
- OpenBSD 5.1
- OS X 10.9
- Solaris 11
2014-03-17 11:37:25 +01:00
Alexander Barton
37090a28e8 portab.h: Restructure and clean up code
- Don't use HAVE_SYS_TYPES_H, <sys/types.h> is a required header now.
- Streamline check for boolean data types.
- Better indent #ifdef constructs.
2014-03-17 01:17:30 +01:00
Alexander Barton
67256f9da1 configure[.ng]: <sys/types.h> is a required header file
ngIRCd already includes <sys/types.h> in a lot of places without
checking for its existence (for example in "ngircd.c", "io.c", ...),
therefore make it a required header file.
2014-03-17 00:52:11 +01:00
Alexander Barton
7b10a0e4ee io.c: <sys/time.h> is only needed when using select()
Only include the <sys/time.h> header when using the select() IO API,
it isn't required otherwise.
2014-03-17 00:45:07 +01:00
Alexander Barton
259c314d14 Remove imp.h and exp.h header files
These include files don't have a function any more, remove them.
2014-03-17 00:17:02 +01:00
Alexander Barton
51396f8f1c strdup.c: Code cleanup 2014-03-16 22:59:03 +01:00
Alexander Barton
6238196dac Don't define SSL_Want{Read|Write}() when SSL is disabled
Not even call the "dummy" functions.
2014-03-16 22:31:23 +01:00
Alexander Barton
43fb18f2f5 Code cleanup, remove blank lines 2014-03-16 22:11:26 +01:00
Alexander Barton
a4ed90ba9a Fix two K&R C portability issues
Fix the following two errors emitted by the Apple K&R C compiler
on Apple A/UX:

"./class.c", line 47: no automatic aggregate initialization
"./class.c", line 47: illegal lhs of assignment operator

"./conf.c", line 1052: syntax error

Tested on A/UX 3.1.1.
2014-03-16 20:07:08 +01:00
Alexander Barton
af9161a9bc Merge pull request #6 from norrs/pam_server_password_fix
Validate server password when PAM is disabled.
2014-02-28 22:26:41 +01:00
Roy Sindre Norangshol
485d0aec81 Use server password when PAM is compiled in but disabled 2014-02-28 10:53:40 +01:00
Alexander Barton
abf280d5bd CHARCONV: Fix handling conversion errors
Don't overwrite already converted text!
2014-02-23 18:20:47 +01:00
Alexander Barton
ccc9e1baa4 Streamline punctuation of log messages
See commit d38d153f for details.
2014-02-09 16:01:13 +01:00
Alexander Barton
755562d147 Services.txt: Update information for Anope 2.x 2014-02-02 20:28:21 +01:00
Alexander Barton
384b27cee0 IRC_INVITE(): Code cleanup 2014-02-02 00:27:24 +01:00
Alexander Barton
6496fa4655 Streamline punctuation of log messages
See commit d38d153f for details.
2014-02-02 00:27:03 +01:00
Alexander Barton
20b52fe33d Correctly use cloaked IRC masks on "INVITE nickname"
The cloaked IRC mask of a user is his visible mask, so the daemon has
to use it for generating the "one time" entries for the invite list of
the given channel.

Without this patch, ngIRCd records the real IRC mask which will never
match while the target client is "+x", and even worse, will disclose
the real mask on "MODE #channel +I" commands :-/

Bug reported by Cahata on #ngircd, thanks!
2014-01-27 23:05:29 +01:00
Alexander Barton
0fc822d8c4 Use correct sender as target for ISUPPORT replies on "VERSION"
This fixes commit 2e168c78 ("Return ISUPPORT(005) numerics on
'VERSION'") and make sure, that the 005 numerics are correctly
routed back to the sender.
2014-01-27 22:23:47 +01:00
Alexander Barton
2e168c7809 Return ISUPPORT(005) numerics on "VERSION"
This is how ircd-seven, Charybdis, Hybrid, and InspIRCd behave,
for example.
2014-01-26 23:41:59 +01:00
Alexander Barton
14a84dfca5 configure: Only link "contrib/Debian" if it exists
This isn't the case on "VPATH builds", for example.
2014-01-26 23:41:06 +01:00
Alexander Barton
4cb36e370e Merge pull request #5 from grawity/accountname-whois
Show account name in WHOIS
2014-01-21 14:04:59 -08:00
Mantas Mikulėnas
e273bd226a Show account name in WHOIS
This uses the same numeric as Charybdis and ircu families.
2014-01-20 14:25:11 +02:00
Alexander Barton
3b24ebf122 ngircd.conf.5: Update manual page 2014-01-19 15:32:20 +01:00
Alexander Barton
599cfd0944 Merge branch 'no-range-matching' of git://arthur.barton.de/ngircd-alex
* 'no-range-matching' of git://arthur.barton.de/ngircd-alex:
  Remove "range matching" functionality
2014-01-17 23:11:37 +01:00
Alexander Barton
90062111f7 Use $(MKDIR_P) instead of $(mkinstalldirs) in Makefile's
And test for "mkdir -p" using AC_PROG_MKDIR_P in "configure".
2014-01-17 21:04:40 +01:00
Alexander Barton
e747fe9277 Fix configure script and "make check" for TCP Wrappers
Add missing #include's and static variables.

Problem spotted on OpenBSD.
2014-01-17 16:18:55 +01:00
Alexander Barton
0f85c4c6a7 Add libwrap at the end of the configure run
If libwrap becomes added earlier, other tests may fail because of not all
external variables required by libwrap are available when linking: for
example allow_severity and deny_severity.

This patch adds generic support for the LDFLAGS_END and LIBS_END variables
(CFLAGS_END has been implemented already).

Problem spotted on OpenBSD.
2014-01-17 16:16:37 +01:00
Alexander Barton
e73d70ce6f Remove "range matching" functionality
Don't support "range marching" in our pattern matching code using
the "[...]" syntax, because [ and ] are valid characters in nick
names and one has to quote them currently using the "\" character,
which is quite unexpected. For example:

  Nick "te[st" => "MODE #channel +b te\[st"

And remove quoting altogether, too, because "*" and "?" don't need
to be quoted because these characters are not allowed in IRC masks,
nicks, and hostnames.

Reported by "hifi" (Toni Spets) on IRC, thanks!
2014-01-15 14:58:57 +01:00
Alexander Barton
2560e5f156 platformtest.sh: Allow using separate source and build trees
Now you can call platformtest.sh using its complete path name from an
other directory which is then used for building.

See <http://www.gnu.org/software/automake/manual/html_node/VPATH-Builds.html>

Please not that the build system itself is still (re-)genrated in the
original source tree. This can be avoided by passing the "-x" switch to
the platformtest.sh script.
2014-01-11 01:33:24 +01:00
Alexander Barton
1f5508d049 platformtest.sh: Show only up to 10 bytes of version information 2014-01-11 01:32:13 +01:00
Alexander Barton
97b4fd8a08 platformtest.sh: New option "-x", don't renegerate build system 2014-01-11 01:27:15 +01:00
Alexander Barton
fe73835666 Client_SetHostname(): Don't use strlen() to test for value 2014-01-10 19:57:05 +01:00
Alexander Barton
5b4b7e2f55 Test suite: explicitely enable glibc memory checking 2014-01-10 19:56:14 +01:00
Alexander Barton
8ae2cdfce9 Send "fake '*' key" in "MODE -k" replies
According to RFC 2812 3.2.3 "Channel mode message" and the examples
there, it looks like clients should use "MODE -k <key>" to unset channel
keys; and that's how other servers and services behave and do expect it.

(But please note that this is NOT the case for "MODE -l"!)

In the end, it doesn't make sense to specify a key when UNsetting it at
all, and different services behave diffrently when clients do not send
the currently set key to unset it - some ignore such calls, for example!

But this implementation is quite relaxed, it accepts any key when
unsetting channel mode "k" and even accepts no key at all. But the reply
will always include an "*" character for every "-k" parameter.
2014-01-08 14:24:03 +01:00
Alexander Barton
6685ae063f Add "config.cache" to .gitignore file 2014-01-06 17:20:54 +01:00
Alexander Barton
e2b85ccde3 platformtest.sh: don't use "test -e", it isn't portable 2014-01-05 00:50:11 +01:00
Alexander Barton
7b358a57ac Makefile.am: don't use "test -e", it isn't portable 2014-01-05 00:12:10 +01:00
Alexander Barton
5d88030bd1 Support non-standard vsnprintf() return code
C99 states that vsnprintf() "returns the number of characters that
would have been printed if the n were unlimited"; but according to the
Linux manual page "glibc until 2.0.6 would return -1 when the output
was truncated" -- so we have to handle both cases ...
2014-01-04 23:57:05 +01:00
Alexander Barton
8872653ef6 Partially revert bc098794: don't require autoconf 2.67
GNU autoconf 2.61 is still sufficient to generate the configure script, even
after updating configure.{ng|in}, so don't require a newer version.
2014-01-04 23:12:56 +01:00
Alexander Barton
4d4512cd72 doc/Platforms.txt: Update some systems to ngIRCd 21
- update i686/pc/cygwin, gcc 4.8.2
- update x86_64/apple/darwin13.0.0, Apple clang 5.0
- update x86_64/unknown/freebsd8.4, gcc 4.2.1
- update x86_64/unknown/freebsd9.1, gcc 4.2.1
- update x86_64/unknown/linux-gnu, gcc 4.8.2
- update x86_64/unknown/linux-gnu, Open64
- update x86_64/unknown/openbsd4.8, gcc 4.2.1
- update x86_64/unknown/openbsd5.1, gcc 4.2.1
2014-01-02 18:36:18 +01:00
Alexander Barton
bc098794ee Update configure.ng for autoconf 2.67
We already require GNU autoconf 2.67 for generating our build system (at
least this is what the INSTALL document states), so update the build system
accordingly and implement all changes that autoupdate(1) suggests:

 - Update AC_PREREQ and AC_INIT
 - Use AC_LINK_IFELSE, AC_RUN_IFELSE, and AC_COMPILE_IFELSE
 - Remove AC_TYPE_SIGNAL (we don't use RETSIGTYPE)
2014-01-02 15:33:39 +01:00
Alexander Barton
788da901ee Update Copyright notices for 2014 2014-01-02 15:27:07 +01:00
Alexander Barton
2a40112f09 Merge branch 'bug167-WebircIPAnoDNS' of git://arthur.barton.de/ngircd-alex
* 'bug167-WebircIPAnoDNS' of git://arthur.barton.de/ngircd-alex:
  WEBIRC: Don't respect hostname when DNS is disabled
2014-01-02 00:45:05 +01:00
Alexander Barton
61b7932e82 Merge branch 'bug165-005-NETWORK' of git://arthur.barton.de/ngircd-alex
* 'bug165-005-NETWORK' of git://arthur.barton.de/ngircd-alex:
  Implement new configuration option "Network"
2014-01-02 00:44:42 +01:00
Alexander Barton
f024a4992a portabtest: Add checks for strdup(), strndup(), and strtok_r() 2014-01-01 16:38:36 +01:00
Alexander Barton
d38747d951 portabtest: Actually test functions
Test functions snprintf(), strlcpy(), strlcat(), vsnprintf() for
correctness, not only existance (which was quite useless, because
if they weren't available, the program could not have been linked
at all ...).
2014-01-01 15:57:34 +01:00
Alexander Barton
18070e5381 portabtest: Only use one exit code to indicate errors 2013-12-29 17:48:25 +01:00
Alexander Barton
d913323ca9 portabtest: Code cleanup 2013-12-29 17:46:54 +01:00
Federico G. Schwindt
9230f2fff1 Fix permanent k/gline
Reported by Toni Spets (hifi - at - jnz - dot - fi).
2013-12-29 01:14:28 +01:00
Alexander Barton
86bdf6e1d4 Implement new configuration option "Network"
The new configuration variable "Network" is used to set the (completely
optional) "network name", to which this instance of the daemon belongs.
When set, this name is used in the ISUPPORT(005) numeric which is sent to
all clients connecting to the server after logging in.

Closes bug #165.
2013-12-27 23:16:11 +01:00
Alexander Barton
1a628fff51 WEBIRC: Don't respect hostname when DNS is disabled
When DNS lookups are disabled, don't set the hostname received by the
WEBIRC command, but use the IP address instead.

Reported by Toni Spets <toni.spets@iki.fi>, thanks!

Closes bug #167.
2013-12-27 22:34:47 +01:00
Alexander Barton
bd33bd770d OS X has a working getaddrinfo() implementation 2013-12-27 21:35:53 +01:00
Alexander Barton
b8433e9261 Check for working getaddrinfo() function
At least AIX 4.3.3 and 5.1 have a broken implementation of getaddrinfo()
which doesn't handle "0" as numeric service correctly. This patch adds
a configure check for this case and changes all calling functions to only
use getaddrinfo() if it "works".

See <http://www.stacken.kth.se/lists/heimdal-discuss/2004-05/msg00059.html>
2013-12-27 21:35:13 +01:00
Federico G. Schwindt
5a424f60da Fix spelling 2013-12-07 22:48:31 +00:00
Alexander Barton
444308ccde doc/Platforms.txt: Add and update more systems
- add i386/unknown/netbsdelf1.5.2, egcs-1.1.2
- update i386/unknown/openbsd5.3, gcc 4.2.1
- add i386/unknown/openbsd5.4, gcc 4.2.1
- add x86_64/unknown/linux-gnu, nwcc 0.8.2
- update x86_64/unknown/linux-gnu, tcc 0.9.25

Thanks to Götz Hoffart <goetz@hoffart.de>!
2013-12-03 12:16:23 +01:00
Alexander Barton
1ad536eeed doc/Platforms.txt: Add and update more systems
- add i386/unknown/openbsd3.5, gcc 2.95.3
- add x86_64/unknown/linux-gnu, Sun C 5.12
- update mipsel/unknown/linux-gnu, gcc 4.4.5

Thanks to Götz Hoffart <goetz@hoffart.de>!
2013-11-24 18:32:59 +01:00
Alexander Barton
c68ae1a9f5 doc/Platforms.txt: add DragonflyBSD 3.4 on x86_64
Thanks to Götz Hoffart <goetz@hoffart.de>!
2013-11-13 11:44:44 +01:00
Alexander Barton
df7ea9e7b4 doc/Platforms.txt: add OpenBSD 5.4 on HPPA 2013-11-12 00:33:30 +01:00
Alexander Barton
34824abe0d configure: clean up function definitions 2013-11-12 00:25:28 +01:00
Alexander Barton
ae00c100ac Only use unsetenv() when it is available
AIX 4.3 dosn't support it, for example.
2013-11-10 17:08:51 +01:00
Alexander Barton
61d1c864c5 conf-ssl.h: make code compatible with pre-ANSI C compilers 2013-11-09 23:42:56 +01:00
Alexander Barton
8d25044ce5 vsnprintf.c: make code compatible with ansi2knr tool 2013-11-09 23:41:20 +01:00
Alexander Barton
c3c719b978 Remove unused vsnprintf.c test function 2013-11-09 23:31:51 +01:00
Federico G. Schwindt
9ee3760493 Add comments around some IRC_SetPenalty() calls 2013-11-07 18:17:58 +00:00
Federico G. Schwindt
344185b1bd Rework the penalty handling slightly
Increase the penalty for a command before checking its arguments.  This
makes the handling more consistent and allow us to move more penalties to
Handle_Request().
2013-11-07 16:53:29 +00:00
Federico G. Schwindt
fcf61e9e02 Move IRC_SetPenalty() to Handle_Request() when possible
This centralizes the penalty handling. It also exposes some commands that
lack it for our attention.
2013-11-07 16:29:21 +00:00
Federico G. Schwindt
9f236c4b91 Introduce a macro to define the command list
This will pave the way to other changes and simplifies the entries somewhat.
2013-11-07 13:20:08 +00:00
Federico G. Schwindt
00249f3c80 When sending an error use the IRC_WriteErrClient() variant
This ensures that all errors have a 2 second penalty.
2013-11-07 10:45:34 +00:00
Federico G. Schwindt
925b4de298 On bad /oper set the penalty to 10 seconds
This helps against brute-force attempts.
2013-11-06 21:46:53 +00:00
Federico G. Schwindt
48ea69d778 Remove unneded IRC_SetPenalty() calls
IRC_WriteErrClient() already calls IRC_SetPenalty().  While here convert
some IRC_SetPenalty() + IRC_WriteStrClient() to IRC_WriteErrClient().
2013-11-06 18:28:09 +00:00
Federico G. Schwindt
80d0613bf2 Use sizeof() intead of the explicit size 2013-11-06 18:25:11 +00:00
Alexander Barton
4ab688c5e8 Remove wrong #ifdef in Option_String()
This fixes the following error when compiling without zlib support:

  irc.c: In function ‘Option_String’:
  irc.c:487: error: ‘options’ undeclared (first use in this function)

Reported by "der_baer" on #ngircd.
2013-11-01 19:12:35 +01:00
Alexander Barton
2e93129877 NEWS/ChangeLog: Clean up version numbers and release dates 2013-11-01 00:05:43 +01:00
139 changed files with 3232 additions and 2463 deletions

4
.clang_complete Normal file
View File

@@ -0,0 +1,4 @@
-I./src
-I./src/ipaddr
-I./src/portab
-I./src/tool

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors.
#
# 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.
# Please read the file COPYING, README and AUTHORS for more information.
# .editorconfig: Editor settings, see <http://editorconfig.org>.
root = true
[*]
indent_style = tab
indent_size = 8
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

43
.gitignore vendored
View File

@@ -1,4 +1,5 @@
Makefile Makefile
Makefile.am
Makefile.in Makefile.in
aclocal.m4 aclocal.m4
ansi2knr.1 ansi2knr.1
@@ -7,12 +8,15 @@ ansi2knr.h
ar-lib ar-lib
autom4te.cache autom4te.cache
build-stamp-ngircd* build-stamp-ngircd*
build+*
compile compile
config.cache
config.log config.log
config.status config.status
configure configure
configure.ac configure.ac
configure.lineno configure.lineno
cov-int
cscope.out cscope.out
debian debian
depcomp depcomp
@@ -22,3 +26,42 @@ ngircd.dest
.deps .deps
*.a *.a
*.o *.o
doc/sample-ngircd.conf
doc/src/html
man/ngircd.8
man/ngircd.conf.5
src/config.h
src/config.h.in
src/config.h.in~
src/stamp-h1
src/ngircd/check-help
src/ngircd/check-version
src/ngircd/ngircd
src/ngircd/ngircd.exe
src/portab/portabtest
src/portab/portabtest.exe
src/testsuite/*.e_
src/testsuite/channel-test
src/testsuite/connect-test
src/testsuite/invite-test
src/testsuite/join-test
src/testsuite/kick-test
src/testsuite/logs
src/testsuite/message-test
src/testsuite/misc-test
src/testsuite/mode-test
src/testsuite/ngircd-test1.log
src/testsuite/ngircd-test1.motd
src/testsuite/ngircd-test2.log
src/testsuite/ngircd-test2.motd
src/testsuite/opless-channel-test
src/testsuite/server-link-test
src/testsuite/server-login-test
src/testsuite/T-ngircd1
src/testsuite/T-ngircd1.exe
src/testsuite/T-ngircd2
src/testsuite/T-ngircd2.exe
src/testsuite/tests
src/testsuite/tests-skipped.lst
src/testsuite/who-test
src/testsuite/whois-test

View File

@@ -1,4 +1,14 @@
# mailmap file for git-[short]log and git-blame # mailmap file for git-[short]log and git-blame
# use "git shortlog -se" to see the list of all authors.
Alexander Barton <alex@barton.de> <anonymous>
Alexander Barton <alex@barton.de> <alex@kfreebsd.barton.de>
Alexander Barton <anonymous>
Ali Shemiran <ashemira@ucsd.edu> Ali Shemiran <ashemira@ucsd.edu>
Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu> <dana@cs.ucsd.edu>
Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu> <dana+70@cs.ucsd.edu>
DNS <dns@rbose.org>
LucentW <lucent@zebes.info> <LucentW@users.noreply.github.com>

View File

@@ -1,7 +1,15 @@
language: c language: c
before_install: sudo: false
- sudo apt-get update -qq addons:
- sudo apt-get install -qq libident-dev libpam0g-dev libssl-dev libwrap0-dev zlib1g-dev expect telnet apt:
packages:
- libident-dev
- libpam0g-dev
- libssl-dev
- libwrap0-dev
- zlib1g-dev
- expect
- telnet
compiler: compiler:
- gcc - gcc
- clang - clang

25
AUTHORS
View File

@@ -2,16 +2,18 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
-- AUTHORS and CONTRIBUTORS -- -- AUTHORS and CONTRIBUTORS --
Note: If you have critics, patches or something else, please feel free to Note:
post a mail to the ngIRCd mailing list: <ngircd-ml@arthur.barton.de> (please If you have comments, patches or something else, please feel free to post
see <http://ngircd.barton.de/#ml> for details). a mail to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de> (please see
<http://ngircd.barton.de/support.php> for details) or join the ngIRCd IRC
channel: <irc://irc.barton.de/ngircd>.
Don't mail the people listed here directly, if possible! Don't mail the people listed here directly, if possible!
@@ -31,28 +33,37 @@ Brandon Beresini <beresini@google.com>
Brett Smith <brett@w3.org> Brett Smith <brett@w3.org>
Brian Collins <bricollins@gmail.com> Brian Collins <bricollins@gmail.com>
Bryan Caldwell <bcaldwel@ucsd.edu> Bryan Caldwell <bcaldwel@ucsd.edu>
Christian Aistleitner <christian@quelltextlich.at>
Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de> Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>
DNS <dns@rbose.org>
Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu> Dana Dahlstrom <dana+ngIRCd@cs.ucsd.edu>
David Kingston <deathking1337@aim.com> David Kingston <deathking1337@aim.com>
DNS <dns@rbose.org>
Eric Grunow <egrunow@ucsd.edu> Eric Grunow <egrunow@ucsd.edu>
Federico G. Schwindt <fgsch@lodoss.net> Federico G. Schwindt <fgsch@lodoss.net>
Gabor Adam Toth <tg@tgbit.net> Gabor Adam Toth <tg@tgbit.net>
Goetz Hoffart <goetz@hoffart.de> Goetz Hoffart <goetz@hoffart.de>
Ian Chard <ian@chard.org>
Ilja Osthoff <i.osthoff@gmx.net> Ilja Osthoff <i.osthoff@gmx.net>
Jari Aalto <jari.aalto@cante.net> Jari Aalto <jari.aalto@cante.net>
LucentW <lucent@zebes.info>
Mantas Mikulėnas <grawity@gmail.com>
Neale Pickett <neale@woozle.org> Neale Pickett <neale@woozle.org>
Peter Powell <petpow@saberuk.com>
Rolf Eike Beer <eike@sf-mail.de> Rolf Eike Beer <eike@sf-mail.de>
Roy Sindre Norangshol <roy.sindre@norangshol.no>
Scott Perry <scperry@ucsd.edu> Scott Perry <scperry@ucsd.edu>
Sean Reifschneider <jafo-rpms@tummy.com> Sean Reifschneider <jafo-rpms@tummy.com>
Sebastian Köhler <sebkoehler@whoami.org.uk> Sebastian Köhler <sebkoehler@whoami.org.uk>
Tassilo Schweyer <dev@welterde.de> Tassilo Schweyer <dev@welterde.de>
Tom Ryder <tom@sanctum.geek.nz>
Unit 193 <unit193@ubuntu.com>
William Pitcock <nenolod@dereferenced.org> William Pitcock <nenolod@dereferenced.org>
Yecheng Fu <cofyc.jackson@gmail.com>
xor <xorboy@gmail.com> xor <xorboy@gmail.com>
Code snippets Code snippets
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
J. Kercheval: pattern matching functions
Patrick Powell <papowell@astart.com>: snprintf()-function
Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions
John Kercheval: pattern matching functions
Patrick Powell <papowell@astart.com>: snprintf()-function

368
ChangeLog
View File

@@ -2,19 +2,321 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
-- ChangeLog -- -- ChangeLog --
ngIRCd 24
ngIRCd 24~rc1 (2017-01-07)
- Enhance systemd service file, and install it in Debian package.
- Update configuration of Debian package.
- Log privilege violations and failed OPER request with log level "error"
and send it to the "&SERVER" channel, too.
- Immediately shut down connection when receiving an "ERROR" command,
don't wait for the peer to close the connection. This allows the daemon
to forward the received "ERROR" message in the network, instead of the
very generic "client closed connection" message.
- Fix sending of entry duration (no negative values!) when synchronizing
"x-lines" (G-LINES).
- List expiration (G-LINES): use same log level as when setting, and log
this event to the &SERVER channel, too.
- Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the
"AllowRemoteOper" configuration option isn't set, even when the command
seems to originate from the remote server itself: this prevents GLINE's
to become set during server handshake in this case (what wouldn't be
possible during regular runtime when a remote IRC Op sends the command)
and what can't be undone by IRC Ops later on (because of the missing
"AllowRemoteOper" option) ...
- Make scripts and init-files in ./contrib executable.
- Fix building ngIRCd with OpenSSL 1.1. Thanks to Christoph Biedl
<ngircd.anoy@manchmal.in-ulm.de> for the patch!
- Fix code indentation warnings of gcc 6.2.
- Update config.guess (2016-04-02) and config.sub (2016-03-30) files.
- Fix warnings of the "shellcheck" linter in autogen.sh, contrib/ngindent
and contrib/platformtest.sh.
- Update Xcode project for latest Xcode version (8.0), and fix "duplicate
symbols" error messages when building (linking) the binary.
- Add "Documentation" variables to systemd configuration files.
- Make sure that SYSCONFDIR is always set, which can be handy when
using source code linters when ./configure hasn't been run already.
- Add the new "PAMServiceName" configuration option to specify the name
used as PAM service name. This setting allows to run multiple ngIRCd
instances with different PAM configurations for each instance.
Thanks to Christian Aistleitner <christian@quelltextlich.at> for the
patch, closes #226.
- Add an ".editorconfig" file to the project.
- Travis-CI: use "container-based infrastructure".
- Limit the number of message targets, and suppress duplicates: This
prevents an user from flooding the server using commands like this:
"PRIVMSG nick1,nick1,nick1,...".
Duplicate targets are suppressed silently (channels and clients).
In addition, the maximum number of targets per PRIVMSG, NOTICE, ...
command are limited to MAX_HNDL_TARGETS (25). If there are more, the
daemon sends the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing
the first target that hasn't been handled any more. Closes #187.
- Test suite: Add new test for server-server logins.
- contrib/ngindent: Fix shebang line.
- Make contrib/platformtest.sh script more portable, and only show
"runs=Y" when the test suite really has been passed successfully.
- Code cleanup in the NJON handler and the function killing clients as
well as the function sending messages to a "mask" (cleaner code, more
fault tolerant, better code comments).
- Update and enhance documentation: README file, doc/Platforms.txt,
doc/Modes.txt, doc/Commands.txt, doc/PAM.txt.
- Fix NJOIN not propagating "half ops" status: ngIRCd tested for the wrong
prefix of "half ops" when processing NJOIN commands and therefore never
classified a remote user as "half op".
Thanks to wowaname for pointing this out on #ngircd!
ngIRCd 23 (2015-11-16)
- Explicitly cast time_t to long when printing it out: this prevents
wrong sized data types on platforms where time_t doesn't equal a
long any more, for example on OpenBSD (which would result in garbled
output on those platforms).
- contrib/Debian/changelog: Fix email address.
- Documentation: Spelling fixes; update doc/Platforms.txt.
ngIRCd 23~rc1 (2015-09-06)
- Add ".clang_complete" file, which is used by the "linter-clang" package
of the Atom editor, for example.
- Make server-to-server protocol more robust: ngIRCd now catches more
errors on the server-to-server (S2S) protocol that could crash the
daemon before. This hasn't been a real problem because the IRC S2S
protocol is "trusted" by design, but the behavior is much better now.
Thanks to wowaname on #ngircd for pointing this out!
- Make platformtest.sh, autogen.sh, and ngircd.init more portable.
- Enables "reproducible builds" for ngIRCd: Use the optional BIRTHTIME
constant while building ngIRCd, which contains a time stamp for the
"Birth Date" information, in seconds since the epoch.
See <https://wiki.debian.org/ReproducibleBuilds>.
- Update "contrib/ngircd.service" file for systemd.
- INSTALL: Add deprecation notice for "PredefChannelsOnly" variable.
- Use "NOTICE *" before registration instead of "NOTICE AUTH". "AUTH" is
a valid nickname so sending notices to it is probably not a good idea.
Use "*" as the target instead as done with numerics when the nick is not
available. This mimics the behavior in Charybdis, IRCD-Hybrid, InspIRCd
2.2, Plexus 4, etc. Closes #217.
The "NoticeAuth" configuration variable (ngircd.conf) has been renamed
to "NoticeBeforeRegistration" accordingly, but the old name is still
supported for compatibility reasons.
- Implement new channel mode "N" (regular users can't change their nick
name while on this channel). Closes #214.
- README, AUTHORS: Update mailing list and issue tracker URLs.
- Remove doc/GIT.txt (it is outdated), update doc/Contributing.txt:
ngIRCd uses GitHub, and Git itself is quite common today. So don't
include an own Git "mini HowTo" any longer.
- Specify session context for OpenSSL clients. This enables some OpenSSL
clients, including Pidgin and stunnel 5.06, to reuse a session.
Patch by Tom Ryder <tom@sanctum.geek.nz>, thanks! Closes #182.
- Keep track of who placed bans, invites, and excepts.
Idea and implementation by LucentW, Thanks! Closes #203.
- Make setgroups(3) function optional: For example, Interix is missing
this function, which prevented ngIRCd to build on this platform. When
setgroups(3) isn't available, a warning message is issued on startup.
- Implement numeric RPL_LISTSTART(321). lightIRC and other clients
expecting RPL_LISTSTART should now behave correctly.
Idea and implementation by LucentW, Thanks! Closes #207.
- Update ngircd.conf.5: "CloakUserToNick" hides user _and_ real name.
This closes #208.
- Fix case insensitive pattern matching: Up to now, only the the input
string became lowercased and was then compared to the pattern -- which
failed when the pattern itself wasn't all lowercase!
- Streamline the effect of "MorePrivacy" option: Update documentation
in ngircd.conf(5); don't hide channels for IRC Ops on LIST and don't
hide IP addresses/hostnames on WHOIS when "MorePrivacy" is in effect.
This closes #198.
- IRC operators now can kick anyone when "OperCanMode" is set.
Idea and implementation by LucentW, Thanks! Closes #202.
- Implement user mode "I": Hide channels on WHOIS: this mode prevents
ngIRCd from showing channels on WHOIS (IRC Operators can always see
the channel list).
Idea and implementation by LucentW, Thanks! Closes #197.
- INVITE command: Implement ERR_USERNOTONSERV(504) numeric and make sure
that the target user is on the same server when inviting other users
to local ("&") channels.
Idea by Cahata, thanks! Closes #183.
- INVITE command: Enforce 1 second penalty time, which prevents flooding
of the target client.
This closes #186. Reported by Cahata, thanks!
- MODE command: Always report channel creation time. Up to now when
receiving a MODE command, ngIRCd only reported the channel creation
time to clients that were members of the channel. This patch reports
the channel creation time to all clients, regardless if they are joined
to that channel or not. At least ircd-seven behaves like this.
This closes #188. Reported by Cahata, thanks!
- Update Xcode project for latest Xcode version (6.3).
ngIRCd 22.1 (2015-04-06)
- Update doc/Platforms.txt and doc/FAQ.txt.
- Fix spelling of RPL_WHOISBOT message text.
- Don't send nick name as default PART reason: No other IRC daemon seems
to do this (today?). Closes #185.
Reported by Cahata in #ngircd, thanks!
- Fix "WHO #<chan>" showing invisible users and hiding all visible, the
logic was reversed! This bug has been introduced by commit c74115f2,
"Simplify mode checking on channels and users within a channel", ngIRCd
releases 21, 21.1, and 22 are affected :-( Problem reported by Cahata
in #ngircd, Thanks!
- Fix typo in src/testsuite/README
- Auth PING: Fix our information text for manual sending of "PONG". Up to
now, ngIRCd doesn't send a valid IRC command at all, oops!
- Auth PING: Fix internal time stamp conversion and don't send a prefix in
our PING command. The prefix confuses WeeChat, at least, which doesn't
send an appropriate PONG in the case ...
Debugging and patch by "wowaname" on #ngircd, thanks!
- Fix syntax of ERR_LISTFULL_MSG(478) numeric. Pointed out by "wowaname"
in #ngircd, thanks!
- Enhance debug messages while sending CHANINFO commands.
- Reset "last try" timer when enabling a passive server. This results in
a new connection attempt as soon as possible.
- Change log message for "Can't resolve address" and for IP address
forgeries.
- doc/HowToRelease.txt: Add note about the bug tracker.
- Update "CipherList" to not enable SSLv3 by default. Idea, initial patch,
and testing by Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>.
- Change ngIRCd test suite not to use DNS lookups: Different operating
systems do behave quite differently when doing DNS lookups, for example
"127.0.0.1" sometimes resolves to "localhost" and sometimes to
"localhost.localdomain" (for example OpenBSD). And other OS resolve
"localhost" to the real host name (for example Cygwin). So not using
DNS at all makes the test site much more portable.
ngIRCd 22 (2014-10-11)
- Match all list patterns case-insensitive: this affects the invite-,
ban-, and except lists, as well as G-Lines an K-Lines.
Problem pointed out by "wowaname" on #ngircd, thanks!
ngIRCd 22~rc1 (2014-09-29)
- Sync "except lists" between servers: Up to now, ban, invite, and G-Line
lists have been synced between servers while linking -- but obviously
nobody noticed that except list have been missing ever since. Until now.
Thanks to "j4jackj", who reported this issue in #ngircd.
- Allow longer user names (up to 63 characters) for authentication.
- Correctly check that a server has a valid hostname and port, thanks to
David Binderman <dcb314@hotmail.com> who reported this bug.
- Fix the function which generates complete "IRC masks" from user input,
don't destroy the source buffer and use all provided parts (nick, user,
host name). This fixes GLINEs/KLINEs from not working in some situations.
- Increase MAX_SERVERS from 16 to 64: There are installations out there
that would like to configure more than 16 links per server, so increase
this limit. Best would be to get rid of MAX_SERVERS altogether and make
if fully dynamic, but start with this quick and dirty hack ...
- Debian: Don't adjust path names that are correct by default and correctly
set and use "docdir".
- Update config.guess and config.sub to recent versions.
- Test suite/platformtest.sh: Detect when tests have been skipped.
- doc/Bopm.txt: Update "connregex" and "kline" for current ngIRCd.
- Allow "DefaultUserModes" to set all possible modes, including modes only
settable by IRC Operators.
- Spoofed prefixes: Really kill connection on non-server links.
- Implement user mode "F": "relaxed flood protection". Clients with mode
"F" set are allowed to rapidly send data to the daemon. This mode is only
settable by IRC Operators and can cause problems in the network -- so be
careful and only set it on "trusted" clients!
User mode "F" is used by Bahamut for this purpose, for example.
- Handle "throttling" in a single function: ngIRCd implements "command
throttling" and "bps throttling" (bytes per second). The states are
detected in different functions, Conn_Handler() and Read_Request(), but
handle the actual "throttling" in a common function: this enables us to
guarantee consistent behavior and to disable throttling for special
connections in only one place
- Use server password when PAM is compiled in but disabled.
- Streamline punctuation of log messages.
- Return ISUPPORT(005) numerics on "VERSION". This is how ircd-seven,
Charybdis, Hybrid, and InspIRCd behave, for example.
- configure: Only link "contrib/Debian" if it exists, which isn't the case
on "VPATH builds", for example.
- Show the account name in WHOIS. This uses the same numeric as Charybdis
and ircu families: WHOISLOGGEDIN(330).
- Pattern matching: Remove "range matching" in our pattern matching code
using the "[...]" syntax, because [ and ] are valid characters in nick
names and one has to quote them currently using the "\" character, which
is quite unexpected for users.
- platformtest.sh: New option "-x", don't regenerate build system and
allow using separate source and build trees.
- Test suite: explicitly enable glibc memory checking.
- Make "MODE -k" handling more robust and compatible, send "fake '*' key"
in all replies.
- Update configure.ng: ngIRCd requires GNU autoconf 2.61 for generating its
build system, so update the build system accordingly and implement all
changes that autoupdate(1) suggests: Update AC_PREREQ and AC_INIT, use
AC_LINK_IFELSE, AC_RUN_IFELSE, and AC_COMPILE_IFELSE, and remove
AC_TYPE_SIGNAL (we don't use RETSIGTYPE).
- portabtest: Actually test the functions snprintf(), strlcpy(), strlcat(),
and vsnprintf() for correctness, not only existence (which was quite
useless, because if they weren't available, the program could not have
been linked at all ...).
- Implement new configuration option "Network": it is used to set the
(completely optional) "network name", to which this instance of the
daemon belongs. When set, this name is used in the ISUPPORT(005) numeric
which is sent to all clients connecting to the server after logging in.
- Update doc/Platforms.txt.
- Various code cleanups, remove unused code, streamline error handling.
Remove all imp.h and exp.h header files, support non-standard vsnprintf()
return codes, and fix some K&R C portability issues. Streamline
DEBUG_ARRAY, DEBUG_BUFFER, DEBUG_IO, DEBUG_ZIP definitions.
- Increase penalty time to 10 seconds when handling OPER commands with an
invalid password.
ngIRCd 21.1 (2014-03-25)
- Don't ignore but use the server password when PAM is compiled in but
disabled. Thanks to Roy Sindre Norangshol <roy.sindre@norangshol.no>!
- doc/Platforms.txt: Update from master branch.
- Really kill connections that send "spoofed prefixes" on non-server links.
This fixes commit 6cbe1308 which only killed the connection when the
spoofed prefix itself belonged to a non-server client.
- CHARCONV command: Fix handling conversion errors, don't overwrite already
converted text!
- doc/Services.txt: Update information for Anope 2.x.
- Correctly use cloaked IRC masks on "INVITE nickname": The cloaked IRC mask
of a user is his visible mask, so the daemon has to use it for generating
the "one time" entries for the invite list of the given channel, and not
the "real" mask which will never match while the target client is "+x", and
even worse, will disclose the real mask on "MODE #channel +I" commands :-/
Bug reported by Cahata on #ngircd, thanks!
- configure: Only link "contrib/Debian" if it exists. This isn't the case on
"VPATH builds", for example.
- Use $(MKDIR_P) instead of $(mkinstalldirs) in Makefile's and test for
"mkdir -p" using AC_PROG_MKDIR_P in "configure".
- Fix configure script and "make check" for TCP Wrappers (problems spotted on
OpenBSD): add missing #include's and static variables, and add libwrap at
the end of the configure run because if libwrap becomes added earlier,
other tests may fail.
- configure: add support for the LDFLAGS_END and LIBS_END variables to add
linker flags and libraries at the end of the configure run (CFLAGS_END has
been implemented already).
- platformtest.sh and Makefile.am: Don't use "test -e", it isn't portable.
- Update Copyright notices for 2014 :-)
- Fix permanent {G|K}LINES (with a timeout of 0 seconds).
- WEBIRC: Don't set the hostname received by the WEBIRC command when DNS
lookups are disabled, but use the IP address instead.
Reported by Toni Spets <toni.spets@iki.fi>, thanks!
- Check for working getaddrinfo() function: At least AIX 4.3.3 and 5.1 have a
broken implementation of getaddrinfo() which doesn't handle "0" as numeric
service correctly. This patch adds a configure check for this case and
changes all calling functions to only use getaddrinfo() if it "works".
See <http://www.stacken.kth.se/lists/heimdal-discuss/2004-05/msg00059.html>
- Only use the unsetenv() function when it is available (AIX 4.3 doesn't
support it, for example).
- Make sure that the source code is still compatible with the "ansi2knr" tool
and builds using non-ANSI K&R C compilers. Tested with Apple C on A/UX.
- Fix building ngIRCd without support for ZLIB compression. Reported by
"der_baer" on #ngircd, thanks!
ngIRCd 21 (2013-10-30) ngIRCd 21 (2013-10-30)
- ./contrib/Debian/ngircd.init: Make sure no stale PID file is left over - ./contrib/Debian/ngircd.init: Make sure no stale PID file is left over
when (re-)starting ngIRCd. when (re-)starting ngIRCd.
- Change ./contrib/platformtest.sh and update ./doc/Platforms.txt to - Change ./contrib/platformtest.sh and update ./doc/Platforms.txt to
allow usernames up to 8 characters. allow user names up to 8 characters.
- Call arc4random_stir() in forked subprocesses, when available. This - Call arc4random_stir() in forked subprocesses, when available. This
is required by FreeBSD <10 and current NetBSD at least to correctly is required by FreeBSD <10 and current NetBSD at least to correctly
initialize the "arc4" random number generator on these platforms. initialize the "arc4" random number generator on these platforms.
@@ -374,7 +676,7 @@ ngIRCd 20 (2012-12-17)
the hash function. When "CloakHostSalt" is not set (the default), a the hash function. When "CloakHostSalt" is not set (the default), a
random salt will be generated after each server restart. (Closes #133) random salt will be generated after each server restart. (Closes #133)
ngIRCd Release 19.2 (2012-06-19) ngIRCd 19.2 (2012-06-19)
- doc/Capabilities.txt: document "multi-prefix" capability - doc/Capabilities.txt: document "multi-prefix" capability
@@ -398,13 +700,13 @@ ngIRCd Release 19.2 (2012-06-19)
"CC=xxx MAKE=yyy ./platformtest.sh" calling convention. "CC=xxx MAKE=yyy ./platformtest.sh" calling convention.
- Add instructions for setting up Atheme IRC services. - Add instructions for setting up Atheme IRC services.
- Implement support for IRC capability handling, the new "CAP" command, - Implement support for IRC capability handling, the new "CAP" command,
and capablity "multi-prefix" which allows both the NAME and WHO command and capability "multi-prefix" which allows both the NAME and WHO command
handlers to return more than one "class prefix" to the client. handlers to return more than one "class prefix" to the client.
- Update Xcode project files: reference missing documentation files. - Update Xcode project files: reference missing documentation files.
- Fix: Don't ignore "permission denied" errors when enabling chroot. - Fix: Don't ignore "permission denied" errors when enabling chroot.
- FAQ: enhance description of chroot setup. - FAQ: enhance description of chroot setup.
ngIRCd Release 19.1 (2012-03-19) ngIRCd 19.1 (2012-03-19)
- Fix gcc warning (v4.6.3), initialize "list" variable to NULL. - Fix gcc warning (v4.6.3), initialize "list" variable to NULL.
- Fix typos: "recieved" -> "received", "Please not" -> "Please note", - Fix typos: "recieved" -> "received", "Please not" -> "Please note",
@@ -414,7 +716,7 @@ ngIRCd Release 19.1 (2012-03-19)
- getpid.sh: Fix test case error for Debian using sbuild(1). - getpid.sh: Fix test case error for Debian using sbuild(1).
- Don't log "ngIRCd hello message" two times when starting up. - Don't log "ngIRCd hello message" two times when starting up.
ngIRCd Release 19 (2012-02-29) ngIRCd 19 (2012-02-29)
- Update build system: bump config.guess and config.sub files used by - Update build system: bump config.guess and config.sub files used by
GNU autoconf/automake to recent versions. GNU autoconf/automake to recent versions.
@@ -564,7 +866,7 @@ ngIRCd Release 19 (2012-02-29)
asynchronous nature of the IRC protocol. So don't break server- asynchronous nature of the IRC protocol. So don't break server-
links, only log a message and ignore the command. (Closes #113) links, only log a message and ignore the command. (Closes #113)
ngIRCd Release 18 (2011-07-10) ngIRCd 18 (2011-07-10)
- Update timestamp of ngircd(8) manual page. - Update timestamp of ngircd(8) manual page.
- Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/. - Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/.
@@ -674,7 +976,7 @@ ngIRCd Release 18 (2011-07-10)
only relevant when a trusted server on a server-server link sends invalid only relevant when a trusted server on a server-server link sends invalid
commands). commands).
ngIRCd Release 17.1 (2010-12-19) ngIRCd 17.1 (2010-12-19)
- --configtest: remember if MOTD is configured by file or phrase - --configtest: remember if MOTD is configured by file or phrase
- Enhance log messages when establishing server links a little bit - Enhance log messages when establishing server links a little bit
@@ -690,7 +992,7 @@ ngIRCd Release 17.1 (2010-12-19)
- New numeric 329: get channel creation time on "MODE #chan" commands - New numeric 329: get channel creation time on "MODE #chan" commands
- Save channel creation time; new function Channel_CreationTime() - Save channel creation time; new function Channel_CreationTime()
ngIRCd Release 17 (2010-11-07) ngIRCd 17 (2010-11-07)
- doc: change path names in sample-ngircd.conf depending on sysconfdir - doc: change path names in sample-ngircd.conf depending on sysconfdir
- Fix up generation and distribution of sample-ngircd.conf - Fix up generation and distribution of sample-ngircd.conf
@@ -698,7 +1000,7 @@ ngIRCd Release 17 (2010-11-07)
- contrib/platformtest.sh: make command name quoting consistent - contrib/platformtest.sh: make command name quoting consistent
ngIRCd 17~rc3 (2010-10-27) ngIRCd 17~rc3 (2010-10-27)
- Xcode builds: detect version number correctly, updateed project file - Xcode builds: detect version number correctly, updated project file
to use the Mac OS X 10.5.x SDK, disable pam_fail_delay() because it to use the Mac OS X 10.5.x SDK, disable pam_fail_delay() because it
is only available starting with Mac OS X 10.6, and generate a default is only available starting with Mac OS X 10.6, and generate a default
PAM configuration for the Mac OS X Installer.app package of ngIRCd. PAM configuration for the Mac OS X Installer.app package of ngIRCd.
@@ -710,7 +1012,7 @@ ngIRCd Release 17 (2010-11-07)
ngIRCd 17~rc2 (2010-10-25) ngIRCd 17~rc2 (2010-10-25)
- ZeroConf: include header files missing since commit a988bbc86a. - ZeroConf: include header files missing since commit a988bbc86a.
- Generate ngIRCd version number from GIT tag. - Generate ngIRCd version number from GIT tag.
- Make sourcecode compatible with ansi2knr again. This allows to compile - Make source code compatible with ansi2knr again. This allows to compile
ngIRCd using a pre-ANSI K&R C compiler again. ngIRCd using a pre-ANSI K&R C compiler again.
- ./configure: check if C compiler can compile ISO Standard C. - ./configure: check if C compiler can compile ISO Standard C.
- ./configure: check support for C prototypes again. - ./configure: check support for C prototypes again.
@@ -726,7 +1028,7 @@ ngIRCd Release 17 (2010-11-07)
Howl, Avahi or on Mac OS X). Howl, Avahi or on Mac OS X).
- New configuration option "SyslogFacility" to define the syslog "facility" - New configuration option "SyslogFacility" to define the syslog "facility"
(the "target"), to which ngIRCd should send its log messages. (the "target"), to which ngIRCd should send its log messages.
Possible values are system dependant, but most probably "auth", "daemon", Possible values are system dependent, but most probably "auth", "daemon",
"user" and "local1" through "local7" are possible values; see syslog(3). "user" and "local1" through "local7" are possible values; see syslog(3).
Default is "local5" for historical reasons. Default is "local5" for historical reasons.
- Dump the "internal server state" (configured servers, established - Dump the "internal server state" (configured servers, established
@@ -747,7 +1049,7 @@ ngIRCd Release 17 (2010-11-07)
- Make configure switch "--docdir" work (closes: #108). - Make configure switch "--docdir" work (closes: #108).
- Reformat and update FAQ.txt a little bit. - Reformat and update FAQ.txt a little bit.
- INSTALL: mention SSL, IPv6, and changed handling of MotdFile. - INSTALL: mention SSL, IPv6, and changed handling of MotdFile.
- Change MOTD file handling: ngIRCd now caches the contens of the MOTD - Change MOTD file handling: ngIRCd now caches the contents of the MOTD
file, so the daemon now requires a HUP signal or REHASH command to file, so the daemon now requires a HUP signal or REHASH command to
re-read the MOTD file when its content changed. re-read the MOTD file when its content changed.
- Startup: open /dev/null before chroot'ing the daemon. - Startup: open /dev/null before chroot'ing the daemon.
@@ -771,7 +1073,7 @@ ngIRCd Release 17 (2010-11-07)
- Fix "beeing" typo ... - Fix "beeing" typo ...
- SSL/TLS: fix bogus "socket closed" error message. - SSL/TLS: fix bogus "socket closed" error message.
ngIRCd Release 16 (2010-05-02) ngIRCd 16 (2010-05-02)
- doc/SSL: remove line continuation marker - doc/SSL: remove line continuation marker
@@ -783,14 +1085,14 @@ ngIRCd Release 16 (2010-05-02)
- Include netinet/{in.h, in_systm.h} when checking for netinet/ip.h - Include netinet/{in.h, in_systm.h} when checking for netinet/ip.h
- Only include <netinet/in_systm.h> if it exists - Only include <netinet/in_systm.h> if it exists
- Updated doc/Platforms.txt - Updated doc/Platforms.txt
- Enhace connection statistics counters: display total number of served - Enhance connection statistics counters: display total number of served
connections on daemon shutdown and when a new client connects using connections on daemon shutdown and when a new client connects using
the new numeric RPL_STATSCONN (250). the new numeric RPL_STATSCONN (250).
ngIRCd 16~rc1 (2010-03-25) ngIRCd 16~rc1 (2010-03-25)
- Various fixes to the build system and code cleanups. - Various fixes to the build system and code cleanups.
- contrib/platformtest.sh: Only show latest commit. - contrib/platformtest.sh: Only show latest commit.
- Updatet doc/Platforms.txt, added new README-Interix.txt documenting - Updated doc/Platforms.txt, added new README-Interix.txt documenting
how to tun ngIRCd on Microsoft Services for UNIX (MS SFU, MS SUA). how to tun ngIRCd on Microsoft Services for UNIX (MS SFU, MS SUA).
- Updated links to the ngIRCd homepage (bug tracker, mailing list). - Updated links to the ngIRCd homepage (bug tracker, mailing list).
- Added missing modes to USERMODES #define - Added missing modes to USERMODES #define
@@ -811,14 +1113,14 @@ ngIRCd Release 16 (2010-05-02)
every channel, and c) remote clients using a server not supporting this every channel, and c) remote clients using a server not supporting this
mode are not checked either and therefore always allowed to join. mode are not checked either and therefore always allowed to join.
ngIRCd Release 15 (2009-11-07) ngIRCd 15 (2009-11-07)
- "ngircd --configtest": print SSL configuration options even when unset. - "ngircd --configtest": print SSL configuration options even when unset.
ngIRCd 15~rc1 (2009-10-15) ngIRCd 15~rc1 (2009-10-15)
- Do not add default listening port (6667) if SSL ports were specified, so - Do not add default listening port (6667) if SSL ports were specified, so
ngIRCd can be configured to only accept SSL-encrypted connections now. ngIRCd can be configured to only accept SSL-encrypted connections now.
- Enable IRC operators to use the IRC command SQUIT (insted of the already - Enable IRC operators to use the IRC command SQUIT (instead of the already
implemented but non-standard DISCONNECT command). implemented but non-standard DISCONNECT command).
- New configuration option "AllowRemoteOper" (disabled by default) that - New configuration option "AllowRemoteOper" (disabled by default) that
enables remote IRC operators to use the IRC commands SQUIT and CONNECT enables remote IRC operators to use the IRC commands SQUIT and CONNECT
@@ -837,7 +1139,7 @@ ngIRCd Release 15 (2009-11-07)
- Fix a few error handling glitches for SSL/TLS connections. - Fix a few error handling glitches for SSL/TLS connections.
- Minor fixes to manual pages and documentation. - Minor fixes to manual pages and documentation.
ngIRCd Release 14.1 (2009-05-05) ngIRCd 14.1 (2009-05-05)
- Security: fix remotely triggerable crash in SSL/TLS code. - Security: fix remotely triggerable crash in SSL/TLS code.
- BSD start script contrib/ngircd.sh has been renamed to ngircd-bsd.sh. - BSD start script contrib/ngircd.sh has been renamed to ngircd-bsd.sh.
@@ -850,7 +1152,7 @@ ngIRCd Release 14.1 (2009-05-05)
- Fix server list announcement. - Fix server list announcement.
- Do not remove host names from info text. - Do not remove host names from info text.
ngIRCd Release 14 (2009-04-20) ngIRCd 14 (2009-04-20)
- Display IPv6 addresses as "[<addr>]" when accepting connections. - Display IPv6 addresses as "[<addr>]" when accepting connections.
@@ -872,9 +1174,9 @@ ngIRCd Release 14 (2009-04-20)
- Fix memory leak when a encrypted and compressed server link goes down. - Fix memory leak when a encrypted and compressed server link goes down.
(closes bug #95, reported by Christoph, fiesh@fiesh.homeip.net) (closes bug #95, reported by Christoph, fiesh@fiesh.homeip.net)
- Fix handling of channels containing dots. - Fix handling of channels containing dots.
(closes ug #93, reported by Gonosz Csiga) (closes bug #93, reported by Gonosz Csiga)
ngIRCd Release 13 (2008-12-25) ngIRCd 13 (2008-12-25)
- Updated documentation, especially doc/Services.txt and doc/SSL.txt. - Updated documentation, especially doc/Services.txt and doc/SSL.txt.
- Make the test suite work on OpenSolaris. - Make the test suite work on OpenSolaris.
@@ -965,7 +1267,7 @@ ngIRCd 0.11.0 (2008-01-15)
ngIRCd 0.11.0-pre2 (2008-01-07) ngIRCd 0.11.0-pre2 (2008-01-07)
- SECURITY: IRC_PART could reference invalid memory, causing - SECURITY: IRC_PART could reference invalid memory, causing
ngircd to crash [from HEAD]. (CVE-2008-0285) ngircd to crash [from HEAD]. (CVE-2008-0285)
ngIRCd 0.11.0-pre1 (2008-01-02) ngIRCd 0.11.0-pre1 (2008-01-02)
- Use dotted-decimal IP address if host name is >= 64. - Use dotted-decimal IP address if host name is >= 64.
- Add support for /STAT u (server uptime) command. - Add support for /STAT u (server uptime) command.
@@ -999,7 +1301,7 @@ ngIRCd 0.10.4 (2008-01-07)
- SECURITY: IRC_PART could reference invalid memory, causing - SECURITY: IRC_PART could reference invalid memory, causing
ngircd to crash [from HEAD]. (CVE-2008-0285) ngircd to crash [from HEAD]. (CVE-2008-0285)
ngIRCd 0.10.3 (2007-08-01) ngIRCd 0.10.3 (2007-08-01)
- SECURITY: Fixed a severe bug in handling JOIN commands, which could - SECURITY: Fixed a severe bug in handling JOIN commands, which could
@@ -1102,7 +1404,7 @@ ngIRCd 0.9.0 (2005-07-24)
- Fixed ./configure test for TCP Wrappers: now it runs on Mac OS X as well. - Fixed ./configure test for TCP Wrappers: now it runs on Mac OS X as well.
- Enhanced configure script: now you can pass an (optional) search path - Enhanced configure script: now you can pass an (optional) search path
to all --with-XXX parameters, e. g. "--with-ident=/opt/ident". to all --with-XXX parameters, e. g. "--with-ident=/opt/ident".
- Removed typedefs for the native C datatypes. - Removed typedefs for the native C data types.
Use stdbool.h / inttypes.h if available. Use stdbool.h / inttypes.h if available.
- New configuration option "OperServerMode" to enable a workaround needed - New configuration option "OperServerMode" to enable a workaround needed
when running an network with ircd2 servers and "OperCanUseMode" enabled when running an network with ircd2 servers and "OperCanUseMode" enabled
@@ -1283,7 +1585,7 @@ ngIRCd 0.7.0 (2003-05-01)
to add a new server (ngIRCd tries to connect new servers only once!). to add a new server (ngIRCd tries to connect new servers only once!).
- Added DISCONNECT command ("DISCONNECT <name>") to disable servers. - Added DISCONNECT command ("DISCONNECT <name>") to disable servers.
- Restructured the documentation: Now the main language is English. The - Restructured the documentation: Now the main language is English. The
german documentation has been removed (until there is a maintainer). German documentation has been removed (until there is a maintainer).
- Enhanced killing of users caused by a nickname collision. - Enhanced killing of users caused by a nickname collision.
- Better error detection for status code ("numerics") forwarding. - Better error detection for status code ("numerics") forwarding.
- Moved tool functions to own library: "libngtool". - Moved tool functions to own library: "libngtool".
@@ -1305,7 +1607,7 @@ ngIRCd 0.7.0 (2003-05-01)
- Documentation is now installed in $(datadir)/doc/ngircd. - Documentation is now installed in $(datadir)/doc/ngircd.
- Enhanced handling of NJOIN in case of nick collisions. - Enhanced handling of NJOIN in case of nick collisions.
ngIRCd 0.6.1, 2003-01-21 ngIRCd 0.6.1 (2003-01-21)
- Fixed KILL: you can't crash the server by killing yourself any more, - Fixed KILL: you can't crash the server by killing yourself any more,
ngIRCd no longer sends a QUIT to other servers after the KILL, and you ngIRCd no longer sends a QUIT to other servers after the KILL, and you
@@ -1324,17 +1626,17 @@ ngIRCd 0.6.1, 2003-01-21
member when changing his channel user modes which could crash ngIRCd. member when changing his channel user modes which could crash ngIRCd.
Older changes (sorry, only available in german language): Older changes (sorry, only available in German language):
ngIRCd 0.6.0, 2002-12-24 ngIRCd 0.6.0, 24.12.2002
ngIRCd 0.6.0-pre2, 2002-12-23 ngIRCd 0.6.0-pre2, 23.12.2002
- neuer Numeric 005 ("Features") beim Connect. - neuer Numeric 005 ("Features") beim Connect.
- LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen - LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen
Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start
dem Server gleichzeitig bekannt waren, angezeigt. dem Server gleichzeitig bekannt waren, angezeigt.
ngIRCd 0.6.0-pre1, 2002-12-18 ngIRCd 0.6.0-pre1, 18.12.2002
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an. noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
- der Server wartet bei einer eingehenden Verbindung nun laenger auf den - der Server wartet bei einer eingehenden Verbindung nun laenger auf den
@@ -1385,7 +1687,7 @@ ngIRCd 0.6.0, 2002-12-24
ngIRCd 0.5.4, 24.11.2002 ngIRCd 0.5.4, 24.11.2002
- Fehler-Handling von connect() gefixed: der Server kann sich nun auch - Fehler-Handling von connect() gefixed: der Server kann sich nun auch
unter A/UX wieder zu anderen verbinden. unter A/UX wieder zu anderen verbinden.
- in den Konfigurationsvariablen ServerUID und ServerGID kann nun nicht - in den Konfigurationsvariablen ServerUID und ServerGID kann nun nicht
nur die numerische ID, sondern auch der Name des Users bzw. der Gruppe nur die numerische ID, sondern auch der Name des Users bzw. der Gruppe
@@ -1497,7 +1799,7 @@ ngIRCd 0.5.0, 20.09.2002
- ADMIN-Befehl implementiert. Die Daten hierzu werden in der Konfig-Datei - ADMIN-Befehl implementiert. Die Daten hierzu werden in der Konfig-Datei
im [Global]-Abschnitt mit den Variablen "AdminInfo1", "AdminInfo2" und im [Global]-Abschnitt mit den Variablen "AdminInfo1", "AdminInfo2" und
"AdminEMail" konfiguriert. "AdminEMail" konfiguriert.
ngIRCd 0.4.3, 11.06.2002 ngIRCd 0.4.3, 11.06.2002
- Bei PRIVMSG und NOTICE hat der ngIRCd nicht ueberpruft, ob das Ziel - Bei PRIVMSG und NOTICE hat der ngIRCd nicht ueberpruft, ob das Ziel

45
INSTALL
View File

@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -12,17 +12,34 @@
I. Upgrade Information I. Upgrade Information
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
Differences to version 22.x
- The "NoticeAuth" ngircd.conf configuration variable has been renamed to
"NoticeBeforeRegistration". The old "NoticeAuth" variable still works but
is deprecated now.
- The default value of the SSL "CipherList" variable has been changed to
"HIGH:!aNULL:@STRENGTH:!SSLv3" (OpenSSL) and "SECURE128:-VERS-SSL3.0"
(GnuTLS) to disable the old SSLv3 protocol by default.
To enable connections of clients still requiring the weak SSLv3 protocol,
the "CipherList" must be set to its old value (not recommended!), which
was "HIGH:!aNULL:@STRENGTH" (OpenSSL) and "SECURE128" (GnuTLS), see below.
Differences to version 20.x Differences to version 20.x
- Starting with ngIRCd 21, the ciphers used by SSL are configurable and - Starting with ngIRCd 21, the ciphers used by SSL are configurable and
default to HIGH:!aNULL:@STRENGTH (OpenSSL) or SECURE128 (GnuTLS). default to "HIGH:!aNULL:@STRENGTH" (OpenSSL) or "SECURE128" (GnuTLS).
Previous version were using the OpenSSL or GnuTLS defaults, DEFAULT Previous version were using the OpenSSL or GnuTLS defaults, "DEFAULT"
and NORMAL respectively. and "NORMAL" respectively.
- When adding GLINE's or KLINE's to ngIRCd 21 (or newer), all clients matching - When adding GLINE's or KLINE's to ngIRCd 21 (or newer), all clients matching
the new mask will be KILL'ed. This was not the case with earlier versions the new mask will be KILL'ed. This was not the case with earlier versions
that only added the mask but didn't kill already connected users. that only added the mask but didn't kill already connected users.
- The "PredefChannelsOnly" configuration variable has been superseded by the
new "AllowedChannelTypes" variable. It is still supported and translated to
the appropriate "AllowedChannelTypes" setting but is deprecated now.
Differences to version 19.x Differences to version 19.x
- Starting with ngIRCd 20, users can "cloak" their hostname only when the - Starting with ngIRCd 20, users can "cloak" their hostname only when the
@@ -31,7 +48,7 @@ Differences to version 19.x
set mode +x. This prevents regular users from changing their hostmask to set mode +x. This prevents regular users from changing their hostmask to
the name of the IRC server itself, which confused quite a few people ;-) the name of the IRC server itself, which confused quite a few people ;-)
Differences to version 17 Differences to version 17.x
- Support for ZeroConf/Bonjour/Rendezvous service registration has been - Support for ZeroConf/Bonjour/Rendezvous service registration has been
removed. The configuration option "NoZeroconf" is no longer available. removed. The configuration option "NoZeroconf" is no longer available.
@@ -68,7 +85,7 @@ Differences to version 17
You should adjust your ngircd.conf and run "ngircd --configtest" to make You should adjust your ngircd.conf and run "ngircd --configtest" to make
sure that your settings are correct and up to date! sure that your settings are correct and up to date!
Differences to version 16 Differences to version 16.x
- Changes to the "MotdFile" specified in ngircd.conf now require a ngircd - Changes to the "MotdFile" specified in ngircd.conf now require a ngircd
configuration reload to take effect (HUP signal, REHASH command). configuration reload to take effect (HUP signal, REHASH command).
@@ -145,7 +162,7 @@ If you are using one of the "big" operating systems or Linux distributions,
you can use the following commands to install all the required packages to you can use the following commands to install all the required packages to
build the sources including all optional features and to run the test suite: build the sources including all optional features and to run the test suite:
* RedHat / Fedora based distributions: * Red Hat / Fedora based distributions:
yum install \ yum install \
autoconf automake expect gcc glibc-devel gnutls-devel \ autoconf automake expect gcc glibc-devel gnutls-devel \
@@ -169,8 +186,8 @@ This step is therefore only interesting for developers.
autogen.sh produces the Makefile.in's, which are necessary for the configure autogen.sh produces the Makefile.in's, which are necessary for the configure
script itself, and some more files for make. To run autogen.sh you'll need script itself, and some more files for make. To run autogen.sh you'll need
GNU autoconf and GNU automake: at least autoconf 2.61 and automake 1.10 are GNU autoconf and GNU automake: at least autoconf 2.61 and automake 1.10 are
requird, newer is better. But don't use automake 1.12 or newer for creating required, newer is better. But don't use automake 1.12 or newer for creating
distribution archives: it will work but lack "de-ANSI-fucation" support in the distribution archives: it will work but lack "de-ANSI-fication" support in the
generated Makefile's! Stick with automake 1.11.x for this purpose ... generated Makefile's! Stick with automake 1.11.x for this purpose ...
So automake 1.11.x and autoconf 2.67+ is recommended. So automake 1.11.x and autoconf 2.67+ is recommended.
@@ -226,7 +243,7 @@ which will be used to search for the required libraries and header files in
the given paths ("<path>/lib/...", "<path>/include/...") in addition to the the given paths ("<path>/lib/...", "<path>/include/...") in addition to the
standard locations. standard locations.
* Syslog Logging (autodetected by default): * Syslog Logging (autodetected by default):
--with-syslog[=<path>] / --without-syslog --with-syslog[=<path>] / --without-syslog
Enable (disable) support for logging to "syslog", which should be Enable (disable) support for logging to "syslog", which should be
@@ -237,13 +254,13 @@ standard locations.
Enable (disable) support for compressed server-server links. Enable (disable) support for compressed server-server links.
The Z compression library ("libz") is required for this option. The Z compression library ("libz") is required for this option.
* IO Backend (autodetected by default): * IO Backend (autodetected by default):
--with-select[=<path>] / --without-select --with-select[=<path>] / --without-select
--with-poll[=<path>] / --without-poll --with-poll[=<path>] / --without-poll
--with-devpoll[=<path>] / --without-devpoll --with-devpoll[=<path>] / --without-devpoll
--with-epoll[=<path>] / --without-epoll --with-epoll[=<path>] / --without-epoll
--with-kqueue[=<path>] / --without-kqueue --with-kqueue[=<path>] / --without-kqueue
ngIRCd can use different IO "backends": the "old school" select() and poll() ngIRCd can use different IO "backends": the "old school" select() and poll()
API which should be supported by most UNIX-like operating systems, or the API which should be supported by most UNIX-like operating systems, or the
@@ -261,7 +278,7 @@ standard locations.
required for this option. required for this option.
* TCP-Wrappers: * TCP-Wrappers:
--with-tcp-wrappers[=<path>] --with-tcp-wrappers[=<path>]
Include support for Wietse Venemas "TCP Wrappers" to limit client access Include support for Wietse Venemas "TCP Wrappers" to limit client access
to the daemon, for example by using "/etc/hosts.{allow|deny}". to the daemon, for example by using "/etc/hosts.{allow|deny}".
@@ -318,7 +335,7 @@ IRC operators of this server are defined in [Operator] blocks, remote
servers are configured in [Server] sections, and [Channel] blocks are servers are configured in [Server] sections, and [Channel] blocks are
used to configure pre-defined ("persistent") IRC channels. used to configure pre-defined ("persistent") IRC channels.
The meaning of the variables in the configuration file is explained in the The meaning of the variables in the configuration file is explained in the
"doc/sample-ngircd.conf", which is used as sample configuration file in "doc/sample-ngircd.conf", which is used as sample configuration file in
/usr/local/etc after running "make install" (if you don't already have one) /usr/local/etc after running "make install" (if you don't already have one)
and in the ngircd.conf(5) manual page. and in the ngircd.conf(5) manual page.

View File

@@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@ AUTOMAKE_OPTIONS = gnu
SUBDIRS = doc src man contrib SUBDIRS = doc src man contrib
EXTRA_DIST = autogen.sh configure.ng .mailmap EXTRA_DIST = autogen.sh configure.ng .clang_complete .mailmap
clean-local: osxpkg-clean clean-local: osxpkg-clean
rm -f build-stamp* rm -f build-stamp*
@@ -69,7 +69,7 @@ osxpkg: have-packagemaker osxpkg-dest
make osxpkg-clean make osxpkg-clean
osxpkg-clean: osxpkg-clean:
[ ! -e ngircd.dest ] || sudo -n rm -rf ngircd.dest [ ! -r ngircd.dest ] || sudo -n rm -rf ngircd.dest
rm -rf ngircd.dest $(distdir).mpkg rm -rf ngircd.dest $(distdir).mpkg
osxpkg-dest: have-xcodebuild osxpkg-clean clean osxpkg-dest: have-xcodebuild osxpkg-clean clean

198
NEWS
View File

@@ -2,13 +2,169 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
-- NEWS -- -- NEWS --
ngIRCd 24
ngIRCd 24~rc1 (2017-01-07)
- Log privilege violations and failed OPER request with log level "error"
and send it to the "&SERVER" channel, too.
- Immediately shut down connection when receiving an "ERROR" command,
don't wait for the peer to close the connection. This allows the daemon
to forward the received "ERROR" message in the network, instead of the
very generic "client closed connection" message.
- Explicitly forbid remote servers to modify "x-lines" (G-LINES) when the
"AllowRemoteOper" configuration option isn't set, even when the command
seems to originate from the remote server itself: this prevents GLINE's
to become set during server handshake in this case (what wouldn't be
possible during regular runtime when a remote IRC Op sends the command)
and what can't be undone by IRC Ops later on (because of the missing
"AllowRemoteOper" option) ...
- Update Xcode project for latest Xcode version (8.0), and fix "duplicate
symbols" error messages when building (linking) the binary.
- Add "Documentation" variables to systemd configuration files.
- Make sure that SYSCONFDIR is always set, which can be handy when
using source code linters when ./configure hasn't been run already.
- Add the new "PAMServiceName" configuration option to specify the name
used as PAM service name. This setting allows to run multiple ngIRCd
instances with different PAM configurations for each instance.
Thanks to Christian Aistleitner <christian@quelltextlich.at> for the
patch, closes #226.
- Add an ".editorconfig" file to the project.
- Limit the number of message target, and suppress duplicates: This
prevents an user from flooding the server using commands like this:
"PRIVMSG nick1,nick1,nick1,...".
Duplicate targets are suppressed silently (channels and clients).
In addition, the maximum number of targets per PRIVMSG, NOTICE, ...
command are limited to MAX_HNDL_TARGETS (25). If there are more, the
daemon sends the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing
the first target that hasn't been handled any more. Closes #187.
- Make contrib/platformtest.sh script more portable, and only show
"runs=Y" when the test suite really has been passed successfully.
ngIRCd 23 (2015-11-16)
ngIRCd 23~rc1 (2015-09-06)
- Use "NOTICE *" before registration instead of "NOTICE AUTH". "AUTH" is
a valid nickname so sending notices to it is probably not a good idea.
Use "*" as the target instead as done with numerics when the nick is not
available. This mimics the behavior in Charybdis, IRCD-Hybrid, InspIRCd
2.2, Plexus 4, etc. Closes #217.
The "NoticeAuth" configuration variable (ngircd.conf) has been renamed
to "NoticeBeforeRegistration" accordingly, but the old name is still
supported for compatibility reasons.
- Implement new channel mode "N" (regular users can't change their nick
name while on this channel). Closes #214.
- Keep track of who placed bans, invites, and excepts.
Idea and implementation by LucentW, Thanks! Closes #203.
- Implement numeric RPL_LISTSTART(321). lightIRC and other clients
expecting RPL_LISTSTART should now behave correctly.
Idea and implementation by LucentW, Thanks! Closes #207.
- Streamline the effect of "MorePrivacy" option: Update documentation
in ngircd.conf(5); don't hide channels for IRC Ops on LIST and don't
hide IP addresses/hostnames on WHOIS when "MorePrivacy" is in effect.
This closes #198.
- IRC operators now can kick anyone when "OperCanMode" is set.
Idea and implementation by LucentW, Thanks! Closes #202.
- Implement user mode "I": Hide channels on WHOIS: this mode prevents
ngIRCd from showing channels on WHOIS (IRC Operators can always see
the channel list).
Idea and implementation by LucentW, Thanks! Closes #197.
- INVITE command: Implement ERR_USERNOTONSERV(504) numeric and make sure
that the target user is on the same server when inviting other users
to local ("&") channels.
Idea by Cahata, thanks! Closes #183.
- MODE command: Always report channel creation time. Up to now when
receiving a MODE command, ngIRCd only reported the channel creation
time to clients that were members of the channel. This patch reports
the channel creation time to all clients, regardless if they are joined
to that channel or not. At least ircd-seven behaves like this.
This closes #188. Reported by Cahata, thanks!
ngIRCd 22.1 (2015-04-06)
- Update "CipherList" to not enable SSLv3 by default. Idea, initial patch,
and testing by Christoph Biedl <ngircd.anoy@manchmal.in-ulm.de>.
- Change ngIRCd test suite not to use DNS lookups: Different operating
systems do behave quite differently when doing DNS lookups, for example
"127.0.0.1" sometimes resolves to "localhost" and sometimes to
"localhost.localdomain" (for example OpenBSD). And other OS resolve
"localhost" to the real host name (for example Cygwin). So not using
DNS at all makes the test site much more portable.
ngIRCd 22 (2014-10-11)
- Match all list patterns case-insensitive: this affects the invite-,
ban-, and except lists, as well as G-Lines an K-Lines.
Problem pointed out by "wowaname" on #ngircd, thanks!
ngIRCd 22~rc1 (2014-09-29)
- Sync "except lists" between servers: Up to now, ban, invite, and G-Line
lists have been synced between servers while linking -- but obviously
nobody noticed that except list have been missing ever since. Until now.
Thanks to "j4jackj", who reported this issue in #ngircd.
- Allow longer user names (up to 63 characters) for authentication.
- Increase MAX_SERVERS from 16 to 64: There are installations out there
that would like to configure more than 16 links per server, so increase
this limit. Best would be to get rid of MAX_SERVERS altogether and make
if fully dynamic, but start with this quick and dirty hack ...
- Test suite/platformtest.sh: Detect when tests have been skipped.
- Allow "DefaultUserModes" to set all possible modes, including modes only
settable by IRC Operators.
- Implement user mode "F": "relaxed flood protection". Clients with mode
"F" set are allowed to rapidly send data to the daemon. This mode is only
settable by IRC Operators and can cause problems in the network -- so be
careful and only set it on "trusted" clients!
User mode "F" is used by Bahamut for this purpose, for example.
- Use server password when PAM is compiled in but disabled.
- Streamline punctuation of log messages.
- Return ISUPPORT(005) numerics on "VERSION". This is how ircd-seven,
Charybdis, Hybrid, and InspIRCd behave, for example.
- configure: Only link "contrib/Debian" if it exists, which isn't the case
on "VPATH builds", for example.
- Show the account name in WHOIS. This uses the same numeric as Charybdis
and ircu families: WHOISLOGGEDIN(330).
- Pattern matching: Remove "range matching" in our pattern matching code
using the "[...]" syntax, because [ and ] are valid characters in nick
names and one has to quote them currently using the "\" character, which
is quite unexpected for users.
- platformtest.sh: New option "-x", don't regenerate build system and
allow using separate source and build trees.
- Test suite: explicitly enable glibc memory checking.
- Make "MODE -k" handling more robust and compatible, send "fake '*' key"
in all replies.
- portabtest: Actually test the functions snprintf(), strlcpy(), strlcat(),
and vsnprintf() for correctness, not only existence (which was quite
useless, because if they weren't available, the program could not have
been linked at all ...).
- Implement new configuration option "Network": it is used to set the
(completely optional) "network name", to which this instance of the
daemon belongs. When set, this name is used in the ISUPPORT(005) numeric
which is sent to all clients connecting to the server after logging in.
- Update doc/Platforms.txt.
- Various code cleanups, remove unused code, streamline error handling.
Remove all imp.h and exp.h header files, support non-standard vsnprintf()
return codes, and fix some K&R C portability issues. Streamline
DEBUG_ARRAY, DEBUG_BUFFER, DEBUG_IO, DEBUG_ZIP definitions.
- Increase penalty time to 10 seconds when handling OPER commands with an
invalid password.
ngIRCd 21.1 (2014-03-25)
- Don't ignore but use the server password when PAM is compiled in but
disabled. Thanks to Roy Sindre Norangshol <roy.sindre@norangshol.no>!
- doc/Platforms.txt: Update from master branch.
- doc/Services.txt: Update information for Anope 2.x.
- configure: add support for the LDFLAGS_END and LIBS_END variables to add
linker flags and libraries at the end of the configure run (CFLAGS_END has
been implemented already).
- Update Copyright notices for 2014 :-)
ngIRCd 21 (2013-10-30) ngIRCd 21 (2013-10-30)
- Call arc4random_stir() in forked subprocesses, when available. This - Call arc4random_stir() in forked subprocesses, when available. This
@@ -197,7 +353,7 @@ ngIRCd 20 (2012-12-17)
the hash function. When "CloakHostSalt" is not set (the default), a the hash function. When "CloakHostSalt" is not set (the default), a
random salt will be generated after each server restart. random salt will be generated after each server restart.
ngIRCd Release 19.2 (2012-06-19) ngIRCd 19.2 (2012-06-19)
ngIRCd 19.2~rc1 (2012-06-13) ngIRCd 19.2~rc1 (2012-06-13)
- New configuration option "CloakHostModeX" to configure the hostname - New configuration option "CloakHostModeX" to configure the hostname
@@ -206,15 +362,15 @@ ngIRCd Release 19.2 (2012-06-19)
which still is the default when "CloakHostModeX" isn't set. which still is the default when "CloakHostModeX" isn't set.
- Add instructions for setting up Atheme IRC services. - Add instructions for setting up Atheme IRC services.
- Implement support for IRC capability handling, the new "CAP" command, - Implement support for IRC capability handling, the new "CAP" command,
and capablity "multi-prefix" which allows both the NAME and WHO command and capability "multi-prefix" which allows both the NAME and WHO command
handlers to return more than one "class prefix" to the client. handlers to return more than one "class prefix" to the client.
ngIRCd Release 19.1 (2012-03-19) ngIRCd 19.1 (2012-03-19)
- Really include _all_ patches to build the Anope module into the - Really include _all_ patches to build the Anope module into the
distribution archive ... ooops! distribution archive ... ooops!
ngIRCd Release 19 (2012-02-29) ngIRCd 19 (2012-02-29)
ngIRCd 19~rc1 (2012-02-12) ngIRCd 19~rc1 (2012-02-12)
- Update preliminary ngIRCd protocol module for Anope 1.9.6, which now - Update preliminary ngIRCd protocol module for Anope 1.9.6, which now
@@ -282,7 +438,7 @@ ngIRCd Release 19 (2012-02-29)
argument. Like unknown user and channel modes, these modes are saved argument. Like unknown user and channel modes, these modes are saved
and forwarded to other servers, but ignored otherwise. and forwarded to other servers, but ignored otherwise.
ngIRCd Release 18 (2011-07-10) ngIRCd 18 (2011-07-10)
- Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/. - Add preliminary ngIRCd protocol module for Anope 1.9 to contrib/Anope/.
@@ -357,19 +513,19 @@ ngIRCd Release 18 (2011-07-10)
vice-versa). The defaults are adjusted accordingly and the old variables vice-versa). The defaults are adjusted accordingly and the old variables
in [Global] are still accepted, so there is no functional change. in [Global] are still accepted, so there is no functional change.
ngIRCd Release 17.1 (2010-12-19) ngIRCd 17.1 (2010-12-19)
- Don't log critical (or worse) messages to stderr - Don't log critical (or worse) messages to stderr
- Remove "error file" when compiled with debug code enabled - Remove "error file" when compiled with debug code enabled
- New numeric 329: get channel creation time on "MODE #chan" commands - New numeric 329: get channel creation time on "MODE #chan" commands
ngIRCd Release 17 (2010-11-07) ngIRCd 17 (2010-11-07)
- doc: change path names in sample-ngircd.conf depending on sysconfdir - doc: change path names in sample-ngircd.conf depending on sysconfdir
ngIRCd 17~rc2 (2010-10-25) ngIRCd 17~rc2 (2010-10-25)
- Generate ngIRCd version number from GIT tag. - Generate ngIRCd version number from GIT tag.
- Make sourcecode compatible with ansi2knr again. This allows to compile - Make source code compatible with ansi2knr again. This allows to compile
ngIRCd using a pre-ANSI K&R C compiler again. ngIRCd using a pre-ANSI K&R C compiler again.
ngIRCd 17~rc1 (2010-10-11) ngIRCd 17~rc1 (2010-10-11)
@@ -378,7 +534,7 @@ ngIRCd Release 17 (2010-11-07)
Howl, Avahi or on Mac OS X). Howl, Avahi or on Mac OS X).
- New configuration option "SyslogFacility" to define the syslog "facility" - New configuration option "SyslogFacility" to define the syslog "facility"
(the "target"), to which ngIRCd should send its log messages. (the "target"), to which ngIRCd should send its log messages.
Possible values are system dependant, but most probably "auth", "daemon", Possible values are system dependent, but most probably "auth", "daemon",
"user" and "local1" through "local7" are possible values; see syslog(3). "user" and "local1" through "local7" are possible values; see syslog(3).
Default is "local5" for historical reasons. Default is "local5" for historical reasons.
- Dump the "internal server state" (configured servers, established - Dump the "internal server state" (configured servers, established
@@ -388,7 +544,7 @@ ngIRCd Release 17 (2010-11-07)
signal SIGUSR1, when debug code is compiled in, not only on startup signal SIGUSR1, when debug code is compiled in, not only on startup
using the command line parameters. using the command line parameters.
- Implement user mode "x": host name cloaking (closes: #102). - Implement user mode "x": host name cloaking (closes: #102).
- Change MOTD file handling: ngIRCd now caches the contens of the MOTD - Change MOTD file handling: ngIRCd now caches the contents of the MOTD
file, so the daemon now requires a HUP signal or REHASH command to file, so the daemon now requires a HUP signal or REHASH command to
re-read the MOTD file when its content changed. re-read the MOTD file when its content changed.
- Allow IRC ops to change channel modes even without OperServerMode set. - Allow IRC ops to change channel modes even without OperServerMode set.
@@ -401,10 +557,10 @@ ngIRCd Release 17 (2010-11-07)
this new mode requires the user to be an IRC operator. this new mode requires the user to be an IRC operator.
- Show SSL status in WHOIS output, numeric 275. - Show SSL status in WHOIS output, numeric 275.
ngIRCd Release 16 (2010-05-02) ngIRCd 16 (2010-05-02)
ngIRCd 16~rc2 (2010-04-25) ngIRCd 16~rc2 (2010-04-25)
- Enhace connection statistics counters: display total number of served - Enhance connection statistics counters: display total number of served
connections on daemon shutdown and when a new client connects using connections on daemon shutdown and when a new client connects using
the new numeric RPL_STATSCONN (250). the new numeric RPL_STATSCONN (250).
@@ -421,12 +577,12 @@ ngIRCd Release 16 (2010-05-02)
every channel, and c) remote clients using a server not supporting this every channel, and c) remote clients using a server not supporting this
mode are not checked either and therefore always allowed to join. mode are not checked either and therefore always allowed to join.
ngIRCd Release 15 (2009-11-07) ngIRCd 15 (2009-11-07)
ngIRCd 15~rc1 (2009-10-15) ngIRCd 15~rc1 (2009-10-15)
- Do not add default listening port (6667) if SSL ports were specified, so - Do not add default listening port (6667) if SSL ports were specified, so
ngIRCd can be configured to only accept SSL-encrypted connections now. ngIRCd can be configured to only accept SSL-encrypted connections now.
- Enable IRC operators to use the IRC command SQUIT (insted of the already - Enable IRC operators to use the IRC command SQUIT (instead of the already
implemented but non-standard DISCONNECT command). implemented but non-standard DISCONNECT command).
- New configuration option "AllowRemoteOper" (disabled by default) that - New configuration option "AllowRemoteOper" (disabled by default) that
enables remote IRC operators to use the IRC commands SQUIT and CONNECT enables remote IRC operators to use the IRC commands SQUIT and CONNECT
@@ -435,13 +591,13 @@ ngIRCd Release 15 (2009-11-07)
a throttling scheme: an IRC client can send up to 3 commands or 256 bytes a throttling scheme: an IRC client can send up to 3 commands or 256 bytes
per second before a one second pause is enforced. per second before a one second pause is enforced.
ngIRCd Release 14.1 (2009-05-05) ngIRCd 14.1 (2009-05-05)
- Security: fix remotely triggerable crash in SSL/TLS code. - Security: fix remotely triggerable crash in SSL/TLS code.
- Debian: build ngircd-full-dbg package. - Debian: build ngircd-full-dbg package.
- Allow ping timeout quit messages to show the timeout value. - Allow ping timeout quit messages to show the timeout value.
ngIRCd Release 14 (2009-04-20) ngIRCd 14 (2009-04-20)
ngIRCd 14~rc1 (2009-03-29) ngIRCd 14~rc1 (2009-03-29)
- Allow creation of persistent modeless channels. - Allow creation of persistent modeless channels.
@@ -452,7 +608,7 @@ ngIRCd Release 14 (2009-04-20)
individual channel keys for different users. individual channel keys for different users.
- Remove limit on maximum number of predefined channels in ngircd.conf. - Remove limit on maximum number of predefined channels in ngircd.conf.
ngIRCd Release 13 (2008-12-25) ngIRCd 13 (2008-12-25)
ngIRCd 13~rc1 (2008-11-21): ngIRCd 13~rc1 (2008-11-21):
- New version number scheme :-) - New version number scheme :-)
@@ -584,7 +740,7 @@ ngIRCd 0.7.5 (2003-07-11)
(DoS), the default is 5 connections per client IP. (DoS), the default is 5 connections per client IP.
- Added new configuration variable "Listen" to bind all listening - Added new configuration variable "Listen" to bind all listening
sockets of the server to a single IP address. sockets of the server to a single IP address.
ngIRCd 0.7.1 (2003-07-18) ngIRCd 0.7.1 (2003-07-18)
- Added support for GNU/Hurd. - Added support for GNU/Hurd.
@@ -609,9 +765,9 @@ ngIRCd 0.7.0 (2003-05-01)
- Documentation is now installed in $(datadir)/doc/ngircd. - Documentation is now installed in $(datadir)/doc/ngircd.
Older news (sorry, only available in german language): Older news (sorry, only available in German language):
ngIRCd 0.6.0, 2002-12-24 ngIRCd 0.6.0, 24.12.2002
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an. noch eine Statistik ueber die empfangene und gesendete Datenmenge an.

68
README
View File

@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -28,31 +28,26 @@ Please see the INSTALL document for installation and upgrade information!
II. Status II. Status
~~~~~~~~~~~ ~~~~~~~~~~~
It is not the goal of ngIRCd to implement all the nasty behaviours of the ngIRCd should be quite feature complete and stable to be used as daemon in
real world IRC networks.
It is not the goal of ngIRCd to implement all the nasty behaviors of the
original ircd, but to implement most of the useful commands and semantics original ircd, but to implement most of the useful commands and semantics
specified by the RFCs. specified by the RFCs that are used by existing clients.
In the meantime ngIRCd should be quite feature complete and stable to be
used in real IRC networks.
Implemented IRC-commands are:
ADMIN, AWAY, CHANINFO, CONNECT, DIE, DISCONNECT, ERROR, GLINE, HELP, INFO,
INVITE, ISON, JOIN, KICK, KILL, KLINE, LINKS, LIST, LUSERS, MODE, MOTD,
NAMES, NICK, NJOIN, NOTICE, OPER, PART, PASS, PING, PONG, PRIVMSG, QUIT,
REHASH, RESTART, SERVER, SERVICE, SERVLIST, SQUERY, SQUIT, STATS, SUMMON,
TIME, TOPIC, TRACE, USER, USERHOST, USERS, VERSION, WALLOPS, WEBIRC, WHO,
WHOIS, WHOWAS.
III. Features (or: why use ngIRCd?) III. Features (or: why use ngIRCd?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- well arranged (lean) configuration file - Well arranged (lean) configuration file.
- simple to build/install, configure and maintain - Simple to build, install, configure, and maintain.
- supports IPv6 and SSL - Supports IPv6 and SSL.
- no problems with servers that have dynamic IP addresses - Can use PAM for user authentication.
- freely available, modern, portable and tidy C-source - Lots of popular user and channel modes are implemented.
- wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX, - Supports "cloaking" of users.
- No problems with servers that have dynamic IP addresses.
- Freely available, modern, portable and tidy C source.
- Wide field of supported platforms, including AIX, A/UX, FreeBSD, HP-UX,
IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin. IRIX, Linux, Mac OS X, NetBSD, OpenBSD, Solaris, and Windows with Cygwin.
- ngIRCd is being actively developed since 2001. - ngIRCd is being actively developed since 2001.
@@ -61,33 +56,34 @@ IV. Documentation
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
More documentation can be found in the "doc/" directory and the homepage of More documentation can be found in the "doc/" directory and the homepage of
the ngIRCd: <http://ngircd.barton.de/>. ngIRCd: <http://ngircd.barton.de/>.
V. Download V. Download
~~~~~~~~~~~ ~~~~~~~~~~~
The homepage of the ngIRCd is: <http://ngircd.barton.de/>; you will find The homepage of the ngIRCd is <http://ngircd.barton.de/>; you will find
the newest information about the ngIRCd and the most recent ("stable") the newest information about the ngIRCd and the most recent ("stable")
releases there. releases there.
If you are interested in the latest development versions (which are not Visit our source code repository at GitHub if you are interested in the
always stable), then please read the section about "GIT" on the homepage and latest development version: <https://github.com/ngircd/ngircd>.
the file "doc/GIT.txt" which describes the use of GIT, the version control
system used by ngIRCd (homepage: http://git-scm.com/).
VI. Bugs VI. Problems, Bugs, Patches
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you find bugs in the ngIRCd (which might be there :-), please report Please don't hesitate to contact us if you encounter problems:
them at the following URL:
<http://ngircd.barton.de/bugtracker.php> - On IRC: <irc://irc.barton.de/ngircd>
- Via the mailing list: <ngircd-ml@ngircd.barton.de>
See <http://ngircd.barton.de/support.php> for details.
If you find bugs in ngIRCd (which will be there most probably ...), please
report them to our issue tracker at GitHub:
- Bug tracker: <https://github.com/ngircd/ngircd/issues>
- Patches, "pull requests": <https://github.com/ngircd/ngircd/pulls>
There you can read about known bugs and limitations, too. There you can read about known bugs and limitations, too.
If you have critics, patches or something else, please feel free to post a
mail to the ngIRCd mailing list: <ngircd-ml@arthur.barton.de> (please see
<http://ngircd.barton.de/support.php#ml> for details) or join the ngIRCd
IRC channel: <irc://irc.barton.de/ngircd>.

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ Search()
return 0 return 0
fi fi
done done
minor=`expr $minor - 1` minor=$(expr $minor - 1)
done done
return 1 return 1
} }
@@ -109,8 +109,8 @@ Notfound()
Run() Run()
{ {
[ "$VERBOSE" = "1" ] && echo " - running \"$@\" ..." [ "$VERBOSE" = "1" ] && echo " - running \"$*\" ..."
$@ "$@"
} }
# Reset locale settings to suppress warning messages of Perl # Reset locale settings to suppress warning messages of Perl
@@ -139,26 +139,26 @@ fi
# Try to detect the needed tools when no environment variable already # Try to detect the needed tools when no environment variable already
# specifies one: # specifies one:
echo "Searching for required tools ..." echo "Searching for required tools ..."
[ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1` [ -z "$ACLOCAL" ] && ACLOCAL=$(Search aclocal 1)
[ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL" [ "$VERBOSE" = "1" ] && echo " - ACLOCAL=$ACLOCAL"
[ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2` [ -z "$AUTOHEADER" ] && AUTOHEADER=$(Search autoheader 2)
[ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER" [ "$VERBOSE" = "1" ] && echo " - AUTOHEADER=$AUTOHEADER"
[ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1` [ -z "$AUTOMAKE" ] && AUTOMAKE=$(Search automake 1)
[ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE" [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE=$AUTOMAKE"
[ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2` [ -z "$AUTOCONF" ] && AUTOCONF=$(Search autoconf 2)
[ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF" [ "$VERBOSE" = "1" ] && echo " - AUTOCONF=$AUTOCONF"
AUTOCONF_VERSION=`echo $AUTOCONF | cut -d'-' -f2-` AUTOCONF_VERSION=$(echo "$AUTOCONF" | cut -d'-' -f2-)
[ -n "$AUTOCONF_VERSION" -a "$AUTOCONF_VERSION" != "autoconf" ] \ [ -n "$AUTOCONF_VERSION" ] && [ "$AUTOCONF_VERSION" != "autoconf" ] \
&& export AUTOCONF_VERSION || unset AUTOCONF_VERSION && export AUTOCONF_VERSION || unset AUTOCONF_VERSION
[ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$AUTOCONF_VERSION" [ "$VERBOSE" = "1" ] && echo " - AUTOCONF_VERSION=$AUTOCONF_VERSION"
AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-` AUTOMAKE_VERSION=$(echo $AUTOMAKE | cut -d'-' -f2-)
[ -n "$AUTOMAKE_VERSION" -a "$AUTOMAKE_VERSION" != "automake" ] \ [ -n "$AUTOMAKE_VERSION" ] && [ "$AUTOMAKE_VERSION" != "automake" ] \
&& export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION && export AUTOMAKE_VERSION || unset AUTOMAKE_VERSION
[ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION" [ "$VERBOSE" = "1" ] && echo " - AUTOMAKE_VERSION=$AUTOMAKE_VERSION"
[ $# -gt 0 ] && CONFIGURE_ARGS=" $@" || CONFIGURE_ARGS="" [ $# -gt 0 ] && CONFIGURE_ARGS=" $*" || CONFIGURE_ARGS=""
[ -z "$GO" -a -n "$CONFIGURE_ARGS" ] && GO=1 [ -z "$GO" ] && [ -n "$CONFIGURE_ARGS" ] && GO=1
# Verify that all tools have been found # Verify that all tools have been found
[ -z "$ACLOCAL" ] && Notfound aclocal [ -z "$ACLOCAL" ] && Notfound aclocal
@@ -166,15 +166,15 @@ AUTOMAKE_VERSION=`echo $AUTOMAKE | cut -d'-' -f2-`
[ -z "$AUTOMAKE" ] && Notfound automake [ -z "$AUTOMAKE" ] && Notfound automake
[ -z "$AUTOCONF" ] && Notfound autoconf [ -z "$AUTOCONF" ] && Notfound autoconf
AM_VERSION=`$AUTOMAKE --version | head -n 1 | sed -e 's/.* //g'` AM_VERSION=$($AUTOMAKE --version | head -n 1 | sed -e 's/.* //g')
ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs ifs=$IFS; IFS="."; set $AM_VERSION; IFS=$ifs
AM_MAJOR="$1"; AM_MINOR="$2"; AM_PATCHLEVEL="$3" AM_MAJOR="$1"; AM_MINOR="$2"
echo "Detected automake $AM_VERSION ..." echo "Detected automake $AM_VERSION ..."
AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng" AM_MAKEFILES="src/ipaddr/Makefile.ng src/ngircd/Makefile.ng src/testsuite/Makefile.ng src/tool/Makefile.ng"
# De-ANSI-fication? # De-ANSI-fication?
if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -lt "12" ]; then if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -lt "12" ]; then
# automake < 1.12 => automatic de-ANSI-fication support available # automake < 1.12 => automatic de-ANSI-fication support available
echo " - Enabling de-ANSI-fication support." echo " - Enabling de-ANSI-fication support."
sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac sed -e "s|^__ng_PROTOTYPES__|AM_C_PROTOTYPES|g" configure.ng >configure.ac
@@ -188,19 +188,20 @@ else
DEANSI_END=" (disabled by ./autogen.sh script)" DEANSI_END=" (disabled by ./autogen.sh script)"
fi fi
# Serial test harness? # Serial test harness?
if [ "$AM_MAJOR" -eq "1" -a "$AM_MINOR" -ge "13" ]; then if [ "$AM_MAJOR" -eq "1" ] && [ "$AM_MINOR" -ge "13" ]; then
# automake >= 1.13 => enforce "serial test harness" # automake >= 1.13 => enforce "serial test harness"
echo " - Enforcing serial test harness." echo " - Enforcing serial test harness."
SERIAL_TESTS="serial-tests" SERIAL_TESTS="serial-tests"
else else
# automake < 1.13 => no new test harness, nothing to do # automake < 1.13 => no new test harness, nothing to do
# shellcheck disable=SC2034
SERIAL_TEST="" SERIAL_TEST=""
fi fi
sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \ sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}ansi2knr${DEANSI_END}|g" \
src/portab/Makefile.ng >src/portab/Makefile.am src/portab/Makefile.ng >src/portab/Makefile.am
for makefile_ng in $AM_MAKEFILES; do for makefile_ng in $AM_MAKEFILES; do
makefile_am=`echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g"` makefile_am=$(echo "$makefile_ng" | sed -e "s|\.ng\$|\.am|g")
sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \ sed -e "s|^__ng_Makefile_am_template__|AUTOMAKE_OPTIONS = ${SERIAL_TESTS} ${DEANSI_START}../portab/ansi2knr${DEANSI_END}|g" \
$makefile_ng >$makefile_am $makefile_ng >$makefile_am
done done
@@ -214,10 +215,10 @@ Run $ACLOCAL && \
Run $AUTOHEADER && \ Run $AUTOHEADER && \
Run $AUTOMAKE --add-missing --no-force Run $AUTOMAKE --add-missing --no-force
if [ $? -eq 0 -a -x ./configure ]; then if [ $? -eq 0 ] && [ -x ./configure ]; then
# Success: if we got some parameters we call ./configure and pass # Success: if we got some parameters we call ./configure and pass
# all of them to it. # all of them to it.
NAME=`grep PACKAGE_STRING= configure | cut -d"'" -f2` NAME=$(grep PACKAGE_STRING= configure | cut -d"'" -f2)
if [ "$GO" = "1" ]; then if [ "$GO" = "1" ]; then
[ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p="" [ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
c="./configure${p}${CONFIGURE_ARGS}" c="./configure${p}${CONFIGURE_ARGS}"

463
config.guess vendored
View File

@@ -1,14 +1,12 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2016 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2012-08-14' timestamp='2016-04-02'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, but # This program is distributed in the hope that it will be useful, but
@@ -22,19 +20,17 @@ timestamp='2012-08-14'
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
# #
# This script attempts to guess a canonical system name similar to # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
@@ -54,9 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992-2016 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive. # Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -153,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor # Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown". # portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch" sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)` /sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;; armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;; sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
# to ELF recently, or will in the future. # to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__ | grep -q __ELF__
@@ -182,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd os=netbsd
;; ;;
esac esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release # The OS release
# Debian GNU/NetBSD machines have a different userland, and # Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need # thus, need a distinct triplet. However, they do not need
@@ -192,13 +221,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu' release='-gnu'
;; ;;
*) *)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;; ;;
esac esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}${abi}"
exit ;; exit ;;
*:Bitrig:*:*) *:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -208,6 +237,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;; exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;; exit ;;
@@ -220,6 +253,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*) *:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;; exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
case $UNAME_RELEASE in case $UNAME_RELEASE in
*4.0) *4.0)
@@ -236,42 +272,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in case "$ALPHA_CPU_TYPE" in
"EV4 (21064)") "EV4 (21064)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"EV4.5 (21064)") "EV4.5 (21064)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)") "LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;; UNAME_MACHINE=alpha ;;
"EV5 (21164)") "EV5 (21164)")
UNAME_MACHINE="alphaev5" ;; UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)") "EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;; UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)") "EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;; UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)") "EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;; UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)") "EV6 (21264)")
UNAME_MACHINE="alphaev6" ;; UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)") "EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;; UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)") "EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)") "EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)") "EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;; UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)") "EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;; UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)") "EV7 (21364)")
UNAME_MACHINE="alphaev7" ;; UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)") "EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;; UNAME_MACHINE=alphaev79 ;;
esac esac
# A Pn.n version is a patched version. # A Pn.n version is a patched version.
# A Vn.n version is a released version. # A Vn.n version is a released version.
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code. # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$? exitcode=$?
trap '' 0 trap '' 0
@@ -306,7 +342,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE} echo arm-acorn-riscix${UNAME_RELEASE}
exit ;; exit ;;
arm:riscos:*:*|arm:RISCOS:*:*) arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos echo arm-unknown-riscos
exit ;; exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -344,16 +380,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;; exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build eval $set_cc_for_build
SUN_ARCH="i386" SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects. # If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers. # This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null grep IS_64BIT_ARCH >/dev/null
then then
SUN_ARCH="x86_64" SUN_ARCH=x86_64
fi fi
fi fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -378,7 +414,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;; exit ;;
sun*:*:4.2BSD:*) sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in case "`/bin/arch`" in
sun3) sun3)
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos${UNAME_RELEASE}
@@ -564,8 +600,9 @@ EOF
else else
IBM_ARCH=powerpc IBM_ARCH=powerpc
fi fi
if [ -x /usr/bin/oslevel ] ; then if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/oslevel` IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi fi
@@ -602,13 +639,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0 532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;; 32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH="hppa2.0w" ;; 64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;; esac ;;
esac esac
fi fi
@@ -647,11 +684,11 @@ EOF
exit (0); exit (0);
} }
EOF EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;; fi ;;
esac esac
if [ ${HP_ARCH} = "hppa2.0w" ] if [ ${HP_ARCH} = hppa2.0w ]
then then
eval $set_cc_for_build eval $set_cc_for_build
@@ -664,12 +701,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23 # => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__ grep -q __LP64__
then then
HP_ARCH="hppa2.0w" HP_ARCH=hppa2.0w
else else
HP_ARCH="hppa64" HP_ARCH=hppa64
fi fi
fi fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -774,14 +811,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
5000:UNIX_System_V:4.*:*) 5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -811,7 +848,7 @@ EOF
*:MINGW*:*) *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit ;; exit ;;
i*:MSYS*:*) *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys echo ${UNAME_MACHINE}-pc-msys
exit ;; exit ;;
i*:windows32*:*) i*:windows32*:*)
@@ -859,21 +896,21 @@ EOF
exit ;; exit ;;
*:GNU:*:*) *:GNU:*:*)
# the GNU system # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;; exit ;;
*:GNU/*:*:*) *:GNU/*:*:*)
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;; exit ;;
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
aarch64:Linux:*:*) aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
aarch64_be:Linux:*:*) aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -886,59 +923,60 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;; EV68*) UNAME_MACHINE=alphaev68 ;;
esac esac
objdump --private-headers /bin/sh | grep -q ld.so.1 objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__ | grep -q __ARM_EABI__
then then
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP | grep -q __ARM_PCS_VFP
then then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi fi
fi fi
exit ;; exit ;;
avr32*:Linux:*:*) avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
cris:Linux:*:*) cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;; exit ;;
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
hexagon:Linux:*:*) hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
i*86:Linux:*:*) i*86:Linux:*:*)
LIBC=gnu echo ${UNAME_MACHINE}-pc-linux-${LIBC}
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;; exit ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
m32r*:Linux:*:*) m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
mips:Linux:*:* | mips64:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
@@ -957,54 +995,63 @@ EOF
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;; ;;
or32:Linux:*:*) openrisc*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-gnu echo sparc-unknown-linux-${LIBC}
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu echo hppa64-unknown-linux-${LIBC}
exit ;; exit ;;
parisc:Linux:*:* | hppa:Linux:*:*) parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level # Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;; PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-gnu ;; *) echo hppa-unknown-linux-${LIBC} ;;
esac esac
exit ;; exit ;;
ppc64:Linux:*:*) ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu echo powerpc64-unknown-linux-${LIBC}
exit ;; exit ;;
ppc:Linux:*:*) ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;; exit ;;
sh64*:Linux:*:*) sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
sh*:Linux:*:*) sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
tile*:Linux:*:*) tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;; exit ;;
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;; exit ;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1080,7 +1127,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586. # the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub # Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that # prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build. # this is a cross-build.
echo i586-pc-msdosdjgpp echo i586-pc-msdosdjgpp
exit ;; exit ;;
@@ -1229,6 +1276,9 @@ EOF
SX-8R:SUPER-UX:*:*) SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE} echo sx8r-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;; exit ;;
@@ -1237,24 +1287,36 @@ EOF
exit ;; exit ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in eval $set_cc_for_build
i386) if test "$UNAME_PROCESSOR" = unknown ; then
eval $set_cc_for_build UNAME_PROCESSOR=powerpc
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then fi
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
grep IS_64BIT_ARCH >/dev/null if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
then (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
UNAME_PROCESSOR="x86_64" grep IS_64BIT_ARCH >/dev/null
fi then
fi ;; case $UNAME_PROCESSOR in
unknown) UNAME_PROCESSOR=powerpc ;; i386) UNAME_PROCESSOR=x86_64 ;;
esac powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;; exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p` UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386 UNAME_PROCESSOR=i386
UNAME_MACHINE=pc UNAME_MACHINE=pc
fi fi
@@ -1285,7 +1347,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386 # "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86 # is converted to i386 for consistency with other x86
# operating systems. # operating systems.
if test "$cputype" = "386"; then if test "$cputype" = 386; then
UNAME_MACHINE=i386 UNAME_MACHINE=i386
else else
UNAME_MACHINE="$cputype" UNAME_MACHINE="$cputype"
@@ -1327,7 +1389,7 @@ EOF
echo i386-pc-xenix echo i386-pc-xenix
exit ;; exit ;;
i*86:skyos:*:*) i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;; exit ;;
i*86:rdos:*:*) i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos echo ${UNAME_MACHINE}-pc-rdos
@@ -1338,156 +1400,11 @@ EOF
x86_64:VMkernel:*:*) x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx echo ${UNAME_MACHINE}-unknown-esx
exit ;; exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF cat >&2 <<EOF
$0: unable to guess system type $0: unable to guess system type
@@ -1495,9 +1412,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you the operating system you are using. It is advised that you
download the most up to date version of the config scripts from download the most up to date version of the config scripts from
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please If the version you run ($0) is already up to date, please
send the following data and any information you think might be send the following data and any information you think might be

139
config.sub vendored
View File

@@ -1,24 +1,18 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2016 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
timestamp='2012-08-18' timestamp='2016-03-30'
# This file is (in principle) common to ALL GNU software. # This file is free software; you can redistribute it and/or modify it
# The presence of a machine in this file suggests that SOME GNU software # under the terms of the GNU General Public License as published by
# can handle that machine. It does not imply ALL GNU software can. # the Free Software Foundation; either version 3 of the License, or
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful, but
# but WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# GNU General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -26,11 +20,12 @@ timestamp='2012-08-18'
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches to <config-patches@gnu.org>.
# diff and a properly formatted GNU ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
@@ -38,7 +33,7 @@ timestamp='2012-08-18'
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
@@ -58,8 +53,7 @@ timestamp='2012-08-18'
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
usage="\ usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
$0 [OPTION] ALIAS
Canonicalize a configuration name. Canonicalize a configuration name.
@@ -73,9 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992-2016 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,7 +116,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
@@ -156,7 +148,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze) -apple | -axis | -knuth | -cray | -microblaze*)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
@@ -259,21 +251,25 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | arc | arceb \
| be32 | be64 \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \ | e2k | epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \ | hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| k1om \
| le32 | le64 \ | le32 | le64 \
| lm32 \ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
@@ -287,26 +283,29 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \ | mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \ | mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \ | mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \ | moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nds32 | nds32le | nds32be \ | nds32 | nds32le | nds32be \
| nios | nios2 \ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \ | ns16k | ns32k \
| open8 \ | open8 | or1k | or1knd | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| riscv32 | riscv64 \
| rl78 | rx \ | rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -314,6 +313,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \ | we32k \
| x86 | xc16x | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
@@ -328,7 +328,10 @@ case $basic_machine in
c6x) c6x)
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@@ -370,26 +373,29 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \ | be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \ | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \ | le32-* | le64-* \
| lm32-* \ | lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@@ -403,28 +409,33 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \ | mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \ | mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nds32-* | nds32le-* | nds32be-* \ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \ | open8-* \
| or1k*-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \ | pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \ | tile*-* \
@@ -432,6 +443,7 @@ case $basic_machine in
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \ | vax-* \
| visium-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
@@ -508,6 +520,9 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-aros os=-aros
;; ;;
asmjs)
basic_machine=asmjs-unknown
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
@@ -769,6 +784,9 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu) m68knommu)
basic_machine=m68k-unknown basic_machine=m68k-unknown
os=-linux os=-linux
@@ -788,7 +806,7 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze) microblaze*)
basic_machine=microblaze-xilinx basic_machine=microblaze-xilinx
;; ;;
mingw64) mingw64)
@@ -796,7 +814,7 @@ case $basic_machine in
os=-mingw64 os=-mingw64
;; ;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i686-pc
os=-mingw32 os=-mingw32
;; ;;
mingw32ce) mingw32ce)
@@ -824,6 +842,10 @@ case $basic_machine in
basic_machine=powerpc-unknown basic_machine=powerpc-unknown
os=-morphos os=-morphos
;; ;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos) msdos)
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
@@ -832,7 +854,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys) msys)
basic_machine=i386-pc basic_machine=i686-pc
os=-msys os=-msys
;; ;;
mvs) mvs)
@@ -1023,7 +1045,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;
@@ -1350,13 +1376,13 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \ | -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
@@ -1365,14 +1391,15 @@ case $os in
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1496,9 +1523,6 @@ case $os in
-aros*) -aros*)
os=-aros os=-aros
;; ;;
-kaos*)
os=-kaos
;;
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
@@ -1507,6 +1531,8 @@ case $os in
;; ;;
-nacl*) -nacl*)
;; ;;
-ios)
;;
-none) -none)
;; ;;
*) *)
@@ -1547,6 +1573,9 @@ case $basic_machine in
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
c8051-*)
os=-elf
;;
hexagon-*) hexagon-*)
os=-elf os=-elf
;; ;;

View File

@@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -23,8 +23,7 @@ m4_ifdef([AM_SILENT_RULES],
# -- Initialisation -- # -- Initialisation --
AC_PREREQ([2.61]) AC_PREREQ([2.61])
AC_INIT([ngIRCd], VERSION_ID, AC_INIT([ngIRCd],[VERSION_ID],[ngircd-ml@ngircd.barton.de],[ngircd],[http://ngircd.barton.de/])
[ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
AC_CONFIG_SRCDIR([src/ngircd/ngircd.c]) AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
AC_CONFIG_HEADER([src/config.h]) AC_CONFIG_HEADER([src/config.h])
@@ -67,6 +66,7 @@ AC_PROG_AWK
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_RANLIB AC_PROG_RANLIB
# -- Compiler Features -- # -- Compiler Features --
@@ -75,23 +75,57 @@ AC_C_CONST
AC_C_INLINE AC_C_INLINE
__ng_PROTOTYPES__ __ng_PROTOTYPES__
# -- Hard coded system and compiler dependencies/features/options ... -- # -- Function Definitions --
AC_DEFUN([GCC_STACK_PROTECT_CC],[ AC_DEFUN([GCC_STACK_PROTECT_CC],[
ssp_cc=yes ssp_cc=yes
# we use -fstack-protector-all for the test to enfoce the use of the guard variable # Use -fstack-protector-all for the test to enfoce the use of the
AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) # guard variable
ssp_old_cflags="$CFLAGS" AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
CFLAGS="$CFLAGS -fstack-protector-all" ssp_old_cflags="$CFLAGS"
AC_TRY_LINK(,,, ssp_cc=no) CFLAGS="$CFLAGS -fstack-protector-all"
echo $ssp_cc AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],[],[ssp_cc=no])
CFLAGS="$ssp_old_cflags" echo $ssp_cc
if test "X$ssp_cc" = "Xyes"; then CFLAGS="$ssp_old_cflags"
CFLAGS="$CFLAGS -fstack-protector" if test "X$ssp_cc" = "Xyes"; then
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) CFLAGS="$CFLAGS -fstack-protector"
fi AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
]) ])
AC_DEFUN([WORKING_GETADDRINFO],[
AC_CHECK_FUNCS([getaddrinfo],[
AC_MSG_CHECKING([whether getaddrinfo() works])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int
main(int argc, char **argv)
{
struct addrinfo hints, *ai;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = PF_UNSPEC;
if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
return 1;
return 0;
}
]])],[
AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
],[
AC_MSG_RESULT(no)
])
])
])
# -- Hard coded system and compiler dependencies/features/options ... --
if test "$GCC" = "yes"; then if test "$GCC" = "yes"; then
# We are using the GNU C compiler. Good! # We are using the GNU C compiler. Good!
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes" CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -121,7 +155,7 @@ AC_HEADER_TIME
# Required header files # Required header files
AC_CHECK_HEADERS([ \ AC_CHECK_HEADERS([ \
fcntl.h netdb.h netinet/in.h stdlib.h string.h \ fcntl.h netdb.h netinet/in.h stdlib.h string.h \
strings.h sys/socket.h sys/time.h unistd.h \ strings.h sys/socket.h sys/time.h sys/types.h unistd.h \
],,AC_MSG_ERROR([required C header missing!])) ],,AC_MSG_ERROR([required C header missing!]))
# Optional header files # Optional header files
@@ -133,20 +167,19 @@ AC_CHECK_HEADERS_ONCE([ \
# -- Datatypes -- # -- Datatypes --
AC_MSG_CHECKING(whether socklen_t exists) AC_MSG_CHECKING(whether socklen_t exists)
AC_TRY_COMPILE([ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
],[ ]],[[
socklen_t a, b; socklen_t a, b;
a = 2; b = 4; a += b; a = 2; b = 4; a += b;
],[ ]])],[
AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes) AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
],[ ],[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
AC_TYPE_PID_T AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T AC_TYPE_SSIZE_T
AC_TYPE_UID_T AC_TYPE_UID_T
@@ -186,10 +219,12 @@ AC_CHECK_FUNCS([ \
AC_MSG_ERROR([required function missing!])) AC_MSG_ERROR([required function missing!]))
# Optional functions # Optional functions
AC_CHECK_FUNCS_ONCE([ \ AC_CHECK_FUNCS_ONCE([
arc4random arc4random_stir gai_strerror getaddrinfo getnameinfo inet_aton arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \ setgroups sigaction sigprocmask snprintf strdup strlcat strlcpy \
strtok_r waitpid]) strndup strtok_r unsetenv vsnprintf waitpid])
WORKING_GETADDRINFO
# -- Configuration options -- # -- Configuration options --
@@ -383,8 +418,8 @@ AC_ARG_WITH(openssl,
LDFLAGS="-L$withval/lib $LDFLAGS" LDFLAGS="-L$withval/lib $LDFLAGS"
fi fi
AC_CHECK_LIB(crypto, BIO_s_mem) AC_CHECK_LIB(crypto, BIO_s_mem)
AC_CHECK_LIB(ssl, SSL_library_init) AC_CHECK_LIB(ssl, SSL_new)
AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes, AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes,
AC_MSG_ERROR([Can't enable openssl]) AC_MSG_ERROR([Can't enable openssl])
) )
fi fi
@@ -432,14 +467,18 @@ AC_ARG_WITH(tcp-wrappers,
LDFLAGS="-L$withval/lib $LDFLAGS" LDFLAGS="-L$withval/lib $LDFLAGS"
fi fi
AC_MSG_CHECKING(for hosts_access) AC_MSG_CHECKING(for hosts_access)
saved_LIBS="$LIBS"
LIBS="-lwrap $LIBS" LIBS="-lwrap $LIBS"
AC_TRY_LINK([ LIBS_END="-lwrap $LIBS_END"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
#include <tcpd.h> #include <tcpd.h>
int allow_severity = 0; int allow_severity = 0;
int deny_severity = 0; int deny_severity = 0;
],[ ]],[[
tcpd_warn("link test"); tcpd_warn("link test");
],[ ]])],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(TCPWRAP, 1) AC_DEFINE(TCPWRAP, 1)
x_tcpwrap_on=yes x_tcpwrap_on=yes
@@ -447,6 +486,7 @@ int deny_severity = 0;
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_ERROR([Can't enable TCP wrappers!]) AC_MSG_ERROR([Can't enable TCP wrappers!])
]) ])
LIBS="$saved_LIBS"
fi fi
] ]
) )
@@ -602,9 +642,12 @@ AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" ) AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" ) AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
# Add additional CFLAGS, eventually specified on the command line, but after # Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
# running this configure script. Useful for "-Werror" for example. # line or by some tests from above, but after running this script. Useful for
# adding "-Werror", for example:
test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END" test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
# -- Generate files -- # -- Generate files --
@@ -633,7 +676,9 @@ if test $? -eq 0; then
# Generate debian/ link if the dpkg command exists # Generate debian/ link if the dpkg command exists
# (read: if we are running on a debian compatible system) # (read: if we are running on a debian compatible system)
echo "creating Debian-specific links ..." echo "creating Debian-specific links ..."
test -f debian/rules || ln -s contrib/Debian debian if test ! -f debian/rules -a -f contrib/Debian/rules; then
ln -s contrib/Debian debian
fi
fi fi
# -- Result -- # -- Result --

View File

@@ -4,10 +4,13 @@
files files
ngircd/ ngircd/
ngircd-full/ ngircd-full/
ngircd.service
ngircd-full.default ngircd-full.default
ngircd-full.init ngircd-full.init
ngircd-full.postinst ngircd-full.postinst
ngircd-full.service
ngircd-full-dbg/ ngircd-full-dbg/
ngircd-full-dbg.default ngircd-full-dbg.default
ngircd-full-dbg.init ngircd-full-dbg.init
ngircd-full-dbg.postinst ngircd-full-dbg.postinst
ngircd-full-dbg.service

View File

@@ -1,3 +1,53 @@
ngircd (24~rc1-0ab1) unstable; urgency=low
* New "upstream" release candidate 1 for ngIRCd Release 24.
-- Alexander Barton <alex@barton.de> Sat, 07 Jan 2017 18:58:02 +0100
ngircd (23-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 23.
-- Alexander Barton <alex@barton.de> Mon, 16 Nov 2015 21:27:03 +0100
ngircd (23~rc1-0ab1) unstable; urgency=low
* New "upstream" release candidate 1 for ngIRCd Release 23.
-- Alexander Barton <alex@barton.de> Sun, 06 Sep 2015 16:55:23 +0200
ngircd (22.1-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 22.1.
-- Alexander Barton <alex@barton.de> Mon, 06 Apr 2015 14:34:50 +0200
ngircd (22-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 22.
-- Alexander Barton <alex@barton.de> Sat, 11 Oct 2014 20:29:03 +0200
ngircd (22~rc1-0ab1) unstable; urgency=low
* New "upstream" release candidate 1 for ngIRCd Release 22.
-- Alexander Barton <alex@barton.de> Mon, 29 Sep 2014 17:07:55 +0200
ngircd (21.1-0ab2) unstable; urgency=low
* Use correct package name in pathname to "HelpFile" (Command.txt)
in "ngircd-full" and "ngircd-full-dbg" packages.
* Don't adjust path names that are correct by default.
-- Alexander Barton <alex@barton.de> Mon, 14 Jul 2014 11:20:17 +0200
ngircd (21.1-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 21.1.
-- Alexander Barton <alex@barton.de> Tue, 25 Mar 2014 14:44:59 +0100
ngircd (21-0ab1) unstable; urgency=low ngircd (21-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 21. * New "upstream" release: ngIRCd 21.

View File

@@ -1 +1 @@
4 9

View File

@@ -2,13 +2,14 @@ Source: ngircd
Section: net Section: net
Priority: optional Priority: optional
Maintainer: Alexander Barton <alex@barton.de> Maintainer: Alexander Barton <alex@barton.de>
Build-Depends: debhelper (>> 4.0.0), Build-Depends: debhelper (>> 9.0.0),
autotools-dev, autotools-dev,
dh-systemd (>= 1.5),
expect, expect,
libz-dev, libz-dev,
libwrap0-dev, libwrap0-dev,
libident-dev, libident-dev,
libgnutls-dev, libgnutls28-dev,
libpam0g-dev, libpam0g-dev,
telnet | telnet-ssl, telnet | telnet-ssl,
Standards-Version: 3.9.1 Standards-Version: 3.9.1

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# ngIRCd start and stop script for Debian-based systems # ngIRCd start and stop script for Debian-based systems
# Copyright 2008-2013 Alexander Barton <alex@barton.de> # Copyright 2008-2015 Alexander Barton <alex@barton.de>
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
@@ -37,7 +37,7 @@ log_daemon_msg() {
echo -n "$*" echo -n "$*"
} }
log_end_msg() { log_end_msg() {
[ "$1" == "0" ] && echo "." || echo " failed!" [ "$1" = "0" ] && echo "." || echo " failed!"
} }
log_failure_msg() { log_failure_msg() {
echo "$*" echo "$*"

View File

@@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Debian post-installation script # Debian post-installation script
# $Id: ngircd.postinst,v 1.2 2006/12/26 14:44:40 alex Exp $
# #
set -e set -e
@@ -12,6 +11,7 @@ case "$1" in
# make sure that the configuration file is not # make sure that the configuration file is not
# world-readable, it contains passwords! # world-readable, it contains passwords!
chmod o= /etc/ngircd/ngircd.conf chmod o= /etc/ngircd/ngircd.conf
chgrp irc /etc/ngircd/ngircd.conf
fi fi
;; ;;
esac esac

View File

@@ -1,7 +1,7 @@
#!/usr/bin/make -f #!/usr/bin/make -f
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -42,6 +42,7 @@ configure-ngircd: configure
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/ngircd \ --sysconfdir=/etc/ngircd \
--mandir=\$${prefix}/share/man \ --mandir=\$${prefix}/share/man \
--docdir=\$${prefix}/share/doc/ngircd \
--with-syslog --with-zlib --with-syslog --with-zlib
configure-ngircd-full: configure configure-ngircd-full: configure
@@ -52,6 +53,7 @@ configure-ngircd-full: configure
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/ngircd \ --sysconfdir=/etc/ngircd \
--mandir=\$${prefix}/share/man \ --mandir=\$${prefix}/share/man \
--docdir=\$${prefix}/share/doc/ngircd-full \
--with-syslog --with-zlib \ --with-syslog --with-zlib \
--with-gnutls --with-iconv --with-ident --with-tcp-wrappers \ --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
--with-pam \ --with-pam \
@@ -65,6 +67,7 @@ configure-ngircd-full-dbg: configure
--prefix=/usr \ --prefix=/usr \
--sysconfdir=/etc/ngircd \ --sysconfdir=/etc/ngircd \
--mandir=\$${prefix}/share/man \ --mandir=\$${prefix}/share/man \
--docdir=\$${prefix}/share/doc/ngircd-full-dbg \
--enable-debug --enable-sniffer \ --enable-debug --enable-sniffer \
--with-syslog --with-zlib \ --with-syslog --with-zlib \
--with-gnutls --with-iconv --with-ident --with-tcp-wrappers \ --with-gnutls --with-iconv --with-ident --with-tcp-wrappers \
@@ -72,7 +75,7 @@ configure-ngircd-full-dbg: configure
--enable-ipv6 --enable-ipv6
build: build:
dh_clean -k dh_prep
build-ngircd: build-stamp-ngircd build-ngircd: build-stamp-ngircd
build-stamp-ngircd: configure-ngircd build-stamp-ngircd: configure-ngircd
@@ -108,12 +111,15 @@ clean:
dh_testdir dh_testdir
dh_testroot dh_testroot
rm -f build-stamp* rm -f build-stamp*
rm -f $(CURDIR)/debian/ngircd.service
rm -f $(CURDIR)/debian/ngircd-full.default rm -f $(CURDIR)/debian/ngircd-full.default
rm -f $(CURDIR)/debian/ngircd-full.init rm -f $(CURDIR)/debian/ngircd-full.init
rm -f $(CURDIR)/debian/ngircd-full.postinst rm -f $(CURDIR)/debian/ngircd-full.postinst
rm -f $(CURDIR)/debian/ngircd-full.service
rm -f $(CURDIR)/debian/ngircd-full-dbg.default rm -f $(CURDIR)/debian/ngircd-full-dbg.default
rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst rm -f $(CURDIR)/debian/ngircd-full-dbg.postinst
rm -f $(CURDIR)/debian/ngircd-full-dbg.init rm -f $(CURDIR)/debian/ngircd-full-dbg.init
rm -f $(CURDIR)/debian/ngircd-full-dbg.service
# Add here commands to clean up after the build process: # Add here commands to clean up after the build process:
[ ! -f Makefile ] || $(MAKE) distclean [ ! -f Makefile ] || $(MAKE) distclean
@@ -137,11 +143,9 @@ install-ngircd: build-ngircd
$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd
rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL* rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/INSTALL*
rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING* rm $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/COPYING*
mkdir -p $(CURDIR)/debian/ngircd/var/run/ircd
cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \ cat $(CURDIR)/debian/ngircd/usr/share/doc/ngircd/sample-ngircd.conf | \
sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = |/etc/ngircd/ngircd.motd|g" | \
sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \ sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
>$(CURDIR)/debian/ngircd/etc/ngircd/ngircd.conf >$(CURDIR)/debian/ngircd/etc/ngircd/ngircd.conf
touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd touch $(CURDIR)/debian/ngircd/etc/ngircd/ngircd.motd
@@ -153,16 +157,11 @@ install-ngircd-full: build-ngircd-full
# Add here commands to install the "full" package into debian/ngircd-full: # Add here commands to install the "full" package into debian/ngircd-full:
$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full
rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/INSTALL* rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/INSTALL*
rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd/COPYING* rm $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/COPYING*
mv $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd \
$(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full
mkdir -p $(CURDIR)/debian/ngircd-full/var/run/ircd
cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \ cat $(CURDIR)/debian/ngircd-full/usr/share/doc/ngircd-full/sample-ngircd.conf | \
sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = /etc/ngircd/ngircd.motd|g" | \
sed -e "s|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full/Commands.txt|g" | \
sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \ sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
>$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf >$(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.conf
touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd touch $(CURDIR)/debian/ngircd-full/etc/ngircd/ngircd.motd
@@ -176,16 +175,11 @@ install-ngircd-full-dbg: build-ngircd-full-dbg
# Add here commands to install the "full" package into debian/ngircd-full: # Add here commands to install the "full" package into debian/ngircd-full:
$(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg $(MAKE) install DESTDIR=$(CURDIR)/debian/ngircd-full-dbg
rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/INSTALL* rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/INSTALL*
rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd/COPYING* rm $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/COPYING*
mv $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd \
$(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg
mkdir -p $(CURDIR)/debian/ngircd-full-dbg/var/run/ircd
cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \ cat $(CURDIR)/debian/ngircd-full-dbg/usr/share/doc/ngircd-full-dbg/sample-ngircd.conf | \
sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \ sed -e "s|;ServerUID = 65534|ServerUID = irc|g" | \
sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \ sed -e "s|;ServerGID = 65534|ServerGID = irc|g" | \
sed -e "s|;MotdFile = /usr/local/etc/ngircd.motd|MotdFile = /etc/ngircd/ngircd.motd|g" | \
sed -e "s|;HelpFile = /usr/share/doc/ngircd/Commands.txt|HelpFile = /usr/share/doc/ngircd-full-dbg/Commands.txt|g" | \
sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \ sed -e "s|;PidFile = /var/run/ngircd/ngircd.pid|PidFile = /var/run/ircd/ngircd.pid|g" \
>$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf >$(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.conf
touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd touch $(CURDIR)/debian/ngircd-full-dbg/etc/ngircd/ngircd.motd
@@ -198,12 +192,18 @@ binary-indep:
# Build architecture-dependent files here. # Build architecture-dependent files here.
binary-arch: build install binary-arch: build install
ln -s $(CURDIR)/contrib/ngircd.service \
$(CURDIR)/debian/ngircd.service
ln -s $(CURDIR)/debian/ngircd.default \ ln -s $(CURDIR)/debian/ngircd.default \
$(CURDIR)/debian/ngircd-full.default $(CURDIR)/debian/ngircd-full.default
ln -s $(CURDIR)/debian/ngircd.init \ ln -s $(CURDIR)/debian/ngircd.init \
$(CURDIR)/debian/ngircd-full.init $(CURDIR)/debian/ngircd-full.init
ln -s $(CURDIR)/debian/ngircd.postinst \ ln -s $(CURDIR)/debian/ngircd.postinst \
$(CURDIR)/debian/ngircd-full.postinst $(CURDIR)/debian/ngircd-full.postinst
cp $(CURDIR)/contrib/ngircd.service \
$(CURDIR)/debian/ngircd-full.service
echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full.service
ln -s $(CURDIR)/debian/ngircd.default \ ln -s $(CURDIR)/debian/ngircd.default \
$(CURDIR)/debian/ngircd-full-dbg.default $(CURDIR)/debian/ngircd-full-dbg.default
@@ -211,12 +211,17 @@ binary-arch: build install
$(CURDIR)/debian/ngircd-full-dbg.init $(CURDIR)/debian/ngircd-full-dbg.init
ln -s $(CURDIR)/debian/ngircd.postinst \ ln -s $(CURDIR)/debian/ngircd.postinst \
$(CURDIR)/debian/ngircd-full-dbg.postinst $(CURDIR)/debian/ngircd-full-dbg.postinst
cp $(CURDIR)/contrib/ngircd.service \
$(CURDIR)/debian/ngircd-full-dbg.service
echo "Alias=ngircd.service" >>$(CURDIR)/debian/ngircd-full-dbg.service
dh_testdir dh_testdir
dh_testroot dh_testroot
dh_installchangelogs -a -A ChangeLog dh_installchangelogs -a -A ChangeLog
dh_installdocs -a dh_installdocs -a
dh_systemd_enable -a
dh_installinit -a dh_installinit -a
dh_systemd_start -a
dh_strip -a --no-package=ngircd-full-dbg dh_strip -a --no-package=ngircd-full-dbg
dh_compress -a -XCommands.txt dh_compress -a -XCommands.txt
dh_fixperms -a dh_fixperms -a
@@ -228,6 +233,6 @@ binary-arch: build install
binary: binary-indep binary-arch binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install .PHONY: build clean binary-indep binary-arch binary install
# -eof- # -eof-

View File

@@ -105,6 +105,8 @@
#define HAVE_INET_ATON 1 #define HAVE_INET_ATON 1
/* Define to 1 if you have the `getaddrinfo' function. */ /* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1 #define HAVE_GETADDRINFO 1
/* getaddrinfo(0) */
#define HAVE_WORKING_GETADDRINFO 1
/* Define to 1 if you have the `getnameinfo' function. */ /* Define to 1 if you have the `getnameinfo' function. */
#define HAVE_GETNAMEINFO 1 #define HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `sigaction' function. */ /* Define to 1 if you have the `sigaction' function. */

View File

@@ -5,7 +5,7 @@
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural
\f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\ \f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\
Copyright (c)2001-2013 Alexander Barton and Contributors.\ Copyright (c)2001-2014 Alexander Barton and Contributors.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\i0 \cf0 \ \i0 \cf0 \

View File

@@ -84,7 +84,7 @@
FA2D564811EA158B00D37A35 /* pam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pam.h; sourceTree = "<group>"; }; FA2D564811EA158B00D37A35 /* pam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pam.h; sourceTree = "<group>"; };
FA2D564911EA158B00D37A35 /* pam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pam.c; sourceTree = "<group>"; }; FA2D564911EA158B00D37A35 /* pam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pam.c; sourceTree = "<group>"; };
FA2D567A11EA1AB300D37A35 /* libpam.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpam.dylib; path = usr/lib/libpam.dylib; sourceTree = SDKROOT; }; FA2D567A11EA1AB300D37A35 /* libpam.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpam.dylib; path = usr/lib/libpam.dylib; sourceTree = SDKROOT; };
FA322BBA0CEF72E4001761B3 /* ngIRCd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = ngIRCd; path = ngircd; sourceTree = BUILT_PRODUCTS_DIR; }; FA322BBA0CEF72E4001761B3 /* ngircd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ngircd; sourceTree = BUILT_PRODUCTS_DIR; };
FA322CD60CEF74B1001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; }; FA322CD60CEF74B1001761B3 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
FA322CD90CEF74B1001761B3 /* array.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = array.c; sourceTree = "<group>"; }; FA322CD90CEF74B1001761B3 /* array.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = array.c; sourceTree = "<group>"; };
FA322CDA0CEF74B1001761B3 /* array.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = array.h; sourceTree = "<group>"; }; FA322CDA0CEF74B1001761B3 /* array.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = array.h; sourceTree = "<group>"; };
@@ -138,8 +138,6 @@
FA322D0D0CEF74B1001761B3 /* resolve.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = resolve.h; sourceTree = "<group>"; }; FA322D0D0CEF74B1001761B3 /* resolve.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = resolve.h; sourceTree = "<group>"; };
FA322D100CEF74B1001761B3 /* ansi2knr.1 */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.man; path = ansi2knr.1; sourceTree = "<group>"; }; FA322D100CEF74B1001761B3 /* ansi2knr.1 */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.man; path = ansi2knr.1; sourceTree = "<group>"; };
FA322D110CEF74B1001761B3 /* ansi2knr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = ansi2knr.c; sourceTree = "<group>"; }; FA322D110CEF74B1001761B3 /* ansi2knr.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = ansi2knr.c; sourceTree = "<group>"; };
FA322D120CEF74B1001761B3 /* exp.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = exp.h; sourceTree = "<group>"; };
FA322D130CEF74B1001761B3 /* imp.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = imp.h; sourceTree = "<group>"; };
FA322D150CEF74B1001761B3 /* portab.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = portab.h; sourceTree = "<group>"; }; FA322D150CEF74B1001761B3 /* portab.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = portab.h; sourceTree = "<group>"; };
FA322D160CEF74B1001761B3 /* portabtest.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = portabtest.c; sourceTree = "<group>"; }; FA322D160CEF74B1001761B3 /* portabtest.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = portabtest.c; sourceTree = "<group>"; };
FA322D170CEF74B1001761B3 /* splint.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = splint.h; sourceTree = "<group>"; }; FA322D170CEF74B1001761B3 /* splint.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = splint.h; sourceTree = "<group>"; };
@@ -312,7 +310,7 @@
1AB674ADFE9D54B511CA2CBB /* Products */ = { 1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FA322BBA0CEF72E4001761B3 /* ngIRCd */, FA322BBA0CEF72E4001761B3 /* ngircd */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -423,8 +421,6 @@
FA18A64716CEE14900132F66 /* Makefile.ng */, FA18A64716CEE14900132F66 /* Makefile.ng */,
FA322D100CEF74B1001761B3 /* ansi2knr.1 */, FA322D100CEF74B1001761B3 /* ansi2knr.1 */,
FA322D110CEF74B1001761B3 /* ansi2knr.c */, FA322D110CEF74B1001761B3 /* ansi2knr.c */,
FA322D120CEF74B1001761B3 /* exp.h */,
FA322D130CEF74B1001761B3 /* imp.h */,
FA322D150CEF74B1001761B3 /* portab.h */, FA322D150CEF74B1001761B3 /* portab.h */,
FA322D160CEF74B1001761B3 /* portabtest.c */, FA322D160CEF74B1001761B3 /* portabtest.c */,
FA322D170CEF74B1001761B3 /* splint.h */, FA322D170CEF74B1001761B3 /* splint.h */,
@@ -630,7 +626,7 @@
name = ngIRCd; name = ngIRCd;
productInstallPath = "$(HOME)/bin"; productInstallPath = "$(HOME)/bin";
productName = ngIRCd; productName = ngIRCd;
productReference = FA322BBA0CEF72E4001761B3 /* ngIRCd */; productReference = FA322BBA0CEF72E4001761B3 /* ngircd */;
productType = "com.apple.product-type.tool"; productType = "com.apple.product-type.tool";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@@ -639,7 +635,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = { 08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0430; LastUpgradeCheck = 0800;
}; };
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */; buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "ngIRCd" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
@@ -746,10 +742,25 @@
1DEB928B08733DD80010E9CD /* Default */ = { 1DEB928B08733DD80010E9CD /* Default */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = NO;
GCC_VERSION = ""; GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6; MACOSX_DEPLOYMENT_TARGET = 10.6;
SDKROOT = ""; SDKROOT = "";
@@ -759,11 +770,27 @@
FAB0570C105D917F006AF9E2 /* Debug */ = { FAB0570C105D917F006AF9E2 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)"; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_DEBUGGING_SYMBOLS = full; GCC_DEBUGGING_SYMBOLS = full;
GCC_NO_COMMON_BLOCKS = NO;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = ""; GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6; MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;

View File

@@ -12,7 +12,7 @@
Debian/ Debian/
- Various files for building Debian GNU/Linux packages (".deb's"). - Various files for building Debian GNU/Linux packages (".deb's").
- ngircd.init; ngircd.default: init script for Debian-based systems. - ngircd.init; ngircd.default: init script for Debian-based systems.
- ngircd.pam: example PAM configuraton. - ngircd.pam: example PAM configuration.
MacOSX/ MacOSX/
- Project files for XCode, the "project builder" of Apple Mac OS X. - Project files for XCode, the "project builder" of Apple Mac OS X.

View File

@@ -1,17 +1,17 @@
#/bin/sh #!/bin/sh
INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl" INDENTARGS="-kr -i8 -ts8 -l80 -c3 -cd41 -ss -ncs -psl"
# check if indent(1) is available # check if indent(1) is available
type indent >/dev/null 2>&1 && INDENT="indent" command -v indent >/dev/null 2>&1 && INDENT="indent"
type gindent >/dev/null 2>&1 && INDENT="gindent" command -v gindent >/dev/null 2>&1 && INDENT="gindent"
type gnuindent >/dev/null 2>&1 && INDENT="gnuindent" command -v gnuindent >/dev/null 2>&1 && INDENT="gnuindent"
if [ -z "$INDENT" ]; then if [ -z "$INDENT" ]; then
echo "Error: GNU \"indent\" not found!" echo "Error: GNU \"indent\" not found!"
exit 1 exit 1
fi fi
$INDENT -v $INDENTARGS $* $INDENT -v $INDENTARGS "$@"
# -eof- # -eof-

0
contrib/ngircd-bsd.sh Normal file → Executable file
View File

0
contrib/ngircd-redhat.init Normal file → Executable file
View File

View File

@@ -1,11 +1,43 @@
# ngIRCd systemd service unit.
# See systemd(1), systemd.unit(5), systemd.service(5), systemd.exec(5).
[Unit] [Unit]
Description=Next Generation IRC Daemon Description=Next Generation IRC Daemon
Documentation=man:ngircd(8) man:ngircd.conf(5) https://ngircd.barton.de
After=network.target After=network.target
Wants=anope.service atheme.service irc-services.service
Wants=bopm.service
Before=anope.service atheme.service irc-services.service
Before=bopm.service
[Service] [Service]
Type=forking Type=forking
ExecStart=/usr/sbin/ngircd User=irc
Group=irc
# Settings & limits:
CapabilityBoundingSet=CAP_SYS_CHROOT CAP_NET_BIND_SERVICE
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
PrivateDevices=yes
PrivateTmp=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=full
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictRealtime=yes
RuntimeDirectory=ircd
RuntimeDirectoryMode=750
# Try to load "default files" from any Debian package variant to keep this
# unit generic.
EnvironmentFile=-/etc/default/ngircd
EnvironmentFile=-/etc/default/ngircd-full
EnvironmentFile=-/etc/default/ngircd-full-dbg
# Start ngIRCd. Note: systemd doesn't allow to use $DAEMON here!
ExecStart=/usr/sbin/ngircd $PARAMS
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -1,5 +1,6 @@
[Unit] [Unit]
Description=Next Generation IRC Daemon (Socket) Description=Next Generation IRC Daemon (Socket)
Documentation=man:ngircd(8) man:ngircd.conf(5)
[Socket] [Socket]
BindIPv6Only=ipv6-only BindIPv6Only=ipv6-only

View File

@@ -1,5 +1,5 @@
%define name ngircd %define name ngircd
%define version 21 %define version 24~rc1
%define release 1 %define release 1
%define prefix %{_prefix} %define prefix %{_prefix}

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -14,20 +14,25 @@
# suitable for inclusion in doc/Platforms.txt -- please send reports # suitable for inclusion in doc/Platforms.txt -- please send reports
# to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>. # to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
NAME=`basename "$0"` NAME=$(basename "$0")
VERBOSE= VERBOSE=
CLEAN=1
PLATFORM= PLATFORM=
COMPILER="unknown" COMPILER="unknown"
VERSION="unknown" VERSION="unknown"
DATE=`date "+%y-%m-%d"` DATE=$(date "+%y-%m-%d")
COMMENT= COMMENT=
R_CONFIGURE= R_CONFIGURE=
R_MAKE= R_MAKE=
R_CHECK= R_CHECK=
R_CHECK_Y="?"
R_RUN= R_RUN=
SRC_D=$(dirname "$0")
MY_D="$PWD"
[ -n "$MAKE" ] || MAKE="make" [ -n "$MAKE" ] || MAKE="make"
export MAKE CC export MAKE CC
@@ -36,54 +41,95 @@ while [ $# -gt 0 ]; do
"-v") "-v")
VERBOSE=1 VERBOSE=1
;; ;;
"-x")
CLEAN=
;;
*) *)
echo "Usage: $NAME [-v]" echo "Usage: $NAME [-v] [-x]"
echo
echo " -v Verbose output"
echo " -x Don't regenerate build system, even when possible"
echo
exit 2 exit 2
esac esac
shift shift
done done
for cmd in telnet expect; do
command -v "$cmd" >/dev/null 2>&1 \
|| echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!"
done
echo "$NAME: Checking ngIRCd base source directory ..." echo "$NAME: Checking ngIRCd base source directory ..."
grep "ngIRCd" ./ChangeLog >/dev/null 2>&1 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
grep "ngIRCd" ../ChangeLog >/dev/null 2>&1 grep "ngIRCd" "$SRC_D/../ChangeLog" >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "$NAME: ngIRCd base source directory not found!?" echo "$NAME: ngIRCd base source directory not found!?"
exit 1 exit 1
fi fi
cd .. SRC_D="$SRC_D/.."
fi fi
echo "$NAME: - source directory: $SRC_D"
echo "$NAME: - working directory: $MY_D"
echo "$NAME: Checking for GIT tree ..." echo "$NAME: Checking for GIT tree ..."
if [ -d .git ]; then if [ -d "$SRC_D/.git" ]; then
echo "$NAME: Checking for \"git\" command ..." echo "$NAME: Checking for \"git\" command ..."
git version >/dev/null 2>&1 git version >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
echo "$NAME: Running \"git clean\" ..." echo "$NAME: Running \"git clean\" ..."
[ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null cd "$SRC_D" || exit 1
if [ -n "$VERBOSE" ]; then
git clean -dxf
else
git clean -dxf >/dev/null
fi
cd "$MY_D" || exit 1
fi fi
fi fi
echo "$NAME: Checking for \"./configure\" script ..." echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
if [ ! -e ./configure ]; then if [ ! -r "$SRC_D/configure" ]; then
echo "$NAME: Running \"./autogen.sh\" ..." echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null cd "$SRC_D" || exit 1
if [ -n "$VERBOSE" ]; then
./autogen.sh
else
./autogen.sh >/dev/null
fi
cd "$MY_D" || exit 1
fi fi
if [ -r ./configure ]; then if [ -r "$SRC_D/configure" ]; then
echo "$NAME: Running \"./configure\" script ..." echo "$NAME: Running \"$SRC_D/configure\" script ..."
[ -n "$VERBOSE" ] && ./configure || ./configure >/dev/null if [ -n "$VERBOSE" ]; then
if [ $? -eq 0 -a -r ./Makefile ]; then "$SRC_D/configure" -C
else
"$SRC_D/configure" -C >/dev/null
fi
if [ $? -eq 0 ] && [ -r ./Makefile ]; then
R_CONFIGURE=1 R_CONFIGURE=1
rm -f "src/ngircd/ngircd"
echo "$NAME: Running \"$MAKE\" ..." echo "$NAME: Running \"$MAKE\" ..."
[ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null if [ -n "$VERBOSE" ]; then
if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then "$MAKE"
else
"$MAKE" >/dev/null
fi
if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then
R_MAKE=1 R_MAKE=1
echo "$NAME: Running \"$MAKE check\" ..." echo "$NAME: Running \"$MAKE check\" ..."
[ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null if [ -n "$VERBOSE" ]; then
"$MAKE" check
else
"$MAKE" check >/dev/null
fi
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
R_CHECK=1 R_CHECK=1
R_RUN=$R_CHECK R_RUN=$R_CHECK
[ -r ./src/testsuite/tests-skipped.lst ] \
&& R_CHECK_Y="y" || R_CHECK_Y="Y"
else else
./src/ngircd/ngircd --help 2>/dev/null \ ./src/ngircd/ngircd --help 2>/dev/null \
| grep "^ngIRCd" >/dev/null | grep "^ngIRCd" >/dev/null
@@ -95,13 +141,13 @@ fi
# Get target platform information # Get target platform information
if [ -r "src/config.h" ]; then if [ -r "src/config.h" ]; then
CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2` CPU=$(grep "HOST_CPU" "src/config.h" | cut -d'"' -f2)
OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2` OS=$(grep "HOST_OS" "src/config.h" | cut -d'"' -f2)
VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2` VENDOR=$(grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2)
PLATFORM="$CPU/$VENDOR/$OS" PLATFORM="$CPU/$VENDOR/$OS"
fi fi
if [ -z "$PLATFORM" ]; then if [ -z "$PLATFORM" ]; then
PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`" PLATFORM="$(uname 2>/dev/null) $(uname -r 2>/dev/null), $(uname -m 2>/dev/null)"
fi fi
# Get compiler information # Get compiler information
@@ -133,18 +179,18 @@ if [ -r "Makefile" ]; then
| cut -d'(' -f1 | sed -e 's/version //g') | cut -d'(' -f1 | sed -e 's/version //g')
fi fi
if [ "$COMPILER" = "unknown" ]; then if [ "$COMPILER" = "unknown" ]; then
v="`$CC --version 2>/dev/null | head -1`" v="$($CC --version 2>/dev/null | head -1)"
[ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`" [ -z "$v" ] && v="$($CC -version 2>/dev/null | head -1)"
[ -n "$v" ] && COMPILER="$v" [ -n "$v" ] && COMPILER="$v"
fi fi
fi fi
fi fi
# Get ngIRCd version information # Get ngIRCd version information
eval $(grep "^VERSION = " Makefile | sed -e 's/ //g') eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
case "$VERSION" in case "$VERSION" in
*-*-*) *~*-*)
VERSION=`echo "$VERSION" | cut -d'-' -f3 | cut -b2-` VERSION=$(echo "$VERSION" | cut -b1-10)
;; ;;
esac esac
[ -n "$VERSION" ] || VERSION="unknown" [ -n "$VERSION" ] || VERSION="unknown"
@@ -163,8 +209,13 @@ fi
[ -n "$R_CONFIGURE" ] && C="Y" || C="N" [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
[ -n "$R_MAKE" ] && M="Y" || M="N" [ -n "$R_MAKE" ] && M="Y" || M="N"
[ -n "$R_CHECK" ] && T="Y" || T="N" [ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N"
[ -n "$R_RUN" ] && R="Y" || R="N" if [ -n "$R_RUN" ]; then
# Mark "runs" with "Y" only when the test suite succeeded:
[ "$T" = "N" ] && R="?" || R="Y"
else
R="N"
fi
[ -n "$COMMENT" ] && COMMENT=" $COMMENT" [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
echo echo
@@ -175,13 +226,29 @@ echo " ./configure works --+ |
echo " | | | |" echo " | | | |"
echo "Platform Compiler ngIRCd Date Tester C M T R *" echo "Platform Compiler ngIRCd Date Tester C M T R *"
echo "--------------------------- ------------ ---------- -------- -------- - - - - -" echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
type printf >/dev/null 2>&1 command -v printf >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s" \ printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
"$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \ "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$LOGNAME" \
"$C" "$M" "$T" "$R" "$COMMENT" "$C" "$M" "$T" "$R" "$COMMENT"
else else
echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \ echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \
"$C" "$M" "$T" "$R" "$COMMENT" "$C" "$M" "$T" "$R" "$COMMENT"
fi fi
echo; echo echo
double_check() {
echo "Please double check that the ngIRCd daemon starts up, runs and handles IRC"
echo "connections successfully!"
}
if [ "$R_CHECK_Y" = "y" ]; then
echo "WARNING: Some tests have been skipped!"
double_check
echo
fi
if [ "$R" = "?" ]; then
echo "WARNING: The resulting binary passed simple tests, but the test suite failed!"
double_check
echo
fi

1
doc/.gitignore vendored
View File

@@ -1 +0,0 @@
sample-ngircd.conf

View File

@@ -1,9 +1,8 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
(c)2001-2010 Alexander Barton, (c)2001-2014 Alexander Barton and Contributors.
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -18,7 +17,7 @@ monitor, designed for use with hybrid-based ircds, although it can be used
with slight modification on any server which has the ability to show connects with slight modification on any server which has the ability to show connects
to opers and that supports KLINEs." to opers and that supports KLINEs."
And starting with Release 17, ngIRCd supports all required log messages that Starting with Release 17, ngIRCd supports all required log messages that
BOPM requires to be useful. BOPM requires to be useful.
II. Installation II. Installation
@@ -37,11 +36,12 @@ a) BOPM "IRC" section:
3) change "mode" to "+ci" or "+c". 3) change "mode" to "+ci" or "+c".
4) Set "connregex" to the following string, everything in one line(!): 4) Set "connregex" to the following string, everything in one line(!):
"\\*\\*\\* Notice -- Client connecting: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*"; "Client connecting: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*";
and comment all the other "connregex" examples (prepend a "#" character). and comment out all the other "connregex" examples (that is, prepend a
"#" character).
5) Set "kline" to "KILL %n :Open proxy found on your host!"; for example, 5) Set "kline" to "GLINE *@%h :Open proxy found on your host!";
and comment all the other "kline" examples. and comment out all the other "kline" examples.
b) BOPM "scanner" section: b) BOPM "scanner" section:

View File

@@ -13,7 +13,7 @@ This document lists and describes the "IRC capabilities" that ngIRCd supports
and can be requested by a IRC/IRCv3 client that supports the "CAP" command. and can be requested by a IRC/IRCv3 client that supports the "CAP" command.
ngIRCd implements the "IRC Client Capabilities Extension" as described here: ngIRCd implements the "IRC Client Capabilities Extension" as described here:
<http://www.leeh.co.uk/draft-mitchell-irc-capabilities-02.html> <http://ircv3.net/specs/core/capability-negotiation-3.1.html>
I. Supported Capabilities I. Supported Capabilities
@@ -25,4 +25,4 @@ I. Supported Capabilities
server to send all possible prefixes which apply to a user in NAMES and server to send all possible prefixes which apply to a user in NAMES and
WHO output. WHO output.
See <http://ircv3.atheme.org/extensions/multi-prefix-3.1>. See <http://ircv3.net/specs/extensions/multi-prefix-3.1.html>.

View File

@@ -78,7 +78,7 @@ Connection Handling Commands
like this: "CAP REQ :capability1 capability2 capability3" for example. like this: "CAP REQ :capability1 capability2 capability3" for example.
References: References:
- <http://ircv3.atheme.org/specification/capability-negotiation-3.1> - <http://ircv3.net/specs/core/capability-negotiation-3.1.html>
- <http://ngircd.barton.de/doc/Capabilities.txt> - <http://ngircd.barton.de/doc/Capabilities.txt>
- doc/Capabilities.txt - doc/Capabilities.txt
@@ -324,7 +324,7 @@ General Commands
In addition, IRC Ops can use these two forms to specify the <target>: In addition, IRC Ops can use these two forms to specify the <target>:
. .
- #<hostmask> - #<hostmask>
- #<servermask> - $<servermask>
. .
The <mask> can contain the wildcard characters "*" and "?", but must The <mask> can contain the wildcard characters "*" and "?", but must
contain at least one dot (".") and no wildcard after the last one. contain at least one dot (".") and no wildcard after the last one.
@@ -380,7 +380,7 @@ Status and Informational Commands
Please note that "all" IRC daemons even parse separate nicknames in Please note that "all" IRC daemons even parse separate nicknames in
a single parameter (like ":nick1 nick2"), and therefore ngIRCd a single parameter (like ":nick1 nick2"), and therefore ngIRCd
implements this behaviour, too. implements this behavior, too.
References: References:
- RFC 2812, 4.9 "Ison message" - RFC 2812, 4.9 "Ison message"

View File

@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2011 Alexander Barton and Contributors. (c)2001-2015 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -15,7 +15,7 @@ get an idea of how to do it the best :-)
- Use GIT - Use GIT
The source code of ngIRCd is maintained using GIT, see doc/GIT.txt. So if The source code of ngIRCd is maintained using GIT, see doc/GIT.txt. So if
remotely possible, use GIT for your work, too. It makes your and our lifes remotely possible, use GIT for your work, too. It makes your and our lives
much easier ;-) much easier ;-)
- Don't forget to include documentation - Don't forget to include documentation
@@ -52,3 +52,9 @@ get an idea of how to do it the best :-)
And this is open source, your work must not be 100% finished and perfect, And this is open source, your work must not be 100% finished and perfect,
work in progress is interesting, too: "release early, release often"! work in progress is interesting, too: "release early, release often"!
- Use GitHub to create "Pull Requests"
ngIRCd is hosted on GitHub (<https://github.com/ngircd>), so please use the
tools available there and open issues (comment!) and create pull requests!
See <https://help.github.com/articles/using-pull-requests/> for details.

View File

@@ -89,16 +89,21 @@ A: You need to set 'OperCanUseMode = yes' in ngircd.conf, then IRC operators
can use the MODE command for changing modes even when they are not joined can use the MODE command for changing modes even when they are not joined
to the specific channel. to the specific channel.
Q: How can I "auto-op" users in channels?
A: ngIRCd can't do this: you would have to use some "IRC Services", like
Atheme (<http://atheme.net/atheme.html>) or Anope (<http://www.anope.org>).
See "doc/Services.txt" for setup instructions.
IV. Bugs!? IV. Bugs!?
~~~~~~~~~~ ~~~~~~~~~~
Q: Is there a list of known bugs and desired feature enhancements? Q: Is there a list of known bugs and desired feature enhancements?
A: Yes. Have a look at the bug tracking system (Bugzilla) for ngIRCd located A: Yes. Have a look at the bug tracking system (GitHub issues) for ngIRCd located
at <http://ngircd.barton.de/bugzilla/index.cgi>. There you can file bug at <https://github.com/ngircd/ngircd/issues>. There you can file bug
reports and feature requests as well as search the bug database. reports and feature requests as well as search the bug database.
Q: What should I do if I found a bug? Q: What should I do if I found a bug?
A: Please file a bug report at <http://ngircd.barton.de/bugzilla/index.cgi>! A: Please file a bug report at <https://github.com/ngircd/ngircd/issues/new>!
The author of the particular component will be notified automagically :-) The author will be notified automagically :-)

View File

@@ -1,65 +0,0 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
(c)2001-2011 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- GIT.txt --
The source code of ngIRCd is maintained using GIT, an distributed version
control system. Homepage including documentation: <http://git-scm.com/>.
I. Viewing the source code online
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ngIRCd "GITweb" interface allows you to browse the GIT repository and
to see all individual files, tags, branches, commits etc.:
<http://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git>
II. Getting the source code
~~~~~~~~~~~~~~~~~~~~~~~~~~~
To access (copy, clone) the source tree repository anonymously, run:
$ git clone git://ngircd.barton.de/ngircd.git
Thereby a new folder "ngircd" will be created containing all the individual
source files.
The newly created directory ("ngircd") is the "working directory", all
GIT commands will be executed from within this directory in the future.
Please note: When checking out a fresh copy of ngIRCd using GIT, the
configure script doesn't exist; you have to run the autogen.sh shell script
(which is included in the source tree) to generate it. This requires you to
have GNU automake and GNU autoconf installed on your system. Please see the
file INSTALL for details!
To update the local GIT repository:
$ git pull
This retrieves all changes and merges them into the current branch.
III. Contributing
~~~~~~~~~~~~~~~~~
Patches should be sent to the ngircd mailing list. List homepage:
http://arthur.barton.de/mailman/listinfo/ngircd-ml
If you do not want to send them to the list, you can also mail them
to Alex Barton, <alex@barton.de>.
IV. Write Access
~~~~~~~~~~~~~~~~
If you want to contribute a couple of patches and write access to the GIT
repository would be handy, please contact Alex Barton, <alex@barton.de>.

View File

@@ -37,6 +37,7 @@ II. How to prepare a new ngIRCd release?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) Make sure the source tree is in a releasable state ;-) a) Make sure the source tree is in a releasable state ;-)
- is the AUTHORS file up to date?
b) Make sure you have working versions of GNU autoconf and GNU automake b) Make sure you have working versions of GNU autoconf and GNU automake
installed on the system you use for generating the release: installed on the system you use for generating the release:
@@ -74,4 +75,6 @@ l) Upload and distribute the newly generated ngIRCd release archive(s)
m) Write an announcement to the mailing list, freshmeat, Twitter, ... m) Write an announcement to the mailing list, freshmeat, Twitter, ...
n) Relax :-) n) Update the list of releases in our bug tracker.
o) Relax :-)

View File

@@ -1,6 +1,6 @@
# #
# ngIRCd -- The Next Generation IRC Daemon # ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors # Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@ static_docs = \
Commands.txt \ Commands.txt \
Contributing.txt \ Contributing.txt \
FAQ.txt \ FAQ.txt \
GIT.txt \
HowToRelease.txt \ HowToRelease.txt \
Modes.txt \ Modes.txt \
PAM.txt \ PAM.txt \
@@ -54,11 +53,11 @@ maintainer-clean-local:
all: $(generated_docs) all: $(generated_docs)
install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs) install-data-hook: $(static_docs) $(toplevel_docs) $(generated_docs)
$(mkinstalldirs) $(DESTDIR)$(sysconfdir) $(MKDIR_P) -m 755 $(DESTDIR)$(sysconfdir)
@if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \ @if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
make install-config; \ make install-config; \
fi fi
$(mkinstalldirs) $(DESTDIR)$(docdir) $(MKDIR_P) -m 755 $(DESTDIR)$(docdir)
for f in $(static_docs) $(toplevel_docs); do \ for f in $(static_docs) $(toplevel_docs); do \
$(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \ $(INSTALL) -m 644 -c $(srcdir)/$$f $(DESTDIR)$(docdir)/; \
done done

View File

@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2012 Alexander Barton and Contributors. (c)2001-2015 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -26,7 +26,9 @@ channels he is using at the moment.
B 20 User is flagged as a "bot". B 20 User is flagged as a "bot".
c 17 IRC operator wants to receive connect/disconnect NOTICEs. c 17 IRC operator wants to receive connect/disconnect NOTICEs.
C 19 Only users that share a channel are allowed to send messages. C 19 Only users that share a channel are allowed to send messages.
F 22 Relaxed flood protection (only settable by IRC Operators).
i 0.0.1 User is "invisible". i 0.0.1 User is "invisible".
I 23 No channels are shown on WHOIS (IRC Ops can always see those).
o 0.0.1 User is IRC operator. o 0.0.1 User is IRC operator.
q 20 User is protected, can not be kicked from a channel. q 20 User is protected, can not be kicked from a channel.
r 0.0.1 User is restricted. r 0.0.1 User is restricted.
@@ -54,6 +56,7 @@ users to lists (e.g. "invite list", "ban list"), others have parameters
m 0.3.0 Channel is moderated, only "voiced" users can send messages. m 0.3.0 Channel is moderated, only "voiced" users can send messages.
M 20 Only registered users (and IRC Ops) can send messages. M 20 Only registered users (and IRC Ops) can send messages.
n 0.3.0 Channel doesn't allow messages of users not being members. n 0.3.0 Channel doesn't allow messages of users not being members.
N 23 Users can't change their nickname while on this channel.
O 18 Only IRC operators are allowed to join this channel. O 18 Only IRC operators are allowed to join this channel.
P 0.5.0 Channel is "persistent". P 0.5.0 Channel is "persistent".
Q 20 Nobody can be kicked from the channel. Q 20 Nobody can be kicked from the channel.
@@ -72,17 +75,21 @@ channel of which he is a member.
mode since description mode since description
q 20 User is channel owner can only be set by a service, other q 20 User is channel owner. This mode can only be set by an IRC
owner and irc op. Can promote other users to q, a, o, h, v. service, other owner or IRC operator. Channel owners can
a 20 User is channel admin and can promote other users to v, h, o promote other users to all levels: q, a, o, h, v. Prefix: "~".
a 20 User is channel admin and can promote other users to v, h, o.
Prefix: "&".
o 0.2.0 User is channel operator and can op/kick/... other members. o 0.2.0 User is channel operator and can op/kick/... other members.
Prefix: "@".
h 20 User is half op and can set channel modes imntvIbek and kick h 20 User is half op and can set channel modes imntvIbek and kick
voiced and normal users. voiced and normal users. Prefix: "%".
v 0.2.0 User is "voiced" and can speak even if channel is moderated. v 0.2.0 User is "voiced" and can speak even if channel is moderated.
Prefix: "+".
Notes Notes
~~~~~ ~~~~~
(1) This mode is not set by ngIRCd itself but by services. ngIRCd handles (1) This mode is not set by ngIRCd itself but by services. ngIRCd handles
the mode transparently and possibly adjusts its behaviour. the mode transparently and possibly adjusts its behavior.

View File

@@ -26,6 +26,10 @@ A very simple -- and quite useless ;-) -- example would be:
Here the "pam_debug" module will be called each time a client connects to Here the "pam_debug" module will be called each time a client connects to
the ngIRCd and has sent its PASS, NICK, and USER commands. the ngIRCd and has sent its PASS, NICK, and USER commands.
The PAM library used by the ngIRCd daemon must be able to access its
configuration file, so don't forget to check permissions and run something
like this: "chmod 644 /etc/pam.d/ngircd".
Please note ONE VERY IMPORTANT THING: Please note ONE VERY IMPORTANT THING:
All the PAM modules are executed with the privileges of the user ngIRCd All the PAM modules are executed with the privileges of the user ngIRCd

View File

@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/ http://ngircd.barton.de/
(c)2001-2013 Alexander Barton and Contributors. (c)2001-2016 Alexander Barton and Contributors.
ngIRCd is free software and published under the ngIRCd is free software and published under the
terms of the GNU General Public License. terms of the GNU General Public License.
@@ -30,37 +30,48 @@ alpha/unknown/netbsd3.0 gcc 3.3.3 CVSHEAD 06-05-07 fw Y Y Y Y 3
armv6l/unk./linux-gnueabi gcc 4.7.2 20.2 13-03-08 goetz Y Y Y Y 5 armv6l/unk./linux-gnueabi gcc 4.7.2 20.2 13-03-08 goetz Y Y Y Y 5
armv6l/unk./linux-gnueabihf gcc 4.6.3 21~rc2 13-10-26 pi Y Y Y Y 5 armv6l/unk./linux-gnueabihf gcc 4.6.3 21~rc2 13-10-26 pi Y Y Y Y 5
armv7l/unk./linux-gnueabi gcc 4.4.3 19.1 12-04-29 goetz Y Y Y Y 5 armv7l/unk./linux-gnueabi gcc 4.4.3 19.1 12-04-29 goetz Y Y Y Y 5
armv7l/unk./linux-gnueabihf gcc 4.6.3 22~rc1-3 14-10-10 alex Y Y Y Y 5
armv7l/unk./linux-gnueabihf gcc 4.8.2 21.1 14-07-15 goetz Y Y Y Y 5
armv7l/unk./linux-gnueabihf gcc 4.9.2 23 16-01-10 alex Y Y Y Y 5
hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y
hppa/unknown/openbsd5.4 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3
hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
hppa2.0/unknown/linux-gnu gcc 3.3.5 13~rc1 08-12-02 alex Y Y Y Y hppa2.0/unknown/linux-gnu gcc 3.3.5 13~rc1 08-12-02 alex Y Y Y Y
hppa2.0w-hp-hpux11.11 gcc 4.2.3 14.1 09-07-22 goetz Y Y Y Y hppa2.0w-hp-hpux11.11 gcc 4.2.3 14.1 09-07-22 goetz Y Y Y Y
i386/apple/darwin9.7.0 gcc 4.0.1 14.1 09-08-04 alex Y Y Y Y 3 i386/apple/darwin9.7.0 gcc 4.0.1 14.1 09-08-04 alex Y Y Y Y 3
i386/apple/darwin10.8.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3 i386/apple/darwin10.8.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3
i386/apple/darwin11.3.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3 i386/apple/darwin11.3.0 gcc 4.2.1 19 12-02-26 alex Y Y Y Y 3
i386/pc/linux-gnu gcc 4.1.2 13~rc1 08-12-05 alex Y Y Y Y 1
i386/pc/linux-gnu gcc 4.4.5 22~rc1-3 14-10-10 alex Y Y Y Y 1
i386/pc/minix clang 3.4 23 16-01-06 goetz Y Y N Y
i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y
i386/pc/solaris2.11 gcc 4.5.2 21~rc2 13-10-27 alex Y Y N Y 4 i386/pc/solaris2.11 gcc 4.8.2 23 16-02-07 goetz Y Y Y Y 4
i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
i386/unknown/freebsd6.2 gcc 3.4.6 20~rc1 12-11-13 alex Y Y Y Y 3 i386/unknown/freebsd6.2 gcc 3.4.6 20~rc1 12-11-13 alex Y Y Y Y 3
i386/unknown/freebsd7.3 gcc 4.2.1 20~rc1 12-11-13 alex Y Y Y Y 3 i386/unknown/freebsd7.3 gcc 4.2.1 20~rc1 12-11-13 alex Y Y Y Y 3
i686/pc/minix gcc 4.4.6 21~rc2 13-10-27 alex Y Y N N i386/unknown/netbsdelf1.5.2 egcs-1.1.2 21 13-11-25 goetz Y Y N Y
i686/unknown/gnu0.3 gcc 4.4.5 19 12-02-29 alex Y Y Y Y
i686/unknown/gnu0.5 gcc 4.8.1 21~rc2 13-10-27 alex Y Y Y Y
i686/unkn./kfreebsd7.2-gnu gcc 4.3.4 15 09-12-02 alex Y Y Y Y 3
i386/unknown/netbsdelf1.6.2 gcc 2.95.3 18 11-07-10 goetz Y Y Y Y i386/unknown/netbsdelf1.6.2 gcc 2.95.3 18 11-07-10 goetz Y Y Y Y
i386/unknown/netbsdelf3.0.1 gcc 3.3.3 0.10.0-p1 06-08-30 alex Y Y Y Y 3 i386/unknown/netbsdelf3.0.1 gcc 3.3.3 0.10.0-p1 06-08-30 alex Y Y Y Y 3
i386/unknown/netbsdelf4.0 gcc 4.1.2 19 12-02-29 alex Y Y Y Y 3 i386/unknown/netbsdelf4.0 gcc 4.1.2 19 12-02-29 alex Y Y Y Y 3
i386/unknown/netbsdelf5.0.2 gcc 4.1.3 19 12-02-26 alex Y Y Y Y 3 i386/unknown/netbsdelf5.0.2 gcc 4.1.3 19 12-02-26 alex Y Y Y Y 3
i386/unknown/openbsd3.5 gcc 2.95.3 23 15-11-27 goetz Y Y y Y 3
i386/unknown/openbsd3.9 gcc 3.3.5 0.10.0-p1 06-08-30 alex Y Y Y Y 3 i386/unknown/openbsd3.9 gcc 3.3.5 0.10.0-p1 06-08-30 alex Y Y Y Y 3
i386/unknown/openbsd4.1 gcc 3.3.5 16 10-04-11 alex Y Y Y Y 3 i386/unknown/openbsd4.1 gcc 3.3.5 16 10-04-11 alex Y Y Y Y 3
i386/unknown/openbsd5.3 gcc 4.2.1 21~rc2 13-10-21 dspruell Y Y Y Y 3 i386/unknown/openbsd5.3 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3
i386/unknown/openbsd5.4 gcc 4.2.1 21 13-11-28 goetz Y Y Y Y 3
i586/pc/haiku gcc 2.95.3 19.2~138 12-10-11 user Y Y N N i586/pc/haiku gcc 2.95.3 19.2~138 12-10-11 user Y Y N N
i586/pc/interix3.5 gcc 3.3 19 12-02-29 alex Y Y N Y i586/pc/interix3.5 gcc 3.3 23 16-01-29 alex Y Y N Y
i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y N Y i686/pc/cygwin gcc 4.9.3 23 16-01-06 alex Y Y Y Y
i686/pc/linux-gnu gcc 2.7.2 19.1 12-05-30 goetz Y Y Y Y 1 i686/pc/linux-gnu gcc 2.6.3 23 16-01-06 goetz Y Y y Y 1
i686/pc/linux-gnu gcc 2.7.2.1 23 15-11-30 goetz Y Y N Y 1
i686/pc/linux-gnu gcc 2.95.2 23 15-12-23 goetz Y Y Y Y 1
i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y 1 i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y 1
i686/pc/linux-gnu gcc 3.3.5 14.1 09-08-04 alex Y Y Y Y 1 i686/pc/linux-gnu gcc 3.3.5 14.1 09-08-04 alex Y Y Y Y 1
i386/pc/linux-gnu gcc 4.1.2 13~rc1 08-12-05 alex Y Y Y Y 1
i686/pc/linux-gnu gcc 4.3.2 14.1 09-08-04 alex Y Y Y Y 1 i686/pc/linux-gnu gcc 4.3.2 14.1 09-08-04 alex Y Y Y Y 1
i686/pc/minix gcc 4.4.6 21~rc2 13-10-27 alex Y Y N N
i686/unknown/gnu0.3 gcc 4.4.5 19 12-02-29 alex Y Y Y Y
i686/unknown/gnu0.5 gcc 4.9.1 22~rc1-3 14-10-11 alex Y Y Y Y
i686/unkn./kfreebsd7.2-gnu gcc 4.3.4 15 09-12-02 alex Y Y Y Y 3
m68k/apple/aux3.0.1 gcc 2.7.2 17 10-11-07 alex Y Y N Y m68k/apple/aux3.0.1 gcc 2.7.2 17 10-11-07 alex Y Y N Y
m68k/apple/aux3.0.1 Orig. A/UX 17 10-11-07 alex Y Y N Y 2 m68k/apple/aux3.0.1 Orig. A/UX 17 10-11-07 alex Y Y N Y 2
m68k/apple/aux3.1.1 gcc 2.7.2 19 12-02-26 alex Y Y N Y m68k/apple/aux3.1.1 gcc 2.7.2 19 12-02-26 alex Y Y N Y
@@ -68,28 +79,44 @@ m68k/apple/aux3.1.1 Orig. A/UX 19 12-02-26 alex Y Y N Y 2
m68k/hp/hp-ux9.10 Orig. HPUX 0.7.x-CVS 03-04-30 goetz Y Y Y Y m68k/hp/hp-ux9.10 Orig. HPUX 0.7.x-CVS 03-04-30 goetz Y Y Y Y
m88k/dg/dgux5.4R3.10 gcc 2.5.8 CVSHEAD 04-03-15 alex Y Y ? ? m88k/dg/dgux5.4R3.10 gcc 2.5.8 CVSHEAD 04-03-15 alex Y Y ? ?
mipsel/unknown/linux-gnu gcc 4.1.2 18 11-07-05 goetz Y Y N Y 1 mipsel/unknown/linux-gnu gcc 4.1.2 18 11-07-05 goetz Y Y N Y 1
mipsel/unknown/linux-gnu gcc 4.4.5 18 11-07-30 goetz Y Y Y Y 1 mipsel/unknown/linux-gnu gcc 4.4.5 21 13-11-24 goetz Y Y Y Y 1
powerpc/apple/darwin6.5 gcc 3.1 0.7.x-CVS 03-04-23 alex Y Y Y Y powerpc/apple/darwin6.8 gcc 3.1 21 14-01-03 goetz Y Y Y Y
powerpc/apple/darwin7.9.0 gcc 3.3 19.1 12-05-22 goetz Y Y Y Y 3 powerpc/apple/darwin7.9.0 gcc 3.3 22 15-03-22 goetz Y Y Y Y 3
powerpc/apple/darwin8.11.0 gcc 4.0.1 18 11-07-02 goetz Y Y Y Y 3 powerpc/apple/darwin8.11.0 gcc 4.0.1 18 11-07-02 goetz Y Y Y Y 3
powerpc/apple/darwin9.8.0 gcc 4.0.1 21 14-01-04 goetz Y Y Y Y 3
powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
powerpc/unknown/openbsd3.6 gcc 2.95.3 0.10.0 06-10-08 alex Y Y N Y powerpc/unknown/openbsd3.6 gcc 2.95.3 0.10.0 06-10-08 alex Y Y N Y
sparc/sun/solaris2.6 gcc 2.95.3 0.7.x-CVS 03-04-22 alex Y Y Y Y sparc/sun/solaris2.6 gcc 2.95.3 0.7.x-CVS 03-04-22 alex Y Y Y Y
sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/unkn./netbsdelf1.6.1 gcc 2.95.3 0.8.0 04-05-30 alex Y Y Y Y sparc/unkn./netbsdelf1.6.1 gcc 2.95.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/unknown/openbsd5.5 gcc 4.2.1 21.1 14-05-03 goetz Y Y Y Y 3
x86_64/apple/darwin10.8.0 gcc 4.2.1 21~rc2 13-10-30 alex Y Y Y Y 3 x86_64/apple/darwin10.8.0 gcc 4.2.1 21~rc2 13-10-30 alex Y Y Y Y 3
x86_64/apple/darwin12.3.0 gcc 4.2.1 20.2 13-04-01 alex Y Y Y Y 3 x86_64/apple/darwin12.3.0 gcc 4.2.1 20.2 13-04-01 alex Y Y Y Y 3
x86_64/apple/darwin13.0.0 A-clang 5.0 21~rc2 13-10-20 alex Y Y Y Y 3 x86_64/apple/darwin13.0.0 A-clang 5.0 21 14-01-02 alex Y Y Y Y 3
x86_64/unknown/freebsd8.4 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/apple/darwin14.5.0 A-clang 6.1 23~rc1 15-09-06 alex Y Y Y Y 3
x86_64/unknown/freebsd9.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/apple/darwin15.6.0 A-clang 8.0 23~38-g455 16-11-04 alex Y Y Y Y 3
x86_64/apple/darwin16.3.0 A-clang 8.0 23~55-g8e0 17-01-06 alex Y Y Y Y 3
x86_64/unknown/dragonfly3.4 gcc 4.7.2 21 13-11-12 goetz Y Y N Y 3
x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3 x86_64/unkn./freebsd8.1-gnu gcc 4.4.5 19 12-02-26 alex Y Y Y Y 3
x86_64/unknown/linux-gnu clang 3.2 21~rc2 13-10-20 alex Y Y Y Y 1 x86_64/unknown/freebsd8.4 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3
x86_64/unknown/linux-gnu gcc 4.8.1 21~rc2 13-10-20 alex Y Y Y Y 1 x86_64/unknown/freebsd9.2 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y Y Y 3
x86_64/unknown/linux-gnu Open64 20.3 13-10-16 goetz Y Y Y Y 1 x86_64/unknown/freebsd10.0 F-clang 3.3 22~rc1-3 14-10-10 alex Y Y Y Y 3
x86_64/unknown/linux-gnu tcc 0.9.25 20.3 13-10-16 goetz Y Y Y Y 1 x86_64/unknown/linux-gnu clang 3.3 21 14-01-07 alex Y Y Y Y 1
x86_64/unknown/linux-gnu clang 3.4 22~rc1-3 14-10-11 alex Y Y Y Y 1
x86_64/unknown/linux-gnu gcc 4.4.5 23~rc1-3 15-11-15 alex Y Y Y Y 1
x86_64/unknown/linux-gnu gcc 4.7.2 23~rc1-3 15-11-15 alex Y Y Y Y 1
x86_64/unknown/linux-gnu gcc 4.8.2 21 13-12-29 alex Y Y Y Y 1
x86_64/pc/linux-gnu gcc 4.9.2 23~55-g8e0 17-01-06 alex Y Y Y Y 1
x86_64/unknown/linux-gnu gcc 5.3.0 23 15-12-14 goetz Y Y Y Y 1
x86_64/pc/linux-gnu gcc 6.2.1 23~44-g995 16-12-06 alex Y Y Y Y 1
x86_64/unknown/linux-gnu icc 16 23 16-01-13 goetz Y Y Y Y 1
x86_64/unknown/linux-gnu nwcc 0.8.2 21 13-12-01 goetz Y Y Y Y 1
x86_64/unknown/linux-gnu Open64 21.1 14-03-27 goetz Y Y Y Y 1
x86_64/unknown/linux-gnu Sun C 5.12 21.1 14-03-27 goetz Y Y Y Y 1
x86_64/unknown/openbsd4.7 gcc 3.3.5 20~rc1 12-02-26 alex Y Y Y Y 3 x86_64/unknown/openbsd4.7 gcc 3.3.5 20~rc1 12-02-26 alex Y Y Y Y 3
x86_64/unknown/openbsd4.8 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/unknown/openbsd4.8 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y y Y 3
x86_64/unknown/openbsd5.1 gcc 4.2.1 21~rc2 13-10-27 alex Y Y Y Y 3 x86_64/unknown/openbsd5.1 gcc 4.2.1 21 13-12-28 alex Y Y Y Y 3
x86_64/unknown/openbsd5.5 gcc 4.2.1 22~rc1-3 14-10-10 alex Y Y Y Y 3
* Notes * Notes

View File

@@ -22,7 +22,7 @@ The following software packages are needed:
- GNU sed - GNU sed
Source: Source:
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
ftp://arthur.barton.de/pub/unix/aux/tools/sed-3.02.tar.gz http://arthur.barton.de/pub/unix/aux/tools/sed-3.02.tar.gz
A/UX comes with /bin/sed which isn't supporting all functions needed A/UX comes with /bin/sed which isn't supporting all functions needed
by GNU automake/autoconf. by GNU automake/autoconf.
@@ -34,7 +34,7 @@ The following software packages are needed:
- libUTIL.a - libUTIL.a
Source: Source:
ftp://ftp.mayn.de/pub/really_old_stuff/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz> ftp://ftp.mayn.de/pub/really_old_stuff/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz>
ftp://arthur.barton.de/pub/unix/aux/libraries/libUTIL-2.1.tar.gz http://arthur.barton.de/pub/unix/aux/libraries/libUTIL-2.1.tar.gz
This library contains functions that are common on other UNIX This library contains functions that are common on other UNIX
systems but not on A/UX e.g. memmove(), strerror() and strdup(). systems but not on A/UX e.g. memmove(), strerror() and strdup().
@@ -50,7 +50,7 @@ A few hints in case of errors:
(so 'configure' uses its own shell script) or use a fully functionable one. (so 'configure' uses its own shell script) or use a fully functionable one.
There's at least one binary "out there" causing problems. The one There's at least one binary "out there" causing problems. The one
of the GNU fileutils works fine: of the GNU fileutils works fine:
ftp://arthur.barton.de/pub/unix/aux/tools/fileutils-4.0.tar.gz http://arthur.barton.de/pub/unix/aux/tools/fileutils-4.0.tar.gz
- The precompiled binary of the old 'bash' shouldn't be installed within - The precompiled binary of the old 'bash' shouldn't be installed within
/bin (better do this in /usr/local/bin) because 'configure' would /bin (better do this in /usr/local/bin) because 'configure' would

View File

@@ -41,8 +41,8 @@ Example:
ServiceMask = *Serv ServiceMask = *Serv
Setting up Anope 1.9.x Setting up Anope 1.9.x & 2.x
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anope 1.9.8 or later (<http://www.anope.org/>) can be used with ngIRCd using Anope 1.9.8 or later (<http://www.anope.org/>) can be used with ngIRCd using
the "ngircd" protocol module. the "ngircd" protocol module.
@@ -66,20 +66,28 @@ In conf/services.conf:
} }
# Load ngIRCd protocol module # Load ngIRCd protocol module
module { name = "ngircd" } module
{
name = "ngircd"
}
networkinfo networkinfo
{ {
# Must be set to the "MaxNickLength" setting of ngIRCd! # Must be set to the "MaxNickLength" setting of ngIRCd!
nicklen = 9 nicklen = 9
# When not using "strict mode", which is the default:
userlen = 20
chanlen = 50 chanlen = 50
} }
In conf/nickserv.conf: In conf/nickserv.conf:
nickserv module
{ {
name = "nickserv"
# not required if you are running ngIRCd with a higher nickname limit # not required if you are running ngIRCd with a higher nickname limit
# ("MaxNickLength") than 11 characters, but REQUIRED by default! # ("MaxNickLength") than 11 characters, but REQUIRED by default!
guestnickprefix = "G-" guestnickprefix = "G-"
@@ -115,7 +123,7 @@ Please note that versions up to and including 5.1.3 contain a bug that
sometimes causes IRC Services to hang on startup. There are two workarounds: sometimes causes IRC Services to hang on startup. There are two workarounds:
a) send the services process a HUP signal ("killall -HUP ircservices") a) send the services process a HUP signal ("killall -HUP ircservices")
b) apply this patch to the IRC Services source tree: b) apply this patch to the IRC Services source tree:
<ftp://ngircd.barton.de/ngircd/contrib/IRCServices513-FlushBuffer.patch> <http://arthur.barton.de/pub/ngircd/contrib/IRCServices513-FlushBuffer.patch>
At least the following settings have to be tweaked, in addition to all the At least the following settings have to be tweaked, in addition to all the
settings marked as required by IRC Services: settings marked as required by IRC Services:

View File

@@ -54,6 +54,12 @@
# A simple Phrase (<256 chars) if you don't want to use a motd file. # A simple Phrase (<256 chars) if you don't want to use a motd file.
;MotdPhrase = "Hello world!" ;MotdPhrase = "Hello world!"
# The name of the IRC network to which this server belongs. This name
# is optional, should only contain ASCII characters, and can't contain
# spaces. It is only used to inform clients. The default is empty,
# so no network name is announced to clients.
;Network = aIRCnetwork
# Global password for all users needed to connect to the server. # Global password for all users needed to connect to the server.
# (Default: not set) # (Default: not set)
;Password = abc ;Password = abc
@@ -166,8 +172,8 @@
;ConnectIPv4 = yes ;ConnectIPv4 = yes
# Default user mode(s) to set on new local clients. Please note that # Default user mode(s) to set on new local clients. Please note that
# only modes can be set that the client could set on itself, you can't # only modes can be set that the client could set using regular MODE
# set "a" (away) or "o" (IRC Op), for example! Default: none. # commands, you can't set "a" (away) for example! Default: none.
;DefaultUserModes = i ;DefaultUserModes = i
# Do DNS lookups when a client connects to the server. # Do DNS lookups when a client connects to the server.
@@ -187,9 +193,9 @@
;MorePrivacy = no ;MorePrivacy = no
# Normally ngIRCd doesn't send any messages to a client until it is # Normally ngIRCd doesn't send any messages to a client until it is
# registered. Enable this option to let the daemon send "NOTICE AUTH" # registered. Enable this option to let the daemon send "NOTICE *"
# messages to clients while connecting. # messages to clients while connecting.
;NoticeAuth = no ;NoticeBeforeRegistration = no
# Should IRC Operators be allowed to use the MODE command even if # Should IRC Operators be allowed to use the MODE command even if
# they are not(!) channel-operators? # they are not(!) channel-operators?
@@ -220,6 +226,15 @@
# character prepended to their respective user names! # character prepended to their respective user names!
;PAMIsOptional = no ;PAMIsOptional = no
# When PAM is enabled, this value determines the used PAM
# configuration.
# This setting allows to run multiple ngIRCd instances with
# different PAM configurations on each instance.
# If you set it to "ngircd-foo", PAM will use
# /etc/pam.d/ngircd-foo instead of the default
# /etc/pam.d/ngircd.
;PAMServiceName = ngircd
# Let ngIRCd send an "authentication PING" when a new client connects, # Let ngIRCd send an "authentication PING" when a new client connects,
# and register this client only after receiving the corresponding # and register this client only after receiving the corresponding
# "PONG" reply. # "PONG" reply.
@@ -253,9 +268,9 @@
# See 'man 1ssl ciphers' (OpenSSL) or 'man 3 gnutls_priority_init' # See 'man 1ssl ciphers' (OpenSSL) or 'man 3 gnutls_priority_init'
# (GnuTLS) for details. # (GnuTLS) for details.
# For OpenSSL: # For OpenSSL:
;CipherList = HIGH:!aNULL:@STRENGTH ;CipherList = HIGH:!aNULL:@STRENGTH:!SSLv3
# For GnuTLS: # For GnuTLS:
;CipherList = SECURE128 ;CipherList = SECURE128:-VERS-SSL3.0
# Diffie-Hellman parameters # Diffie-Hellman parameters
;DHFile = :ETCDIR:/ssl/dhparams.pem ;DHFile = :ETCDIR:/ssl/dhparams.pem

1
doc/src/.gitignore vendored
View File

@@ -1 +0,0 @@
html

2
man/.gitignore vendored
View File

@@ -1,2 +0,0 @@
ngircd.8
ngircd.conf.5

View File

@@ -1,7 +1,7 @@
.\" .\"
.\" ngircd(8) manual page template .\" ngircd(8) manual page template
.\" .\"
.TH ngircd 8 "Oct 2013" ngIRCd "ngIRCd Manual" .TH ngircd 8 "Jan 2016" ngIRCd "ngIRCd Manual"
.SH NAME .SH NAME
ngIRCd \- the "next generation" IRC daemon ngIRCd \- the "next generation" IRC daemon
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -1,7 +1,7 @@
.\" .\"
.\" ngircd.conf(5) manual page template .\" ngircd.conf(5) manual page template
.\" .\"
.TH ngircd.conf 5 "Oct 2013" ngIRCd "ngIRCd Manual" .TH ngircd.conf 5 "Jan 2016" ngIRCd "ngIRCd Manual"
.SH NAME .SH NAME
ngircd.conf \- configuration file of ngIRCd ngircd.conf \- configuration file of ngIRCd
.SH SYNOPSIS .SH SYNOPSIS
@@ -60,7 +60,7 @@ The main configuration of the server is stored in the
section, like the server name, administrative information and the ports on section, like the server name, administrative information and the ports on
which the server should be listening. The variables in this section have to be which the server should be listening. The variables in this section have to be
adjusted to the local requirements most of the time, whereas all the variables adjusted to the local requirements most of the time, whereas all the variables
in the other sections can be left on there defaults very often. in the other sections can be left on their defaults very often.
.PP .PP
Options in the Options in the
.I [Limits] .I [Limits]
@@ -82,12 +82,13 @@ sections. And
blocks are used to configure pre-defined ("persistent") IRC channels. blocks are used to configure pre-defined ("persistent") IRC channels.
.PP .PP
There can be more than one [Operator], [Server] and [Channel] section per There can be more than one [Operator], [Server] and [Channel] section per
configuration file (one for each operator, server, and channel), but only configuration file, one for each operator, server, and channel. [Global],
exactly one [Global], one [Limits], one [Options], and one [SSL] section. [Limits], [Options], and [SSL] sections can occur multiple times, too, but
each variable overwrites itself, only the last assignment is relevant.
.SH [GLOBAL] .SH [GLOBAL]
The The
.I [Global] .I [Global]
section of this file is used to define the main configuration of the server, section is used to define the main configuration of the server,
like the server name and the ports on which the server should be listening. like the server name and the ports on which the server should be listening.
These settings depend on your personal preferences, so you should make sure These settings depend on your personal preferences, so you should make sure
that they correspond to your installation and setup! that they correspond to your installation and setup!
@@ -126,6 +127,12 @@ configuration file.
\fBMotdPhrase\fR (string) \fBMotdPhrase\fR (string)
A simple Phrase (<256 chars) if you don't want to use a MOTD file. A simple Phrase (<256 chars) if you don't want to use a MOTD file.
.TP .TP
\fBNetwork\fR (string)
The name of the IRC network to which this server belongs. This name is
optional, should only contain ASCII characters, and can't contain spaces.
It is only used to inform clients. The default is empty, so no network
name is announced to clients.
.TP
\fBPassword\fR (string) \fBPassword\fR (string)
Global password for all users needed to connect to the server. The default is Global password for all users needed to connect to the server. The default is
empty, so no password is required. Please note: This feature is not available empty, so no password is required. Please note: This feature is not available
@@ -133,16 +140,16 @@ if ngIRCd is using PAM!
.TP .TP
\fBPidFile\fR (string) \fBPidFile\fR (string)
This tells ngIRCd to write its current process ID to a file. Note that the This tells ngIRCd to write its current process ID to a file. Note that the
"PID file" is written AFTER chroot and switching the user ID, e.g. the directory "PID file" is written AFTER chroot and switching the user ID, therefore the
the file resides in must be writable by the ngIRCd user and exist in the directory the file resides in must be writable by the ngIRCd user and exist
chroot directory (if configured, see above). in the chroot directory (if configured, see above).
.TP .TP
\fBPorts\fR (list of numbers) \fBPorts\fR (list of numbers)
Ports on which the server should listen for unencrypted connections. There Port number(s) on which the server should listen for unencrypted connections.
may be more than one port, separated with commas (","). Default: 6667. There may be more than one port, separated with commas (","). Default: 6667.
.TP .TP
\fBServerGID\fR (string or number) \fBServerGID\fR (string or number)
Group ID under which the ngIRCd should run; you can use the name of the Group ID under which the ngIRCd daemon should run; you can use the name of the
group or the numerical ID. group or the numerical ID.
.PP .PP
.RS .RS
@@ -152,8 +159,8 @@ For this to work the server must have been started with root privileges!
.RE .RE
.TP .TP
\fBServerUID\fR (string or number) \fBServerUID\fR (string or number)
User ID under which the server should run; you can use the name of the user User ID under which the ngIRCd daemon should run; you can use the name of the
or the numerical ID. user or the numerical ID.
.PP .PP
.RS .RS
.B Attention: .B Attention:
@@ -163,8 +170,8 @@ addition, the configuration and MOTD files must be readable by this user,
otherwise RESTART and REHASH won't work! otherwise RESTART and REHASH won't work!
.RE .RE
.SH [LIMITS] .SH [LIMITS]
Define some limits and timeouts for this ngIRCd instance. Default values This section is used to define some limits and timeouts for this ngIRCd
should be safe, but it is wise to double-check :-) instance. Default values should be safe, but it is wise to double-check :-)
.TP .TP
\fBConnectRetry\fR (number) \fBConnectRetry\fR (number)
The server tries every <ConnectRetry> seconds to establish a link to not yet The server tries every <ConnectRetry> seconds to establish a link to not yet
@@ -206,8 +213,8 @@ If a client fails to answer a PING with a PONG within <PongTimeout>
seconds, it will be disconnected by the server. Default: 20. seconds, it will be disconnected by the server. Default: 20.
.SH [OPTIONS] .SH [OPTIONS]
Optional features and configuration options to further tweak the behavior of Optional features and configuration options to further tweak the behavior of
ngIRCd. If you want to get started quickly, you most probably don't have to ngIRCd are configured in this section. If you want to get started quickly, you
make changes here -- they are all optional. most probably don't have to make changes here -- they are all optional.
.TP .TP
\fBAllowedChannelTypes\fR (string) \fBAllowedChannelTypes\fR (string)
List of allowed channel types (channel prefixes) for newly created channels List of allowed channel types (channel prefixes) for newly created channels
@@ -216,9 +223,9 @@ Set this variable to the empty string to disallow creation of new channels
by local clients at all. Default: #&+ by local clients at all. Default: #&+
.TP .TP
\fBAllowRemoteOper\fR (boolean) \fBAllowRemoteOper\fR (boolean)
Are IRC operators connected to remote servers allowed to control this server, If this option is active, IRC operators connected to remote servers are allowed
e.g. are they allowed to use administrative commands like CONNECT, DIE, to control this local server using administrative commands, for example like
SQUIT, ... that affect this server? Default: no. CONNECT, DIE, SQUIT etc. Default: no.
.TP .TP
\fBChrootDir\fR (string) \fBChrootDir\fR (string)
A directory to chroot in when everything is initialized. It doesn't need A directory to chroot in when everything is initialized. It doesn't need
@@ -245,8 +252,8 @@ The Salt for cloaked hostname hashing. When undefined a random hash is
generated after each server start. generated after each server start.
.TP .TP
\fBCloakUserToNick\fR (boolean) \fBCloakUserToNick\fR (boolean)
Set every clients' user name to their nickname and hide the one supplied Set every clients' user name and real name to their nickname and hide the one
by the IRC client. Default: no. supplied by the IRC client. Default: no.
.TP .TP
\fBConnectIPv4\fR (boolean) \fBConnectIPv4\fR (boolean)
Set this to no if you do not want ngIRCd to connect to other IRC servers using Set this to no if you do not want ngIRCd to connect to other IRC servers using
@@ -260,8 +267,8 @@ Default: yes.
.TP .TP
\fBDefaultUserModes\fR (string) \fBDefaultUserModes\fR (string)
Default user mode(s) to set on new local clients. Please note that only modes Default user mode(s) to set on new local clients. Please note that only modes
can be set that the client could set on itself, you can't set "a" (away) or can be set that the client could set using regular MODE commands, you can't
"o" (IRC Op), for example! set "a" (away) for example!
Default: none. Default: none.
.TP .TP
\fBDNS\fR (boolean) \fBDNS\fR (boolean)
@@ -277,23 +284,24 @@ Users identified using IDENT are registered without the "~" character
prepended to their user name. prepended to their user name.
Default: yes. Default: yes.
.TP .TP
.TP
\fBIncludeDir\fR (string) \fBIncludeDir\fR (string)
Directory containing configuration snippets (*.conf), that should be read in Directory containing configuration snippets (*.conf), that should be read in
after parsing the current configuration file. after parsing the current configuration file.
Default: none. Default: none.
.TP
\fBMorePrivacy\fR (boolean) \fBMorePrivacy\fR (boolean)
This will cause ngIRCd to censor user idle time, logon time as well as the This will cause ngIRCd to censor user idle time, logon time as well as the
part/quit messages (that are sometimes used to inform everyone about which PART/QUIT messages (that are sometimes used to inform everyone about which
client software is being used). WHOWAS requests are also silently ignored. client software is being used). WHOWAS requests are also silently ignored,
and NAMES output doesn't list any clients for non-members.
This option is most useful when ngIRCd is being used together with This option is most useful when ngIRCd is being used together with
anonymizing software such as TOR or I2P and one does not wish to make it anonymizing software such as TOR or I2P and one does not wish to make it
too easy to collect statistics on the users. too easy to collect statistics on the users.
Default: no. Default: no.
.TP .TP
\fBNoticeAuth\fR (boolean) \fBNoticeBeforeRegistration\fR (boolean)
Normally ngIRCd doesn't send any messages to a client until it is registered. Normally ngIRCd doesn't send any messages to a client until it is registered.
Enable this option to let the daemon send "NOTICE AUTH" messages to clients Enable this option to let the daemon send "NOTICE *" messages to clients
while connecting. Default: no. while connecting. Default: no.
.TP .TP
\fBOperCanUseMode\fR (boolean) \fBOperCanUseMode\fR (boolean)
@@ -331,6 +339,14 @@ able to distinguish between Ident'ified and PAM-authenticated users: both
don't have a "~" character prepended to their respective user names! don't have a "~" character prepended to their respective user names!
Default: no. Default: no.
.TP .TP
\fBPAMServiceName\fR (string)
When PAM is enabled, this value determines the used PAM configuration.
This setting allows to run multiple ngIRCd instances with different
PAM configurations on each instance. If you set it to "ngircd-foo",
PAM will use /etc/pam.d/ngircd-foo instead of the default
/etc/pam.d/ngircd.
Default: ngircd.
.TP
\fBRequireAuthPing\fR (boolean) \fBRequireAuthPing\fR (boolean)
Let ngIRCd send an "authentication PING" when a new client connects, and Let ngIRCd send an "authentication PING" when a new client connects, and
register this client only after receiving the corresponding "PONG" reply. register this client only after receiving the corresponding "PONG" reply.
@@ -368,7 +384,7 @@ SSL Certificate file of the private server key.
.TP .TP
\fBCipherList\fR (string) \fBCipherList\fR (string)
Select cipher suites allowed for SSL/TLS connections. This defaults to Select cipher suites allowed for SSL/TLS connections. This defaults to
"HIGH:!aNULL:@STRENGTH" (OpenSSL) or "SECURE128" (GnuTLS). "HIGH:!aNULL:@STRENGTH:!SSLv3" (OpenSSL) or "SECURE128:-VERS-SSL3.0" (GnuTLS).
Please see 'man 1ssl ciphers' (OpenSSL) and 'man 3 gnutls_priority_init' Please see 'man 1ssl ciphers' (OpenSSL) and 'man 3 gnutls_priority_init'
(GnuTLS) for details. (GnuTLS) for details.
.TP .TP

4
src/.gitignore vendored
View File

@@ -1,4 +0,0 @@
config.h
config.h.in
config.h.in~
stamp-h1

View File

@@ -1 +0,0 @@
Makefile.am

View File

@@ -23,7 +23,7 @@
GLOBAL bool GLOBAL bool
ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
{ {
#ifdef HAVE_GETADDRINFO #ifdef HAVE_WORKING_GETADDRINFO
int ret; int ret;
char portstr[64]; char portstr[64];
struct addrinfo *res0; struct addrinfo *res0;

View File

@@ -4,6 +4,7 @@
#ifndef NG_IPADDR_HDR #ifndef NG_IPADDR_HDR
#define NG_IPADDR_HDR #define NG_IPADDR_HDR
#include "portab.h" #include "portab.h"
/** /**
@@ -12,6 +13,7 @@
*/ */
#include <assert.h> #include <assert.h>
#include <string.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@@ -1,5 +0,0 @@
Makefile.am
check-help
check-version
ngircd
ngircd.exe

View File

@@ -14,16 +14,19 @@
* Functions to dynamically allocate arrays. * Functions to dynamically allocate arrays.
*/ */
/* Additionan debug messages related to array handling: 0=off / 1=on */
#define DEBUG_ARRAY 0
#include "array.h" #include "array.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "log.h" #if DEBUG_ARRAY
# include "log.h"
/* Enable more Debug messages in alloc / append / memmove code. */ #endif
/* #define DEBUG_ARRAY */
#define array_UNUSABLE(x) ( !(x)->mem ) #define array_UNUSABLE(x) ( !(x)->mem )
@@ -64,7 +67,7 @@ array_alloc(array * a, size_t size, size_t pos)
return NULL; return NULL;
if (a->allocated < alloc) { if (a->allocated < alloc) {
#ifdef DEBUG_ARRAY #if DEBUG_ARRAY
Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.", Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc); a->allocated, alloc);
#endif #endif
@@ -165,7 +168,7 @@ array_catb(array * dest, const char *src, size_t len)
assert(ptr != NULL); assert(ptr != NULL);
#ifdef DEBUG_ARRAY #if DEBUG_ARRAY
Log(LOG_DEBUG, Log(LOG_DEBUG,
"array_catb(): appending %u bytes to array (now %u bytes in array).", "array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp); len, tmp);
@@ -245,7 +248,7 @@ void
array_free(array * a) array_free(array * a)
{ {
assert(a != NULL); assert(a != NULL);
#ifdef DEBUG_ARRAY #if DEBUG_ARRAY
Log(LOG_DEBUG, Log(LOG_DEBUG,
"array_free(): %u bytes free'd (%u bytes still used at time of free()).", "array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used); a->allocated, a->used);
@@ -311,7 +314,7 @@ array_moveleft(array * a, size_t membersize, size_t pos)
if (!bytepos) if (!bytepos)
return; /* nothing to do */ return; /* nothing to do */
#ifdef DEBUG_ARRAY #if DEBUG_ARRAY
Log(LOG_DEBUG, Log(LOG_DEBUG,
"array_moveleft(): %u bytes used in array, starting at position %u.", "array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos); a->used, bytepos);

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,41 +18,32 @@
* Channel management * Channel management
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include "defines.h"
#include "conn-func.h" #include "conn-func.h"
#include "exp.h"
#include "channel.h" #include "channel.h"
#include "imp.h"
#include "irc-write.h" #include "irc-write.h"
#include "conf.h" #include "conf.h"
#include "hash.h" #include "hash.h"
#include "lists.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "match.h" #include "match.h"
#include "exp.h"
#define REMOVE_PART 0 #define REMOVE_PART 0
#define REMOVE_QUIT 1 #define REMOVE_QUIT 1
#define REMOVE_KICK 2 #define REMOVE_KICK 2
static CHANNEL *My_Channels; static CHANNEL *My_Channels;
static CL2CHAN *My_Cl2Chan; static CL2CHAN *My_Cl2Chan;
static CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client )); static CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client ));
static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client )); static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer )); static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const char *Reason, bool InformServer ));
@@ -361,14 +352,19 @@ Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
!Channel_UserHasMode(chan, Target, 'q') && !Channel_UserHasMode(chan, Target, 'q') &&
!Channel_UserHasMode(chan, Target, 'a')) !Channel_UserHasMode(chan, Target, 'a'))
can_kick = true; can_kick = true;
/* Half Op can't kick owner | admin | op */ /* Half Op can't kick owner | admin | op */
else if (Channel_UserHasMode(chan, Peer, 'h') && else if (Channel_UserHasMode(chan, Peer, 'h') &&
!Channel_UserHasMode(chan, Target, 'q') && !Channel_UserHasMode(chan, Target, 'q') &&
!Channel_UserHasMode(chan, Target, 'a') && !Channel_UserHasMode(chan, Target, 'a') &&
!Channel_UserHasMode(chan, Target, 'o')) !Channel_UserHasMode(chan, Target, 'o'))
can_kick = true; can_kick = true;
/* IRC operators & IRCd with OperCanMode enabled
* can kick anyways regardless of privilege */
else if(Client_HasMode(Origin, 'o') && Conf_OperCanMode)
can_kick = true;
if(!can_kick) { if(!can_kick) {
IRC_WriteErrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG, IRC_WriteErrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG,
Client_ID(Origin), Name); Client_ID(Origin), Name);
@@ -1048,7 +1044,7 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
switch( Type ) switch( Type )
{ {
case REMOVE_QUIT: case REMOVE_QUIT:
/* QUIT: other servers have already been notified, /* QUIT: other servers have already been notified,
* see Client_Destroy(); so only inform other clients * see Client_Destroy(); so only inform other clients
* in same channel. */ * in same channel. */
assert( InformServer == false ); assert( InformServer == false );
@@ -1102,29 +1098,29 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, const ch
GLOBAL bool GLOBAL bool
Channel_AddBan(CHANNEL *c, const char *mask ) Channel_AddBan(CHANNEL *c, const char *mask, const char *who )
{ {
struct list_head *h = Channel_GetListBans(c); struct list_head *h = Channel_GetListBans(c);
LogDebug("Adding \"%s\" to \"%s\" ban list", mask, Channel_Name(c)); LogDebug("Adding \"%s\" to \"%s\" ban list", mask, Channel_Name(c));
return Lists_Add(h, mask, false, NULL); return Lists_Add(h, mask, time(NULL), who, false);
} }
GLOBAL bool GLOBAL bool
Channel_AddExcept(CHANNEL *c, const char *mask ) Channel_AddExcept(CHANNEL *c, const char *mask, const char *who )
{ {
struct list_head *h = Channel_GetListExcepts(c); struct list_head *h = Channel_GetListExcepts(c);
LogDebug("Adding \"%s\" to \"%s\" exception list", mask, Channel_Name(c)); LogDebug("Adding \"%s\" to \"%s\" exception list", mask, Channel_Name(c));
return Lists_Add(h, mask, false, NULL); return Lists_Add(h, mask, time(NULL), who, false);
} }
GLOBAL bool GLOBAL bool
Channel_AddInvite(CHANNEL *c, const char *mask, bool onlyonce) Channel_AddInvite(CHANNEL *c, const char *mask, bool onlyonce, const char *who )
{ {
struct list_head *h = Channel_GetListInvites(c); struct list_head *h = Channel_GetListInvites(c);
LogDebug("Adding \"%s\" to \"%s\" invite list", mask, Channel_Name(c)); LogDebug("Adding \"%s\" to \"%s\" invite list", mask, Channel_Name(c));
return Lists_Add(h, mask, onlyonce, NULL); return Lists_Add(h, mask, time(NULL), who, onlyonce);
} }
@@ -1141,7 +1137,9 @@ ShowChannelList(struct list_head *head, CLIENT *Client, CHANNEL *Channel,
while (e) { while (e) {
if (!IRC_WriteStrClient(Client, msg, Client_ID(Client), if (!IRC_WriteStrClient(Client, msg, Client_ID(Client),
Channel_Name(Channel), Channel_Name(Channel),
Lists_GetMask(e))) Lists_GetMask(e),
Lists_GetReason(e),
Lists_GetValidity(e)))
return DISCONNECTED; return DISCONNECTED;
e = Lists_GetNext(e); e = Lists_GetNext(e);
} }

View File

@@ -127,10 +127,10 @@ GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan )); GLOBAL unsigned int Channel_CreationTime PARAMS(( CHANNEL *Chan ));
#endif #endif
GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask)); GLOBAL bool Channel_AddBan PARAMS((CHANNEL *c, const char *Mask, const char *who));
GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask)); GLOBAL bool Channel_AddExcept PARAMS((CHANNEL *c, const char *Mask, const char *who));
GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask, GLOBAL bool Channel_AddInvite PARAMS((CHANNEL *c, const char *Mask,
bool OnlyOnce)); bool OnlyOnce, const char *who));
GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c)); GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
GLOBAL bool Channel_ShowExcepts PARAMS((CLIENT *client, CHANNEL *c)); GLOBAL bool Channel_ShowExcepts PARAMS((CLIENT *client, CHANNEL *c));

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,19 +16,13 @@
* User class management. * User class management.
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "defines.h"
#include "array.h"
#include "conn.h" #include "conn.h"
#include "client.h"
#include "lists.h" #include "lists.h"
#include "match.h"
#include "stdio.h"
#include "exp.h"
#include "class.h" #include "class.h"
struct list_head My_Classes[CLASS_COUNT]; struct list_head My_Classes[CLASS_COUNT];
@@ -50,11 +44,13 @@ Class_Exit(void)
GLOBAL bool GLOBAL bool
Class_GetMemberReason(const int Class, CLIENT *Client, char *reason, size_t len) Class_GetMemberReason(const int Class, CLIENT *Client, char *reason, size_t len)
{ {
char str[COMMAND_LEN] = "listed"; char str[COMMAND_LEN];
assert(Class < CLASS_COUNT); assert(Class < CLASS_COUNT);
assert(Client != NULL); assert(Client != NULL);
strlcpy(str, "listed", sizeof(str));
if (!Lists_CheckReason(&My_Classes[Class], Client, str, sizeof(str))) if (!Lists_CheckReason(&My_Classes[Class], Client, str, sizeof(str)))
return false; return false;
@@ -109,7 +105,7 @@ Class_AddMask(const int Class, const char *Pattern, time_t ValidUntil,
Lists_MakeMask(Pattern, mask, sizeof(mask)); Lists_MakeMask(Pattern, mask, sizeof(mask));
return Lists_Add(&My_Classes[Class], mask, return Lists_Add(&My_Classes[Class], mask,
ValidUntil, Reason); ValidUntil, Reason, false);
} }
GLOBAL void GLOBAL void

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,15 +18,11 @@
* Functions to deal with IRC Capabilities * Functions to deal with IRC Capabilities
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "client.h"
#include "log.h" #include "log.h"
#include "exp.h"
#include "client-cap.h" #include "client-cap.h"
GLOBAL int GLOBAL int

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,22 +18,16 @@
* Client management. * Client management.
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include <netdb.h> #include <netdb.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "exp.h"
#include "client.h"
#include <imp.h>
#include "ngircd.h" #include "ngircd.h"
#include "channel.h" #include "channel.h"
#include "conf.h" #include "conf.h"
@@ -44,8 +38,6 @@
#include "match.h" #include "match.h"
#include "messages.h" #include "messages.h"
#include <exp.h>
#define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1 #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
static CLIENT *This_Server, *My_Clients; static CLIENT *This_Server, *My_Clients;
@@ -80,7 +72,7 @@ GLOBAL void
Client_Init( void ) Client_Init( void )
{ {
struct hostent *h; struct hostent *h;
This_Server = New_Client_Struct( ); This_Server = New_Client_Struct( );
if( ! This_Server ) if( ! This_Server )
{ {
@@ -106,7 +98,7 @@ Client_Init( void )
Client_SetInfo( This_Server, Conf_ServerInfo ); Client_SetInfo( This_Server, Conf_ServerInfo );
My_Clients = This_Server; My_Clients = This_Server;
memset( &My_Whowas, 0, sizeof( My_Whowas )); memset( &My_Whowas, 0, sizeof( My_Whowas ));
} /* Client_Init */ } /* Client_Init */
@@ -119,7 +111,7 @@ Client_Exit( void )
if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false ); if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false );
else Client_Destroy( This_Server, "Server going down.", NULL, false ); else Client_Destroy( This_Server, "Server going down.", NULL, false );
cnt = 0; cnt = 0;
c = My_Clients; c = My_Clients;
while(c) { while(c) {
@@ -236,7 +228,7 @@ GLOBAL void
Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit ) Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit )
{ {
/* remove a client */ /* remove a client */
CLIENT *last, *c; CLIENT *last, *c;
char msg[COMMAND_LEN]; char msg[COMMAND_LEN];
const char *txt; const char *txt;
@@ -345,7 +337,7 @@ Client_SetHostname( CLIENT *Client, const char *Hostname )
assert(Client != NULL); assert(Client != NULL);
assert(Hostname != NULL); assert(Hostname != NULL);
if (strlen(Conf_CloakHost)) { if (Conf_CloakHost[0]) {
char cloak[GETID_LEN]; char cloak[GETID_LEN];
strlcpy(cloak, Hostname, GETID_LEN); strlcpy(cloak, Hostname, GETID_LEN);
@@ -389,7 +381,7 @@ Client_SetID( CLIENT *Client, const char *ID )
{ {
assert( Client != NULL ); assert( Client != NULL );
assert( ID != NULL ); assert( ID != NULL );
strlcpy( Client->id, ID, sizeof( Client->id )); strlcpy( Client->id, ID, sizeof( Client->id ));
if (Conf_CloakUserToNick) { if (Conf_CloakUserToNick) {
@@ -435,7 +427,7 @@ Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User)
assert(Client != NULL); assert(Client != NULL);
assert(User != NULL); assert(User != NULL);
#if defined(PAM) && defined(IDENTAUTH) #if defined(PAM)
strlcpy(Client->orig_user, User, sizeof(Client->orig_user)); strlcpy(Client->orig_user, User, sizeof(Client->orig_user));
#endif #endif
} /* Client_SetOrigUser */ } /* Client_SetOrigUser */
@@ -706,7 +698,7 @@ Client_ID( CLIENT *Client )
if(Client->type == CLIENT_USER) if(Client->type == CLIENT_USER)
assert(strlen(Client->id) < Conf_MaxNickLength); assert(strlen(Client->id) < Conf_MaxNickLength);
#endif #endif
if( Client->id[0] ) return Client->id; if( Client->id[0] ) return Client->id;
else return "*"; else return "*";
} /* Client_ID */ } /* Client_ID */
@@ -739,15 +731,7 @@ Client_User( CLIENT *Client )
*/ */
GLOBAL char * GLOBAL char *
Client_OrigUser(CLIENT *Client) { Client_OrigUser(CLIENT *Client) {
#ifndef IDENTAUTH
char *user = Client->user;
if (user[0] == '~')
user++;
return user;
#else
return Client->orig_user; return Client->orig_user;
#endif
} /* Client_OrigUser */ } /* Client_OrigUser */
#endif #endif

View File

@@ -52,8 +52,9 @@ typedef struct _CLIENT
char *cloaked; /* cloaked hostname of the client */ char *cloaked; /* cloaked hostname of the client */
char *ipa_text; /* textual representaton of IP address */ char *ipa_text; /* textual representaton of IP address */
char user[CLIENT_USER_LEN]; /* user name ("login") */ char user[CLIENT_USER_LEN]; /* user name ("login") */
#if defined(PAM) && defined(IDENTAUTH) #if defined(PAM)
char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */ char orig_user[CLIENT_AUTHUSER_LEN];
/* original user name supplied by USER command */
#endif #endif
char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
char modes[CLIENT_MODE_LEN]; /* client modes */ char modes[CLIENT_MODE_LEN]; /* client modes */

View File

@@ -42,7 +42,7 @@ struct ConnSSL_State {
#endif #endif
bool ConnSSL_InitLibrary(void); GLOBAL bool ConnSSL_InitLibrary PARAMS((void));
#endif /* conf_ssl_h */ #endif /* conf_ssl_h */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,9 +16,7 @@
* Configuration management (reading, parsing & validation) * Configuration management (reading, parsing & validation)
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <errno.h> #include <errno.h>
#ifdef PROTOTYPES #ifdef PROTOTYPES
# include <stdarg.h> # include <stdarg.h>
@@ -29,23 +27,19 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include "array.h"
#include "ngircd.h" #include "ngircd.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "defines.h"
#include "log.h" #include "log.h"
#include "match.h" #include "match.h"
#include "tool.h"
#include "exp.h"
#include "conf.h" #include "conf.h"
@@ -94,10 +88,10 @@ static void Init_Server_Struct PARAMS(( CONF_SERVER *Server ));
#endif #endif
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
#define DEFAULT_CIPHERS "HIGH:!aNULL:@STRENGTH" #define DEFAULT_CIPHERS "HIGH:!aNULL:@STRENGTH:!SSLv3"
#endif #endif
#ifdef HAVE_LIBGNUTLS #ifdef HAVE_LIBGNUTLS
#define DEFAULT_CIPHERS "SECURE128" #define DEFAULT_CIPHERS "SECURE128:-VERS-SSL3.0"
#endif #endif
#ifdef SSL_SUPPORT #ifdef SSL_SUPPORT
@@ -369,9 +363,9 @@ Conf_Test( void )
printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd) printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd)
? (const char*) array_start(&Conf_Motd) : ""); ? (const char*) array_start(&Conf_Motd) : "");
} }
#ifndef PAM printf(" Network = %s\n", Conf_Network);
printf(" Password = %s\n", Conf_ServerPwd); if (!Conf_PAM)
#endif printf(" Password = %s\n", Conf_ServerPwd);
printf(" PidFile = %s\n", Conf_PidFile); printf(" PidFile = %s\n", Conf_PidFile);
printf(" Ports = "); printf(" Ports = ");
ports_puts(&Conf_ListenPorts); ports_puts(&Conf_ListenPorts);
@@ -418,13 +412,14 @@ Conf_Test( void )
#endif #endif
printf(" IncludeDir = %s\n", Conf_IncludeDir); printf(" IncludeDir = %s\n", Conf_IncludeDir);
printf(" MorePrivacy = %s\n", yesno_to_str(Conf_MorePrivacy)); printf(" MorePrivacy = %s\n", yesno_to_str(Conf_MorePrivacy));
printf(" NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth)); printf(" NoticeBeforeRegistration = %s\n", yesno_to_str(Conf_NoticeBeforeRegistration));
printf(" OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); printf(" OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode));
printf(" OperChanPAutoOp = %s\n", yesno_to_str(Conf_OperChanPAutoOp)); printf(" OperChanPAutoOp = %s\n", yesno_to_str(Conf_OperChanPAutoOp));
printf(" OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); printf(" OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode));
#ifdef PAM #ifdef PAM
printf(" PAM = %s\n", yesno_to_str(Conf_PAM)); printf(" PAM = %s\n", yesno_to_str(Conf_PAM));
printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional)); printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional));
printf(" PAMServiceName = %s\n", Conf_PAMServiceName);
#endif #endif
#ifndef STRICT_RFC #ifndef STRICT_RFC
printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing)); printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing));
@@ -624,6 +619,7 @@ Conf_EnablePassiveServer(const char *Name)
&& (Conf_Server[i].port > 0)) { && (Conf_Server[i].port > 0)) {
/* BINGO! Enable server */ /* BINGO! Enable server */
Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED; Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
Conf_Server[i].lasttry = 0;
return true; return true;
} }
} }
@@ -749,6 +745,7 @@ Set_Defaults(bool InitServers)
strcpy(Conf_ServerAdminMail, ""); strcpy(Conf_ServerAdminMail, "");
snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
PACKAGE_NAME, PACKAGE_VERSION); PACKAGE_NAME, PACKAGE_VERSION);
strcpy(Conf_Network, "");
free(Conf_ListenAddress); free(Conf_ListenAddress);
Conf_ListenAddress = NULL; Conf_ListenAddress = NULL;
array_free(&Conf_ListenPorts); array_free(&Conf_ListenPorts);
@@ -801,7 +798,7 @@ Set_Defaults(bool InitServers)
#endif #endif
strcpy(Conf_IncludeDir, ""); strcpy(Conf_IncludeDir, "");
Conf_MorePrivacy = false; Conf_MorePrivacy = false;
Conf_NoticeAuth = false; Conf_NoticeBeforeRegistration = false;
Conf_OperCanMode = false; Conf_OperCanMode = false;
Conf_OperChanPAutoOp = true; Conf_OperChanPAutoOp = true;
Conf_OperServerMode = false; Conf_OperServerMode = false;
@@ -811,8 +808,9 @@ Set_Defaults(bool InitServers)
Conf_PAM = false; Conf_PAM = false;
#endif #endif
Conf_PAMIsOptional = false; Conf_PAMIsOptional = false;
#ifdef SYSLOG strcpy(Conf_PAMServiceName, "ngircd");
Conf_ScrubCTCP = false; Conf_ScrubCTCP = false;
#ifdef SYSLOG
#ifdef LOG_LOCAL5 #ifdef LOG_LOCAL5
Conf_SyslogFacility = LOG_LOCAL5; Conf_SyslogFacility = LOG_LOCAL5;
#else #else
@@ -1052,9 +1050,13 @@ Read_Config(bool TestOnly, bool IsStarting)
} }
/** /**
* ... * Read in and handle a configuration file.
*
* @param File Name of the configuration file.
* @param fd File descriptor already opened for reading.
*/ */
static void Read_Config_File(const char *File, FILE *fd) static void
Read_Config_File(const char *File, FILE *fd)
{ {
char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
int i, line = 0; int i, line = 0;
@@ -1409,6 +1411,7 @@ Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg )
struct group *grp; struct group *grp;
size_t len; size_t len;
const char *section; const char *section;
char *ptr;
assert(File != NULL); assert(File != NULL);
assert(Line > 0); assert(Line > 0);
@@ -1491,6 +1494,19 @@ Handle_GLOBAL(const char *File, int Line, char *Var, char *Arg )
Using_MotdFile = false; Using_MotdFile = false;
return; return;
} }
if (strcasecmp(Var, "Network") == 0) {
len = strlcpy(Conf_Network, Arg, sizeof(Conf_Network));
if (len >= sizeof(Conf_Network))
Config_Error_TooLong(File, Line, Var);
ptr = strchr(Conf_Network, ' ');
if (ptr) {
Config_Error(LOG_WARNING,
"%s, line %d: \"Network\" can't contain spaces!",
File, Line);
*ptr = '\0';
}
return;
}
if(strcasecmp(Var, "Password") == 0) { if(strcasecmp(Var, "Password") == 0) {
len = strlcpy(Conf_ServerPwd, Arg, sizeof(Conf_ServerPwd)); len = strlcpy(Conf_ServerPwd, Arg, sizeof(Conf_ServerPwd));
if (len >= sizeof(Conf_ServerPwd)) if (len >= sizeof(Conf_ServerPwd))
@@ -1783,7 +1799,19 @@ Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
return; return;
} }
if (strcasecmp(Var, "NoticeAuth") == 0) { if (strcasecmp(Var, "NoticeAuth") == 0) {
Conf_NoticeAuth = Check_ArgIsTrue(Arg); /*
* TODO: This section and support for "NoticeAuth" variable
* could be removed starting with ngIRCd release 24 (one
* release after marking it "deprecated") ...
*/
Config_Error(LOG_WARNING,
"%s, line %d (section \"Options\"): \"%s\" is deprecated, please use \"NoticeBeforeRegistration\"!",
File, Line, Var);
Conf_NoticeBeforeRegistration = Check_ArgIsTrue(Arg);
return;
}
if (strcasecmp(Var, "NoticeBeforeRegistration") == 0) {
Conf_NoticeBeforeRegistration = Check_ArgIsTrue(Arg);
return; return;
} }
if (strcasecmp(Var, "OperCanUseMode") == 0) { if (strcasecmp(Var, "OperCanUseMode") == 0) {
@@ -1807,6 +1835,12 @@ Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
Conf_PAMIsOptional = Check_ArgIsTrue(Arg); Conf_PAMIsOptional = Check_ArgIsTrue(Arg);
return; return;
} }
if (strcasecmp(Var, "PAMServiceName") == 0) {
len = strlcpy(Conf_PAMServiceName, Arg, sizeof(Conf_PAMServiceName));
if (len >= sizeof(Conf_PAMServiceName))
Config_Error_TooLong(File, Line, Var);
return;
}
if (strcasecmp(Var, "PredefChannelsOnly") == 0) { if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
/* /*
* TODO: This section and support for "PredefChannelsOnly" * TODO: This section and support for "PredefChannelsOnly"
@@ -2243,7 +2277,7 @@ Validate_Config(bool Configtest, bool Rehash)
} }
#ifdef PAM #ifdef PAM
if (Conf_ServerPwd[0]) if (Conf_PAM && Conf_ServerPwd[0])
Config_Error(LOG_ERR, Config_Error(LOG_ERR,
"This server uses PAM, \"Password\" in [Global] section will be ignored!"); "This server uses PAM, \"Password\" in [Global] section will be ignored!");
#endif #endif

View File

@@ -109,6 +109,9 @@ GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN]; GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN]; GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
/** Network name (optional, no spaces allowed) */
GLOBAL char Conf_Network[CLIENT_INFO_LEN];
/** Message of the day (MOTD) of this server */ /** Message of the day (MOTD) of this server */
GLOBAL array Conf_Motd; GLOBAL array Conf_Motd;
@@ -191,8 +194,8 @@ GLOBAL bool Conf_Ident;
/** Enable "more privacy" mode and "censor" some user-related information */ /** Enable "more privacy" mode and "censor" some user-related information */
GLOBAL bool Conf_MorePrivacy; GLOBAL bool Conf_MorePrivacy;
/** Enable NOTICE AUTH messages on connect */ /** Enable "NOTICE *" messages on connect */
GLOBAL bool Conf_NoticeAuth; GLOBAL bool Conf_NoticeBeforeRegistration;
/** Enable all usage of PAM, even when compiled with support for it */ /** Enable all usage of PAM, even when compiled with support for it */
GLOBAL bool Conf_PAM; GLOBAL bool Conf_PAM;
@@ -200,6 +203,9 @@ GLOBAL bool Conf_PAM;
/** Don't require all clients to send a password an to be PAM authenticated */ /** Don't require all clients to send a password an to be PAM authenticated */
GLOBAL bool Conf_PAMIsOptional; GLOBAL bool Conf_PAMIsOptional;
/** The service name to use for PAM */
GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN];
/** Disable all CTCP commands except for /me ? */ /** Disable all CTCP commands except for /me ? */
GLOBAL bool Conf_ScrubCTCP; GLOBAL bool Conf_ScrubCTCP;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -20,25 +20,21 @@
* Functions to deal with character encodings and conversions * Functions to deal with character encodings and conversions
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "log.h"
#include "exp.h"
#include "conn-encoding.h"
#ifdef ICONV #ifdef ICONV
#include "log.h"
#include "conn-encoding.h"
char Encoding_Buffer[COMMAND_LEN]; char Encoding_Buffer[COMMAND_LEN];
char *Convert_Message PARAMS((iconv_t Handle, char *Message)); char *Convert_Message PARAMS((iconv_t Handle, char *Message));
/** /**
* Set client character encoding on a connection. * Set client character encoding on a connection.
* *
@@ -125,7 +121,7 @@ Convert_Message(iconv_t Handle, char *Message)
if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) { if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) {
/* An error occurred! */ /* An error occurred! */
LogDebug("Error converting message encoding!"); LogDebug("Error converting message encoding!");
strlcpy(Encoding_Buffer, Message, sizeof(Encoding_Buffer)); strlcpy(out, Message, sizeof(Encoding_Buffer));
iconv(Handle, NULL, NULL, NULL, NULL); iconv(Handle, NULL, NULL, NULL, NULL);
} else } else
*out = '\0'; *out = '\0';
@@ -133,7 +129,7 @@ Convert_Message(iconv_t Handle, char *Message)
return Encoding_Buffer; return Encoding_Buffer;
} }
#endif #endif /* ICONV */
/** /**
* Convert encoding of a message received from a connection. * Convert encoding of a message received from a connection.

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de) * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,18 +18,16 @@
* Connection management: Global functions * Connection management: Global functions
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <time.h>
#include "log.h"
#ifdef DEBUG
# include "log.h"
#endif
#include "conn.h" #include "conn.h"
#include "client.h"
#include "exp.h"
#include "conn-func.h" #include "conn-func.h"
/** /**
* Update "idle timestamp", the time of the last visible user action * Update "idle timestamp", the time of the last visible user action
* (e. g. like sending messages, joining or leaving channels). * (e. g. like sending messages, joining or leaving channels).
@@ -73,7 +71,6 @@ Conn_GetIdle( CONN_ID Idx )
return time( NULL ) - My_Connections[Idx].lastprivmsg; return time( NULL ) - My_Connections[Idx].lastprivmsg;
} /* Conn_GetIdle */ } /* Conn_GetIdle */
GLOBAL time_t GLOBAL time_t
Conn_LastPing( CONN_ID Idx ) Conn_LastPing( CONN_ID Idx )
{ {
@@ -81,7 +78,6 @@ Conn_LastPing( CONN_ID Idx )
return My_Connections[Idx].lastping; return My_Connections[Idx].lastping;
} /* Conn_LastPing */ } /* Conn_LastPing */
/** /**
* Add "penalty time" for a connection. * Add "penalty time" for a connection.
* *
@@ -116,7 +112,6 @@ Conn_SetPenalty(CONN_ID Idx, time_t Seconds)
#endif #endif
} /* Conn_SetPenalty */ } /* Conn_SetPenalty */
GLOBAL void GLOBAL void
Conn_ClearFlags( void ) Conn_ClearFlags( void )
{ {
@@ -125,7 +120,6 @@ Conn_ClearFlags( void )
for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0; for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0;
} /* Conn_ClearFlags */ } /* Conn_ClearFlags */
GLOBAL int GLOBAL int
Conn_Flag( CONN_ID Idx ) Conn_Flag( CONN_ID Idx )
{ {
@@ -133,7 +127,6 @@ Conn_Flag( CONN_ID Idx )
return My_Connections[Idx].flag; return My_Connections[Idx].flag;
} /* Conn_Flag */ } /* Conn_Flag */
GLOBAL void GLOBAL void
Conn_SetFlag( CONN_ID Idx, int Flag ) Conn_SetFlag( CONN_ID Idx, int Flag )
{ {
@@ -141,12 +134,11 @@ Conn_SetFlag( CONN_ID Idx, int Flag )
My_Connections[Idx].flag = Flag; My_Connections[Idx].flag = Flag;
} /* Conn_SetFlag */ } /* Conn_SetFlag */
GLOBAL CONN_ID GLOBAL CONN_ID
Conn_First( void ) Conn_First( void )
{ {
CONN_ID i; CONN_ID i;
for( i = 0; i < Pool_Size; i++ ) for( i = 0; i < Pool_Size; i++ )
{ {
if( My_Connections[i].sock != NONE ) return i; if( My_Connections[i].sock != NONE ) return i;
@@ -154,14 +146,13 @@ Conn_First( void )
return NONE; return NONE;
} /* Conn_First */ } /* Conn_First */
GLOBAL CONN_ID GLOBAL CONN_ID
Conn_Next( CONN_ID Idx ) Conn_Next( CONN_ID Idx )
{ {
CONN_ID i = NONE; CONN_ID i = NONE;
assert( Idx > NONE ); assert( Idx > NONE );
for( i = Idx + 1; i < Pool_Size; i++ ) for( i = Idx + 1; i < Pool_Size; i++ )
{ {
if( My_Connections[i].sock != NONE ) return i; if( My_Connections[i].sock != NONE ) return i;
@@ -169,7 +160,6 @@ Conn_Next( CONN_ID Idx )
return NONE; return NONE;
} /* Conn_Next */ } /* Conn_Next */
GLOBAL UINT16 GLOBAL UINT16
Conn_Options( CONN_ID Idx ) Conn_Options( CONN_ID Idx )
{ {
@@ -177,7 +167,6 @@ Conn_Options( CONN_ID Idx )
return My_Connections[Idx].options; return My_Connections[Idx].options;
} /* Conn_Options */ } /* Conn_Options */
/** /**
* Set connection option. * Set connection option.
*/ */
@@ -188,7 +177,6 @@ Conn_SetOption(CONN_ID Idx, int Option)
Conn_OPTION_ADD(&My_Connections[Idx], Option); Conn_OPTION_ADD(&My_Connections[Idx], Option);
} /* Conn_SetOption */ } /* Conn_SetOption */
/** /**
* Get the start time of the connection. * Get the start time of the connection.
* The result is the start time in seconds since 1970-01-01, as reported * The result is the start time in seconds since 1970-01-01, as reported
@@ -224,7 +212,6 @@ Conn_SendQ( CONN_ID Idx )
return array_bytes(&My_Connections[Idx].wbuf); return array_bytes(&My_Connections[Idx].wbuf);
} /* Conn_SendQ */ } /* Conn_SendQ */
/** /**
* return number of messages sent on this connection so far * return number of messages sent on this connection so far
*/ */
@@ -236,7 +223,6 @@ Conn_SendMsg( CONN_ID Idx )
return My_Connections[Idx].msg_out; return My_Connections[Idx].msg_out;
} /* Conn_SendMsg */ } /* Conn_SendMsg */
/** /**
* return number of (uncompressed) bytes sent * return number of (uncompressed) bytes sent
* on this connection so far * on this connection so far
@@ -248,7 +234,6 @@ Conn_SendBytes( CONN_ID Idx )
return My_Connections[Idx].bytes_out; return My_Connections[Idx].bytes_out;
} /* Conn_SendBytes */ } /* Conn_SendBytes */
/** /**
* return number of bytes pending in read buffer * return number of bytes pending in read buffer
*/ */
@@ -264,7 +249,6 @@ Conn_RecvQ( CONN_ID Idx )
return array_bytes(&My_Connections[Idx].rbuf); return array_bytes(&My_Connections[Idx].rbuf);
} /* Conn_RecvQ */ } /* Conn_RecvQ */
/** /**
* return number of messages received on this connection so far * return number of messages received on this connection so far
*/ */
@@ -275,7 +259,6 @@ Conn_RecvMsg( CONN_ID Idx )
return My_Connections[Idx].msg_in; return My_Connections[Idx].msg_in;
} /* Conn_RecvMsg */ } /* Conn_RecvMsg */
/** /**
* return number of (uncompressed) bytes received on this * return number of (uncompressed) bytes received on this
* connection so far * connection so far
@@ -297,19 +280,16 @@ Conn_IPA(CONN_ID Idx)
return ng_ipaddr_tostr(&My_Connections[Idx].addr); return ng_ipaddr_tostr(&My_Connections[Idx].addr);
} }
GLOBAL void GLOBAL void
Conn_ResetWCounter( void ) Conn_ResetWCounter( void )
{ {
WCounter = 0; WCounter = 0;
} /* Conn_ResetWCounter */ } /* Conn_ResetWCounter */
GLOBAL long GLOBAL long
Conn_WCounter( void ) Conn_WCounter( void )
{ {
return WCounter; return WCounter;
} /* Conn_WCounter */ } /* Conn_WCounter */
/* -eof- */ /* -eof- */

View File

@@ -1,6 +1,13 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c) 2005-2008 Florian Westphal <fw@strlen.de> * Copyright (c)2005-2008 Florian Westphal (fw@strlen.de).
* Copyright (c)2008-2014 Alexander Barton (alex@barton.de) and Contributors.
*
* 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.
* Please read the file COPYING, README and AUTHORS for more information.
*/ */
#include "portab.h" #include "portab.h"
@@ -10,7 +17,6 @@
* SSL wrapper functions * SSL wrapper functions
*/ */
#include "imp.h"
#include "conf-ssl.h" #include "conf-ssl.h"
#ifdef SSL_SUPPORT #ifdef SSL_SUPPORT
@@ -29,7 +35,6 @@
#include "conn-ssl.h" #include "conn-ssl.h"
#include "log.h" #include "log.h"
#include "exp.h"
#include "defines.h" #include "defines.h"
extern struct SSLOptions Conf_SSLOptions; extern struct SSLOptions Conf_SSLOptions;
@@ -278,10 +283,12 @@ ConnSSL_InitLibrary( void )
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
SSL_CTX *newctx; SSL_CTX *newctx;
#if OPENSSL_API_COMPAT < 0x10100000L
if (!ssl_ctx) { if (!ssl_ctx) {
SSL_library_init(); SSL_library_init();
SSL_load_error_strings(); SSL_load_error_strings();
} }
#endif
if (!RAND_status()) { if (!RAND_status()) {
Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?"); Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");
@@ -312,6 +319,7 @@ ConnSSL_InitLibrary( void )
goto out; goto out;
} }
SSL_CTX_set_session_id_context(newctx, (unsigned char *)"ngircd", 6);
SSL_CTX_set_options(newctx, SSL_OP_SINGLE_DH_USE|SSL_OP_NO_SSLv2); SSL_CTX_set_options(newctx, SSL_OP_SINGLE_DH_USE|SSL_OP_NO_SSLv2);
SSL_CTX_set_mode(newctx, SSL_MODE_ENABLE_PARTIAL_WRITE); SSL_CTX_set_mode(newctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
SSL_CTX_set_verify(newctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, SSL_CTX_set_verify(newctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
@@ -739,7 +747,7 @@ ConnSSL_InitCertFp( CONNECTION *c )
gnutls_x509_crt_deinit(cert); gnutls_x509_crt_deinit(cert);
return 0; return 0;
} }
if (gnutls_x509_crt_import(cert, &cert_list[0], if (gnutls_x509_crt_import(cert, &cert_list[0],
GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) { GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) {
gnutls_x509_crt_deinit(cert); gnutls_x509_crt_deinit(cert);
@@ -906,5 +914,3 @@ ConnSSL_InitLibrary(void)
#endif /* SSL_SUPPORT */ #endif /* SSL_SUPPORT */
/* -eof- */ /* -eof- */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2007 Alexander Barton (alex@barton.de) * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -9,6 +9,8 @@
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
*/ */
#define CONN_MODULE
#include "portab.h" #include "portab.h"
/** /**
@@ -16,14 +18,11 @@
* Connection compression using ZLIB * Connection compression using ZLIB
*/ */
#define CONN_MODULE /* Additionan debug messages related to ZIP compression: 0=off / 1=on */
#define DEBUG_ZIP 0
#ifdef ZLIB #ifdef ZLIB
/* enable more zlib related debug messages: */
/* #define DEBUG_ZLIB */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <zlib.h> #include <zlib.h>
@@ -31,9 +30,8 @@
#include "conn.h" #include "conn.h"
#include "conn-func.h" #include "conn-func.h"
#include "log.h" #include "log.h"
#include "array.h" #include "array.h"
#include "exp.h"
#include "conn-zip.h" #include "conn-zip.h"
@@ -143,7 +141,7 @@ Zip_Flush( CONN_ID Idx )
out->next_out = zipbuf; out->next_out = zipbuf;
out->avail_out = (uInt)sizeof zipbuf; out->avail_out = (uInt)sizeof zipbuf;
#ifdef DEBUG_ZIP #if DEBUG_ZIP
Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d", Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out); out->avail_in, out->avail_out);
#endif #endif
@@ -166,7 +164,7 @@ Zip_Flush( CONN_ID Idx )
assert(out->avail_out <= WRITEBUFFER_SLINK_LEN); assert(out->avail_out <= WRITEBUFFER_SLINK_LEN);
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out; zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
#ifdef DEBUG_ZIP #if DEBUG_ZIP
Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used); Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
#endif #endif
if (!array_catb(&My_Connections[Idx].wbuf, if (!array_catb(&My_Connections[Idx].wbuf,
@@ -177,7 +175,7 @@ Zip_Flush( CONN_ID Idx )
} }
My_Connections[Idx].bytes_out += zipbuf_used; My_Connections[Idx].bytes_out += zipbuf_used;
My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf); My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf);
array_trunc(&My_Connections[Idx].zip.wbuf); array_trunc(&My_Connections[Idx].zip.wbuf);
return true; return true;
@@ -200,7 +198,7 @@ Unzip_Buffer( CONN_ID Idx )
int unzipbuf_used = 0; int unzipbuf_used = 0;
unsigned int z_rdatalen; unsigned int z_rdatalen;
unsigned int in_len; unsigned int in_len;
z_stream *in; z_stream *in;
assert( Idx > NONE ); assert( Idx > NONE );
@@ -218,7 +216,7 @@ Unzip_Buffer( CONN_ID Idx )
in->next_out = unzipbuf; in->next_out = unzipbuf;
in->avail_out = (uInt)sizeof unzipbuf; in->avail_out = (uInt)sizeof unzipbuf;
#ifdef DEBUG_ZIP #if DEBUG_ZIP
Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d", Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out); in->avail_in, in->avail_out);
#endif #endif
@@ -233,7 +231,7 @@ Unzip_Buffer( CONN_ID Idx )
assert(z_rdatalen >= in->avail_in); assert(z_rdatalen >= in->avail_in);
in_len = z_rdatalen - in->avail_in; in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out; unzipbuf_used = READBUFFER_LEN - in->avail_out;
#ifdef DEBUG_ZIP #if DEBUG_ZIP
Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN, Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used); in->avail_out, unzipbuf_used);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@
/* Size of structures */ /* Size of structures */
/** Max. count of configurable servers. */ /** Max. count of configurable servers. */
#define MAX_SERVERS 16 #define MAX_SERVERS 64
/** Max. number of WHOWAS list items that can be stored. */ /** Max. number of WHOWAS list items that can be stored. */
#define MAX_WHOWAS 64 #define MAX_WHOWAS 64
@@ -61,6 +61,9 @@
/** Size of default connection pool. */ /** Size of default connection pool. */
#define CONNECTION_POOL 100 #define CONNECTION_POOL 100
/** Size of buffer for PAM service name. */
#define MAX_PAM_SERVICE_NAME_LEN 64
/* Hard-coded (default) options */ /* Hard-coded (default) options */
@@ -109,6 +112,10 @@
#else #else
# define CLIENT_USER_LEN 10 # define CLIENT_USER_LEN 10
#endif #endif
/** Max. length of user names saved for authentication (used by PAM) */
#ifdef PAM
# define CLIENT_AUTHUSER_LEN 64
#endif
/** Max. length of "real names" (including NULL). */ /** Max. length of "real names" (including NULL). */
#define CLIENT_NAME_LEN 32 #define CLIENT_NAME_LEN 32
@@ -173,7 +180,7 @@
#endif #endif
/** Supported user modes. */ /** Supported user modes. */
#define USERMODES "abBcCioqrRswx" #define USERMODES "abBcCFiIoqrRswx"
/** Supported channel modes. */ /** Supported channel modes. */
#define CHANMODES "abehiIklmMnoOPqQrRstvVz" #define CHANMODES "abehiIklmMnoOPqQrRstvVz"
@@ -202,6 +209,9 @@
/** Max. number of channel modes with arguments per MODE command. */ /** Max. number of channel modes with arguments per MODE command. */
#define MAX_HNDL_MODES_ARG 5 #define MAX_HNDL_MODES_ARG 5
/** Max. number of targets per PRIVMSG/NOTICE/... command. */
#define MAX_HNDL_TARGETS 25
/** Max. number of WHO replies. */ /** Max. number of WHO replies. */
#define MAX_RPL_WHO 25 #define MAX_RPL_WHO 25

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de) * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,14 +16,12 @@
* Hash calculation * Hash calculation
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "defines.h" #include "defines.h"
#include "tool.h" #include "tool.h"
#include "exp.h"
#include "hash.h" #include "hash.h"
static UINT32 jenkins_hash PARAMS((UINT8 *k, UINT32 length, UINT32 initval)); static UINT32 jenkins_hash PARAMS((UINT8 *k, UINT32 length, UINT32 initval));

View File

@@ -1,11 +1,13 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2005-2006 Florian Westphal (westphal@foo.fh-furtwangen.de)
* Copyright (c)2006-2014 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * Please read the file COPYING, README and AUTHORS for more information.
*
* Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de)
*/ */
#include "portab.h" #include "portab.h"
@@ -15,21 +17,20 @@
* I/O abstraction interface. * I/O abstraction interface.
*/ */
/* Extra debug messages in event add/delete/callback code: 0=off / 1=on */
#define DEBUG_IO 0
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "array.h" #include "array.h"
#include "io.h" #include "io.h"
#include "log.h" #include "log.h"
/* Enables extra debug messages in event add/delete/callback code. */
/* #define DEBUG_IO */
typedef struct { typedef struct {
#ifdef PROTOTYPES #ifdef PROTOTYPES
void (*callback)(int, short); void (*callback)(int, short);
@@ -119,6 +120,7 @@ static bool io_event_change_devpoll(int fd, short what);
#endif #endif
#ifdef IO_USE_SELECT #ifdef IO_USE_SELECT
#include <sys/time.h>
#include "defines.h" /* for conn.h */ #include "defines.h" /* for conn.h */
#include "proc.h" /* for PROC_STAT (needed by conf.h) */ #include "proc.h" /* for PROC_STAT (needed by conf.h) */
#include "conn.h" /* for CONN_ID (needed by conf.h) */ #include "conn.h" /* for CONN_ID (needed by conf.h) */
@@ -142,7 +144,7 @@ static array io_events;
static void io_docallback PARAMS((int fd, short what)); static void io_docallback PARAMS((int fd, short what));
#ifdef DEBUG_IO #if DEBUG_IO
static void static void
io_debug(const char *s, int fd, int what) io_debug(const char *s, int fd, int what)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,22 +16,19 @@
* Handler for IRC capability ("CAP") commands * Handler for IRC capability ("CAP") commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "client-cap.h" #include "client-cap.h"
#include "irc-macros.h"
#include "irc-write.h" #include "irc-write.h"
#include "log.h" #include "log.h"
#include "login.h" #include "login.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "exp.h"
#include "irc-cap.h" #include "irc-cap.h"
/* Local functions */ /* Local functions */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,13 +16,11 @@
* IRC channel commands * IRC channel commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "conn-func.h" #include "conn-func.h"
@@ -37,7 +35,6 @@
#include "irc-write.h" #include "irc-write.h"
#include "conf.h" #include "conf.h"
#include "exp.h"
#include "irc-channel.h" #include "irc-channel.h"
/** /**
@@ -323,11 +320,9 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
channame = strtok_r(channame, ",", &lastchan); channame = strtok_r(channame, ",", &lastchan);
/* Make sure that "channame" is not the empty string ("JOIN :") */ /* Make sure that "channame" is not the empty string ("JOIN :") */
if (!channame) { if (!channame)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
while (channame) { while (channame) {
flags = NULL; flags = NULL;
@@ -447,15 +442,13 @@ IRC_PART(CLIENT * Client, REQUEST * Req)
chan = strtok(Req->argv[0], ","); chan = strtok(Req->argv[0], ",");
/* Make sure that "chan" is not the empty string ("PART :") */ /* Make sure that "chan" is not the empty string ("PART :") */
if (!chan) { if (!chan)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
while (chan) { while (chan) {
Channel_Part(target, Client, chan, Channel_Part(target, Client, chan,
Req->argc > 1 ? Req->argv[1] : Client_ID(target)); Req->argc > 1 ? Req->argv[1] : "");
chan = strtok(NULL, ","); chan = strtok(NULL, ",");
} }
@@ -484,8 +477,6 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
chan = Channel_Search(Req->argv[0]); chan = Channel_Search(Req->argv[0]);
@@ -582,8 +573,6 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 2);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
if (Req->argc > 0) if (Req->argc > 0)
@@ -608,6 +597,10 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
} }
} }
/* Send list head */
if (!IRC_WriteStrClient(from, RPL_LISTSTART_MSG, Client_ID(from)))
return DISCONNECTED;
while (pattern) { while (pattern) {
/* Loop through all the channels */ /* Loop through all the channels */
if (Req->argc > 0) if (Req->argc > 0)
@@ -619,9 +612,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
/* Gotcha! */ /* Gotcha! */
if (!Channel_HasMode(chan, 's') if (!Channel_HasMode(chan, 's')
|| Channel_IsMemberOf(chan, from) || Channel_IsMemberOf(chan, from)
|| (!Conf_MorePrivacy || Client_HasMode(from, 'o'))
&& Client_HasMode(Client, 'o')
&& Client_Conn(Client) > NONE))
{ {
if ((Conf_MaxListSize > 0) if ((Conf_MaxListSize > 0)
&& IRC_CheckListTooBig(from, count, && IRC_CheckListTooBig(from, count,
@@ -669,11 +660,9 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
assert( Req != NULL ); assert( Req != NULL );
/* Bad number of parameters? */ /* Bad number of parameters? */
if (Req->argc < 2 || Req->argc == 4 || Req->argc > 5) { if (Req->argc < 2 || Req->argc == 4 || Req->argc > 5)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
/* Compatibility kludge */ /* Compatibility kludge */
if (Req->argc == 5) if (Req->argc == 5)

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,8 @@
* IRC encoding commands * IRC encoding commands
*/ */
#include "imp.h" #ifdef ICONV
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
@@ -28,11 +29,8 @@
#include "parse.h" #include "parse.h"
#include "tool.h" #include "tool.h"
#include "exp.h"
#include "irc-encoding.h" #include "irc-encoding.h"
#ifdef ICONV
/** /**
* Handler for the IRC+ "CHARCONV" command. * Handler for the IRC+ "CHARCONV" command.
* *

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,13 +16,12 @@
* IRC info commands * IRC info commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include "ngircd.h" #include "ngircd.h"
#include "conn-func.h" #include "conn-func.h"
@@ -30,12 +29,9 @@
#include "channel.h" #include "channel.h"
#include "class.h" #include "class.h"
#include "conf.h" #include "conf.h"
#include "defines.h"
#include "lists.h" #include "lists.h"
#include "log.h"
#include "messages.h" #include "messages.h"
#include "match.h" #include "match.h"
#include "tool.h"
#include "parse.h" #include "parse.h"
#include "irc.h" #include "irc.h"
#include "irc-macros.h" #include "irc-macros.h"
@@ -43,7 +39,6 @@
#include "client-cap.h" #include "client-cap.h"
#include "op.h" #include "op.h"
#include "exp.h"
#include "irc-info.h" #include "irc-info.h"
/* Local functions */ /* Local functions */
@@ -152,8 +147,6 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps)
assert( Client != NULL ); assert( Client != NULL );
assert( Chan != NULL ); assert( Chan != NULL );
IRC_SetPenalty(Client, 1);
is_member = Channel_IsMemberOf(Chan, Client); is_member = Channel_IsMemberOf(Chan, Client);
/* Secret channel? */ /* Secret channel? */
@@ -169,7 +162,7 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps)
if (OnlyOps && !is_ircop) if (OnlyOps && !is_ircop)
continue; continue;
is_visible = Client_HasMode(c, 'i'); is_visible = !Client_HasMode(c, 'i');
if (is_member || is_visible) { if (is_member || is_visible) {
memset(flags, 0, sizeof(flags)); memset(flags, 0, sizeof(flags));
@@ -191,7 +184,7 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps)
} }
} }
/* If there are a lot of clients, augment penalty a bit */ /* If there are a lot of clients, increase the penalty a bit */
if (count > MAX_RPL_WHO) if (count > MAX_RPL_WHO)
IRC_SetPenalty(Client, 1); IRC_SetPenalty(Client, 1);
@@ -320,48 +313,50 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
Client_Info(Client_Introducer(c)))) Client_Info(Client_Introducer(c))))
return DISCONNECTED; return DISCONNECTED;
/* Channels */ /* Channels, show only if client has no +I or if from is oper */
snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG, if(!(Client_HasMode(c, 'I')) || Client_HasMode(from, 'o')) {
Client_ID(from), Client_ID(c)); snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG,
cl2chan = Channel_FirstChannelOf(c); Client_ID(from), Client_ID(c));
while (cl2chan) { cl2chan = Channel_FirstChannelOf(c);
chan = Channel_GetChannel(cl2chan); while (cl2chan) {
assert(chan != NULL); chan = Channel_GetChannel(cl2chan);
assert(chan != NULL);
/* next */ /* next */
cl2chan = Channel_NextChannelOf(c, cl2chan); cl2chan = Channel_NextChannelOf(c, cl2chan);
/* Secret channel? */ /* Secret channel? */
if (Channel_HasMode(chan, 's') if (Channel_HasMode(chan, 's')
&& !Channel_IsMemberOf(chan, Client)) && !Channel_IsMemberOf(chan, Client))
continue; continue;
/* Local channel and request is not from a user? */ /* Local channel and request is not from a user? */
if (Client_Type(Client) == CLIENT_SERVER if (Client_Type(Client) == CLIENT_SERVER
&& Channel_IsLocal(chan)) && Channel_IsLocal(chan))
continue; continue;
/* Concatenate channel names */ /* Concatenate channel names */
if (str[strlen(str) - 1] != ':') if (str[strlen(str) - 1] != ':')
strlcat(str, " ", sizeof(str)); strlcat(str, " ", sizeof(str));
who_flags_qualifier(Client, Channel_UserModes(chan, c), who_flags_qualifier(Client, Channel_UserModes(chan, c),
str, sizeof(str)); str, sizeof(str));
strlcat(str, Channel_Name(chan), sizeof(str)); strlcat(str, Channel_Name(chan), sizeof(str));
if (strlen(str) > (COMMAND_LEN - CHANNEL_NAME_LEN - 4)) { if (strlen(str) > (COMMAND_LEN - CHANNEL_NAME_LEN - 4)) {
/* Line becomes too long: send it! */ /* Line becomes too long: send it! */
if (!IRC_WriteStrClient(Client, "%s", str))
return DISCONNECTED;
snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG,
Client_ID(from), Client_ID(c));
}
}
if(str[strlen(str) - 1] != ':') {
/* There is data left to send: */
if (!IRC_WriteStrClient(Client, "%s", str)) if (!IRC_WriteStrClient(Client, "%s", str))
return DISCONNECTED; return DISCONNECTED;
snprintf(str, sizeof(str), RPL_WHOISCHANNELS_MSG,
Client_ID(from), Client_ID(c));
} }
} }
if(str[strlen(str) - 1] != ':') {
/* There is data left to send: */
if (!IRC_WriteStrClient(Client, "%s", str))
return DISCONNECTED;
}
/* IRC-Services? */ /* IRC-Services? */
if (Client_Type(c) == CLIENT_SERVICE && if (Client_Type(c) == CLIENT_SERVICE &&
@@ -403,9 +398,16 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
Client_ID(from), Client_ID(c))) Client_ID(from), Client_ID(c)))
return DISCONNECTED; return DISCONNECTED;
/* Account name metadata? */
if (Client_AccountName(c) &&
!IRC_WriteStrClient(from, RPL_WHOISLOGGEDIN_MSG,
Client_ID(from), Client_ID(c),
Client_AccountName(c)))
return DISCONNECTED;
/* Local client and requester is the user itself or an IRC Op? */ /* Local client and requester is the user itself or an IRC Op? */
if (Client_Conn(c) > NONE && if (Client_Conn(c) > NONE &&
(from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) { (from == c || Client_HasMode(from, 'o'))) {
/* Client hostname */ /* Client hostname */
if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG,
Client_ID(from), Client_ID(c), Client_ID(from), Client_ID(c),
@@ -500,8 +502,6 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
@@ -544,8 +544,6 @@ IRC_INFO(CLIENT * Client, REQUEST * Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 2);
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
@@ -560,7 +558,15 @@ IRC_INFO(CLIENT * Client, REQUEST * Req)
NGIRCd_Version)) NGIRCd_Version))
return DISCONNECTED; return DISCONNECTED;
#if defined(__DATE__) && defined(__TIME__) #if defined(BIRTHDATE)
char t_str[60];
time_t t = BIRTHDATE;
(void)strftime(t_str, sizeof(t_str), "%a %b %d %Y at %H:%M:%S (%Z)",
localtime(&t));
snprintf(msg, sizeof(msg), "Birth Date: %s", t_str);
if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
return DISCONNECTED;
#elif defined(__DATE__) && defined(__TIME__)
snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__); snprintf(msg, sizeof(msg), "Birth Date: %s at %s", __DATE__, __TIME__);
if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg)) if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
return DISCONNECTED; return DISCONNECTED;
@@ -631,8 +637,6 @@ IRC_LINKS(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
/* Get pointer to server mask or "*", if none given */ /* Get pointer to server mask or "*", if none given */
@@ -685,8 +689,6 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
@@ -716,8 +718,6 @@ IRC_SERVLIST(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 1);
if (Req->argc < 2 || strcmp(Req->argv[1], "0") == 0) { if (Req->argc < 2 || strcmp(Req->argv[1], "0") == 0) {
for (c = Client_First(); c!= NULL; c = Client_Next(c)) { for (c = Client_First(); c!= NULL; c = Client_Next(c)) {
if (Client_Type(c) != CLIENT_SERVICE) if (Client_Type(c) != CLIENT_SERVICE)
@@ -753,8 +753,6 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 3);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
@@ -785,8 +783,6 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
@@ -871,8 +867,6 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 2);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
@@ -900,16 +894,16 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
list = Class_GetList(CLASS_GLINE); list = Class_GetList(CLASS_GLINE);
else else
list = Class_GetList(CLASS_KLINE); list = Class_GetList(CLASS_KLINE);
list_item = Lists_GetFirst(list); list_item = Lists_GetFirst(list);
while (list_item) { while (list_item) {
if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG, if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG,
Client_ID(from), query, Client_ID(from), query,
Lists_GetMask(list_item), Lists_GetMask(list_item),
Lists_GetValidity(list_item), Lists_GetValidity(list_item),
Lists_GetReason(list_item))) Lists_GetReason(list_item)))
return DISCONNECTED; return DISCONNECTED;
list_item = Lists_GetNext(list_item); list_item = Lists_GetNext(list_item);
} }
break; break;
case 'L': /* Link status (servers and user links) */ case 'L': /* Link status (servers and user links) */
if (!Op_Check(from, Req)) if (!Op_Check(from, Req))
@@ -1013,8 +1007,6 @@ IRC_TIME( CLIENT *Client, REQUEST *Req )
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
@@ -1048,8 +1040,6 @@ IRC_USERHOST(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 1);
if (Req->argc > 5) if (Req->argc > 5)
max = 5; max = 5;
else else
@@ -1110,8 +1100,6 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client) _IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
@@ -1123,10 +1111,19 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
} }
/* send version information */ /* send version information */
return IRC_WriteStrClient(Client, RPL_VERSION_MSG, Client_ID(prefix), if (!IRC_WriteStrClient(Client, RPL_VERSION_MSG, Client_ID(prefix),
PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_NAME, PACKAGE_VERSION,
NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_DebugLevel, Conf_ServerName,
NGIRCd_VersionAddition); NGIRCd_VersionAddition))
return DISCONNECTED;
#ifndef STRICT_RFC
/* send RPL_ISUPPORT(005) numerics */
if (!IRC_Send_ISUPPORT(prefix))
return DISCONNECTED;
#endif
return CONNECTED;
} /* IRC_VERSION */ } /* IRC_VERSION */
/** /**
@@ -1145,15 +1142,12 @@ IRC_WHO(CLIENT *Client, REQUEST *Req)
assert (Client != NULL); assert (Client != NULL);
assert (Req != NULL); assert (Req != NULL);
IRC_SetPenalty(Client, 1);
only_ops = false; only_ops = false;
if (Req->argc == 2) { if (Req->argc == 2) {
if (strcmp(Req->argv[1], "o") == 0) if (strcmp(Req->argv[1], "o") == 0)
only_ops = true; only_ops = true;
#ifdef STRICT_RFC #ifdef STRICT_RFC
else { else {
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, return IRC_WriteErrClient(Client,
ERR_NEEDMOREPARAMS_MSG, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Client_ID(Client),
@@ -1177,7 +1171,6 @@ IRC_WHO(CLIENT *Client, REQUEST *Req)
} }
/* No channel or (valid) mask given */ /* No channel or (valid) mask given */
IRC_SetPenalty(Client, 2);
return IRC_WHO_Mask(Client, NULL, only_ops); return IRC_WHO_Mask(Client, NULL, only_ops);
} /* IRC_WHO */ } /* IRC_WHO */
@@ -1200,8 +1193,6 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
IRC_SetPenalty(Client, 1);
/* Wrong number of parameters? */ /* Wrong number of parameters? */
if (Req->argc < 1) if (Req->argc < 1)
return IRC_WriteErrClient(Client, ERR_NONICKNAMEGIVEN_MSG, return IRC_WriteErrClient(Client, ERR_NONICKNAMEGIVEN_MSG,
@@ -1263,6 +1254,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
continue; continue;
} }
got_wildcard = true; got_wildcard = true;
/* Increase penalty for wildcard queries */
IRC_SetPenalty(Client, 3); IRC_SetPenalty(Client, 3);
for (c = Client_First(); c; c = Client_Next(c)) { for (c = Client_First(); c; c = Client_Next(c)) {
@@ -1568,6 +1560,10 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
GLOBAL bool GLOBAL bool
IRC_Send_ISUPPORT(CLIENT * Client) IRC_Send_ISUPPORT(CLIENT * Client)
{ {
if (Conf_Network[0] && !IRC_WriteStrClient(Client, RPL_ISUPPORTNET_MSG,
Client_ID(Client),
Conf_Network))
return DISCONNECTED;
if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client), if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client),
CHANTYPES, CHANTYPES, Conf_MaxJoins)) CHANTYPES, CHANTYPES, Conf_MaxJoins))
return DISCONNECTED; return DISCONNECTED;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,15 +16,14 @@
* Login and logout * Login and logout
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include "conn-func.h" #include "conn-func.h"
#include "class.h"
#include "conf.h" #include "conf.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
@@ -32,11 +31,9 @@
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "irc.h" #include "irc.h"
#include "irc-info.h"
#include "irc-macros.h" #include "irc-macros.h"
#include "irc-write.h" #include "irc-write.h"
#include "exp.h"
#include "irc-login.h" #include "irc-login.h"
static void Change_Nick PARAMS((CLIENT * Origin, CLIENT * Target, char *NewNick, static void Change_Nick PARAMS((CLIENT * Origin, CLIENT * Target, char *NewNick,
@@ -80,7 +77,6 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
} else if (Client_Type(Client) == CLIENT_UNKNOWN || } else if (Client_Type(Client) == CLIENT_UNKNOWN ||
Client_Type(Client) == CLIENT_UNKNOWNSERVER) { Client_Type(Client) == CLIENT_UNKNOWNSERVER) {
/* Unregistered connection, but wrong number of arguments: */ /* Unregistered connection, but wrong number of arguments: */
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
} else { } else {
@@ -176,6 +172,7 @@ GLOBAL bool
IRC_NICK( CLIENT *Client, REQUEST *Req ) IRC_NICK( CLIENT *Client, REQUEST *Req )
{ {
CLIENT *intr_c, *target, *c; CLIENT *intr_c, *target, *c;
CHANNEL *chan;
char *nick, *user, *hostname, *modes, *info; char *nick, *user, *hostname, *modes, *info;
int token, hops; int token, hops;
@@ -199,6 +196,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
/* Search "target" client */ /* Search "target" client */
if (Client_Type(Client) == CLIENT_SERVER) { if (Client_Type(Client) == CLIENT_SERVER) {
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
target = Client_Search(Req->prefix); target = Client_Search(Req->prefix);
if (!target) if (!target)
return IRC_WriteErrClient(Client, return IRC_WriteErrClient(Client,
@@ -247,7 +245,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
#else #else
Conn_SetAuthPing(Client_Conn(Client), rand()); Conn_SetAuthPing(Client_Conn(Client), rand());
#endif #endif
IRC_WriteStrClient(Client, "PING :%ld", Conn_WriteStr(Client_Conn(Client), "PING :%ld",
Conn_GetAuthPing(Client_Conn(Client))); Conn_GetAuthPing(Client_Conn(Client)));
LogDebug("Connection %d: sent AUTH PING %ld ...", LogDebug("Connection %d: sent AUTH PING %ld ...",
Client_Conn(Client), Client_Conn(Client),
@@ -263,6 +261,22 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
Client_SetType( Client, CLIENT_GOTNICK ); Client_SetType( Client, CLIENT_GOTNICK );
} else { } else {
/* Nickname change */ /* Nickname change */
/* Check that the user isn't on any channels set +N */
if(Client_Type(Client) == CLIENT_USER &&
!Client_HasMode(Client, 'o')) {
chan = Channel_First();
while (chan) {
if(Channel_HasMode(chan, 'N') &&
Channel_IsMemberOf(chan, Client))
return IRC_WriteErrClient(Client,
ERR_NONICKCHANGE_MSG,
Client_ID(Client),
Channel_Name(chan));
chan = Channel_Next(chan);
}
}
Change_Nick(Client, target, Req->argv[0], Change_Nick(Client, target, Req->argv[0],
Client_Type(Client) == CLIENT_USER ? true : false); Client_Type(Client) == CLIENT_USER ? true : false);
IRC_SetPenalty(target, 2); IRC_SetPenalty(target, 2);
@@ -274,11 +288,9 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
/* Server or service introduces new client */ /* Server or service introduces new client */
/* Bad number of parameters? */ /* Bad number of parameters? */
if (Req->argc != 2 && Req->argc != 7) { if (Req->argc != 2 && Req->argc != 7)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
if (Req->argc >= 7) { if (Req->argc >= 7) {
/* RFC 2813 compatible syntax */ /* RFC 2813 compatible syntax */
@@ -368,6 +380,8 @@ IRC_SVSNICK(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
/* Search the originator */ /* Search the originator */
from = Client_Search(Req->prefix); from = Client_Search(Req->prefix);
if (!from) if (!from)
@@ -375,10 +389,9 @@ IRC_SVSNICK(CLIENT *Client, REQUEST *Req)
/* Search the target */ /* Search the target */
target = Client_Search(Req->argv[0]); target = Client_Search(Req->argv[0]);
if (!target || Client_Type(target) != CLIENT_USER) { if (!target || Client_Type(target) != CLIENT_USER)
return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->argv[0]); Client_ID(Client), Req->argv[0]);
}
if (Client_Conn(target) <= NONE) { if (Client_Conn(target) <= NONE) {
/* We have to forward the message to the server handling /* We have to forward the message to the server handling
@@ -471,6 +484,7 @@ IRC_USER(CLIENT * Client, REQUEST * Req)
Client_Type(Client) == CLIENT_SERVICE) { Client_Type(Client) == CLIENT_SERVICE) {
/* Server/service updating an user */ /* Server/service updating an user */
_IRC_ARGC_EQ_OR_RETURN_(Client, Req, 4) _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 4)
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
c = Client_Search(Req->prefix); c = Client_Search(Req->prefix);
if (!c) if (!c)
@@ -613,7 +627,10 @@ IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
Client_SetUser(Client, Req->argv[1], true); Client_SetUser(Client, Req->argv[1], true);
Client_SetOrigUser(Client, Req->argv[1]); Client_SetOrigUser(Client, Req->argv[1]);
Client_SetHostname(Client, Req->argv[2]); if (Conf_DNS)
Client_SetHostname(Client, Req->argv[2]);
else
Client_SetHostname(Client, Req->argv[3]);
Client_SetIPAText(Client, Req->argv[3]); Client_SetIPAText(Client, Req->argv[3]);
return CONNECTED; return CONNECTED;
@@ -640,6 +657,8 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req )
if (Client_Type(Client) == CLIENT_SERVER) { if (Client_Type(Client) == CLIENT_SERVER) {
/* Server */ /* Server */
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
target = Client_Search(Req->prefix); target = Client_Search(Req->prefix);
if (!target) { if (!target) {
Log(LOG_WARNING, Log(LOG_WARNING,
@@ -728,9 +747,10 @@ IRC_PING(CLIENT *Client, REQUEST *Req)
if (target != Client_ThisServer()) { if (target != Client_ThisServer()) {
/* Ok, we have to forward the PING */ /* Ok, we have to forward the PING */
if (Client_Type(Client) == CLIENT_SERVER) if (Client_Type(Client) == CLIENT_SERVER) {
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
from = Client_Search(Req->prefix); from = Client_Search(Req->prefix);
else } else
from = Client; from = Client;
if (!from) if (!from)
return IRC_WriteErrClient(Client, return IRC_WriteErrClient(Client,
@@ -802,6 +822,8 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
/* Forward? */ /* Forward? */
if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) { if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) {
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
target = Client_Search(Req->argv[0]); target = Client_Search(Req->argv[0]);
if (!target) if (!target)
return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG, return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
@@ -836,14 +858,14 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
if (auth_ping) { if (auth_ping) {
LogDebug("AUTH PONG: waiting for token \"%ld\", got \"%s\" ...", LogDebug("AUTH PONG: waiting for token \"%ld\", got \"%s\" ...",
auth_ping, Req->argv[0]); auth_ping, Req->argv[0]);
if (auth_ping == atoi(Req->argv[0])) { if (auth_ping == atol(Req->argv[0])) {
Conn_SetAuthPing(conn, 0); Conn_SetAuthPing(conn, 0);
if (Client_Type(Client) == CLIENT_WAITAUTHPING) if (Client_Type(Client) == CLIENT_WAITAUTHPING)
Login_User(Client); Login_User(Client);
} else } else
if (!IRC_WriteStrClient(Client, if (!IRC_WriteStrClient(Client,
"To connect, type /QUOTE PONG %ld", "NOTICE %s :To connect, type /QUOTE PONG %ld",
auth_ping)) Client_ID(Client), auth_ping))
return DISCONNECTED; return DISCONNECTED;
} }
#endif #endif
@@ -851,13 +873,14 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) { if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
Log(LOG_INFO, Log(LOG_INFO,
"Synchronization with \"%s\" done (connection %d): %ld second%s [%ld users, %ld channels].", "Synchronization with \"%s\" done (connection %d): %ld second%s [%ld users, %ld channels].",
Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn), Client_ID(Client), conn,
(long)(time(NULL) - Conn_GetSignon(conn)),
time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s", time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
Client_UserCount(), Channel_CountVisible(NULL)); Client_UserCount(), Channel_CountVisible(NULL));
Conn_UpdatePing(conn); Conn_UpdatePing(conn);
} else } else
LogDebug("Connection %d: received PONG. Lag: %ld seconds.", LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
conn, time(NULL) - Conn_LastPing(conn)); conn, (long)(time(NULL) - Conn_LastPing(conn)));
return CONNECTED; return CONNECTED;
} /* IRC_PONG */ } /* IRC_PONG */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -25,8 +25,7 @@
*/ */
#define _IRC_ARGC_EQ_OR_RETURN_(Client, Req, Count) \ #define _IRC_ARGC_EQ_OR_RETURN_(Client, Req, Count) \
if (Req->argc != Count) { \ if (Req->argc != Count) { \
IRC_SetPenalty(Client, 2); \ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
Client_ID(Client), Req->command); \ Client_ID(Client), Req->command); \
} }
@@ -38,8 +37,7 @@ if (Req->argc != Count) { \
*/ */
#define _IRC_ARGC_LE_OR_RETURN_(Client, Req, Max) \ #define _IRC_ARGC_LE_OR_RETURN_(Client, Req, Max) \
if (Req->argc > Max) { \ if (Req->argc > Max) { \
IRC_SetPenalty(Client, 2); \ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
Client_ID(Client), Req->command); \ Client_ID(Client), Req->command); \
} }
@@ -51,8 +49,7 @@ if (Req->argc > Max) { \
*/ */
#define _IRC_ARGC_GE_OR_RETURN_(Client, Req, Min) \ #define _IRC_ARGC_GE_OR_RETURN_(Client, Req, Min) \
if (Req->argc < Min) { \ if (Req->argc < Min) { \
IRC_SetPenalty(Client, 2); \ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
Client_ID(Client), Req->command); \ Client_ID(Client), Req->command); \
} }
@@ -64,8 +61,19 @@ if (Req->argc < Min) { \
*/ */
#define _IRC_ARGC_BETWEEN_OR_RETURN_(Client, Req, Min, Max) \ #define _IRC_ARGC_BETWEEN_OR_RETURN_(Client, Req, Min, Max) \
if (Req->argc < Min || Req->argc > Max) { \ if (Req->argc < Min || Req->argc > Max) { \
IRC_SetPenalty(Client, 2); \ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, \ Client_ID(Client), Req->command); \
}
/**
* Make sure that the command has a prefix.
*
* If there is no prefix, send an error to the client and return from
* the function.
*/
#define _IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req) \
if (!Req->prefix) { \
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
Client_ID(Client), Req->command); \ Client_ID(Client), Req->command); \
} }
@@ -77,13 +85,17 @@ if (Req->argc < Min || Req->argc > Max) { \
* send an error to the client and return from the function. * send an error to the client and return from the function.
*/ */
#define _IRC_GET_SENDER_OR_RETURN_(Sender, Req, Client) \ #define _IRC_GET_SENDER_OR_RETURN_(Sender, Req, Client) \
if (Client_Type(Client) == CLIENT_SERVER) \ if (Client_Type(Client) == CLIENT_SERVER) { \
if (!Req->prefix) \
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, \
Client_ID(Client), Req->command); \
Sender = Client_Search(Req->prefix); \ Sender = Client_Search(Req->prefix); \
else \ } else \
Sender = Client; \ Sender = Client; \
if (!Sender) \ if (!Sender) \
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, \ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, \
Client_ID(Client), Req->prefix); Client_ID(Client), \
Req->prefix ? Req->prefix : "(none)");
/** /**
* Get target of an IRC command and make sure that it is a server. * Get target of an IRC command and make sure that it is a server.
@@ -101,7 +113,7 @@ if (Req->argc < Min || Req->argc > Max) { \
if (!Target) \ if (!Target) \
Target = Client_SearchServer(Req->argv[Argc]); \ Target = Client_SearchServer(Req->argv[Argc]); \
if (!Target) \ if (!Target) \
return IRC_WriteStrClient(From, ERR_NOSUCHSERVER_MSG, \ return IRC_WriteErrClient(From, ERR_NOSUCHSERVER_MSG, \
Client_ID(From), Req->argv[Argc]); \ Client_ID(From), Req->argv[Argc]); \
if (Client_Type(Target) != CLIENT_SERVER) \ if (Client_Type(Target) != CLIENT_SERVER) \
Target = Client_Introducer(Target); \ Target = Client_Introducer(Target); \

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,21 +18,18 @@
* IRC metadata commands * IRC metadata commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <strings.h>
#include <stdio.h> #include <stdio.h>
#include "conn-func.h" #include "conn-func.h"
#include "channel.h" #include "channel.h"
#include "conn-encoding.h" #include "irc-macros.h"
#include "irc-write.h" #include "irc-write.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "tool.h"
#include "exp.h"
#include "irc-metadata.h" #include "irc-metadata.h"
/** /**
@@ -51,6 +48,8 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
prefix = Client_Search(Req->prefix); prefix = Client_Search(Req->prefix);
if (!prefix) if (!prefix)
return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG, return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,13 +16,11 @@
* IRC commands for mode changes (like MODE, AWAY, etc.) * IRC commands for mode changes (like MODE, AWAY, etc.)
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "irc-macros.h" #include "irc-macros.h"
@@ -33,7 +31,6 @@
#include "messages.h" #include "messages.h"
#include "conf.h" #include "conf.h"
#include "exp.h"
#include "irc-mode.h" #include "irc-mode.h"
static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin, static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
@@ -71,6 +68,13 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
_IRC_GET_SENDER_OR_RETURN_(origin, Req, Client) _IRC_GET_SENDER_OR_RETURN_(origin, Req, Client)
/* Test for "fake" MODE commands injected by this local instance,
* for example when handling the "DefaultUserModes" settings.
* This doesn't harm real commands, because prefixes of regular
* clients are checked in Validate_Prefix() and can't be faked. */
if (Req->prefix && Client_Search(Req->prefix) == Client_ThisServer())
Client = Client_Search(Req->prefix);
/* Channel or user mode? */ /* Channel or user mode? */
cl = NULL; chan = NULL; cl = NULL; chan = NULL;
if (Client_IsValidNick(Req->argv[0])) if (Client_IsValidNick(Req->argv[0]))
@@ -202,6 +206,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
case 'b': /* Block private msgs */ case 'b': /* Block private msgs */
case 'C': /* Only messages from clients sharing a channel */ case 'C': /* Only messages from clients sharing a channel */
case 'i': /* Invisible */ case 'i': /* Invisible */
case 'I': /* Hide channel list from WHOIS */
case 's': /* Server messages */ case 's': /* Server messages */
case 'w': /* Wallops messages */ case 'w': /* Wallops messages */
x[0] = *mode_ptr; x[0] = *mode_ptr;
@@ -225,6 +230,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
break; break;
case 'c': /* Receive connect notices */ case 'c': /* Receive connect notices */
case 'q': /* KICK-protected user */ case 'q': /* KICK-protected user */
case 'F': /* disable flood protection */
/* (only settable by IRC operators!) */ /* (only settable by IRC operators!) */
if (!set || Client_Type(Client) == CLIENT_SERVER if (!set || Client_Type(Client) == CLIENT_SERVER
|| Client_HasMode(Origin, 'o')) || Client_HasMode(Origin, 'o'))
@@ -357,7 +363,6 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
Client_Modes(Target)); Client_Modes(Target));
} }
IRC_SetPenalty(Client, 1);
return ok; return ok;
} /* Client_Mode */ } /* Client_Mode */
@@ -374,37 +379,44 @@ Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel)
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], argadd[CLIENT_PASS_LEN]; char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], argadd[CLIENT_PASS_LEN];
const char *mode_ptr; const char *mode_ptr;
/* Member or not? -- That's the question! */ if (!Channel_IsMemberOf(Channel, Origin)) {
if (!Channel_IsMemberOf(Channel, Origin)) /* Not a member: "simple" mode reply */
return IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG, if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
Client_ID(Origin), Channel_Name(Channel), Channel_Modes(Channel)); Client_ID(Origin), Channel_Name(Channel),
Channel_Modes(Channel)))
return DISCONNECTED;
} else {
/* The sender is a member: generate extended reply */
strlcpy(the_modes, Channel_Modes(Channel), sizeof(the_modes));
mode_ptr = the_modes;
the_args[0] = '\0';
/* The sender is a member: generate extended reply */ while(*mode_ptr) {
strlcpy(the_modes, Channel_Modes(Channel), sizeof(the_modes)); switch(*mode_ptr) {
mode_ptr = the_modes; case 'l':
the_args[0] = '\0'; snprintf(argadd, sizeof(argadd), " %lu",
Channel_MaxUsers(Channel));
while(*mode_ptr) { strlcat(the_args, argadd, sizeof(the_args));
switch(*mode_ptr) { break;
case 'l': case 'k':
snprintf(argadd, sizeof(argadd), " %lu", Channel_MaxUsers(Channel)); strlcat(the_args, " ", sizeof(the_args));
strlcat(the_args, argadd, sizeof(the_args)); strlcat(the_args, Channel_Key(Channel),
break; sizeof(the_args));
case 'k': break;
strlcat(the_args, " ", sizeof(the_args)); }
strlcat(the_args, Channel_Key(Channel), sizeof(the_args)); mode_ptr++;
break;
} }
mode_ptr++; if (the_args[0])
} strlcat(the_modes, the_args, sizeof(the_modes));
if (the_args[0])
strlcat(the_modes, the_args, sizeof(the_modes)); if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
Client_ID(Origin), Channel_Name(Channel),
the_modes))
return DISCONNECTED;
}
if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
Client_ID(Origin), Channel_Name(Channel),
the_modes))
return DISCONNECTED;
#ifndef STRICT_RFC #ifndef STRICT_RFC
/* Channel creation time */
if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG, if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG,
Client_ID(Origin), Channel_Name(Channel), Client_ID(Origin), Channel_Name(Channel),
Channel_CreationTime(Channel))) Channel_CreationTime(Channel)))
@@ -568,6 +580,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
case 'M': /* Only identified nicks can write */ case 'M': /* Only identified nicks can write */
case 'm': /* Moderated */ case 'm': /* Moderated */
case 'n': /* Only members can write */ case 'n': /* Only members can write */
case 'N': /* Can't change nick while on this channel */
case 'Q': /* No kicks */ case 'Q': /* No kicks */
case 't': /* Topic locked */ case 't': /* Topic locked */
if(is_oper || is_machine || is_owner || if(is_oper || is_machine || is_owner ||
@@ -583,9 +596,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
goto chan_exit; goto chan_exit;
if (!set) { if (!set) {
if (is_oper || is_machine || is_owner || if (is_oper || is_machine || is_owner ||
is_admin || is_op || is_halfop) is_admin || is_op || is_halfop) {
x[0] = *mode_ptr; x[0] = *mode_ptr;
else if (Channel_HasMode(Channel, 'k'))
strlcpy(argadd, "*", sizeof(argadd));
if (arg_arg > mode_arg)
arg_arg++;
} else
connected = IRC_WriteErrClient(Origin, connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG, ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin), Client_ID(Origin),
@@ -613,7 +630,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
#ifdef STRICT_RFC #ifdef STRICT_RFC
/* Only send error message in "strict" mode, /* Only send error message in "strict" mode,
* this is how ircd2.11 and others behave ... */ * this is how ircd2.11 and others behave ... */
IRC_SetPenalty(Origin, 2);
connected = IRC_WriteErrClient(Origin, connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command); Client_ID(Origin), Req->command);
@@ -658,7 +674,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
#ifdef STRICT_RFC #ifdef STRICT_RFC
/* Only send error message in "strict" mode, /* Only send error message in "strict" mode,
* this is how ircd2.11 and others behave ... */ * this is how ircd2.11 and others behave ... */
IRC_SetPenalty(Origin, 2);
connected = IRC_WriteErrClient(Origin, connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command); Client_ID(Origin), Req->command);
@@ -760,7 +775,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
* mode, because most other servers don't do * mode, because most other servers don't do
* it as well and some clients send "wired" * it as well and some clients send "wired"
* MODE commands like "MODE #chan -ooo nick". */ * MODE commands like "MODE #chan -ooo nick". */
IRC_SetPenalty(Origin, 2);
connected = IRC_WriteErrClient(Origin, connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command); Client_ID(Origin), Req->command);
@@ -921,7 +935,6 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
} }
} }
IRC_SetPenalty(Client, 1);
return connected; return connected;
} /* Channel_Mode */ } /* Channel_Mode */
@@ -1005,15 +1018,15 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
switch (what) { switch (what) {
case 'I': case 'I':
if (!Channel_AddInvite(Channel, mask, false)) if (!Channel_AddInvite(Channel, mask, false, Client_ID(Client)))
return CONNECTED; return CONNECTED;
break; break;
case 'b': case 'b':
if (!Channel_AddBan(Channel, mask)) if (!Channel_AddBan(Channel, mask, Client_ID(Client)))
return CONNECTED; return CONNECTED;
break; break;
case 'e': case 'e':
if (!Channel_AddExcept(Channel, mask)) if (!Channel_AddExcept(Channel, mask, Client_ID(Client)))
return CONNECTED; return CONNECTED;
break; break;
} }

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,12 +16,9 @@
* Channel operator commands * Channel operator commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "irc-macros.h" #include "irc-macros.h"
@@ -31,7 +28,6 @@
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "exp.h"
#include "irc-op.h" #include "irc-op.h"
/* Local functions */ /* Local functions */
@@ -122,7 +118,6 @@ IRC_KICK(CLIENT *Client, REQUEST *Req)
nickCount--; nickCount--;
} }
} else { } else {
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
} }
@@ -155,6 +150,14 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG, return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->argv[0]); Client_ID(Client), Req->argv[0]);
if (Req->argv[1][0] == '&') {
/* Local channel. Make sure the target user is on this server! */
if (Client_Conn(target) == NONE)
return IRC_WriteErrClient(from, ERR_USERNOTONSERV_MSG,
Client_ID(Client),
Req->argv[0]);
}
chan = Channel_Search(Req->argv[1]); chan = Channel_Search(Req->argv[1]);
if (chan) { if (chan) {
/* Channel exists. Is the user a valid member of the channel? */ /* Channel exists. Is the user a valid member of the channel? */
@@ -171,7 +174,8 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
/* Is the channel "invite-only"? */ /* Is the channel "invite-only"? */
if (Channel_HasMode(chan, 'i')) { if (Channel_HasMode(chan, 'i')) {
/* Yes. The user must be channel owner/admin/operator/halfop! */ /* Yes. The user issuing the INVITE command must be
* channel owner/admin/operator/halfop! */
if (!Channel_UserHasMode(chan, from, 'q') && if (!Channel_UserHasMode(chan, from, 'q') &&
!Channel_UserHasMode(chan, from, 'a') && !Channel_UserHasMode(chan, from, 'a') &&
!Channel_UserHasMode(chan, from, 'o') && !Channel_UserHasMode(chan, from, 'o') &&
@@ -195,7 +199,8 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
if (remember) { if (remember) {
/* We must remember this invite */ /* We must remember this invite */
if (!Channel_AddInvite(chan, Client_Mask(target), true)) if (!Channel_AddInvite(chan, Client_MaskCloaked(target),
true, Client_ID(from)))
return CONNECTED; return CONNECTED;
} }
} }
@@ -204,21 +209,22 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
Req->argv[0], Req->argv[1]); Req->argv[0], Req->argv[1]);
/* /*
* RFC 2812 says: * RFC 2812 states:
* 'There is no requirement that the channel [..] must exist or be a valid channel' * 'There is no requirement that the channel [..] must exist or be a
* The problem with this is that this allows the "channel" to contain spaces, * valid channel'. The problem with this is that this allows the
* in which case we must prefix its name with a colon to make it clear that * "channel" to contain spaces, in which case we must prefix its name
* it is only a single argument. * with a colon to make it clear that it is only a single argument.
*/ */
colon_if_necessary = strchr(Req->argv[1], ' ') ? ":":""; colon_if_necessary = strchr(Req->argv[1], ' ') ? ":":"";
/* Inform target client */ /* Inform target client */
IRC_WriteStrClientPrefix(target, from, "INVITE %s %s%s", Req->argv[0], IRC_WriteStrClientPrefix(target, from, "INVITE %s %s%s", Req->argv[0],
colon_if_necessary, Req->argv[1]); colon_if_necessary, Req->argv[1]);
if (Client_Conn(target) > NONE) { if (Client_Conn(target) > NONE) {
/* The target user is local, so we have to send the status code */ /* The target user is local, so we have to send the status code */
if (!IRC_WriteStrClientPrefix(from, target, RPL_INVITING_MSG, if (!IRC_WriteStrClientPrefix(from, target, RPL_INVITING_MSG,
Client_ID(from), Req->argv[0], colon_if_necessary, Req->argv[1])) Client_ID(from), Req->argv[0],
colon_if_necessary, Req->argv[1]))
return DISCONNECTED; return DISCONNECTED;
if (Client_HasMode(target, 'a') && if (Client_HasMode(target, 'a') &&

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,12 +16,12 @@
* IRC operator commands * IRC operator commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <time.h>
#include "ngircd.h" #include "ngircd.h"
#include "conn-func.h" #include "conn-func.h"
@@ -38,7 +38,6 @@
#include "messages.h" #include "messages.h"
#include "op.h" #include "op.h"
#include <exp.h>
#include "irc-oper.h" #include "irc-oper.h"
/** /**
@@ -48,9 +47,11 @@
static bool static bool
Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
{ {
Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", Log(LOG_ERR|LOG_snotice, "Got invalid OPER from \"%s\": \"%s\" -- %s!",
Client_Mask(Client), errtoken, errmsg); Client_Mask(Client), errtoken, errmsg);
return IRC_WriteErrClient(Client, ERR_PASSWDMISMATCH_MSG, /* Increase penalty to slow down possible brute force attacks */
IRC_SetPenalty(Client, 10);
return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
Client_ID(Client)); Client_ID(Client));
} /* Bad_OperPass */ } /* Bad_OperPass */
@@ -208,18 +209,14 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req)
/* Bad number of parameters? */ /* Bad number of parameters? */
if (Req->argc != 1 && Req->argc != 2 && Req->argc != 3 && if (Req->argc != 1 && Req->argc != 2 && Req->argc != 3 &&
Req->argc != 5 && Req->argc != 6) { Req->argc != 5 && Req->argc != 6)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
/* Invalid port number? */ /* Invalid port number? */
if ((Req->argc > 1) && atoi(Req->argv[1]) < 1) { if ((Req->argc > 1) && atoi(Req->argv[1]) < 1)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
if (Client_Type(Client) != CLIENT_SERVER if (Client_Type(Client) != CLIENT_SERVER
&& !Client_HasMode(Client, 'o')) && !Client_HasMode(Client, 'o'))
@@ -362,6 +359,7 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
from = Client; from = Client;
break; break;
case CLIENT_SERVER: case CLIENT_SERVER:
_IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
from = Client_Search(Req->prefix); from = Client_Search(Req->prefix);
break; break;
default: default:
@@ -389,19 +387,27 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
CLIENT *from, *c, *c_next; CLIENT *from, *c, *c_next;
char reason[COMMAND_LEN], class_c; char reason[COMMAND_LEN], class_c;
struct list_head *list; struct list_head *list;
time_t timeout;
int class; int class;
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
/* Bad number of parameters? */ /* Bad number of parameters? */
if (Req->argc != 1 && Req->argc != 3) { if (Req->argc != 1 && Req->argc != 3)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
from = Op_Check(Client, Req); if (!Conf_AllowRemoteOper && Client_Type(Client) == CLIENT_SERVER) {
/* Explicitely forbid remote servers to modify "x-lines" when
* the "AllowRemoteOper" configuration option isn't set, even
* when the command seems to originate from the remote server
* itself: this prevents GLINE's to become set during server
* handshake in this case (what wouldn't be possible during
* regular runtime when a remote IRC Op sends the command). */
from = NULL;
} else
from = Op_Check(Client, Req);
if (!from) if (!from)
return Op_NoPrivileges(Client, Req); return Op_NoPrivileges(Client, Req);
@@ -435,8 +441,11 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
} }
} else { } else {
/* Add new mask to list */ /* Add new mask to list */
timeout = atol(Req->argv[1]);
if (timeout > 0)
timeout += time(NULL);
if (Class_AddMask(class, Req->argv[0], if (Class_AddMask(class, Req->argv[0],
time(NULL) + atol(Req->argv[1]), timeout,
Req->argv[2])) { Req->argv[2])) {
Log(LOG_NOTICE|LOG_snotice, Log(LOG_NOTICE|LOG_snotice,
"\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).", "\"%s\" added \"%s\" to %c-Line list: \"%s\" (%ld seconds).",

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,31 +16,26 @@
* IRC commands for server links * IRC commands for server links
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "defines.h"
#include "conn.h"
#include "conn-func.h" #include "conn-func.h"
#include "conn-zip.h" #include "conn-zip.h"
#include "conf.h" #include "conf.h"
#include "channel.h" #include "channel.h"
#include "lists.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "numeric.h" #include "numeric.h"
#include "ngircd.h" #include "ngircd.h"
#include "irc.h"
#include "irc-info.h" #include "irc-info.h"
#include "irc-macros.h"
#include "irc-write.h" #include "irc-write.h"
#include "op.h" #include "op.h"
#include "exp.h"
#include "irc-server.h" #include "irc-server.h"
/** /**
@@ -72,12 +67,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
LogDebug("Connection %d: got SERVER command (new server link) ...", LogDebug("Connection %d: got SERVER command (new server link) ...",
Client_Conn(Client)); Client_Conn(Client));
if (Req->argc != 2 && Req->argc != 3) { if (Req->argc != 2 && Req->argc != 3)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Client_ID(Client),
Req->command); Req->command);
}
/* Get configuration index of new remote server ... */ /* Get configuration index of new remote server ... */
for (i = 0; i < MAX_SERVERS; i++) for (i = 0; i < MAX_SERVERS; i++)
@@ -185,11 +178,9 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
{ {
/* New server is being introduced to the network */ /* New server is being introduced to the network */
if (Req->argc != 4) { if (Req->argc != 4)
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
/* check for existing server with same ID */ /* check for existing server with same ID */
if (!Client_CheckID(Client, Req->argv[0])) if (!Client_CheckID(Client, Req->argv[0]))
@@ -235,11 +226,9 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_MyToken(c), Client_Info(c)); Client_MyToken(c), Client_Info(c));
return CONNECTED; return CONNECTED;
} else { } else
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
}
} /* IRC_SERVER */ } /* IRC_SERVER */
/* /*
@@ -257,66 +246,96 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
CHANNEL *chan; CHANNEL *chan;
CLIENT *c; CLIENT *c;
assert( Client != NULL ); assert(Client != NULL);
assert( Req != NULL ); assert(Req != NULL);
strlcpy( nick_in, Req->argv[1], sizeof( nick_in )); strlcpy(nick_in, Req->argv[1], sizeof(nick_in));
strcpy( nick_out, "" ); strcpy(nick_out, "");
channame = Req->argv[0]; channame = Req->argv[0];
ptr = strtok( nick_in, "," );
while( ptr ) ptr = strtok(nick_in, ",");
{ while (ptr) {
is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false; is_owner = is_chanadmin = is_op = is_halfop = is_voiced = false;
/* cut off prefixes */ /* cut off prefixes */
while(( *ptr == '~') || ( *ptr == '&' ) || ( *ptr == '@' ) || while ((*ptr == '~') || (*ptr == '&') || (*ptr == '@') ||
( *ptr == '%') || ( *ptr == '+' )) (*ptr == '%') || (*ptr == '+')) {
{ if (*ptr == '~')
if( *ptr == '~' ) is_owner = true; is_owner = true;
if( *ptr == '&' ) is_chanadmin = true; if (*ptr == '&')
if( *ptr == '@' ) is_op = true; is_chanadmin = true;
if( *ptr == 'h' ) is_halfop = true; if (*ptr == '@')
if( *ptr == '+' ) is_voiced = true; is_op = true;
if (*ptr == '%')
is_halfop = true;
if (*ptr == '+')
is_voiced = true;
ptr++; ptr++;
} }
c = Client_Search( ptr ); c = Client_Search(ptr);
if( c ) if (!c) {
{ /* Client not found? */
Channel_Join( c, channame ); Log(LOG_ERR,
chan = Channel_Search( channame ); "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!",
assert( chan != NULL ); ptr, channame);
goto skip_njoin;
if( is_owner ) Channel_UserModeAdd( chan, c, 'q' );
if( is_chanadmin ) Channel_UserModeAdd( chan, c, 'a' );
if( is_op ) Channel_UserModeAdd( chan, c, 'o' );
if( is_halfop ) Channel_UserModeAdd( chan, c, 'h' );
if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' );
/* announce to channel... */
IRC_WriteStrChannelPrefix( Client, chan, c, false, "JOIN :%s", channame );
/* set Channel-User-Modes */
strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes ));
if( modes[0] )
{
/* send modes to channel */
IRC_WriteStrChannelPrefix( Client, chan, Client, false, "MODE %s +%s %s", channame, modes, Client_ID( c ));
}
if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out ));
if( is_owner ) strlcat( nick_out, "~", sizeof( nick_out ));
if( is_chanadmin ) strlcat( nick_out, "&", sizeof( nick_out ));
if( is_op ) strlcat( nick_out, "@", sizeof( nick_out ));
if( is_halfop ) strlcat( nick_out, "%", sizeof( nick_out ));
if( is_voiced ) strlcat( nick_out, "+", sizeof( nick_out ));
strlcat( nick_out, ptr, sizeof( nick_out ));
} }
else Log( LOG_ERR, "Got NJOIN for unknown nick \"%s\" for channel \"%s\"!", ptr, channame );
/* search for next Nick */ if (!Channel_Join(c, channame)) {
ptr = strtok( NULL, "," ); /* Failed to join channel. Ooops!? */
Log(LOG_ALERT,
"Failed to join client \"%s\" to channel \"%s\" (NJOIN): killing it!",
ptr, channame);
IRC_KillClient(NULL, NULL, ptr, "Internal NJOIN error!");
Log(LOG_DEBUG, "... done.");
goto skip_njoin;
}
chan = Channel_Search(channame);
assert(chan != NULL);
if (is_owner)
Channel_UserModeAdd(chan, c, 'q');
if (is_chanadmin)
Channel_UserModeAdd(chan, c, 'a');
if (is_op)
Channel_UserModeAdd(chan, c, 'o');
if (is_halfop)
Channel_UserModeAdd(chan, c, 'h');
if (is_voiced)
Channel_UserModeAdd(chan, c, 'v');
/* Announce client to the channel */
IRC_WriteStrChannelPrefix(Client, chan, c, false,
"JOIN :%s", channame);
/* Announce "channel user modes" to the channel, if any */
strlcpy(modes, Channel_UserModes(chan, c), sizeof(modes));
if (modes[0])
IRC_WriteStrChannelPrefix(Client, chan, Client, false,
"MODE %s +%s %s", channame,
modes, Client_ID(c));
/* Build nick list for forwarding command */
if (nick_out[0] != '\0')
strlcat(nick_out, ",", sizeof(nick_out));
if (is_owner)
strlcat(nick_out, "~", sizeof(nick_out));
if (is_chanadmin)
strlcat(nick_out, "&", sizeof(nick_out));
if (is_op)
strlcat(nick_out, "@", sizeof(nick_out));
if (is_halfop)
strlcat(nick_out, "%", sizeof(nick_out));
if (is_voiced)
strlcat(nick_out, "+", sizeof(nick_out));
strlcat(nick_out, ptr, sizeof(nick_out));
skip_njoin:
/* Get next nick, if any ... */
ptr = strtok(NULL, ",");
} }
/* forward to other servers */ /* forward to other servers */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@
* Sending IRC commands over the network * Sending IRC commands over the network
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#ifdef PROTOTYPES #ifdef PROTOTYPES
# include <stdarg.h> # include <stdarg.h>
@@ -24,13 +23,10 @@
# include <varargs.h> # include <varargs.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "defines.h"
#include "conn-func.h" #include "conn-func.h"
#include "channel.h" #include "channel.h"
#include "exp.h"
#include "irc-write.h" #include "irc-write.h"
#define SEND_TO_USER 1 #define SEND_TO_USER 1
@@ -70,7 +66,7 @@ va_dcl
#else #else
va_start(ap); va_start(ap);
#endif #endif
vsnprintf(buffer, 1000, Format, ap); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end(ap); va_end(ap);
IRC_SetPenalty(Client, 2); IRC_SetPenalty(Client, 2);
@@ -107,7 +103,7 @@ va_dcl
#else #else
va_start(ap); va_start(ap);
#endif #endif
vsnprintf(buffer, 1000, Format, ap); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end(ap); va_end(ap);
return IRC_WriteStrClientPrefix(Client, Client_ThisServer(), return IRC_WriteStrClientPrefix(Client, Client_ThisServer(),
@@ -148,7 +144,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
return Conn_WriteStr(Client_Conn(Client_NextHop(Client)), ":%s %s", return Conn_WriteStr(Client_Conn(Client_NextHop(Client)), ":%s %s",
@@ -190,7 +186,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
IRC_WriteStrChannelPrefix(Client, Chan, Client_ThisServer(), IRC_WriteStrChannelPrefix(Client, Chan, Client_ThisServer(),
@@ -239,7 +235,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
Conn_ClearFlags( ); Conn_ClearFlags( );
@@ -296,7 +292,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
IRC_WriteStrServersPrefix(ExceptOf, Client_ThisServer(), "%s", buffer); IRC_WriteStrServersPrefix(ExceptOf, Client_ThisServer(), "%s", buffer);
@@ -333,7 +329,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer ); IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer );
@@ -373,7 +369,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag, IRC_WriteStrServersPrefixFlag_CB(ExceptOf, Prefix, Flag,
@@ -451,7 +447,7 @@ va_dcl
#else #else
va_start( ap ); va_start( ap );
#endif #endif
vsnprintf( buffer, 1000, Format, ap ); vsnprintf(buffer, sizeof(buffer), Format, ap);
va_end( ap ); va_end( ap );
Conn_ClearFlags( ); Conn_ClearFlags( );
@@ -513,7 +509,7 @@ va_dcl
#else #else
va_start(ap); va_start(ap);
#endif #endif
vsnprintf(msg, 1000, Format, ap); vsnprintf(msg, sizeof(msg), Format, ap);
va_end(ap); va_end(ap);
for (to=Client_First(); to != NULL; to=Client_Next(to)) { for (to=Client_First(); to != NULL; to=Client_Next(to)) {
@@ -525,12 +521,12 @@ va_dcl
if (Client_HasMode(to, 'w')) if (Client_HasMode(to, 'w'))
IRC_WriteStrClientPrefix(to, From, IRC_WriteStrClientPrefix(to, From,
"WALLOPS :%s", msg); "WALLOPS :%s", msg);
break; break;
case CLIENT_SERVER: case CLIENT_SERVER:
if (to != Client) if (to != Client)
IRC_WriteStrClientPrefix(to, From, IRC_WriteStrClientPrefix(to, From,
"WALLOPS :%s", msg); "WALLOPS :%s", msg);
break; break;
} }
} }
} /* IRC_SendWallops */ } /* IRC_SendWallops */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,17 +16,19 @@
* IRC commands * IRC commands
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <time.h>
#include "ngircd.h" #include "ngircd.h"
#include "conn-func.h" #include "conn-func.h"
#include "conf.h" #include "conf.h"
#include "channel.h" #include "channel.h"
#include "conn-encoding.h" #ifdef ICONV
#include "defines.h" # include "conn-encoding.h"
#endif
#include "irc-macros.h" #include "irc-macros.h"
#include "irc-write.h" #include "irc-write.h"
#include "log.h" #include "log.h"
@@ -34,9 +36,7 @@
#include "messages.h" #include "messages.h"
#include "parse.h" #include "parse.h"
#include "op.h" #include "op.h"
#include "tool.h"
#include "exp.h"
#include "irc.h" #include "irc.h"
static char *Option_String PARAMS((CONN_ID Idx)); static char *Option_String PARAMS((CONN_ID Idx));
@@ -85,6 +85,8 @@ IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit,
GLOBAL bool GLOBAL bool
IRC_ERROR(CLIENT *Client, REQUEST *Req) IRC_ERROR(CLIENT *Client, REQUEST *Req)
{ {
char *msg;
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
@@ -99,12 +101,20 @@ IRC_ERROR(CLIENT *Client, REQUEST *Req)
return CONNECTED; return CONNECTED;
} }
if (Req->argc < 1) if (Req->argc < 1) {
msg = "Got ERROR command";
Log(LOG_NOTICE, "Got ERROR from \"%s\"!", Log(LOG_NOTICE, "Got ERROR from \"%s\"!",
Client_Mask(Client)); Client_Mask(Client));
else } else {
msg = Req->argv[0];
Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!", Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!",
Client_Mask(Client), Req->argv[0]); Client_Mask(Client), msg);
}
if (Client_Conn(Client) != NONE) {
Client_Destroy(Client, NULL, msg, false);
return DISCONNECTED;
}
return CONNECTED; return CONNECTED;
} /* IRC_ERROR */ } /* IRC_ERROR */
@@ -224,8 +234,6 @@ IRC_TRACE(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 3);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client) _IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from) _IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
@@ -242,7 +250,7 @@ IRC_TRACE(CLIENT *Client, REQUEST *Req)
PACKAGE_VERSION, Client_ID(target), PACKAGE_VERSION, Client_ID(target),
Client_ID(Client_NextHop(target)), Client_ID(Client_NextHop(target)),
Option_String(idx2), Option_String(idx2),
time(NULL) - Conn_StartTime(idx2), (long)(time(NULL) - Conn_StartTime(idx2)),
Conn_SendQ(idx), Conn_SendQ(idx2))) Conn_SendQ(idx), Conn_SendQ(idx2)))
return DISCONNECTED; return DISCONNECTED;
@@ -301,8 +309,6 @@ IRC_HELP(CLIENT *Client, REQUEST *Req)
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
IRC_SetPenalty(Client, 2);
if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0) if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0)
|| (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) { || (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) {
/* Help text available and requested */ /* Help text available and requested */
@@ -343,9 +349,12 @@ GLOBAL bool
IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason) IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason)
{ {
const char *msg; const char *msg;
CONN_ID my_conn, conn; CONN_ID my_conn = NONE, conn;
CLIENT *c; CLIENT *c;
assert(Nick != NULL);
assert(Reason != NULL);
/* Do we know such a client in the network? */ /* Do we know such a client in the network? */
c = Client_Search(Nick); c = Client_Search(Nick);
if (!c) { if (!c) {
@@ -380,7 +389,8 @@ IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reaso
} }
/* Save ID of this connection */ /* Save ID of this connection */
my_conn = Client_Conn(Client); if (Client)
my_conn = Client_Conn(Client);
/* Kill the client NOW: /* Kill the client NOW:
* - Close the local connection (if there is one), * - Close the local connection (if there is one),
@@ -478,9 +488,7 @@ Option_String(UNUSED CONN_ID Idx)
#endif #endif
{ {
static char option_txt[8]; static char option_txt[8];
#ifdef ZLIB
UINT16 options; UINT16 options;
#endif
assert(Idx != NONE); assert(Idx != NONE);
@@ -495,11 +503,22 @@ Option_String(UNUSED CONN_ID Idx)
if(options & CONN_ZIP) /* zlib compression enabled */ if(options & CONN_ZIP) /* zlib compression enabled */
strlcat(option_txt, "z", sizeof(option_txt)); strlcat(option_txt, "z", sizeof(option_txt));
#endif #endif
LogDebug(" *** %d: %d = %s", Idx, options, option_txt);
return option_txt; return option_txt;
} /* Option_String */ } /* Option_String */
/**
* Send a message to target(s).
*
* This function is used by IRC_{PRIVMSG|NOTICE|SQUERY} to actualy
* send the message(s).
*
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @param ForceType Required type of the destination of the message(s).
* @param SendErrors Whether to report errors back to the client or not.
* @return CONNECTED or DISCONNECTED.
*/
static bool static bool
Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
{ {
@@ -507,8 +526,10 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
CHANNEL *chan; CHANNEL *chan;
char *currentTarget = Req->argv[0]; char *currentTarget = Req->argv[0];
char *lastCurrentTarget = NULL; char *strtok_last = NULL;
char *message = NULL; char *message = NULL;
char *targets[MAX_HNDL_TARGETS];
int i, target_nr = 0;
assert(Client != NULL); assert(Client != NULL);
assert(Req != NULL); assert(Req != NULL);
@@ -528,12 +549,11 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
if (Req->argc > 2) { if (Req->argc > 2) {
if (!SendErrors) if (!SendErrors)
return CONNECTED; return CONNECTED;
IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
} }
if (Client_Type(Client) == CLIENT_SERVER) if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
from = Client_Search(Req->prefix); from = Client_Search(Req->prefix);
else else
from = Client; from = Client;
@@ -549,10 +569,19 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
message = Req->argv[1]; message = Req->argv[1];
/* handle msgtarget = msgto *("," msgto) */ /* handle msgtarget = msgto *("," msgto) */
currentTarget = strtok_r(currentTarget, ",", &lastCurrentTarget); currentTarget = strtok_r(currentTarget, ",", &strtok_last);
ngt_UpperStr(Req->command); ngt_UpperStr(Req->command);
/* Please note that "currentTarget" is NULL when the target contains
* the separator character only, e. g. "," or ",,,," etc.! */
while (currentTarget) { while (currentTarget) {
/* Make sure that there hasn't been such a target already: */
targets[target_nr++] = currentTarget;
for(i = 0; i < target_nr - 1; i++) {
if (strcasecmp(currentTarget, targets[i]) == 0)
goto send_next_target;
}
/* Check for and handle valid <msgto> of form: /* Check for and handle valid <msgto> of form:
* RFC 2812 2.3.1: * RFC 2812 2.3.1:
* msgto = channel / ( user [ "%" host ] "@" servername ) * msgto = channel / ( user [ "%" host ] "@" servername )
@@ -696,14 +725,14 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
return DISCONNECTED; return DISCONNECTED;
} else if (ForceType != CLIENT_SERVICE } else if (ForceType != CLIENT_SERVICE
&& (chan = Channel_Search(currentTarget))) { && (chan = Channel_Search(currentTarget))) {
/* Target is a channel */
if (!Channel_Write(chan, from, Client, Req->command, if (!Channel_Write(chan, from, Client, Req->command,
SendErrors, message)) SendErrors, message))
return DISCONNECTED; return DISCONNECTED;
} else if (ForceType != CLIENT_SERVICE } else if (ForceType != CLIENT_SERVICE
/* $#: server/target mask, RFC 2812, sec. 3.3.1 */
&& strchr("$#", currentTarget[0]) && strchr("$#", currentTarget[0])
&& strchr(currentTarget, '.')) { && strchr(currentTarget, '.')) {
/* targetmask */ /* $#: server/host mask, RFC 2812, sec. 3.3.1 */
if (!Send_Message_Mask(from, Req->command, currentTarget, if (!Send_Message_Mask(from, Req->command, currentTarget,
message, SendErrors)) message, SendErrors))
return DISCONNECTED; return DISCONNECTED;
@@ -716,14 +745,35 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
} }
send_next_target: send_next_target:
currentTarget = strtok_r(NULL, ",", &lastCurrentTarget); currentTarget = strtok_r(NULL, ",", &strtok_last);
if (currentTarget) if (!currentTarget)
Conn_SetPenalty(Client_Conn(Client), 1); break;
Conn_SetPenalty(Client_Conn(Client), 1);
if (target_nr >= MAX_HNDL_TARGETS) {
/* Too many targets given! */
return IRC_WriteErrClient(Client,
ERR_TOOMANYTARGETS_MSG,
currentTarget);
}
} }
return CONNECTED; return CONNECTED;
} /* Send_Message */ } /* Send_Message */
/**
* Send a message to "target mask" target(s).
*
* See RFC 2812, sec. 3.3.1 for details.
*
* @param from The client from which this command has been received.
* @param command The command to use (PRIVMSG, NOTICE, ...).
* @param targetMask The "target mask" (will be verified by this function).
* @param message The message to send.
* @param SendErrors Whether to report errors back to the client or not.
* @return CONNECTED or DISCONNECTED.
*/
static bool static bool
Send_Message_Mask(CLIENT * from, char * command, char * targetMask, Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
char * message, bool SendErrors) char * message, bool SendErrors)
@@ -747,17 +797,15 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
* dot (".") and no wildcards ("*", "?") following the last one. * dot (".") and no wildcards ("*", "?") following the last one.
*/ */
check_wildcards = strrchr(targetMask, '.'); check_wildcards = strrchr(targetMask, '.');
assert(check_wildcards != NULL); if (!check_wildcards || check_wildcards[strcspn(check_wildcards, "*?")]) {
if (check_wildcards &&
check_wildcards[strcspn(check_wildcards, "*?")])
{
if (!SendErrors) if (!SendErrors)
return true; return true;
return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask); return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL_MSG,
targetMask);
} }
/* #: hostmask, see RFC 2812, sec. 3.3.1 */
if (targetMask[0] == '#') { if (targetMask[0] == '#') {
/* #: hostmask, see RFC 2812, sec. 3.3.1 */
for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
if (Client_Type(cl) != CLIENT_USER) if (Client_Type(cl) != CLIENT_USER)
continue; continue;
@@ -768,7 +816,8 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
return false; return false;
} }
} else { } else {
assert(targetMask[0] == '$'); /* $: server mask, see RFC 2812, sec. 3.3.1 */ /* $: server mask, see RFC 2812, sec. 3.3.1 */
assert(targetMask[0] == '$');
for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) { for (cl = Client_First(); cl != NULL; cl = Client_Next(cl)) {
if (Client_Type(cl) != CLIENT_USER) if (Client_Type(cl) != CLIENT_USER)
continue; continue;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,29 +16,24 @@
* Management of IRC lists: ban, invite, etc. * Management of IRC lists: ban, invite, etc.
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include "defines.h"
#include "conn.h"
#include "channel.h"
#include "log.h"
#include "match.h"
#include "messages.h"
#include "irc-write.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <time.h>
#include "conn.h"
#include "log.h"
#include "match.h"
#include "exp.h"
#include "lists.h" #include "lists.h"
struct list_elem { struct list_elem {
struct list_elem *next; /** pointer to next list element */ struct list_elem *next; /** pointer to next list element */
char mask[MASK_LEN]; /** IRC mask */ char mask[MASK_LEN]; /** IRC mask */
char *reason; /** Optional "reason" text */ char *reason; /** Optional "reason" text */
time_t valid_until; /** 0: unlimited; 1: once; t(>1): until t */ time_t valid_until; /** 0: unlimited; t(>0): until t */
bool onlyonce;
}; };
/** /**
@@ -71,7 +66,7 @@ Lists_GetReason(const struct list_elem *e)
* Get "validity" value stored in list element. * Get "validity" value stored in list element.
* *
* @param list_elem List element. * @param list_elem List element.
* @return Validity: 0=unlimited, 1=once, >1 until this time stamp. * @return Validity: 0=unlimited, >0 until this time stamp.
*/ */
GLOBAL time_t GLOBAL time_t
Lists_GetValidity(const struct list_elem *e) Lists_GetValidity(const struct list_elem *e)
@@ -80,6 +75,19 @@ Lists_GetValidity(const struct list_elem *e)
return e->valid_until; return e->valid_until;
} }
/**
* Get "onlyonce" value stored in list element.
*
* @param list_elem List element.
* @return True if the element was stored for single use, false otherwise.
*/
GLOBAL bool
Lists_GetOnlyOnce(const struct list_elem *e)
{
assert(e != NULL);
return e->onlyonce;
}
/** /**
* Get first list element of a list. * Get first list element of a list.
* *
@@ -117,7 +125,7 @@ Lists_GetNext(const struct list_elem *e)
*/ */
bool bool
Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil, Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
const char *Reason) const char *Reason, bool OnlyOnce)
{ {
struct list_elem *e, *newelem; struct list_elem *e, *newelem;
@@ -154,6 +162,7 @@ Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
else else
newelem->reason = NULL; newelem->reason = NULL;
newelem->valid_until = ValidUntil; newelem->valid_until = ValidUntil;
newelem->onlyonce = OnlyOnce;
newelem->next = e; newelem->next = e;
h->first = newelem; h->first = newelem;
@@ -291,6 +300,7 @@ Lists_MakeMask(const char *Pattern, char *mask, size_t len)
strlcpy(mask, Pattern, len - 5); strlcpy(mask, Pattern, len - 5);
strlcat(mask, "!*@", len); strlcat(mask, "!*@", len);
strlcat(mask, at, len); strlcat(mask, at, len);
at--; *at = '@';
} else { } else {
/* All parts (nick, user and domain name) are given */ /* All parts (nick, user and domain name) are given */
strlcpy(mask, Pattern, len); strlcpy(mask, Pattern, len);
@@ -331,10 +341,10 @@ Lists_CheckReason(struct list_head *h, CLIENT *Client, char *reason, size_t len)
while (e) { while (e) {
next = e->next; next = e->next;
if (Match(e->mask, Client_MaskCloaked(Client))) { if (MatchCaseInsensitive(e->mask, Client_MaskCloaked(Client))) {
if (len && e->reason) if (len && e->reason)
strlcpy(reason, e->reason, len); strlcpy(reason, e->reason, len);
if (e->valid_until == 1) { if (e->onlyonce) {
/* Entry is valid only once, delete it */ /* Entry is valid only once, delete it */
LogDebug("Deleted \"%s\" from list (used).", LogDebug("Deleted \"%s\" from list (used).",
e->mask); e->mask);
@@ -368,14 +378,14 @@ Lists_Expire(struct list_head *h, const char *ListName)
while (e) { while (e) {
next = e->next; next = e->next;
if (e->valid_until > 1 && e->valid_until < now) { if (e->valid_until > 0 && e->valid_until < now) {
/* Entry is expired, delete it */ /* Entry is expired, delete it */
if (e->reason) if (e->reason)
Log(LOG_INFO, Log(LOG_NOTICE|LOG_snotice,
"Deleted \"%s\" (\"%s\") from %s list (expired).", "Deleted \"%s\" (\"%s\") from %s list (expired).",
e->mask, e->reason, ListName); e->mask, e->reason, ListName);
else else
Log(LOG_INFO, Log(LOG_NOTICE|LOG_snotice,
"Deleted \"%s\" from %s list (expired).", "Deleted \"%s\" from %s list (expired).",
e->mask, ListName); e->mask, ListName);
Lists_Unlink(h, last, e); Lists_Unlink(h, last, e);

View File

@@ -36,7 +36,8 @@ GLOBAL struct list_elem *Lists_CheckDupeMask PARAMS((const struct list_head *hea
const char *mask)); const char *mask));
GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask, GLOBAL bool Lists_Add PARAMS((struct list_head *h, const char *Mask,
time_t ValidUntil, const char *Reason)); time_t ValidUntil, const char *Reason,
bool OnlyOnce));
GLOBAL void Lists_Del PARAMS((struct list_head *head, const char *Mask)); GLOBAL void Lists_Del PARAMS((struct list_head *head, const char *Mask));
GLOBAL unsigned long Lists_Count PARAMS((struct list_head *h)); GLOBAL unsigned long Lists_Count PARAMS((struct list_head *h));
@@ -46,6 +47,7 @@ GLOBAL void Lists_MakeMask PARAMS((const char *Pattern, char *mask, size_t len))
GLOBAL const char *Lists_GetMask PARAMS((const struct list_elem *e)); GLOBAL const char *Lists_GetMask PARAMS((const struct list_elem *e));
GLOBAL const char *Lists_GetReason PARAMS((const struct list_elem *e)); GLOBAL const char *Lists_GetReason PARAMS((const struct list_elem *e));
GLOBAL time_t Lists_GetValidity PARAMS((const struct list_elem *e)); GLOBAL time_t Lists_GetValidity PARAMS((const struct list_elem *e));
GLOBAL bool Lists_GetOnlyOnce PARAMS((const struct list_elem *e));
GLOBAL void Lists_Expire PARAMS((struct list_head *h, const char *ListName)); GLOBAL void Lists_Expire PARAMS((struct list_head *h, const char *ListName));

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,34 +16,29 @@
* Logging functions * Logging functions
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#ifdef PROTOTYPES #ifdef PROTOTYPES
# include <stdarg.h> # include <stdarg.h>
#else #else
# include <varargs.h> # include <varargs.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#ifdef SYSLOG #ifdef SYSLOG
#include <syslog.h> # include <syslog.h>
#endif #endif
#include "ngircd.h" #include "ngircd.h"
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
#include "irc-write.h" #include "irc-write.h"
#include "conf.h" #include "conf.h"
#include "exp.h"
#include "log.h" #include "log.h"
static bool Is_Daemon; static bool Is_Daemon;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,36 +16,34 @@
* Functions to deal with client logins * Functions to deal with client logins
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <unistd.h> #include <unistd.h>
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "class.h" #include "class.h"
#include "client.h"
#include "client-cap.h" #include "client-cap.h"
#include "channel.h" #include "channel.h"
#include "conf.h" #include "conf.h"
#include "io.h"
#include "parse.h" #include "parse.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "ngircd.h" #include "ngircd.h"
#include "pam.h"
#include "irc-info.h" #include "irc-info.h"
#include "irc-mode.h" #include "irc-mode.h"
#include "irc-write.h" #include "irc-write.h"
#include "exp.h"
#include "login.h" #include "login.h"
#ifdef PAM #ifdef PAM
#include "io.h"
#include "pam.h"
static void cb_Read_Auth_Result PARAMS((int r_fd, UNUSED short events)); static void cb_Read_Auth_Result PARAMS((int r_fd, UNUSED short events));
#endif #endif
/** /**
@@ -91,13 +89,12 @@ Login_User(CLIENT * Client)
#ifdef PAM #ifdef PAM
if (!Conf_PAM) { if (!Conf_PAM) {
/* Don't do any PAM authentication at all, instead emulate /* Don't do any PAM authentication at all if PAM is not
* the behavior of the daemon compiled without PAM support: * enabled, instead emulate the behavior of the daemon
* because there can't be any "server password", all * compiled without PAM support. */
* passwords supplied are classified as "wrong". */ if (strcmp(Conn_Password(conn), Conf_ServerPwd) == 0)
if(Conn_Password(conn)[0] == '\0')
return Login_User_PostAuth(Client); return Login_User_PostAuth(Client);
Client_Reject(Client, "Non-empty password", false); Client_Reject(Client, "Bad server password", false);
return DISCONNECTED; return DISCONNECTED;
} }
@@ -111,25 +108,27 @@ Login_User(CLIENT * Client)
return Login_User_PostAuth(Client); return Login_User_PostAuth(Client);
} }
/* Fork child process for PAM authentication; and make sure that the if (Conf_PAM) {
* process timeout is set higher than the login timeout! */ /* Fork child process for PAM authentication; and make sure that the
pid = Proc_Fork(Conn_GetProcStat(conn), pipefd, * process timeout is set higher than the login timeout! */
cb_Read_Auth_Result, Conf_PongTimeout + 1); pid = Proc_Fork(Conn_GetProcStat(conn), pipefd,
if (pid > 0) { cb_Read_Auth_Result, Conf_PongTimeout + 1);
LogDebug("Authenticator for connection %d created (PID %d).", if (pid > 0) {
conn, pid); LogDebug("Authenticator for connection %d created (PID %d).",
return CONNECTED; conn, pid);
} else { return CONNECTED;
/* Sub process */ } else {
Log_Init_Subprocess("Auth"); /* Sub process */
Conn_CloseAllSockets(NONE); Log_Init_Subprocess("Auth");
result = PAM_Authenticate(Client); Conn_CloseAllSockets(NONE);
if (write(pipefd[1], &result, sizeof(result)) != sizeof(result)) result = PAM_Authenticate(Client);
Log_Subprocess(LOG_ERR, if (write(pipefd[1], &result, sizeof(result)) != sizeof(result))
"Failed to pipe result to parent!"); Log_Subprocess(LOG_ERR,
Log_Exit_Subprocess("Auth"); "Failed to pipe result to parent!");
exit(0); Log_Exit_Subprocess("Auth");
} exit(0);
}
} else return CONNECTED;
#else #else
/* Check global server password ... */ /* Check global server password ... */
if (strcmp(Conn_Password(conn), Conf_ServerPwd) != 0) { if (strcmp(Conn_Password(conn), Conf_ServerPwd) != 0) {
@@ -193,7 +192,7 @@ Login_User_PostAuth(CLIENT *Client)
/* Set default user modes */ /* Set default user modes */
if (Conf_DefaultUserModes[0]) { if (Conf_DefaultUserModes[0]) {
snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes); snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes);
Req.prefix = Client_ThisServer(); Req.prefix = Client_ID(Client_ThisServer());
Req.command = "MODE"; Req.command = "MODE";
Req.argc = 2; Req.argc = 2;
Req.argv[0] = Client_ID(Client); Req.argv[0] = Client_ID(Client);

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,15 +16,13 @@
* Wildcard pattern matching * Wildcard pattern matching
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "exp.h"
#include "match.h"
#include "defines.h" #include "defines.h"
#include "tool.h" #include "tool.h"
#include "match.h"
/* /*
* The pattern matching functions [Matche(), Matche_After_Star()] are based * The pattern matching functions [Matche(), Matche_After_Star()] are based
@@ -32,11 +30,9 @@
* "public domain": <http://c.snippets.org/snip_lister.php?fname=match.c> * "public domain": <http://c.snippets.org/snip_lister.php?fname=match.c>
*/ */
static int Matche PARAMS(( const char *p, const char *t )); static int Matche PARAMS(( const char *p, const char *t ));
static int Matche_After_Star PARAMS(( const char *p, const char *t )); static int Matche_After_Star PARAMS(( const char *p, const char *t ));
#define MATCH_PATTERN 6 /**< bad pattern */ #define MATCH_PATTERN 6 /**< bad pattern */
#define MATCH_LITERAL 5 /**< match failure on literal match */ #define MATCH_LITERAL 5 /**< match failure on literal match */
#define MATCH_RANGE 4 /**< match failure on [..] construct */ #define MATCH_RANGE 4 /**< match failure on [..] construct */
@@ -44,7 +40,6 @@ static int Matche_After_Star PARAMS(( const char *p, const char *t ));
#define MATCH_END 2 /**< premature end of pattern string */ #define MATCH_END 2 /**< premature end of pattern string */
#define MATCH_VALID 1 /**< valid match */ #define MATCH_VALID 1 /**< valid match */
/** /**
* Match string with pattern. * Match string with pattern.
* *
@@ -55,11 +50,12 @@ static int Matche_After_Star PARAMS(( const char *p, const char *t ));
GLOBAL bool GLOBAL bool
Match( const char *Pattern, const char *String ) Match( const char *Pattern, const char *String )
{ {
if( Matche( Pattern, String ) == MATCH_VALID ) return true; if (Matche(Pattern, String) == MATCH_VALID)
else return false; return true;
else
return false;
} /* Match */ } /* Match */
/** /**
* Match string with pattern case-insensitive. * Match string with pattern case-insensitive.
* *
@@ -70,12 +66,13 @@ Match( const char *Pattern, const char *String )
GLOBAL bool GLOBAL bool
MatchCaseInsensitive(const char *Pattern, const char *String) MatchCaseInsensitive(const char *Pattern, const char *String)
{ {
char haystack[COMMAND_LEN]; char needle[COMMAND_LEN], haystack[COMMAND_LEN];
strlcpy(needle, Pattern, sizeof(needle));
strlcpy(haystack, String, sizeof(haystack)); strlcpy(haystack, String, sizeof(haystack));
return Match(Pattern, ngt_LowerStr(haystack));
} /* MatchCaseInsensitive */
return Match(ngt_LowerStr(needle), ngt_LowerStr(haystack));
} /* MatchCaseInsensitive */
/** /**
* Match string with pattern case-insensitive. * Match string with pattern case-insensitive.
@@ -89,31 +86,23 @@ GLOBAL bool
MatchCaseInsensitiveList(const char *Pattern, const char *String, MatchCaseInsensitiveList(const char *Pattern, const char *String,
const char *Separator) const char *Separator)
{ {
char tmp_pattern[COMMAND_LEN], haystack[COMMAND_LEN], *ptr; char tmp_pattern[COMMAND_LEN], *ptr;
strlcpy(tmp_pattern, Pattern, sizeof(tmp_pattern)); strlcpy(tmp_pattern, Pattern, sizeof(tmp_pattern));
strlcpy(haystack, String, sizeof(haystack));
ngt_LowerStr(haystack);
ptr = strtok(tmp_pattern, Separator); ptr = strtok(tmp_pattern, Separator);
while (ptr) { while (ptr) {
ngt_TrimStr(ptr); ngt_TrimStr(ptr);
if (Match(ptr, haystack)) if (MatchCaseInsensitive(ptr, String))
return true; return true;
ptr = strtok(NULL, Separator); ptr = strtok(NULL, Separator);
} }
return false; return false;
} /* MatchCaseInsensitive */ } /* MatchCaseInsensitive */
static int static int
Matche( const char *p, const char *t ) Matche( const char *p, const char *t )
{ {
register char range_start, range_end;
bool invert;
bool member_match;
bool loop;
for( ; *p; p++, t++ ) for( ; *p; p++, t++ )
{ {
/* if this is the end of the text then this is the end of the match */ /* if this is the end of the text then this is the end of the match */
@@ -131,118 +120,7 @@ Matche( const char *p, const char *t )
case '*': /* multiple any character match */ case '*': /* multiple any character match */
return Matche_After_Star( p, t ); return Matche_After_Star( p, t );
case '[': /* [..] construct, single member/exclusion character match */ default: /* must match this character exactly */
/* move to beginning of range */
p++;
/* check if this is a member match or exclusion match */
invert = false;
if( *p == '!' || *p == '^' )
{
invert = true;
p++;
}
/* if closing bracket here or at range start then we have a malformed pattern */
if ( *p == ']' ) return MATCH_PATTERN;
member_match = false;
loop = true;
while( loop )
{
/* if end of construct then loop is done */
if( *p == ']' )
{
loop = false;
continue;
}
/* matching a '!', '^', '-', '\' or a ']' */
if( *p == '\\' ) range_start = range_end = *++p;
else range_start = range_end = *p;
/* if end of pattern then bad pattern (Missing ']') */
if( ! *p ) return MATCH_PATTERN;
/* check for range bar */
if( *++p == '-' )
{
/* get the range end */
range_end = *++p;
/* if end of pattern or construct then bad pattern */
if( range_end == '\0' || range_end == ']' ) return MATCH_PATTERN;
/* special character range end */
if( range_end == '\\' )
{
range_end = *++p;
/* if end of text then we have a bad pattern */
if ( ! range_end ) return MATCH_PATTERN;
}
/* move just beyond this range */
p++;
}
/* if the text character is in range then match found. make sure the range
* letters have the proper relationship to one another before comparison */
if( range_start < range_end )
{
if( *t >= range_start && *t <= range_end )
{
member_match = true;
loop = false;
}
}
else
{
if( *t >= range_end && *t <= range_start )
{
member_match = true;
loop = false;
}
}
}
/* if there was a match in an exclusion set then no match */
/* if there was no match in a member set then no match */
if(( invert && member_match ) || ! ( invert || member_match )) return MATCH_RANGE;
/* if this is not an exclusion then skip the rest of the [...]
* construct that already matched. */
if( member_match )
{
while( *p != ']' )
{
/* bad pattern (Missing ']') */
if( ! *p ) return MATCH_PATTERN;
/* skip exact match */
if( *p == '\\' )
{
p++;
/* if end of text then we have a bad pattern */
if( ! *p ) return MATCH_PATTERN;
}
/* move to next pattern char */
p++;
}
}
break;
case '\\': /* next character is quoted and must match exactly */
/* move pattern pointer to quoted char and fall through */
p++;
/* if end of text then we have a bad pattern */
if( ! *p ) return MATCH_PATTERN;
/* must match this character exactly */
default:
if( *p != *t ) return MATCH_LITERAL; if( *p != *t ) return MATCH_LITERAL;
} }
} }
@@ -252,7 +130,6 @@ Matche( const char *p, const char *t )
else return MATCH_VALID; else return MATCH_VALID;
} /* Matche */ } /* Matche */
static int static int
Matche_After_Star( const char *p, const char *t ) Matche_After_Star( const char *p, const char *t )
{ {
@@ -302,5 +179,4 @@ Matche_After_Star( const char *p, const char *t )
return match; return match;
} /* Matche_After_Star */ } /* Matche_After_Star */
/* -eof- */ /* -eof- */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)" #define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s" #define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s" #define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_ISUPPORTNET_MSG "005 %s NETWORK=%s :is my network name"
#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=%s CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=%s:%d :are supported on this server" #define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=%s CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=%s:%d :are supported on this server"
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server" #define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"
@@ -66,18 +67,20 @@
#define RPL_WHOISIDLE_MSG "317 %s %s %lu %lu :seconds idle, signon time" #define RPL_WHOISIDLE_MSG "317 %s %s %lu %lu :seconds idle, signon time"
#define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list" #define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
#define RPL_WHOISCHANNELS_MSG "319 %s %s :" #define RPL_WHOISCHANNELS_MSG "319 %s %s :"
#define RPL_LISTSTART_MSG "321 %s Channel :Users Name"
#define RPL_LIST_MSG "322 %s %s %ld :%s" #define RPL_LIST_MSG "322 %s %s %ld :%s"
#define RPL_LISTEND_MSG "323 %s :End of LIST" #define RPL_LISTEND_MSG "323 %s :End of LIST"
#define RPL_CHANNELMODEIS_MSG "324 %s %s +%s" #define RPL_CHANNELMODEIS_MSG "324 %s %s +%s"
#define RPL_CREATIONTIME_MSG "329 %s %s %ld" #define RPL_CREATIONTIME_MSG "329 %s %s %ld"
#define RPL_WHOISLOGGEDIN_MSG "330 %s %s %s :is logged in as"
#define RPL_NOTOPIC_MSG "331 %s %s :No topic is set" #define RPL_NOTOPIC_MSG "331 %s %s :No topic is set"
#define RPL_TOPIC_MSG "332 %s %s :%s" #define RPL_TOPIC_MSG "332 %s %s :%s"
#define RPL_TOPICSETBY_MSG "333 %s %s %s %u" #define RPL_TOPICSETBY_MSG "333 %s %s %s %u"
#define RPL_WHOISBOT_MSG "335 %s %s :is a IRC Bot" #define RPL_WHOISBOT_MSG "335 %s %s :is an IRC Bot"
#define RPL_INVITING_MSG "341 %s %s %s%s" #define RPL_INVITING_MSG "341 %s %s %s%s"
#define RPL_INVITELIST_MSG "346 %s %s %s" #define RPL_INVITELIST_MSG "346 %s %s %s %s %d"
#define RPL_ENDOFINVITELIST_MSG "347 %s %s :End of channel invite list" #define RPL_ENDOFINVITELIST_MSG "347 %s %s :End of channel invite list"
#define RPL_EXCEPTLIST_MSG "348 %s %s %s" #define RPL_EXCEPTLIST_MSG "348 %s %s %s %s %d"
#define RPL_ENDOFEXCEPTLIST_MSG "349 %s %s :End of channel exception list" #define RPL_ENDOFEXCEPTLIST_MSG "349 %s %s :End of channel exception list"
#define RPL_VERSION_MSG "351 %s %s-%s.%s %s :%s" #define RPL_VERSION_MSG "351 %s %s-%s.%s %s :%s"
#define RPL_WHOREPLY_MSG "352 %s %s %s %s %s %s %s :%d %s" #define RPL_WHOREPLY_MSG "352 %s %s %s %s %s %s %s :%d %s"
@@ -85,7 +88,7 @@
#define RPL_LINKS_MSG "364 %s %s %s :%d %s" #define RPL_LINKS_MSG "364 %s %s %s :%d %s"
#define RPL_ENDOFLINKS_MSG "365 %s %s :End of LINKS list" #define RPL_ENDOFLINKS_MSG "365 %s %s :End of LINKS list"
#define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list" #define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list"
#define RPL_BANLIST_MSG "367 %s %s %s" #define RPL_BANLIST_MSG "367 %s %s %s %s %d"
#define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list" #define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list"
#define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list" #define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list"
#define RPL_INFO_MSG "371 %s :%s" #define RPL_INFO_MSG "371 %s :%s"
@@ -107,11 +110,12 @@
#define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel" #define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel"
#define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels" #define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels"
#define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname" #define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname"
#define ERR_TOOMANYTARGETS_MSG "407 %s :Too many recipients"
#define ERR_NOORIGIN_MSG "409 %s :No origin specified" #define ERR_NOORIGIN_MSG "409 %s :No origin specified"
#define ERR_INVALIDCAP_MSG "410 %s %s :Invalid CAP subcommand" #define ERR_INVALIDCAP_MSG "410 %s %s :Invalid CAP subcommand"
#define ERR_NORECIPIENT_MSG "411 %s :No recipient given (%s)" #define ERR_NORECIPIENT_MSG "411 %s :No recipient given (%s)"
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send" #define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
#define ERR_WILDTOPLEVEL "414 %s :Wildcard in toplevel domain" #define ERR_WILDTOPLEVEL_MSG "414 %s :Wildcard in toplevel domain"
#define ERR_UNKNOWNCOMMAND_MSG "421 %s %s :Unknown command" #define ERR_UNKNOWNCOMMAND_MSG "421 %s %s :Unknown command"
#define ERR_NOMOTD_MSG "422 %s :MOTD file is missing" #define ERR_NOMOTD_MSG "422 %s :MOTD file is missing"
#define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given" #define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given"
@@ -124,6 +128,7 @@
#define ERR_USERONCHANNEL_MSG "443 %s %s %s :is already on channel" #define ERR_USERONCHANNEL_MSG "443 %s %s %s :is already on channel"
#define ERR_SUMMONDISABLED_MSG "445 %s :SUMMON has been disabled" #define ERR_SUMMONDISABLED_MSG "445 %s :SUMMON has been disabled"
#define ERR_USERSDISABLED_MSG "446 %s :USERS has been disabled" #define ERR_USERSDISABLED_MSG "446 %s :USERS has been disabled"
#define ERR_NONICKCHANGE_MSG "447 %s :Cannot change nickname while on %s(+N)"
#define ERR_NOTREGISTERED_MSG "451 %s :Connection not registered" #define ERR_NOTREGISTERED_MSG "451 %s :Connection not registered"
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link" #define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error" #define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"
@@ -139,7 +144,7 @@
#define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k) -- Wrong channel key" #define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k) -- Wrong channel key"
#define ERR_NOCHANMODES_MSG "477 %s %s :Channel doesn't support modes" #define ERR_NOCHANMODES_MSG "477 %s %s :Channel doesn't support modes"
#define ERR_NEEDREGGEDNICK_MSG "477 %s %s :Cannot send to channel (+M) -- You need to be identified to a registered account to message this channel" #define ERR_NEEDREGGEDNICK_MSG "477 %s %s :Cannot send to channel (+M) -- You need to be identified to a registered account to message this channel"
#define ERR_LISTFULL_MSG "478 %s %s %s: Channel list is full (%d)" #define ERR_LISTFULL_MSG "478 %s %s %s :Channel list is full (%d)"
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
#define ERR_CHANOPPRIVTOOLOW_MSG "482 %s %s :Your privileges are too low" #define ERR_CHANOPPRIVTOOLOW_MSG "482 %s %s :Your privileges are too low"
@@ -154,6 +159,7 @@
#define ERR_UMODEUNKNOWNFLAG_MSG "501 %s :Unknown mode" #define ERR_UMODEUNKNOWNFLAG_MSG "501 %s :Unknown mode"
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\"" #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
#define ERR_USERNOTONSERV_MSG "504 %s %s :User is not on this server"
#define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)" #define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)"
#ifdef ZLIB #ifdef ZLIB

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -17,12 +17,10 @@
* by the loader of the operating system. * by the loader of the operating system.
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
@@ -36,23 +34,16 @@
#include <mcheck.h> #include <mcheck.h>
#endif #endif
#include "defines.h"
#include "conn.h" #include "conn.h"
#include "class.h" #include "class.h"
#include "conf-ssl.h"
#include "channel.h" #include "channel.h"
#include "conf.h" #include "conf.h"
#include "lists.h"
#include "log.h" #include "log.h"
#include "parse.h"
#include "sighandlers.h" #include "sighandlers.h"
#include "io.h" #include "io.h"
#include "irc.h"
#include "exp.h"
#include "ngircd.h" #include "ngircd.h"
static void Show_Version PARAMS(( void )); static void Show_Version PARAMS(( void ));
static void Show_Help PARAMS(( void )); static void Show_Help PARAMS(( void ));
@@ -460,7 +451,7 @@ static void
Show_Version( void ) Show_Version( void )
{ {
puts( NGIRCd_Version ); puts( NGIRCd_Version );
puts( "Copyright (c)2001-2013 Alexander Barton (<alex@barton.de>) and Contributors." ); puts( "Copyright (c)2001-2016 Alexander Barton (<alex@barton.de>) and Contributors." );
puts( "Homepage: <http://ngircd.barton.de/>\n" ); puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" ); puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ); puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -539,7 +530,7 @@ Pidfile_Create(pid_t pid)
close(pidfd); close(pidfd);
return; return;
} }
if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len) if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
Log(LOG_ERR, "Can't write PID file (%s): %s!", Conf_PidFile, Log(LOG_ERR, "Can't write PID file (%s): %s!", Conf_PidFile,
strerror(errno)); strerror(errno));
@@ -730,9 +721,10 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
Log(LOG_ERR, "Can't change group ID to %s(%u): %s!", Log(LOG_ERR, "Can't change group ID to %s(%u): %s!",
grp ? grp->gr_name : "?", Conf_GID, grp ? grp->gr_name : "?", Conf_GID,
strerror(real_errno)); strerror(real_errno));
if (real_errno != EPERM) if (real_errno != EPERM)
goto out; goto out;
} }
#ifdef HAVE_SETGROUPS
if (setgroups(0, NULL) != 0) { if (setgroups(0, NULL) != 0) {
real_errno = errno; real_errno = errno;
Log(LOG_ERR, "Can't drop supplementary group IDs: %s!", Log(LOG_ERR, "Can't drop supplementary group IDs: %s!",
@@ -740,6 +732,10 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
if (real_errno != EPERM) if (real_errno != EPERM)
goto out; goto out;
} }
#else
Log(LOG_WARNING,
"Can't drop supplementary group IDs: setgroups(3) missing!");
#endif
} }
#endif #endif

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de) * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,29 +16,23 @@
* Handlers for IRC numerics sent to the server * Handlers for IRC numerics sent to the server
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include "defines.h"
#include "conn.h"
#include "conf.h"
#include "conn.h"
#include "conn-func.h" #include "conn-func.h"
#include "conf.h"
#include "channel.h" #include "channel.h"
#include "class.h" #include "class.h"
#include "irc-write.h" #include "irc-write.h"
#include "lists.h" #include "lists.h"
#include "log.h" #include "log.h"
#include "messages.h"
#include "parse.h" #include "parse.h"
#include "exp.h"
#include "numeric.h" #include "numeric.h"
/** /**
* Announce a channel and its users in the network. * Announce a channel and its users in the network.
*/ */
@@ -117,7 +111,6 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
return CONNECTED; return CONNECTED;
} /* Announce_Channel */ } /* Announce_Channel */
/** /**
* Announce new server in the network * Announce new server in the network
* @param Client New server * @param Client New server
@@ -149,11 +142,30 @@ Announce_Server(CLIENT * Client, CLIENT * Server)
Client_MyToken(Server), Client_Info(Server)); Client_MyToken(Server), Client_Info(Server));
} /* Announce_Server */ } /* Announce_Server */
#ifdef IRCPLUS #ifdef IRCPLUS
/** /**
* Synchronize invite, ban, G- and K-Line lists between servers. * Send a specific list to a remote server.
*/
static bool
Send_List(CLIENT *Client, CHANNEL *Chan, struct list_head *Head, char Type)
{
struct list_elem *elem;
elem = Lists_GetFirst(Head);
while (elem) {
if (!IRC_WriteStrClient(Client, "MODE %s +%c %s",
Channel_Name(Chan), Type,
Lists_GetMask(elem))) {
return DISCONNECTED;
}
elem = Lists_GetNext(elem);
}
return CONNECTED;
}
/**
* Synchronize invite, ban, except, and G-Line lists between servers.
* *
* @param Client New server. * @param Client New server.
* @return CONNECTED or DISCONNECTED. * @return CONNECTED or DISCONNECTED.
@@ -164,6 +176,7 @@ Synchronize_Lists(CLIENT * Client)
CHANNEL *c; CHANNEL *c;
struct list_head *head; struct list_head *head;
struct list_elem *elem; struct list_elem *elem;
time_t t;
assert(Client != NULL); assert(Client != NULL);
@@ -171,9 +184,10 @@ Synchronize_Lists(CLIENT * Client)
head = Class_GetList(CLASS_GLINE); head = Class_GetList(CLASS_GLINE);
elem = Lists_GetFirst(head); elem = Lists_GetFirst(head);
while (elem) { while (elem) {
t = Lists_GetValidity(elem) - time(NULL);
if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s", if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
Lists_GetMask(elem), Lists_GetMask(elem),
Lists_GetValidity(elem) - time(NULL), t > 0 ? (long)t : 0,
Lists_GetReason(elem))) Lists_GetReason(elem)))
return DISCONNECTED; return DISCONNECTED;
elem = Lists_GetNext(elem); elem = Lists_GetNext(elem);
@@ -181,36 +195,17 @@ Synchronize_Lists(CLIENT * Client)
c = Channel_First(); c = Channel_First();
while (c) { while (c) {
/* ban list */ if (!Send_List(Client, c, Channel_GetListExcepts(c), 'e'))
head = Channel_GetListBans(c); return DISCONNECTED;
elem = Lists_GetFirst(head); if (!Send_List(Client, c, Channel_GetListBans(c), 'b'))
while (elem) { return DISCONNECTED;
if (!IRC_WriteStrClient(Client, "MODE %s +b %s", if (!Send_List(Client, c, Channel_GetListInvites(c), 'I'))
Channel_Name(c), return DISCONNECTED;
Lists_GetMask(elem))) {
return DISCONNECTED;
}
elem = Lists_GetNext(elem);
}
/* invite list */
head = Channel_GetListInvites(c);
elem = Lists_GetFirst(head);
while (elem) {
if (!IRC_WriteStrClient(Client, "MODE %s +I %s",
Channel_Name(c),
Lists_GetMask(elem))) {
return DISCONNECTED;
}
elem = Lists_GetNext(elem);
}
c = Channel_Next(c); c = Channel_Next(c);
} }
return CONNECTED; return CONNECTED;
} }
/** /**
* Send CHANINFO commands to a new server (inform it about existing channels). * Send CHANINFO commands to a new server (inform it about existing channels).
* @param Client New server * @param Client New server
@@ -223,7 +218,8 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan)
bool has_k, has_l; bool has_k, has_l;
#ifdef DEBUG #ifdef DEBUG
Log(LOG_DEBUG, "Sending CHANINFO commands ..."); Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...",
Channel_Name(Chan));
#endif #endif
modes = Channel_Modes(Chan); modes = Channel_Modes(Chan);
@@ -255,7 +251,6 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan)
#endif /* IRCPLUS */ #endif /* IRCPLUS */
/** /**
* Handle ENDOFMOTD (376) numeric and login remote server. * Handle ENDOFMOTD (376) numeric and login remote server.
* The peer is either an IRC server (no IRC+ protocol), or we got the * The peer is either an IRC server (no IRC+ protocol), or we got the
@@ -349,7 +344,6 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req)
return CONNECTED; return CONNECTED;
} /* IRC_Num_ENDOFMOTD */ } /* IRC_Num_ENDOFMOTD */
/** /**
* Handle ISUPPORT (005) numeric. * Handle ISUPPORT (005) numeric.
*/ */
@@ -385,5 +379,4 @@ IRC_Num_ISUPPORT(CLIENT * Client, REQUEST * Req)
return CONNECTED; return CONNECTED;
} /* IRC_Num_ISUPPORT */ } /* IRC_Num_ISUPPORT */
/* -eof- */ /* -eof- */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,9 +16,7 @@
* IRC operator functions * IRC operator functions
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <string.h>
#include "conn.h" #include "conn.h"
#include "channel.h" #include "channel.h"
@@ -28,10 +26,8 @@
#include "messages.h" #include "messages.h"
#include "irc-write.h" #include "irc-write.h"
#include <exp.h>
#include "op.h" #include "op.h"
/** /**
* Return and log a "no privileges" message. * Return and log a "no privileges" message.
*/ */
@@ -44,19 +40,20 @@ Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
from = Client_Search(Req->prefix); from = Client_Search(Req->prefix);
if (from) { if (from) {
Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"", Log(LOG_ERR|LOG_snotice,
"No privileges: client \"%s\" (%s), command \"%s\"!",
Req->prefix, Client_Mask(Client), Req->command); Req->prefix, Client_Mask(Client), Req->command);
return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG, return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
Client_ID(from)); Client_ID(from));
} else { } else {
Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"", Log(LOG_ERR|LOG_snotice,
"No privileges: client \"%s\", command \"%s\"!",
Client_Mask(Client), Req->command); Client_Mask(Client), Req->command);
return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG, return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
Client_ID(Client)); Client_ID(Client));
} }
} /* Op_NoPrivileges */ } /* Op_NoPrivileges */
/** /**
* Check that the originator of a request is an IRC operator and allowed * Check that the originator of a request is an IRC operator and allowed
* to administer this server. * to administer this server.
@@ -94,5 +91,4 @@ Op_Check(CLIENT * Client, REQUEST * Req)
return c; return c;
} /* Op_Check */ } /* Op_Check */
/* -eof- */ /* -eof- */

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de). * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,26 +18,22 @@
* PAM User Authentication * PAM User Authentication
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SECURITY_PAM_APPL_H
# include <security/pam_appl.h>
#endif
#ifdef HAVE_PAM_PAM_APPL_H
# include <pam/pam_appl.h>
#endif
#include "defines.h" #include "defines.h"
#include "log.h" #include "log.h"
#include "conn.h" #include "conn.h"
#include "client.h" #include "client.h"
#include "conf.h"
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SECURITY_PAM_APPL_H
#include <security/pam_appl.h>
#endif
#ifdef HAVE_PAM_PAM_APPL_H
#include <pam/pam_appl.h>
#endif
#include "exp.h"
#include "pam.h" #include "pam.h"
static char *password; static char *password;
@@ -87,7 +83,7 @@ static struct pam_conv conv = {
}; };
/** /**
* Authenticate a connectiong client using PAM. * Authenticate a connecting client using PAM.
* @param Client The client to authenticate. * @param Client The client to authenticate.
* @return true when authentication succeeded, false otherwise. * @return true when authentication succeeded, false otherwise.
*/ */
@@ -106,7 +102,7 @@ PAM_Authenticate(CLIENT *Client) {
conv.appdata_ptr = Conn_Password(Client_Conn(Client)); conv.appdata_ptr = Conn_Password(Client_Conn(Client));
/* Initialize PAM */ /* Initialize PAM */
retval = pam_start("ngircd", Client_OrigUser(Client), &conv, &pam); retval = pam_start(Conf_PAMServiceName, Client_OrigUser(Client), &conv, &pam);
if (retval != PAM_SUCCESS) { if (retval != PAM_SUCCESS) {
Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval); Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval);
return false; return false;

View File

@@ -1,6 +1,6 @@
/* /*
* ngIRCd -- The Next Generation IRC Daemon * ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors. * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -16,29 +16,26 @@
* IRC command parser and validator. * IRC command parser and validator.
*/ */
#include "imp.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include "ngircd.h" #include "ngircd.h"
#include "defines.h"
#include "conn-func.h" #include "conn-func.h"
#include "conf.h"
#include "channel.h" #include "channel.h"
#include "log.h" #include "log.h"
#include "messages.h" #include "messages.h"
#include "tool.h"
#include "exp.h"
#include "parse.h" #include "parse.h"
#include "imp.h"
#include "irc.h" #include "irc.h"
#include "irc-cap.h" #include "irc-cap.h"
#include "irc-channel.h" #include "irc-channel.h"
#include "irc-encoding.h" #ifdef ICONV
# include "irc-encoding.h"
#endif
#include "irc-info.h" #include "irc-info.h"
#include "irc-login.h" #include "irc-login.h"
#include "irc-metadata.h" #include "irc-metadata.h"
@@ -49,9 +46,6 @@
#include "irc-write.h" #include "irc-write.h"
#include "numeric.h" #include "numeric.h"
#include "exp.h"
#include "conf.h"
struct _NUMERIC { struct _NUMERIC {
int numeric; int numeric;
bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request ));
@@ -60,78 +54,81 @@ struct _NUMERIC {
static COMMAND My_Commands[] = static COMMAND My_Commands[] =
{ {
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, #define _CMD(name, func, type, min, max, penalty) \
{ "AWAY", IRC_AWAY, CLIENT_USER, 0, 1, 0, 0, 0 }, { (name), (func), (type), (min), (max), (penalty), 0, 0, 0 }
{ "CAP", IRC_CAP, CLIENT_ANY, 1, 2, 0, 0, 0 }, _CMD("ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
{ "CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("AWAY", IRC_AWAY, CLIENT_USER, 0, 1, 0),
_CMD("CAP", IRC_CAP, CLIENT_ANY, 1, 2, 0),
_CMD("CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
#ifdef STRICT_RFC #ifdef STRICT_RFC
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0, 0, 0 }, _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 0, 0),
#else #else
{ "DIE", IRC_DIE, CLIENT_USER, 0, 1, 0, 0, 0 }, _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 1, 0),
#endif #endif
{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1, 0, 0, 0 }, _CMD("DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1, 0),
{ "ERROR", IRC_ERROR, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("ERROR", IRC_ERROR, CLIENT_ANY, 0, -1, 0),
{ "GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
{ "HELP", IRC_HELP, CLIENT_USER, 0, 1, 0, 0, 0 }, _CMD("HELP", IRC_HELP, CLIENT_USER, 0, 1, 2),
{ "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, _CMD("INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 2),
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 1),
{ "ISON", IRC_ISON, CLIENT_USER, 1, -1, 0, 0, 0 }, _CMD("ISON", IRC_ISON, CLIENT_USER, 1, -1, 0),
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, _CMD("JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0, 0, 0 }, _CMD("KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0),
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, _CMD("KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
{ "KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
{ "METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3, 0, 0, 0 }, _CMD("METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3, 0),
{ "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1, 0, 0, 0 }, _CMD("MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1, 1),
{ "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, _CMD("MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
{ "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
{ "NICK", IRC_NICK, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("NICK", IRC_NICK, CLIENT_ANY, 0, -1, 0),
{ "NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2, 0, 0, 0 }, _CMD("NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2, 0),
{ "NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1, 0),
{ "OPER", IRC_OPER, CLIENT_USER, 2, 2, 0, 0, 0 }, _CMD("OPER", IRC_OPER, CLIENT_USER, 2, 2, 0),
{ "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, _CMD("PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
{ "PASS", IRC_PASS, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("PASS", IRC_PASS, CLIENT_ANY, 0, -1, 0),
{ "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
{ "PONG", IRC_PONG, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("PONG", IRC_PONG, CLIENT_ANY, 0, -1, 0),
{ "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
{ "QUIT", IRC_QUIT, CLIENT_ANY, 0, 1, 0, 0, 0 }, _CMD("QUIT", IRC_QUIT, CLIENT_ANY, 0, 1, 0),
{ "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0, 0, 0 }, _CMD("REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0),
{ "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0, 0, 0 }, _CMD("RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0),
{ "SERVER", IRC_SERVER, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("SERVER", IRC_SERVER, CLIENT_ANY, 0, -1, 0),
{ "SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6, 0, 0, 0 }, _CMD("SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6, 0),
{ "SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2, 0, 0, 0 }, _CMD("SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2, 1),
{ "SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
{ "SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2, 0, 0, 0 }, _CMD("SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2, 0, 0, 0 }, _CMD("STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
{ "SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2, 0, 0, 0 }, _CMD("SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2, 0),
{ "SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, _CMD("TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2, 0, 0, 0 }, _CMD("TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2, 1),
{ "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, _CMD("TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
{ "USER", IRC_USER, CLIENT_ANY, 0, -1, 0, 0, 0 }, _CMD("USER", IRC_USER, CLIENT_ANY, 0, -1, 0),
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1, 0, 0, 0 }, _CMD("USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1, 1),
{ "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1, 0, 0, 0 }, _CMD("VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
{ "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1, 0, 0, 0 }, _CMD("WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1, 0),
{ "WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4, 0, 0, 0 }, _CMD("WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4, 0),
{ "WHO", IRC_WHO, CLIENT_USER, 0, 2, 0, 0, 0 }, _CMD("WHO", IRC_WHO, CLIENT_USER, 0, 2, 1),
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1, 1),
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
#ifdef IRCPLUS #ifdef IRCPLUS
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1, 0, 0, 0 }, _CMD("CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1, 0),
# ifdef ICONV # ifdef ICONV
{ "CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1, 0, 0, 0 }, _CMD("CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1, 0),
# endif # endif
#endif #endif
#ifndef STRICT_RFC #ifndef STRICT_RFC
{ "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0, 0, 0 }, _CMD("GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
{ "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0, 0, 0 }, _CMD("POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
#endif #endif
{ NULL, NULL, 0x0, 0, 0, 0, 0, 0 } /* End-Mark */ _CMD(NULL, NULL, 0, 0, 0, 0) /* End-Mark */
#undef _CMD
}; };
static void Init_Request PARAMS(( REQUEST *Req )); static void Init_Request PARAMS(( REQUEST *Req ));
@@ -159,7 +156,7 @@ Parse_GetCommandStruct( void )
/** /**
* Parse a command ("request") received from a client. * Parse a command ("request") received from a client.
* *
* This function is called after the connection layer received a valid CR+LF * This function is called after the connection layer received a valid CR+LF
* terminated line of text: we assume that this is a valid IRC command and * terminated line of text: we assume that this is a valid IRC command and
* try to do something useful with it :-) * try to do something useful with it :-)
@@ -345,7 +342,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
/* check if the client named in the prefix is expected /* check if the client named in the prefix is expected
* to come from that direction */ * to come from that direction */
if (Client_NextHop(c) != client) { if (Client_NextHop(c) != client) {
if (Client_Type(c) != CLIENT_SERVER) { if (Client_Type(client) != CLIENT_SERVER) {
Log(LOG_ERR, Log(LOG_ERR,
"Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!", "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!",
Req->prefix, Client_ID(client), Idx, Req->command); Req->prefix, Client_ID(client), Idx, Req->command);
@@ -464,10 +461,10 @@ Handle_Numeric(CLIENT *client, REQUEST *Req)
} }
/* Determine source */ /* Determine source */
if (! Req->prefix[0]) { if (!Req->prefix) {
/* Oops, no prefix!? */ Log(LOG_WARNING,
Log(LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", "Got status code %s from \"%s\" without prefix!?",
Req->command, Client_ID(client)); Req->command, Client_ID(client));
return true; return true;
} }
@@ -530,12 +527,13 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
Client_ID(client)); Client_ID(client));
} }
if (cmd->penalty)
IRC_SetPenalty(client, cmd->penalty);
if (Req->argc < cmd->min_argc || if (Req->argc < cmd->min_argc ||
(cmd->max_argc != -1 && Req->argc > cmd->max_argc)) { (cmd->max_argc != -1 && Req->argc > cmd->max_argc))
IRC_SetPenalty(client, 2); return IRC_WriteErrClient(client, ERR_NEEDMOREPARAMS_MSG,
return IRC_WriteStrClient(client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(client), Req->command); Client_ID(client), Req->command);
}
/* Command is allowed for this client: call it and count /* Command is allowed for this client: call it and count
* generated bytes in output */ * generated bytes in output */

View File

@@ -37,6 +37,7 @@ typedef struct _COMMAND
CLIENT_TYPE type; /**< Valid client types (bit mask) */ CLIENT_TYPE type; /**< Valid client types (bit mask) */
int min_argc; /**< Min parameters */ int min_argc; /**< Min parameters */
int max_argc; /**< Max parameters */ int max_argc; /**< Max parameters */
int penalty; /**< Penalty for this command */
long lcount, rcount; /**< Number of local and remote calls */ long lcount, rcount; /**< Number of local and remote calls */
long bytes; /**< Number of bytes created */ long bytes; /**< Number of bytes created */
} COMMAND; } COMMAND;

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