1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-11-27 18:45:15 +00:00

Compare commits

...

28 Commits

Author SHA1 Message Date
Alexander Barton
4726e36efc Changed version string back to "0.6.x-CVS". 2003-03-09 22:33:19 +00:00
Alexander Barton
3105bd9fff Updated documentation. 2003-03-09 20:16:57 +00:00
Alexander Barton
cb8ed9d5da ngIRCd now handles recursive calls to Conn_Close() correctly (from HEAD). 2003-03-09 20:16:46 +00:00
Alexander Barton
a156641afd Updated version number to 0.6.1 :-) 2003-01-21 21:23:34 +00:00
Alexander Barton
78752bbff8 Updated documentation. 2003-01-21 21:20:19 +00:00
Alexander Barton
90e6ec3f89 The server didn't validate weather the target user of a channel user mode
change is a valid channel member or not (from HEAD).
2003-01-21 21:05:19 +00:00
Alexander Barton
9810da343c - Non-memers of a channel could crash the server when trying to change its modes. (HEAD) 2003-01-17 19:08:57 +00:00
Alexander Barton
e8b99f4d3a - Updated documentation. 2003-01-17 19:07:15 +00:00
Alexander Barton
84efd5e969 - Removed strl[cat|cpy]() function calls ... 2003-01-08 23:13:45 +00:00
Alexander Barton
33927ee854 - Fixed up previous CHANINFO patch ... 2003-01-08 23:09:34 +00:00
Alexander Barton
3d46fc6036 - Changed semantics of Client_SetAway() [from HEAD]. 2003-01-08 23:09:04 +00:00
Alexander Barton
ac587adc69 - MODE returns the key and user limit for channel members correctly now. [Head] 2003-01-08 23:08:12 +00:00
Alexander Barton
2688829ddd - Updated documentation. 2003-01-08 23:07:57 +00:00
Alexander Barton
4294dd8043 - Updated documentation. 2003-01-08 20:36:57 +00:00
Alexander Barton
6b9ce1cb72 - Fixed up broken patch (once again -- *ARGL*) ... 2003-01-08 20:32:17 +00:00
Alexander Barton
72a4c0489f - CHANINFO: Fixed up broken fix ... 2003-01-08 20:22:57 +00:00
Alexander Barton
60a4085c38 - fixed up propagation of modes with arguments between servers. 2003-01-08 17:47:48 +00:00
Alexander Barton
5206ab302d - Updated documentation. 2003-01-08 17:47:43 +00:00
Alexander Barton
635afd660d - Updated documentation. 2003-01-05 23:04:12 +00:00
Alexander Barton
5b3d89312e - CVS date is in ISO format now (YYYY-MM-DD) [from HEAD]. 2003-01-04 10:58:15 +00:00
Alexander Barton
f7c1242979 - the server sets a correct default AWAY message when receiving a "MODE +a". 2003-01-02 18:03:05 +00:00
Alexander Barton
822d3d12c8 - Adjusted copyright banner to include 2003 :-) 2003-01-01 13:47:42 +00:00
Alexander Barton
7de53b1903 - Fixed up command forwarding: only to servers! (from CVS-HEAD) 2003-01-01 13:46:37 +00:00
Alexander Barton
9e3def72e0 - Updated documentation. 2003-01-01 13:46:06 +00:00
Alexander Barton
3da58202e6 - Fixed up bad test if we are still connected in KILL. 2002-12-31 15:48:33 +00:00
Alexander Barton
ec016a89e2 - Fixed up KILL once more: it can't kill other clients than valid users now. 2002-12-27 13:37:43 +00:00
Alexander Barton
1bcc64721f - Fixed KILL: you can't crash the server by killing yourself any more;
and ngIRCd no longer sends a QUIT to other servers after the KILL. (HEAD)
2002-12-26 19:01:29 +00:00
Alexander Barton
939ec25f72 - Changed version string to "0.6.x-CVS". 2002-12-26 18:48:44 +00:00
14 changed files with 203 additions and 105 deletions

View File

