mirror of
https://github.com/osmarks/ngircd.git
synced 2026-05-05 05:11:24 +00:00
Compare commits
34 Commits
rel-0-12-0
...
rel-0-12-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62b668a7b1 | ||
|
|
ecddfb7010 | ||
|
|
fb46757c48 | ||
|
|
b6b019dddc | ||
|
|
ce3215acaf | ||
|
|
edb59b8317 | ||
|
|
42207d160b | ||
|
|
a3dc42534b | ||
|
|
bb81927ce4 | ||
|
|
b2c0a89f45 | ||
|
|
f44007f42f | ||
|
|
1a56c77751 | ||
|
|
78257374f0 | ||
|
|
fc93044909 | ||
|
|
2e0c62df91 | ||
|
|
c5ba599140 | ||
|
|
afc67ff323 | ||
|
|
6cfc56064e | ||
|
|
4a81367dac | ||
|
|
8c425945a2 | ||
|
|
bb6ee46892 | ||
|
|
6052d04c60 | ||
|
|
9194319399 | ||
|
|
32bf6d4de0 | ||
|
|
33b1204349 | ||
|
|
09968ee843 | ||
|
|
523a6fad09 | ||
|
|
54b17fc201 | ||
|
|
25f48a2a34 | ||
|
|
22fa782be7 | ||
|
|
b187fac244 | ||
|
|
6e9389b86c | ||
|
|
2f6d7a649c | ||
|
|
7df90846e1 |
34
ChangeLog
34
ChangeLog
@@ -10,8 +10,36 @@
|
||||
-- ChangeLog --
|
||||
|
||||
|
||||
ngIRCd 0.12.0-pre1 (2008-04-20)
|
||||
ngIRCd 0.12.1 (2008-07-09)
|
||||
|
||||
- Allow mixed line terminations (CR+LF/CR/LF) in non-RFC-compliant mode
|
||||
- Don't allow stray \r or \n in command parameters
|
||||
- --configtest: return non-zero exit code if there are errors
|
||||
- Update ngIRCd manual pages
|
||||
- Add option aliases -V (for --version) and -h (for --help).
|
||||
- Fix 'no-ipv6' compile error.
|
||||
- Make Listen parameter a comma-seperated list of addresses. This also
|
||||
obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
|
||||
is treated as Listen="::,0.0.0.0".
|
||||
Note: ListenIPv4 and ListenIPv6 options are still recognized,
|
||||
but ngircd will print a warning if they are used in the config file.
|
||||
|
||||
ngIRCd 0.12.0 (2008-05-13)
|
||||
|
||||
- Fix Bug: 85: "WHO #SecretChannel" that user is not a member of now returns
|
||||
proper RPL_ENDOFWHO_MSG instead of nothing. (Ali Shemiran)
|
||||
- Fix complie on FreeBSD 5.4 and AIX.
|
||||
- If bind() fails, also print ip address and not just the port number.
|
||||
|
||||
ngIRCd 0.12.0-pre2 (2008-04-29)
|
||||
- IPv6: Add config options to disabe ipv4/ipv6 support.
|
||||
- Don't include doc/CVS.txt in distribution archive, use doc/GIT.txt now!
|
||||
- Documentation: get rid of some more references to CVS, switch to GIT.
|
||||
- Get rid of cvs-version.* and CVSDATE definition.
|
||||
- Report ERR_NOTONCHANNEL when trying to part a channel one is not member of.
|
||||
- Testsuite: remove erroneous ConfUID setting in config file.
|
||||
|
||||
ngIRCd 0.12.0-pre1 (2008-04-20)
|
||||
- Include Mac OS X Xcode project in distribution archives.
|
||||
- Do not exit on SIGHUP or /REHASH if the config file cannot opened.
|
||||
- Add IPv6 support.
|
||||
@@ -758,7 +786,3 @@ ngIRCd 0.0.2, 06.01.2002
|
||||
ngIRCd 0.0.1, 31.12.2001
|
||||
|
||||
- erste oeffentliche Version von ngIRCd als "public preview" :-)
|
||||
|
||||
|
||||
--
|
||||
$Id: ChangeLog,v 1.345 2008/03/18 20:12:47 fw Exp $
|
||||
|
||||
10
INSTALL
10
INSTALL
@@ -51,9 +51,9 @@ on modern UNIX-like systems that are supported by GNU autoconf and GNU
|
||||
automake ("configure") should be no problem.
|
||||
|
||||
The normal installation procedure after getting (and expanding) the source
|
||||
files (using a distribution archive or CVS) is as following:
|
||||
files (using a distribution archive or GIT) is as following:
|
||||
|
||||
1) ./autogen.sh [only necessary when using CVS]
|
||||
1) ./autogen.sh [only necessary when using GIT]
|
||||
2) ./configure
|
||||
3) make
|
||||
4) make install
|
||||
@@ -77,7 +77,7 @@ doc/ directory: sample-ngircd.conf.
|
||||
|
||||
The first step, autogen.sh, is only necessary if the configure-script isn't
|
||||
already generated. This never happens in official ("stable") releases in
|
||||
tar.gz-archives, but when using CVS.
|
||||
tar.gz-archives, but when using GIT.
|
||||
|
||||
This step is therefore only interesting for developers.
|
||||
|
||||
@@ -244,7 +244,3 @@ These parameters could be passed to the ngIRCd:
|
||||
Use "--help" to see a short help text describing all available parameters
|
||||
the server understands, with "--version" the ngIRCd shows its version
|
||||
number. In both cases the server exits after the output.
|
||||
|
||||
|
||||
--
|
||||
$Id: INSTALL,v 1.26 2007/04/08 11:39:08 alex Exp $
|
||||
|
||||
15
NEWS
15
NEWS
@@ -10,8 +10,21 @@
|
||||
-- NEWS --
|
||||
|
||||
|
||||
ngIRCd 0.12.0-pre1 (2008-04-20)
|
||||
ngIRCd 0.12.1 (2008-07-09)
|
||||
|
||||
- Add option aliases -V (for --version) and -h (for --help).
|
||||
- Make Listen parameter a comma-seperated list of addresses. This also
|
||||
obsoletes ListenIPv4 and ListenIPv6 options. If Listen is unset, it
|
||||
is treated as Listen="::,0.0.0.0".
|
||||
Note: ListenIPv4 and ListenIPv6 options are still recognized,
|
||||
but ngircd will print a warning if they are used in the config file.
|
||||
|
||||
ngIRCd 0.12.0 (2008-05-13)
|
||||
|
||||
ngIRCd 0.12.0-pre2 (2008-04-29)
|
||||
- IPv6: Add config options to disabe ipv4/ipv6 support.
|
||||
|
||||
ngIRCd 0.12.0-pre1 (2008-04-20)
|
||||
- Add IPv6 support.
|
||||
- Install a LaunchDaemon script to start/stop ngIRCd on Mac OS X.
|
||||
- Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and
|
||||
|
||||
10
README
10
README
@@ -67,9 +67,9 @@ the newest information about the ngIRCd and the most recent ("stable")
|
||||
releases there.
|
||||
|
||||
If you are interested in the latest development versions (which are not
|
||||
always stable), then please read the section "CVS" on the homepage and
|
||||
the file "doc/CVS.txt" which describes the use of CVS, the "Concurrent
|
||||
Versioning System".
|
||||
always stable), then please read the section about "GIT" on the homepage and
|
||||
the file "doc/GIT.txt" which describes the use of GIT, the version control
|
||||
system used by ngIRCd (homepage: http://git.or.cz/).
|
||||
|
||||
|
||||
VI. Bugs
|
||||
@@ -85,7 +85,3 @@ 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.ath.cx> (please see
|
||||
<http://ngircd.barton.de/#ml> for details).
|
||||
|
||||
|
||||
--
|
||||
$Id: README,v 1.25 2007/10/04 15:18:48 alex Exp $
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# -- Initialisation --
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(ngircd, 0.12.0-pre1)
|
||||
AC_INIT(ngircd, 0.12.1)
|
||||
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE(1.6)
|
||||
@@ -428,7 +428,7 @@ fi
|
||||
# enable support for IPv6?
|
||||
x_ipv6_on=no
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
[ --enable-ipv6, enable IPv6 protocol support],
|
||||
[ --enable-ipv6 enable IPv6 protocol support],
|
||||
if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
|
||||
)
|
||||
if test "$x_ipv6_on" = "yes"; then
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
ngircd (0.12.1-0ab1) unstable; urgency=low
|
||||
|
||||
* New "upstream" release ngIRCd 0.12.1.
|
||||
|
||||
-- Alexander Barton <alex@barton.de> Wed, 9 Jul 2008 11:27:00 +0200
|
||||
|
||||
ngircd (0.12.0-0ab1) unstable; urgency=low
|
||||
|
||||
* New "upstream" release ngIRCd 0.12.0.
|
||||
|
||||
-- Alexander Barton <alex@barton.de> Tue, 13 May 2008 12:30:31 +0200
|
||||
|
||||
ngircd (0.12.0-0ab0-pre2) unstable; urgency=low
|
||||
|
||||
* Second prerelease of upcoming new "upstrem" release 0.12.0-pre1.
|
||||
|
||||
-- Alexander Barton <alex@barton.de> Tue, 29 Apr 2008 23:06:14 +0200
|
||||
|
||||
ngircd (0.12.0-0ab0-pre1) unstable; urgency=low
|
||||
|
||||
* Prereloease of upcoming new "upstrem" release 0.12.0-pre1.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%define name ngircd
|
||||
%define version 0.12.0-pre1
|
||||
%define version 0.12.1
|
||||
%define release 1
|
||||
%define prefix %{_prefix}
|
||||
|
||||
|
||||
@@ -40,9 +40,11 @@
|
||||
# one port, separated with ",". (Default: 6667)
|
||||
;Ports = 6667, 6668, 6669
|
||||
|
||||
# IP address on which the server should listen. (Default: empty,
|
||||
# so the server listens on all IP addresses of the system)
|
||||
;Listen = 1.2.3.4
|
||||
# comma seperated list of IP addresses on which the server should
|
||||
# listen. Default values are:
|
||||
# "0.0.0.0" or (if compiled with IPv6 support) "::,0.0.0.0"
|
||||
# so the server listens on all IP addresses of the system by default.
|
||||
;Listen = 127.0.0.1,192.168.0.1
|
||||
|
||||
# Text file with the "message of the day" (MOTD). This message will
|
||||
# be shown to all users connecting to the server:
|
||||
@@ -103,6 +105,10 @@
|
||||
# Don't do any DNS lookups when a client connects to the server.
|
||||
;NoDNS = no
|
||||
|
||||
# try to connect to other irc servers using ipv4 and ipv6, if possible
|
||||
;ConnectIPv6 = yes
|
||||
;ConnectIPv4 = yes
|
||||
|
||||
# Maximum number of simultaneous connection the server is allowed
|
||||
# to accept (0: unlimited):
|
||||
;MaxConnections = 0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\"
|
||||
.\" $Id: ngircd.8.tmpl,v 1.2 2007/11/15 01:03:29 fw Exp $
|
||||
.\"
|
||||
.TH ngircd 8 "August 2005" ngircd "ngIRCd Manual"
|
||||
.TH ngircd 8 "May 2008" ngircd "ngIRCd Manual"
|
||||
.SH NAME
|
||||
ngIRCd \- the next generation IRC daemon
|
||||
.SH SYNOPSIS
|
||||
@@ -50,10 +50,10 @@ CONNECT later on as IRC Operator to link this ngIRCd to other servers.
|
||||
\fB\-t\fR, \fB\-\-configtest\fR
|
||||
Read, validate and display the configuration; then exit.
|
||||
.TP
|
||||
\fB\-\-version\fR
|
||||
\fB\-V\fR, \fB\-\-version\fR
|
||||
Output version information and exit.
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Display a brief help text and exit.
|
||||
.SH FILES
|
||||
.I :ETCDIR:/ngircd.conf
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\"
|
||||
.\" $Id: ngircd.conf.5.tmpl,v 1.7 2007/11/23 16:26:03 fw Exp $
|
||||
.\"
|
||||
.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
|
||||
.TH ngircd.conf 5 "May 2008" ngircd "ngIRCd Manual"
|
||||
.SH NAME
|
||||
ngircd.conf \- configuration file of ngIRCd
|
||||
.SH SYNOPSIS
|
||||
@@ -26,19 +26,20 @@ Sections contain parameters of the form
|
||||
.RE
|
||||
.PP
|
||||
Empty lines and any line beginning with a semicolon (';') or a hash ('#')
|
||||
character is treated as a comment and will be ignored.
|
||||
character are treated as a comment and will be ignored. Leading and trailing
|
||||
whitespaces are trimmed before any processing takes place.
|
||||
.PP
|
||||
The file format is line-based - that means, each newline-terminated line
|
||||
represents either a comment, a section name or a parameter.
|
||||
The file format is line-based - that means, each non-empty newline-terminated
|
||||
line represents either a comment, a section name, or a parameter.
|
||||
.PP
|
||||
Section and parameter names are not case sensitive.
|
||||
.SH "SECTION OVERVIEW"
|
||||
The file can contain blocks of four types: [Global], [Operator], [Server],
|
||||
and [Channel].
|
||||
.PP
|
||||
In the
|
||||
The main configuration of the server is stored in the
|
||||
.I [Global]
|
||||
section, there is the main configuration like the server name and the
|
||||
section, like the server name, administrative information and the
|
||||
ports on which the server should be listening. IRC operators of this
|
||||
server are defined in
|
||||
.I [Operator]
|
||||
@@ -57,7 +58,7 @@ section is used to define the server main configuration, like the server
|
||||
name and the ports on which the server should be listening.
|
||||
.TP
|
||||
\fBName\fR
|
||||
Server name in the IRC network
|
||||
Server name in the IRC network, must contain at least one dot (".").
|
||||
.TP
|
||||
\fBInfo\fR
|
||||
Info text of the server. This will be shown by WHOIS and LINKS requests for
|
||||
@@ -72,8 +73,10 @@ Ports on which the server should listen. There may be more than one port,
|
||||
separated with ','. Default: 6667.
|
||||
.TP
|
||||
\fBListen\fR
|
||||
The IP address on which the server should listen. Default is empty, so
|
||||
the server listens on all configured IP addresses and interfaces.
|
||||
A comma seperated list of IP address on which the server should listen.
|
||||
If unset, the defaults value is "0.0.0.0", or, if ngircd was compiled
|
||||
with IPv6 support, "::,0.0.0.0", so the server listens on all configured
|
||||
IP addresses and interfaces by default.
|
||||
.TP
|
||||
\fBMotdFile\fR
|
||||
Text file with the "message of the day" (MOTD). This message will be shown
|
||||
@@ -81,7 +84,8 @@ to all users connecting to the server.
|
||||
.TP
|
||||
\fBMotdPhrase\fR
|
||||
A simple Phrase (<256 chars) if you don't want to use a MOTD file.
|
||||
If it is set no MotdFile will be read at all.
|
||||
If it is set no MotdFile will be read at all which can be handy if the
|
||||
daemon should run inside a chroot directory.
|
||||
.TP
|
||||
\fBServerUID\fR
|
||||
User ID under which the server should run; you can use the name of the user
|
||||
@@ -158,6 +162,15 @@ If you configure ngircd to connect to other servers, ngircd may still
|
||||
perform a DNS lookup if required.
|
||||
Default: No.
|
||||
.TP
|
||||
\fBConnectIPv4\fR
|
||||
Set this to no if you do not want ngircd to connect to other irc servers using ipv4.
|
||||
This allows use of ngircd in ipv6-only setups.
|
||||
Default: Yes.
|
||||
.TP
|
||||
\fBConnectIPv6\fR
|
||||
Set this to no if you do not want ngircd to connect to other irc servers using ipv6.
|
||||
Default: Yes.
|
||||
.TP
|
||||
\fBMaxConnections\fR
|
||||
Maximum number of simultaneous connection the server is allowed to accept
|
||||
(0: unlimited). Default: 0.
|
||||
@@ -194,31 +207,34 @@ Example: nick!ident@*.example.com
|
||||
Other servers are configured in
|
||||
.I [Server]
|
||||
sections. If you configure a port for the connection, then this ngIRCd
|
||||
tries to connect to to the other server on the given port; if not, it waits
|
||||
for the other server to connect.
|
||||
tries to connect to to the other server on the given port (active);
|
||||
if not, it waits for the other server to connect (passive).
|
||||
.PP
|
||||
The ngIRCd allows "server groups": You can assign an "ID" to every server
|
||||
with which you want this ngIRCd to link. If a server of a group won't
|
||||
answer, the ngIRCd tries to connect to the next server in the given group.
|
||||
But ngIRCd never tries to connect to two servers with the same group ID.
|
||||
ngIRCd supports "server groups": You can assign an "ID" to every server
|
||||
with which you want this ngIRCd to link, and the daemon ensures that at
|
||||
any given time only one direct link exists to servers with the same ID.
|
||||
So if a server of a group won't answer, ngIRCd tries to connect to the next
|
||||
server in the given group (="with the same ID"), but never tries to connect
|
||||
to more than one server of this group simultaneously.
|
||||
.PP
|
||||
There may be more than one
|
||||
.I [Server]
|
||||
block.
|
||||
.TP
|
||||
\fBName\fR
|
||||
IRC name of the server
|
||||
IRC name of the remote server.
|
||||
.TP
|
||||
\fBHost\fR
|
||||
Internet host name of the peer
|
||||
Internet host name (or IP address) of the peer.
|
||||
.TP
|
||||
\fBBind\fR
|
||||
IP address to use as source IP for the outgoing connection. Default ist
|
||||
to let the operating system decide.
|
||||
.TP
|
||||
\fBPort\fR
|
||||
Port of the server to which the ngIRCd should connect. If you assign no port
|
||||
the ngIRCd waits for incoming connections.
|
||||
Port of the remote server to which ngIRCd should connect (active).
|
||||
If no port is assigned to a configured server, the daemon only waits for
|
||||
incoming connections (passive).
|
||||
.TP
|
||||
\fBMyPassword\fR
|
||||
Own password for this connection. This password has to be configured as
|
||||
@@ -230,6 +246,7 @@ Foreign password for this connection. This password has to be configured as
|
||||
.TP
|
||||
\fBGroup\fR
|
||||
Group of this server (optional).
|
||||
.TP
|
||||
\fBPassive\fR
|
||||
Disable automatic connection even if port value is specified. Default: false.
|
||||
You can use the IRC Operator command CONNECT later on to create the link.
|
||||
@@ -247,19 +264,19 @@ There may be more than one
|
||||
block.
|
||||
.TP
|
||||
\fBName\fR
|
||||
Name of the channel
|
||||
Name of the channel, including channel prefix ("#").
|
||||
.TP
|
||||
\fBTopic\fR
|
||||
Topic for this channel
|
||||
Topic for this channel.
|
||||
.TP
|
||||
\fBModes\fR
|
||||
Initial channel modes.
|
||||
.TP
|
||||
\fBKey\fR
|
||||
Sets initial channel key (only relevant if mode k is set)
|
||||
Sets initial channel key (only relevant if mode k is set).
|
||||
.TP
|
||||
\fBMaxUsers\fR
|
||||
Set maximum user limit for this channel (only relevant if mode l is set)
|
||||
Set maximum user limit for this channel (only relevant if mode l is set).
|
||||
.SH HINTS
|
||||
It's wise to use "ngircd --configtest" to validate the configuration file
|
||||
after changing it. See
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "ng_ipaddr.h"
|
||||
|
||||
@@ -27,18 +24,19 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
|
||||
int ret;
|
||||
char portstr[64];
|
||||
struct addrinfo *res0;
|
||||
struct addrinfo hints = {
|
||||
#ifndef WANT_IPV6 /* only accept v4 addresses */
|
||||
.ai_family = AF_INET,
|
||||
#endif
|
||||
.ai_flags = AI_NUMERICHOST
|
||||
};
|
||||
struct addrinfo hints;
|
||||
|
||||
if (ip_str == NULL)
|
||||
hints.ai_flags |= AI_PASSIVE;
|
||||
assert(ip_str);
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
|
||||
/* some getaddrinfo implementations require that ai_socktype is set. */
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
/* silly, but ngircd stores UINT16 in server config, not string */
|
||||
snprintf(portstr, sizeof(portstr), "%u", (unsigned int) port);
|
||||
|
||||
ret = getaddrinfo(ip_str, portstr, &hints, &res0);
|
||||
assert(ret == 0);
|
||||
if (ret != 0)
|
||||
@@ -52,8 +50,7 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port)
|
||||
freeaddrinfo(res0);
|
||||
return ret == 0;
|
||||
#else /* HAVE_GETADDRINFO */
|
||||
if (ip_str == NULL)
|
||||
ip_str = "0.0.0.0";
|
||||
assert(ip_str);
|
||||
addr->sin4.sin_family = AF_INET;
|
||||
# ifdef HAVE_INET_ATON
|
||||
if (inet_aton(ip_str, &addr->sin4.sin_addr) == 0)
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#define NG_IPADDR_HDR
|
||||
#include "portab.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#else
|
||||
@@ -81,7 +84,6 @@ ng_ipaddr_getport(const ng_ipaddr_t *a)
|
||||
* init a ng_ipaddr_t object.
|
||||
* @param addr: pointer to ng_ipaddr_t to initialize.
|
||||
* @param ip_str: ip address in dotted-decimal (ipv4) or hexadecimal (ipv6) notation
|
||||
* if ip_str is NULL it is treated as 0.0.0.0/[::]
|
||||
* @param port: transport layer port number to use.
|
||||
*/
|
||||
GLOBAL bool ng_ipaddr_init PARAMS((ng_ipaddr_t *addr, const char *ip_str, UINT16 port));
|
||||
|
||||
@@ -36,7 +36,7 @@ noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conn.h conn-func.h \
|
||||
defines.h messages.h
|
||||
|
||||
clean-local:
|
||||
rm -f check-version check-help lint.out cvs-version.*
|
||||
rm -f check-version check-help lint.out
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile Makefile.in
|
||||
@@ -77,23 +77,6 @@ lint:
|
||||
|| echo "Result: no warnings found."; \
|
||||
echo; [ $$warnings -gt 0 ] && exit 1
|
||||
|
||||
ngircd.c: cvs-version.h
|
||||
|
||||
irc-login.c: cvs-version.h
|
||||
|
||||
irc-info.c: cvs-version.h
|
||||
|
||||
cvs-version.h: cvs-date
|
||||
|
||||
cvs-date:
|
||||
grep VERSION ../config.h | grep "CVS" \
|
||||
&& echo "#define CVSDATE \"$$( grep "\$$Id" $(srcdir)/*.c \
|
||||
| $(AWK) "{ print \$$9 }" | sort | tail -1 \
|
||||
| sed -e "s/\//-/g" )\"" > cvs-version.new \
|
||||
|| echo "" > cvs-version.new
|
||||
diff cvs-version.h cvs-version.new 2>/dev/null \
|
||||
|| cp cvs-version.new cvs-version.h
|
||||
|
||||
TESTS = check-version check-help
|
||||
|
||||
# -eof-
|
||||
|
||||
@@ -201,25 +201,38 @@ Channel_Join( CLIENT *Client, char *Name )
|
||||
} /* Channel_Join */
|
||||
|
||||
|
||||
/**
|
||||
* Remove client from channel.
|
||||
* This function lets a client lead a channel. First, the function checks
|
||||
* if the channel exists and the client is a member of it and sends out
|
||||
* appropriate error messages if not. The real work is done by the function
|
||||
* Remove_Client().
|
||||
*/
|
||||
GLOBAL bool
|
||||
Channel_Part( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason )
|
||||
Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Reason)
|
||||
{
|
||||
CHANNEL *chan;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Name != NULL );
|
||||
assert( Reason != NULL );
|
||||
assert(Client != NULL);
|
||||
assert(Name != NULL);
|
||||
assert(Reason != NULL);
|
||||
|
||||
chan = Channel_Search( Name );
|
||||
if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client )))
|
||||
{
|
||||
IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
|
||||
chan = Channel_Search(Name);
|
||||
if (!chan) {
|
||||
IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
|
||||
Client_ID(Client), Name);
|
||||
return false;
|
||||
}
|
||||
if (!Get_Cl2Chan(chan, Client)) {
|
||||
IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
|
||||
Client_ID(Client), Name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* User aus Channel entfernen */
|
||||
if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, true)) return false;
|
||||
else return true;
|
||||
if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
} /* Channel_Part */
|
||||
|
||||
|
||||
|
||||
@@ -56,9 +56,21 @@ static CONF_SERVER New_Server;
|
||||
static int New_Server_Idx;
|
||||
|
||||
|
||||
#ifdef WANT_IPV6
|
||||
/*
|
||||
* these options appeared in ngircd 0.12; they are here
|
||||
* for backwards compatibility. They should be removed
|
||||
* in the future. Instead of setting these options,
|
||||
* the "Listen" option should be set accordingly.
|
||||
*/
|
||||
static bool Conf_ListenIPv6;
|
||||
static bool Conf_ListenIPv4;
|
||||
#endif
|
||||
|
||||
|
||||
static void Set_Defaults PARAMS(( bool InitServers ));
|
||||
static bool Read_Config PARAMS(( bool ngircd_starting ));
|
||||
static void Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
|
||||
static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
|
||||
|
||||
static void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg ));
|
||||
static void Handle_OPERATOR PARAMS(( int Line, char *Var, char *Arg ));
|
||||
@@ -152,6 +164,15 @@ Conf_Rehash( void )
|
||||
} /* Config_Rehash */
|
||||
|
||||
|
||||
static const char*
|
||||
yesno_to_str(int boolean_value)
|
||||
{
|
||||
if (boolean_value)
|
||||
return "yes";
|
||||
return "no";
|
||||
}
|
||||
|
||||
|
||||
GLOBAL int
|
||||
Conf_Test( void )
|
||||
{
|
||||
@@ -161,11 +182,14 @@ Conf_Test( void )
|
||||
struct group *grp;
|
||||
unsigned int i;
|
||||
char *topic;
|
||||
bool config_valid;
|
||||
|
||||
Use_Log = false;
|
||||
|
||||
Read_Config( true );
|
||||
Validate_Config(true, false);
|
||||
if (! Read_Config(true))
|
||||
return 1;
|
||||
|
||||
config_valid = Validate_Config(true, false);
|
||||
|
||||
/* If stdin and stdout ("you can read our nice message and we can
|
||||
* read in your keypress") are valid tty's, wait for a key: */
|
||||
@@ -190,8 +214,7 @@ Conf_Test( void )
|
||||
fputs(" Ports = ", stdout);
|
||||
|
||||
ports_puts(&Conf_ListenPorts);
|
||||
|
||||
printf( " Listen = %s\n", Conf_ListenAddress );
|
||||
printf(" Listen = %s\n", Conf_ListenAddress);
|
||||
pwd = getpwuid( Conf_UID );
|
||||
if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
|
||||
else printf( " ServerUID = %ld\n", (long)Conf_UID );
|
||||
@@ -201,10 +224,20 @@ Conf_Test( void )
|
||||
printf( " PingTimeout = %d\n", Conf_PingTimeout );
|
||||
printf( " PongTimeout = %d\n", Conf_PongTimeout );
|
||||
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
|
||||
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == true ? "yes" : "no" );
|
||||
printf( " OperServerMode = %s\n", Conf_OperServerMode == true? "yes" : "no" );
|
||||
printf( " PredefChannelsOnly = %s\n", Conf_PredefChannelsOnly == true ? "yes" : "no" );
|
||||
printf( " NoDNS = %s\n", Conf_NoDNS ? "yes" : "no");
|
||||
printf( " OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode));
|
||||
printf( " OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode));
|
||||
printf( " PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly));
|
||||
printf( " NoDNS = %s\n", yesno_to_str(Conf_NoDNS));
|
||||
|
||||
#ifdef WANT_IPV6
|
||||
/* both are deprecated, only mention them if their default value changed. */
|
||||
if (!Conf_ListenIPv6)
|
||||
puts(" ListenIPv6 = no");
|
||||
if (!Conf_ListenIPv4)
|
||||
puts(" ListenIPv4 = no");
|
||||
printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6));
|
||||
printf(" ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4));
|
||||
#endif
|
||||
printf( " MaxConnections = %ld\n", Conf_MaxConnections);
|
||||
printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
|
||||
printf( " MaxJoins = %d\n", Conf_MaxJoins>0 ? Conf_MaxJoins : -1);
|
||||
@@ -249,7 +282,7 @@ Conf_Test( void )
|
||||
printf( " Topic = %s\n\n", topic ? topic : "");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (config_valid ? 0 : 1);
|
||||
} /* Conf_Test */
|
||||
|
||||
|
||||
@@ -432,8 +465,8 @@ Set_Defaults( bool InitServers )
|
||||
|
||||
strlcpy( Conf_PidFile, PID_FILE, sizeof( Conf_PidFile ));
|
||||
|
||||
strcpy( Conf_ListenAddress, "" );
|
||||
|
||||
free(Conf_ListenAddress);
|
||||
Conf_ListenAddress = NULL;
|
||||
Conf_UID = Conf_GID = 0;
|
||||
|
||||
Conf_PingTimeout = 120;
|
||||
@@ -449,6 +482,12 @@ Set_Defaults( bool InitServers )
|
||||
Conf_PredefChannelsOnly = false;
|
||||
Conf_OperServerMode = false;
|
||||
|
||||
Conf_ConnectIPv4 = true;
|
||||
Conf_ConnectIPv6 = true;
|
||||
#ifdef WANT_IPV6
|
||||
Conf_ListenIPv4 = true;
|
||||
Conf_ListenIPv6 = true;
|
||||
#endif
|
||||
Conf_MaxConnections = 0;
|
||||
Conf_MaxConnectionsIP = 5;
|
||||
Conf_MaxJoins = 10;
|
||||
@@ -629,6 +668,23 @@ Read_Config( bool ngircd_starting )
|
||||
exit( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
if (!Conf_ListenAddress) {
|
||||
/* no Listen addresses configured, use default */
|
||||
#ifdef WANT_IPV6
|
||||
/* Conf_ListenIPv6/4 should no longer be used */
|
||||
if (Conf_ListenIPv6 && Conf_ListenIPv4)
|
||||
Conf_ListenAddress = strdup_warn("::,0.0.0.0");
|
||||
else if (Conf_ListenIPv6)
|
||||
Conf_ListenAddress = strdup_warn("::");
|
||||
else
|
||||
#endif
|
||||
Conf_ListenAddress = strdup_warn("0.0.0.0");
|
||||
}
|
||||
if (!Conf_ListenAddress) {
|
||||
Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME);
|
||||
exit(1);
|
||||
}
|
||||
return true;
|
||||
} /* Read_Config */
|
||||
|
||||
@@ -817,6 +873,41 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||
Conf_NoDNS = Check_ArgIsTrue( Arg );
|
||||
return;
|
||||
}
|
||||
#ifdef WANT_IPV6
|
||||
/* the default setting for all the WANT_IPV6 special options is 'true' */
|
||||
if (strcasecmp(Var, "ListenIPv6") == 0) { /* DEPRECATED, option appeared in 0.12.0 */
|
||||
/*
|
||||
* listen on ipv6 sockets, if available?
|
||||
* Deprecated use "Listen = 0.0.0.0" (or, rather, do not list "::")
|
||||
*/
|
||||
Conf_ListenIPv6 = Check_ArgIsTrue( Arg );
|
||||
Config_Error(LOG_WARNING, "%s, line %d: %s=%s is deprecated, %sinclude '::' in \"Listen =\" option instead",
|
||||
NGIRCd_ConfFile, Line, Var, yesno_to_str(Conf_ListenIPv6), Conf_ListenIPv6 ? " ":"do not ");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp(Var, "ListenIPv4") == 0) { /* DEPRECATED, option appeared in 0.12.0 */
|
||||
/*
|
||||
* listen on ipv4 sockets, if available?
|
||||
* this allows "ipv6-only" setups
|
||||
* Deprecated use "Listen = ::" (or, rather, do not list "0.0.0.0")
|
||||
*/
|
||||
Conf_ListenIPv4 = Check_ArgIsTrue( Arg );
|
||||
Config_Error(LOG_WARNING, "%s, line %d: %s=%s is deprecated, %sinclude '0.0.0.0' in \"Listen =\" option instead",
|
||||
NGIRCd_ConfFile, Line, Var, yesno_to_str(Conf_ListenIPv4), Conf_ListenIPv4 ? " ":"do not ");
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "ConnectIPv6" ) == 0 ) {
|
||||
/* connect to other hosts using ipv6, if they have an AAAA record? */
|
||||
Conf_ConnectIPv6 = Check_ArgIsTrue( Arg );
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "ConnectIPv4" ) == 0 ) {
|
||||
/* connect to other hosts using ipv4.
|
||||
* again, this can be used for ipv6-only setups */
|
||||
Conf_ConnectIPv4 = Check_ArgIsTrue( Arg );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if( strcasecmp( Var, "OperCanUseMode" ) == 0 ) {
|
||||
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
|
||||
Conf_OperCanMode = Check_ArgIsTrue( Arg );
|
||||
@@ -863,14 +954,24 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||
|
||||
if( strcasecmp( Var, "Listen" ) == 0 ) {
|
||||
/* IP-Address to bind sockets */
|
||||
len = strlcpy( Conf_ListenAddress, Arg, sizeof( Conf_ListenAddress ));
|
||||
if (len >= sizeof( Conf_ListenAddress ))
|
||||
Config_Error_TooLong( Line, Var );
|
||||
if (Conf_ListenAddress) {
|
||||
Config_Error(LOG_ERR, "Multiple Listen= options, ignoring: %s", Arg);
|
||||
return;
|
||||
}
|
||||
Conf_ListenAddress = strdup_warn(Arg);
|
||||
/*
|
||||
* if allocation fails, we're in trouble:
|
||||
* we cannot ignore the error -- otherwise ngircd
|
||||
* would listen on all interfaces.
|
||||
*/
|
||||
if (!Conf_ListenAddress) {
|
||||
Config_Error(LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME);
|
||||
exit(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!",
|
||||
NGIRCd_ConfFile, Line, Var );
|
||||
Config_Error(LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!",
|
||||
NGIRCd_ConfFile, Line, Var);
|
||||
} /* Handle_GLOBAL */
|
||||
|
||||
|
||||
@@ -1066,7 +1167,7 @@ Handle_CHANNEL( int Line, char *Var, char *Arg )
|
||||
} /* Handle_CHANNEL */
|
||||
|
||||
|
||||
static void
|
||||
static bool
|
||||
Validate_Config(bool Configtest, bool Rehash)
|
||||
{
|
||||
/* Validate configuration settings. */
|
||||
@@ -1074,6 +1175,7 @@ Validate_Config(bool Configtest, bool Rehash)
|
||||
#ifdef DEBUG
|
||||
int i, servers, servers_once;
|
||||
#endif
|
||||
bool config_valid = true;
|
||||
char *ptr;
|
||||
|
||||
/* Validate configured server name, see RFC 2812 section 2.3.1 */
|
||||
@@ -1092,6 +1194,7 @@ Validate_Config(bool Configtest, bool Rehash)
|
||||
|
||||
if (!Conf_ServerName[0]) {
|
||||
/* No server name configured! */
|
||||
config_valid = false;
|
||||
Config_Error(LOG_ALERT,
|
||||
"No (valid) server name configured in \"%s\" (section 'Global': 'Name')!",
|
||||
NGIRCd_ConfFile);
|
||||
@@ -1105,6 +1208,7 @@ Validate_Config(bool Configtest, bool Rehash)
|
||||
|
||||
if (Conf_ServerName[0] && !strchr(Conf_ServerName, '.')) {
|
||||
/* No dot in server name! */
|
||||
config_valid = false;
|
||||
Config_Error(LOG_ALERT,
|
||||
"Invalid server name configured in \"%s\" (section 'Global': 'Name'): Dot missing!",
|
||||
NGIRCd_ConfFile);
|
||||
@@ -1119,6 +1223,7 @@ Validate_Config(bool Configtest, bool Rehash)
|
||||
#ifdef STRICT_RFC
|
||||
if (!Conf_ServerAdminMail[0]) {
|
||||
/* No administrative contact configured! */
|
||||
config_valid = false;
|
||||
Config_Error(LOG_ALERT,
|
||||
"No administrator email address configured in \"%s\" ('AdminEMail')!",
|
||||
NGIRCd_ConfFile);
|
||||
@@ -1151,6 +1256,8 @@ Validate_Config(bool Configtest, bool Rehash)
|
||||
"Configuration: Operators=%d, Servers=%d[%d], Channels=%d",
|
||||
Conf_Oper_Count, servers, servers_once, Conf_Channel_Count);
|
||||
#endif
|
||||
|
||||
return config_valid;
|
||||
} /* Validate_Config */
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ GLOBAL char Conf_MotdPhrase[LINE_LEN];
|
||||
GLOBAL array Conf_ListenPorts;
|
||||
|
||||
/* Address to which the socket should be bound or empty (=all) */
|
||||
GLOBAL char Conf_ListenAddress[16];
|
||||
GLOBAL char *Conf_ListenAddress;
|
||||
|
||||
/* User and group ID the server should run with */
|
||||
GLOBAL uid_t Conf_UID;
|
||||
@@ -124,11 +124,14 @@ GLOBAL bool Conf_OperCanMode;
|
||||
/* Disable all DNS functions? */
|
||||
GLOBAL bool Conf_NoDNS;
|
||||
|
||||
/* don't listen for incoming ipv6 connections, even if OS supports it? */
|
||||
GLOBAL bool Conf_NoListenIpv6;
|
||||
/*
|
||||
* try to connect to remote systems using the ipv6 protocol,
|
||||
* if they have an ipv6 address? (default yes)
|
||||
*/
|
||||
GLOBAL bool Conf_ConnectIPv6;
|
||||
|
||||
/* don't connect to remote systems unsign ipv6? */
|
||||
GLOBAL bool Conf_NoConnectIpv6;
|
||||
/* same as above, but for ipv4 hosts, default: yes */
|
||||
GLOBAL bool Conf_ConnectIPv4;
|
||||
|
||||
/* If an IRC op gives chanop privileges without being a chanop,
|
||||
* ircd2 will ignore the command. This enables a workaround:
|
||||
|
||||
@@ -88,7 +88,7 @@ static void Init_Conn_Struct PARAMS(( CONN_ID Idx ));
|
||||
static bool Init_Socket PARAMS(( int Sock ));
|
||||
static void New_Server PARAMS(( int Server, ng_ipaddr_t *dest ));
|
||||
static void Simple_Message PARAMS(( int Sock, const char *Msg ));
|
||||
static int NewListener PARAMS(( int af, const UINT16 Port ));
|
||||
static int NewListener PARAMS(( const char *listen_addr, UINT16 Port ));
|
||||
|
||||
static array My_Listeners;
|
||||
static array My_ConnArray;
|
||||
@@ -272,7 +272,7 @@ Conn_Exit( void )
|
||||
|
||||
|
||||
static unsigned int
|
||||
ports_initlisteners(array *a, int af, void (*func)(int,short))
|
||||
ports_initlisteners(array *a, const char *listen_addr, void (*func)(int,short))
|
||||
{
|
||||
unsigned int created = 0;
|
||||
size_t len;
|
||||
@@ -281,15 +281,15 @@ ports_initlisteners(array *a, int af, void (*func)(int,short))
|
||||
|
||||
len = array_length(a, sizeof (UINT16));
|
||||
port = array_start(a);
|
||||
while(len--) {
|
||||
fd = NewListener(af, *port);
|
||||
while (len--) {
|
||||
fd = NewListener(listen_addr, *port);
|
||||
if (fd < 0) {
|
||||
port++;
|
||||
continue;
|
||||
}
|
||||
if (!io_event_create( fd, IO_WANTREAD, func )) {
|
||||
Log( LOG_ERR, "io_event_create(): Could not add listening fd %d (port %u): %s!",
|
||||
fd, (unsigned int) *port, strerror(errno));
|
||||
fd, (unsigned int) *port, strerror(errno));
|
||||
close(fd);
|
||||
port++;
|
||||
continue;
|
||||
@@ -297,7 +297,6 @@ ports_initlisteners(array *a, int af, void (*func)(int,short))
|
||||
created++;
|
||||
port++;
|
||||
}
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -306,20 +305,39 @@ GLOBAL unsigned int
|
||||
Conn_InitListeners( void )
|
||||
{
|
||||
/* Initialize ports on which the server should accept connections */
|
||||
|
||||
unsigned int created = 0;
|
||||
char *copy, *listen_addr;
|
||||
|
||||
if (!io_library_init(CONNECTION_POOL)) {
|
||||
Log(LOG_EMERG, "Cannot initialize IO routines: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WANT_IPV6
|
||||
if (!Conf_NoListenIpv6)
|
||||
created = ports_initlisteners(&Conf_ListenPorts, AF_INET6, cb_listen);
|
||||
#endif
|
||||
created += ports_initlisteners(&Conf_ListenPorts, AF_INET, cb_listen);
|
||||
assert(Conf_ListenAddress);
|
||||
|
||||
/* can't use Conf_ListenAddress directly, see below */
|
||||
copy = strdup(Conf_ListenAddress);
|
||||
if (!copy) {
|
||||
Log(LOG_CRIT, "Cannot copy %s: %s", Conf_ListenAddress, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
listen_addr = strtok(copy, ",");
|
||||
|
||||
while (listen_addr) {
|
||||
ngt_TrimStr(listen_addr);
|
||||
if (*listen_addr)
|
||||
created += ports_initlisteners(&Conf_ListenPorts, listen_addr, cb_listen);
|
||||
|
||||
listen_addr = strtok(NULL, ",");
|
||||
}
|
||||
|
||||
/*
|
||||
* can't free() Conf_ListenAddress here. On /REHASH, if the config file
|
||||
* cannot be re-loaded, we'd end up with a NULL Conf_ListenAddress.
|
||||
* Instead, free() takes place in conf.c, before the config file
|
||||
* is being parsed.
|
||||
*/
|
||||
free(copy);
|
||||
return created;
|
||||
} /* Conn_InitListeners */
|
||||
|
||||
@@ -349,25 +367,15 @@ Conn_ExitListeners( void )
|
||||
|
||||
|
||||
static bool
|
||||
InitSinaddrListenAddr(int af, ng_ipaddr_t *addr, UINT16 Port)
|
||||
InitSinaddrListenAddr(ng_ipaddr_t *addr, const char *listen_addrstr, UINT16 Port)
|
||||
{
|
||||
bool ret;
|
||||
const char *listen_addrstr = NULL;
|
||||
#ifdef WANT_IPV6
|
||||
if (af == AF_INET)
|
||||
listen_addrstr = "0.0.0.0";
|
||||
#else
|
||||
(void)af;
|
||||
#endif
|
||||
if (Conf_ListenAddress[0]) /* overrides V4/V6 atm */
|
||||
listen_addrstr = Conf_ListenAddress;
|
||||
|
||||
ret = ng_ipaddr_init(addr, listen_addrstr, Port);
|
||||
if (!ret) {
|
||||
if (!listen_addrstr)
|
||||
listen_addrstr = "";
|
||||
Log(LOG_CRIT, "Can't bind to %s:%u: can't convert ip address \"%s\"",
|
||||
listen_addrstr, Port, listen_addrstr);
|
||||
assert(listen_addrstr);
|
||||
Log(LOG_CRIT, "Can't bind to [%s]:%u: can't convert ip address \"%s\"",
|
||||
listen_addrstr, Port, listen_addrstr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -393,32 +401,33 @@ set_v6_only(int af, int sock)
|
||||
|
||||
/* return new listening port file descriptor or -1 on failure */
|
||||
static int
|
||||
NewListener(int af, const UINT16 Port)
|
||||
NewListener(const char *listen_addr, UINT16 Port)
|
||||
{
|
||||
/* Create new listening socket on specified port */
|
||||
ng_ipaddr_t addr;
|
||||
int sock;
|
||||
int sock, af;
|
||||
#ifdef ZEROCONF
|
||||
char name[CLIENT_ID_LEN], *info;
|
||||
#endif
|
||||
if (!InitSinaddrListenAddr(af, &addr, Port))
|
||||
if (!InitSinaddrListenAddr(&addr, listen_addr, Port))
|
||||
return -1;
|
||||
|
||||
sock = socket(ng_ipaddr_af(&addr), SOCK_STREAM, 0);
|
||||
af = ng_ipaddr_af(&addr);
|
||||
sock = socket(af, SOCK_STREAM, 0);
|
||||
if( sock < 0 ) {
|
||||
Log( LOG_CRIT, "Can't create socket: %s!", strerror( errno ));
|
||||
Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
af = ng_ipaddr_af(&addr);
|
||||
|
||||
set_v6_only(af, sock);
|
||||
|
||||
if( ! Init_Socket( sock )) return -1;
|
||||
if (!Init_Socket(sock))
|
||||
return -1;
|
||||
|
||||
if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) {
|
||||
Log( LOG_CRIT, "Can't bind socket (port %d) : %s!", Port, strerror( errno ));
|
||||
close( sock );
|
||||
Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s",
|
||||
ng_ipaddr_tostr(&addr), Port, strerror(errno));
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -435,12 +444,7 @@ NewListener(int af, const UINT16 Port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WANT_IPV6
|
||||
if (af == AF_INET6)
|
||||
Log(LOG_INFO, "Now listening on [%s]:%d (socket %d).", ng_ipaddr_tostr(&addr), Port, sock);
|
||||
else
|
||||
#endif
|
||||
Log(LOG_INFO, "Now listening on %s:%d (socket %d).", ng_ipaddr_tostr(&addr), Port, sock);
|
||||
Log(LOG_INFO, "Now listening on [%s]:%d (socket %d).", ng_ipaddr_tostr(&addr), Port, sock);
|
||||
|
||||
#ifdef ZEROCONF
|
||||
/* Get best server description text */
|
||||
@@ -1223,7 +1227,7 @@ Handle_Buffer( CONN_ID Idx )
|
||||
/* Handle Data in Connections Read-Buffer.
|
||||
* Return true if a reuqest was handled, false otherwise (also returned on errors). */
|
||||
#ifndef STRICT_RFC
|
||||
char *ptr1, *ptr2;
|
||||
char *ptr1, *ptr2, *first_eol;
|
||||
#endif
|
||||
char *ptr;
|
||||
size_t len, delta;
|
||||
@@ -1251,19 +1255,32 @@ Handle_Buffer( CONN_ID Idx )
|
||||
return false;
|
||||
|
||||
/* A Complete Request end with CR+LF, see RFC 2812. */
|
||||
delta = 2;
|
||||
ptr = strstr( array_start(&My_Connections[Idx].rbuf), "\r\n" );
|
||||
|
||||
if( ptr ) delta = 2; /* complete request */
|
||||
#ifndef STRICT_RFC
|
||||
else {
|
||||
/* Check for non-RFC-compliant request (only CR or LF)? Unfortunately,
|
||||
* there are quite a few clients that do this (incl. "mIRC" :-( */
|
||||
ptr1 = strchr( array_start(&My_Connections[Idx].rbuf), '\r' );
|
||||
ptr2 = strchr( array_start(&My_Connections[Idx].rbuf), '\n' );
|
||||
/* Check for non-RFC-compliant request (only CR or LF)?
|
||||
* Unfortunately, there are quite a few clients out there
|
||||
* that do this -- e. g. mIRC, BitchX, and Trillian :-( */
|
||||
ptr1 = strchr(array_start(&My_Connections[Idx].rbuf), '\r');
|
||||
ptr2 = strchr(array_start(&My_Connections[Idx].rbuf), '\n');
|
||||
if (ptr) {
|
||||
/* Check if there is a single CR or LF _before_ the
|
||||
* corerct CR+LF line terminator: */
|
||||
first_eol = ptr1 < ptr2 ? ptr1 : ptr2;
|
||||
if (first_eol < ptr) {
|
||||
/* Single CR or LF before CR+LF found */
|
||||
ptr = first_eol;
|
||||
delta = 1;
|
||||
}
|
||||
} else if (ptr1 || ptr2) {
|
||||
/* No CR+LF terminated command found, but single
|
||||
* CR or LF found ... */
|
||||
if (ptr1 && ptr2)
|
||||
ptr = ptr1 < ptr2 ? ptr1 : ptr2;
|
||||
else
|
||||
ptr = ptr1 ? ptr1 : ptr2;
|
||||
delta = 1;
|
||||
if( ptr1 && ptr2 ) ptr = ptr1 > ptr2 ? ptr2 : ptr1;
|
||||
else if( ptr1 ) ptr = ptr1;
|
||||
else if( ptr2 ) ptr = ptr2;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1438,7 +1455,7 @@ New_Server( int Server , ng_ipaddr_t *dest)
|
||||
af_dest = ng_ipaddr_af(dest);
|
||||
new_sock = socket(af_dest, SOCK_STREAM, 0);
|
||||
if (new_sock < 0) {
|
||||
Log( LOG_CRIT, "Can't create socket: %s!", strerror( errno ));
|
||||
Log( LOG_CRIT, "Can't create socket (af %d) : %s!", af_dest, strerror( errno ));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,29 +286,36 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
||||
} /* IRC_JOIN */
|
||||
|
||||
|
||||
/**
|
||||
* Handler for the IRC "PART" command.
|
||||
*/
|
||||
GLOBAL bool
|
||||
IRC_PART( CLIENT *Client, REQUEST *Req )
|
||||
IRC_PART(CLIENT * Client, REQUEST * Req)
|
||||
{
|
||||
CLIENT *target;
|
||||
char *chan;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
assert(Client != NULL);
|
||||
assert(Req != NULL);
|
||||
|
||||
if (Req->argc < 1 || Req->argc > 2)
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
/* Wer ist der Absender? */
|
||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
||||
else target = Client;
|
||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||
/* Get the sender */
|
||||
if (Client_Type(Client) == CLIENT_SERVER)
|
||||
target = Client_Search(Req->prefix);
|
||||
else
|
||||
target = Client;
|
||||
if (!target)
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
|
||||
Client_ID(Client), Req->prefix);
|
||||
|
||||
/* Channel-Namen durchgehen */
|
||||
/* Loop over all the given channel names */
|
||||
chan = strtok(Req->argv[0], ",");
|
||||
while (chan) {
|
||||
Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target));
|
||||
|
||||
Channel_Part(target, Client, chan,
|
||||
Req->argc > 1 ? Req->argv[1] : Client_ID(target));
|
||||
chan = strtok(NULL, ",");
|
||||
}
|
||||
return CONNECTED;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ngIRCd -- The Next Generation IRC Daemon
|
||||
* Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
|
||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.44 2008/02/17 13:26:42 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@@ -25,7 +23,6 @@ static char UNUSED id[] = "$Id: irc-info.c,v 1.44 2008/02/17 13:26:42 alex Exp $
|
||||
#include <strings.h>
|
||||
|
||||
#include "ngircd.h"
|
||||
#include "cvs-version.h"
|
||||
#include "conn-func.h"
|
||||
#include "conn-zip.h"
|
||||
#include "client.h"
|
||||
@@ -640,9 +637,6 @@ GLOBAL bool
|
||||
IRC_VERSION( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *target, *prefix;
|
||||
#ifdef CVSDATE
|
||||
char ver[12], vertxt[30];
|
||||
#endif
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
@@ -669,21 +663,15 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
|
||||
return CONNECTED;
|
||||
}
|
||||
|
||||
/* mit Versionsinfo antworten */
|
||||
IRC_SetPenalty( Client, 1 );
|
||||
#ifdef CVSDATE
|
||||
strlcpy( ver, CVSDATE, sizeof( ver ));
|
||||
strncpy( ver + 4, ver + 5, 2 );
|
||||
strncpy( ver + 6, ver + 8, 3 );
|
||||
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
|
||||
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
|
||||
#else
|
||||
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
|
||||
#endif
|
||||
/* send version information */
|
||||
IRC_SetPenalty(Client, 1);
|
||||
return IRC_WriteStrClient(Client, RPL_VERSION_MSG, Client_ID(prefix),
|
||||
PACKAGE_NAME, PACKAGE_VERSION,
|
||||
NGIRCd_DebugLevel, Conf_ServerName,
|
||||
NGIRCd_VersionAddition);
|
||||
} /* IRC_VERSION */
|
||||
|
||||
|
||||
|
||||
static bool
|
||||
write_whoreply(CLIENT *Client, CLIENT *c, const char *channelname, const char *flags)
|
||||
{
|
||||
@@ -730,7 +718,7 @@ IRC_Send_WHO(CLIENT *Client, CHANNEL *Chan, bool OnlyOps)
|
||||
|
||||
/* Secret channel? */
|
||||
if (!is_member && strchr(Channel_Modes(Chan), 's'))
|
||||
return CONNECTED;
|
||||
return IRC_WriteStrClient(Client, RPL_ENDOFWHO_MSG, Client_ID(Client), Channel_Name(Chan));
|
||||
|
||||
cl2chan = Channel_FirstMember(Chan);
|
||||
for (; cl2chan ; cl2chan = Channel_NextMember(Chan, cl2chan)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ngIRCd -- The Next Generation IRC Daemon
|
||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-login.c,v 1.55 2008/02/05 11:46:55 fw Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -35,7 +33,6 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.55 2008/02/05 11:46:55 fw Exp $"
|
||||
#include "irc.h"
|
||||
#include "irc-info.h"
|
||||
#include "irc-write.h"
|
||||
#include "cvs-version.h"
|
||||
|
||||
#include "exp.h"
|
||||
#include "irc-login.h"
|
||||
@@ -507,7 +504,7 @@ IRC_PING(CLIENT *Client, REQUEST *Req)
|
||||
Client_ID(from), Client_ID(Client));
|
||||
#else
|
||||
/* Some clients depend on the argument being returned in the PONG
|
||||
* reply (not mentioned in any RFC, though) */
|
||||
* reply (not mentioned in any RFC, though) */
|
||||
return IRC_WriteStrClient(Client, "PONG %s :%s",
|
||||
Client_ID(from), Req->argv[0]);
|
||||
#endif
|
||||
@@ -573,61 +570,60 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
|
||||
|
||||
|
||||
static bool
|
||||
Hello_User( CLIENT *Client )
|
||||
Hello_User(CLIENT * Client)
|
||||
{
|
||||
#ifdef CVSDATE
|
||||
char ver[12], vertxt[30];
|
||||
#endif
|
||||
|
||||
assert( Client != NULL );
|
||||
assert(Client != NULL);
|
||||
|
||||
/* Check password ... */
|
||||
if( strcmp( Client_Password( Client ), Conf_ServerPwd ) != 0 )
|
||||
{
|
||||
if (strcmp(Client_Password(Client), Conf_ServerPwd) != 0) {
|
||||
/* Bad password! */
|
||||
Log( LOG_ERR, "User \"%s\" rejected (connection %d): Bad password!", Client_Mask( Client ), Client_Conn( Client ));
|
||||
Conn_Close( Client_Conn( Client ), NULL, "Bad password", true);
|
||||
Log(LOG_ERR,
|
||||
"User \"%s\" rejected (connection %d): Bad password!",
|
||||
Client_Mask(Client), Client_Conn(Client));
|
||||
Conn_Close(Client_Conn(Client), NULL, "Bad password", true);
|
||||
return DISCONNECTED;
|
||||
}
|
||||
|
||||
Log( LOG_NOTICE, "User \"%s\" registered (connection %d).", Client_Mask( Client ), Client_Conn( Client ));
|
||||
Log(LOG_NOTICE, "User \"%s\" registered (connection %d).",
|
||||
Client_Mask(Client), Client_Conn(Client));
|
||||
|
||||
/* Inform other servers */
|
||||
IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client ));
|
||||
IRC_WriteStrServers(NULL, "NICK %s 1 %s %s 1 +%s :%s",
|
||||
Client_ID(Client), Client_User(Client),
|
||||
Client_Hostname(Client), Client_Modes(Client),
|
||||
Client_Info(Client));
|
||||
|
||||
/* Welcome :-) */
|
||||
if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return false;
|
||||
|
||||
/* Version and system type */
|
||||
#ifdef CVSDATE
|
||||
strlcpy( ver, CVSDATE, sizeof( ver ));
|
||||
memmove( ver + 4, ver + 5, 2 );
|
||||
memmove( ver + 6, ver + 8, 3 );
|
||||
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
|
||||
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false;
|
||||
#else
|
||||
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false;
|
||||
#endif
|
||||
|
||||
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return false;
|
||||
#ifdef CVSDATE
|
||||
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, USERMODES, CHANMODES )) return false;
|
||||
#else
|
||||
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return false;
|
||||
#endif
|
||||
if (!IRC_WriteStrClient
|
||||
(Client, RPL_WELCOME_MSG, Client_ID(Client), Client_Mask(Client)))
|
||||
return false;
|
||||
if (!IRC_WriteStrClient
|
||||
(Client, RPL_YOURHOST_MSG, Client_ID(Client),
|
||||
Client_ID(Client_ThisServer()), PACKAGE_VERSION, TARGET_CPU,
|
||||
TARGET_VENDOR, TARGET_OS))
|
||||
return false;
|
||||
if (!IRC_WriteStrClient
|
||||
(Client, RPL_CREATED_MSG, Client_ID(Client), NGIRCd_StartStr))
|
||||
return false;
|
||||
if (!IRC_WriteStrClient
|
||||
(Client, RPL_MYINFO_MSG, Client_ID(Client),
|
||||
Client_ID(Client_ThisServer()), PACKAGE_VERSION, USERMODES,
|
||||
CHANMODES))
|
||||
return false;
|
||||
|
||||
/* Features supported by this server (005 numeric, ISUPPORT),
|
||||
* see <http://www.irc.org/tech_docs/005.html> for details. */
|
||||
if (! IRC_Send_ISUPPORT(Client))
|
||||
if (!IRC_Send_ISUPPORT(Client))
|
||||
return DISCONNECTED;
|
||||
|
||||
Client_SetType( Client, CLIENT_USER );
|
||||
Client_SetType(Client, CLIENT_USER);
|
||||
|
||||
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
|
||||
if( ! IRC_Show_MOTD( Client )) return DISCONNECTED;
|
||||
if (!IRC_Send_LUSERS(Client))
|
||||
return DISCONNECTED;
|
||||
if (!IRC_Show_MOTD(Client))
|
||||
return DISCONNECTED;
|
||||
|
||||
/* Suspend the client for a second ... */
|
||||
IRC_SetPenalty( Client, 1 );
|
||||
IRC_SetPenalty(Client, 1);
|
||||
|
||||
return CONNECTED;
|
||||
} /* Hello_User */
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "client.h"
|
||||
#include "channel.h"
|
||||
#include "conf.h"
|
||||
#include "cvs-version.h"
|
||||
#include "lists.h"
|
||||
#include "log.h"
|
||||
#include "parse.h"
|
||||
@@ -167,14 +166,12 @@ main( int argc, const char *argv[] )
|
||||
{
|
||||
ok = false;
|
||||
#ifdef DEBUG
|
||||
if( argv[i][n] == 'd' )
|
||||
{
|
||||
if (argv[i][n] == 'd') {
|
||||
NGIRCd_Debug = true;
|
||||
ok = true;
|
||||
}
|
||||
#endif
|
||||
if( argv[i][n] == 'f' )
|
||||
{
|
||||
if (argv[i][n] == 'f') {
|
||||
if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
|
||||
{
|
||||
/* Ok, next character is a blank */
|
||||
@@ -186,31 +183,38 @@ main( int argc, const char *argv[] )
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
if( argv[i][n] == 'n' )
|
||||
{
|
||||
|
||||
if (argv[i][n] == 'h') {
|
||||
Show_Version();
|
||||
puts(""); Show_Help(); puts("");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (argv[i][n] == 'n') {
|
||||
NGIRCd_NoDaemon = true;
|
||||
ok = true;
|
||||
}
|
||||
if( argv[i][n] == 'p' )
|
||||
{
|
||||
if (argv[i][n] == 'p') {
|
||||
NGIRCd_Passive = true;
|
||||
ok = true;
|
||||
}
|
||||
#ifdef SNIFFER
|
||||
if( argv[i][n] == 's' )
|
||||
{
|
||||
if (argv[i][n] == 's') {
|
||||
NGIRCd_Sniffer = true;
|
||||
ok = true;
|
||||
}
|
||||
#endif
|
||||
if( argv[i][n] == 't' )
|
||||
{
|
||||
if (argv[i][n] == 't') {
|
||||
configtest = true;
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if( ! ok )
|
||||
{
|
||||
if (argv[i][n] == 'V') {
|
||||
Show_Version();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (! ok) {
|
||||
printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] );
|
||||
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME );
|
||||
exit( 1 );
|
||||
@@ -410,12 +414,9 @@ Fill_Version( void )
|
||||
strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
|
||||
strlcat( NGIRCd_VersionAddition, TARGET_OS, sizeof( NGIRCd_VersionAddition ));
|
||||
|
||||
#ifdef CVSDATE
|
||||
snprintf( NGIRCd_Version, sizeof NGIRCd_Version,"%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition);
|
||||
#else
|
||||
snprintf( NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition);
|
||||
#endif
|
||||
} /* Fill_Version */
|
||||
snprintf(NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s",
|
||||
PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition);
|
||||
} /* Fill_Version */
|
||||
|
||||
|
||||
/**
|
||||
@@ -581,8 +582,8 @@ Show_Help( void )
|
||||
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
|
||||
#endif
|
||||
puts( " -t, --configtest read, validate and display configuration; then exit" );
|
||||
puts( " --version output version information and exit" );
|
||||
puts( " --help display this help and exit" );
|
||||
puts( " -V, --version output version information and exit" );
|
||||
puts( " -h, --help display this help and exit" );
|
||||
} /* Show_Help */
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ngIRCd -- The Next Generation IRC Daemon
|
||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -9,11 +9,8 @@
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*/
|
||||
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: parse.c,v 1.72 2008/02/17 13:26:42 alex Exp $";
|
||||
|
||||
/**
|
||||
* @file
|
||||
* IRC command parser and validator.
|
||||
@@ -338,12 +335,35 @@ Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
|
||||
|
||||
|
||||
static bool
|
||||
Validate_Args( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
|
||||
Validate_Args(CONN_ID Idx, REQUEST *Req, bool *Closed)
|
||||
{
|
||||
#ifdef STRICT_RFC
|
||||
int i;
|
||||
#endif
|
||||
|
||||
assert( Idx >= 0 );
|
||||
assert( Req != NULL );
|
||||
*Closed = false;
|
||||
|
||||
#ifdef STRICT_RFC
|
||||
/* CR and LF are never allowed in command parameters.
|
||||
* But since we do accept lines terminated only with CR or LF in
|
||||
* "non-RFC-compliant mode" (besides the correct CR+LF combination),
|
||||
* this check can only trigger in "strict RFC" mode; therefore we
|
||||
* optimize it away otherwise ... */
|
||||
for (i = 0; i < Req->argc; i++) {
|
||||
if (strchr(Req->argv[i], '\r') || strchr(Req->argv[i], '\n')) {
|
||||
Log(LOG_ERR,
|
||||
"Invalid character(s) in parameter (connection %d, command %s)!?",
|
||||
Idx, Req->command);
|
||||
if (!Conn_WriteStr(Idx,
|
||||
"ERROR :Invalid character(s) in parameter!"))
|
||||
*Closed = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
} /* Validate_Args */
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ static void Do_ResolveAddr PARAMS(( const ng_ipaddr_t *Addr, int Sock, int w_fd
|
||||
static void Do_ResolveName PARAMS(( const char *Host, int w_fd ));
|
||||
static bool register_callback PARAMS((RES_STAT *s, void (*cbfunc)(int, short)));
|
||||
|
||||
#ifdef WANT_IPV6
|
||||
extern bool Conf_ConnectIPv4;
|
||||
extern bool Conf_ConnectIPv6;
|
||||
#endif
|
||||
|
||||
static pid_t
|
||||
Resolver_fork(int *pipefds)
|
||||
@@ -270,7 +274,7 @@ ForwardLookup(const char *hostname, array *IpAddr)
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
int res;
|
||||
struct addrinfo *a, *ai_results;
|
||||
static const struct addrinfo hints = {
|
||||
static struct addrinfo hints = {
|
||||
#ifndef WANT_IPV6
|
||||
.ai_family = AF_INET,
|
||||
#endif
|
||||
@@ -280,6 +284,14 @@ ForwardLookup(const char *hostname, array *IpAddr)
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_protocol = IPPROTO_TCP
|
||||
};
|
||||
#ifdef WANT_IPV6
|
||||
assert(Conf_ConnectIPv6 || Conf_ConnectIPv4);
|
||||
|
||||
if (!Conf_ConnectIPv6)
|
||||
hints.ai_family = AF_INET;
|
||||
if (!Conf_ConnectIPv4)
|
||||
hints.ai_family = AF_INET6;
|
||||
#endif
|
||||
res = getaddrinfo(hostname, NULL, &hints, &ai_results);
|
||||
switch (res) {
|
||||
case 0: break;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
MotdFile = ngircd-test.motd
|
||||
AdminEMail = admin@irc.server
|
||||
MaxConnectionsIP = 0
|
||||
ServerUID = 1
|
||||
ServerGID = 1
|
||||
OperCanUseMode = yes
|
||||
|
||||
[Operator]
|
||||
|
||||
Reference in New Issue
Block a user