@@ -1,15 +1,40 @@
ngIRCd - Next Generation IRC Server
(c)2001,2002 by Alexander Barton,
(c)2001-2003 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd ist freie Software und steht unter
der GNU General Public License.
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- ChangeLog / Aenderungen --
ngIRCd 0.6.x
- Conn_Close() now handles recurisive calls for the same link correctly.
ngIRCd 0.6.1, 2002-01-21
- 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
can kill only valid users now.
- The server no longer forwards commands to ordinary users, instead it
answers with the correct error message ("no such server") now.
- WHOIS commands weren't always forwarded as requested.
- The server sets a correct default AWAY message now when propagating
between servers (bug introduced in 0.6.0).
- Fixed up and enhanced CHANINFO command: channel keys and user limits
are syncronized between servers now, too.
- MODE returns the key and user limit for channel members correctly now.
- Non-members of a channel could crash the server when trying to change
its modes or modes of its members.
- The server didn't validate weather a target user is a valid channel
member when changing his channel user modes which could crash ngIRCd.
Older changes (sorry, only available in german language):
ngIRCd 0.6.0, 2002-12-24
ngIRCd 0.6.0-pre2, 2002-12-23
@@ -369,4 +394,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.147.2.3 2002/12/24 13:53:54 alex Exp $
$Id: ChangeLog,v 1.147.2.14 2003/03/09 20:16:57 alex Exp $

View File

@@ -1,15 +1,14 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# 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.
#
# $Id: configure.in,v 1.69.2.3 2002/12/24 13:54:09 alex Exp $
# $Id: configure.in,v 1.69.2.6 2003/03/09 22:33:19 alex Exp $
#
# -- Initialisierung --
@@ -18,7 +17,7 @@ AC_INIT
AC_PREREQ(2.50)
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR(src/config.h.in)
AM_INIT_AUTOMAKE(ngircd,0.6.0)
AM_INIT_AUTOMAKE(ngircd,0.6.x-CVS)
AM_CONFIG_HEADER(src/config.h)
# -- Templates fuer config.h --

View File

@@ -1,5 +1,5 @@
%define name ngircd
%define version 0.6.0
%define version 0.6.1
%define release 1
%define prefix %{_prefix}

View File

@@ -90,11 +90,11 @@ Folgende <serverflags> sind zur Zeit definiert:
II.2 Channel-Modes, persistente Channel und Topic austauschen
Befehl: CHANINFO
Parameter: <channel> +<mode> [<topic>]
Parameter: <channel> +<modes> [[<key> <maxusers>] <topic>]
Fuer: Server
Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
Modes und dessen Topic. <topic> ist optional.
Modes, Channel-Key, User-Limit und dessen Topic. <topic> ist optional.
Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
@@ -104,6 +104,12 @@ ignoriert.
Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
erzeugt.
Hat ein Channel keinen Key (in <modes> ist der Mode "k" nicht vorhanden),
so muss der Parameter <key> ignoriert werden (da <key> vorhanden sein muss,
sollte in diesem Fall "*" uebergeben werden). Hat er kein User-Limit (kein
"l" in <modes>), so muss <limit> ignoriert werden (<limit> sollte hierbei
als "0" uebergeben werden).
--
$Id: Protocol.txt,v 1.5 2002/09/04 00:06:19 alex Exp $
$Id: Protocol.txt,v 1.5.4.1 2003/01/08 20:36:57 alex Exp $

View File

@@ -9,7 +9,7 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.31 2002/12/12 12:36:41 alex Exp $
# $Id: Makefile.am,v 1.31.2.1 2003/01/04 10:58:15 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -65,7 +65,8 @@ ngircd.c: cvs-date cvs-version.h
cvs-date:
grep VERSION ../config.h | grep "CVS" \
&& echo "#define CVSDATE \"$$( grep "\$$Id" $(srcdir)/*.c \
| awk "{ print \$$9 }" | sort | tail -n 1 )\"" > cvs-version.new \
| $(AWK) "{ print \$$9 }" | sort | tail -1 \
| sed -e "s/\//-/g" )\"" > cvs-version.new \
|| echo "" > cvs-version.new
diff cvs-version.h cvs-version.new || cp cvs-version.new cvs-version.h

View File

@@ -17,7 +17,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.65.2.1 2002/12/22 23:42:28 alex Exp $";
static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -394,24 +394,14 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
GLOBAL VOID
Client_SetAway( CLIENT *Client, CHAR *Txt )
{
/* Von einem Client gelieferte AWAY-Nachricht */
/* Set AWAY reason of client */
assert( Client != NULL );
assert( Txt != NULL );
if( Txt )
{
/* Client AWAY setzen */
strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
Client_ModeAdd( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
}
else
{
/* AWAY loeschen */
Client_ModeDel( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is no longer away.", Client_Mask( Client ));
}
strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
} /* Client_SetAway */

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conn.c,v 1.106 2002/12/18 13:50:22 alex Exp $";
static char UNUSED id[] = "$Id: conn.c,v 1.106.2.1 2003/03/09 20:16:46 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -574,6 +574,18 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
assert( Idx > NONE );
assert( My_Connections[Idx].sock > NONE );
/* Is this link already shutting down? */
if( My_Connections[Idx].options & CONN_ISCLOSING )
{
/* Conn_Close() has been called recursively for this link;
* probabe reason: Try_Write() failed -- see below. */
return;
}
/* Mark link as "closing" */
My_Connections[Idx].options |= CONN_ISCLOSING;
/* Search client, if any */
c = Client_GetFromConn( Idx );
if( InformClient )
@@ -592,9 +604,8 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
if( My_Connections[Idx].sock == NONE ) return;
}
/* zunaechst versuchen, noch im Schreibpuffer vorhandene
* Daten auf den Socket zu schreiben ... */
Try_Write( Idx );
/* Try to write out the write buffer */
(VOID)Try_Write( Idx );
if( close( My_Connections[Idx].sock ) != 0 )
{

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn.h,v 1.26 2002/12/18 13:50:22 alex Exp $
* $Id: conn.h,v 1.26.2.1 2003/03/09 20:16:46 alex Exp $
*
* Connection management (header)
*/
@@ -18,11 +18,13 @@
#define __conn_h__
#include <time.h> /* wg. time_t, s.u. */
#include <time.h> /* fro time_t, see below */
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
#ifdef USE_ZLIB
#define CONN_ZIP 4 /* Kompression mit zlib */
#define CONN_ZIP 2 /* zlib compressed link */
#endif

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.21 2002/12/16 23:06:46 alex Exp $";
static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -326,7 +326,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
@@ -365,18 +365,24 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
CLIENT *from;
CHANNEL *chan;
CHAR *ptr;
INT arg_topic;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Bad number of parameters? */
if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From-Server suchen */
/* Compatibility kludge */
if( Req->argc == 5 ) arg_topic = 4;
else if( Req->argc == 3 ) arg_topic = 2;
else arg_topic = -1;
/* Search origin */
from = Client_Search( Req->prefix );
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Channel suchen bzw. erzeugen */
/* Search or create channel */
chan = Channel_Search( Req->argv[0] );
if( ! chan ) chan = Channel_Create( Req->argv[0] );
if( ! chan ) return CONNECTED;
@@ -386,27 +392,36 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
ptr = Channel_Modes( chan );
if( ! *ptr )
{
/* OK, es sind noch keine Modes gesetzt */
/* OK, this channel doesn't have modes jet, set the received ones: */
Channel_SetModes( chan, &Req->argv[1][1] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], &Req->argv[1][1] );
/* Delete modes which we never want to inherit */
Channel_ModeDel( chan, 'l' );
Channel_ModeDel( chan, 'k' );
/* Inform members of this channel */
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], Channel_Modes( chan ));
}
}
else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
if( Req->argc == 3 )
if( arg_topic > 0 )
{
/* Es wurde auch ein Topic mit uebermittelt */
/* We got a topic */
ptr = Channel_Topic( chan );
if( ! *ptr )
if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
{
/* OK, es ist bisher kein Topic gesetzt */
Channel_SetTopic( chan, Req->argv[2] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[2] );
/* OK, there is no topic jet */
Channel_SetTopic( chan, Req->argv[arg_topic] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan ));
}
}
/* an andere Server forwarden */
IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
/* Forward CHANINFO to other serevrs */
if( Req->argc == 5 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4] );
else if( Req->argc == 3 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
else IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1] );
return CONNECTED;
} /* IRC_CHANINFO */

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.1 2002/12/22 23:42:28 alex Exp $";
static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -62,7 +62,7 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if( ! target ) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
@@ -141,7 +141,7 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req )
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
}
@@ -184,7 +184,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
}
@@ -219,7 +219,7 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
@@ -254,7 +254,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
@@ -349,7 +349,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
@@ -426,7 +426,7 @@ IRC_TIME( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
@@ -504,7 +504,7 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if( ! target ) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
@@ -596,40 +596,39 @@ GLOBAL BOOLEAN
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CHAR str[LINE_LEN + 1], *ptr = NULL;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
/* Bad number of parameters? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Client suchen */
/* Search client */
c = Client_Search( Req->argv[Req->argc - 1] );
if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
/* Empfaenger des WHOIS suchen */
/* Search sender of the WHOIS */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Forwarden an anderen Server? */
/* Forward to other server? */
if( Req->argc > 1 )
{
/* angegebenen Ziel-Server suchen */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
ptr = Req->argv[1];
/* Search target server (can be specified as nick of that server!) */
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
}
else target = Client_ThisServer( );
assert( target != NULL );
if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], ptr );
if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], Req->argv[1] );
/* Nick, User und Name */
/* Nick, user and name */
if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
/* Server */
@@ -643,7 +642,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
chan = Channel_GetChannel( cl2chan );
assert( chan != NULL );
/* Channel-Name anhaengen */
/* Concatenate channel names */
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
@@ -651,17 +650,17 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
/* Line becomes too long: send it! */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
}
/* naechstes Mitglied suchen */
/* next */
cl2chan = Channel_NextChannelOf( c, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* Es sind noch Daten da, die gesendet werden muessen */
/* There is data left to send: */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
@@ -671,7 +670,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
}
/* Idle (nur lokale Clients) */
/* Idle (only local clients) */
if( Client_Conn( c ) > NONE )
{
if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.1 2002/12/22 23:42:28 alex Exp $";
static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -371,7 +371,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
{
/* es wurde ein Ziel-Client angegeben */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* ok, forwarden */
@@ -403,7 +403,7 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* ok, forwarden */

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.24 2002/12/18 14:16:21 alex Exp $";
static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -156,7 +156,11 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
{
case 'a':
/* Away */
if( Client_Type( Client ) == CLIENT_SERVER ) x[0] = 'a';
if( Client_Type( Client ) == CLIENT_SERVER )
{
x[0] = 'a';
Client_SetAway( Client, DEFAULT_AWAY_MSG );
}
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
break;
case 'i':
@@ -242,11 +246,42 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
LONG l;
/* Mode request: let's answer it :-) */
if( Req->argc == 1 ) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
if( Req->argc == 1 )
{
/* Member or not? -- That's the question! */
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
/* The sender is a member: generate extended reply */
strcpy( the_modes, Channel_Modes( Channel ));
mode_ptr = the_modes;
strcpy( the_args, "" );
while( *mode_ptr )
{
switch( *mode_ptr )
{
case 'l':
snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
strcat( the_args, argadd );
break;
case 'k':
strcat( the_args, " " );
strcat( the_args, Channel_Key( Channel ));
break;
}
mode_ptr++;
}
if( the_args[0] ) strcat( the_modes, the_args );
return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes );
}
/* Is the user allowed to change modes? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Is the originating user on that channel? */
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel ));
/* Is he channel operator? */
if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
else modeok = FALSE;
if( Conf_OperCanMode )
@@ -472,6 +507,13 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Is there a valid mode change? */
if( ! x[0] ) continue;
/* Validate target client */
if( client && ( ! Channel_IsMemberOf( Channel, client )))
{
if( ! IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( client ), Channel_Name( Channel ))) break;
continue;
}
if( set )
{
/* Set mode */
@@ -569,13 +611,14 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
{
/* AWAY setzen */
Client_SetAway( Client, Req->argv[0] );
Client_ModeAdd( Client, 'a' );
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
}
else
{
/* AWAY loeschen */
Client_SetAway( Client, NULL );
Client_ModeDel( Client, 'a' );
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
}

View File

@@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc.c,v 1.107 2002/12/12 12:24:18 alex Exp $";
static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -52,14 +52,15 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
{
CLIENT *prefix, *c;
CHAR reason[COMMAND_LEN];
CONN_ID my_conn, conn;
assert( Client != NULL );
assert( Req != NULL );
/* is the user an IRC operator? */
/* Is the user an IRC operator? */
if(( Client_Type( Client ) != CLIENT_SERVER ) && ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
/* Bad number of parameters? */
if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->prefix ) prefix = Client_Search( Req->prefix );
@@ -72,24 +73,30 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
/* build reason string */
/* Build reason string */
if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
else strcpy( reason, Req->argv[1] );
/* andere Server benachrichtigen */
/* Inform other servers */
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
/* Save ID of this connection */
my_conn = Client_Conn( Client );
/* haben wir selber einen solchen Client? */
/* Do we host such a client? */
c = Client_Search( Req->argv[0] );
if( c )
if( c && Client_Type( c ) == CLIENT_USER )
{
/* Ja, wir haben einen solchen Client */
if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
else Client_Destroy( c, NULL, reason, TRUE );
/* Yes, I found it! */
conn = Client_Conn( c );
Client_Destroy( c, NULL, reason, FALSE );
if( conn != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
}
else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
return CONNECTED;
/* Are we still connected or were we killed, too? */
if( Client_GetFromConn( my_conn )) return CONNECTED;
else return DISCONNECTED;
} /* IRC_KILL */

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2003 by 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,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.64 2002/12/12 11:31:21 alex Exp $";
static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -506,7 +506,7 @@ LOCAL VOID
Show_Version( VOID )
{
puts( NGIRCd_Version( ));
puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
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." );