mirror of
https://github.com/osmarks/ngircd.git
synced 2025-03-04 00:18:10 +00:00
Allow ngIRCd to detect services connected to an "virtual services server".
Introduce a new configuration variable "ServiceMask" in SERVER blocks to define a mask matching nick names that should be treated as services. Regular servers don't need this parameter (leave it empty, the default), but you should set it to "*Serv" when connection ircservices, for example. This patch allows ngIRCd to detect services, it doesn't change the functionality: you only get different log messages ;-)
This commit is contained in:
parent
c5342fb467
commit
02d7623074
@ -42,6 +42,7 @@
|
||||
#include "client.h"
|
||||
#include "defines.h"
|
||||
#include "log.h"
|
||||
#include "match.h"
|
||||
#include "resolve.h"
|
||||
#include "tool.h"
|
||||
|
||||
@ -292,6 +293,7 @@ Conf_Test( void )
|
||||
#endif
|
||||
printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
|
||||
printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
|
||||
printf( " ServiceMask = %s\n", Conf_Server[i].svs_mask);
|
||||
printf( " Group = %d\n", Conf_Server[i].group );
|
||||
printf( " Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
|
||||
}
|
||||
@ -469,6 +471,16 @@ Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd
|
||||
} /* Conf_AddServer */
|
||||
|
||||
|
||||
/**
|
||||
* Check if the given nick name is an service
|
||||
*/
|
||||
GLOBAL bool
|
||||
Conf_IsService(int ConfServer, char *Nick)
|
||||
{
|
||||
return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
|
||||
} /* Conf_IsService */
|
||||
|
||||
|
||||
static void
|
||||
Set_Defaults( bool InitServers )
|
||||
{
|
||||
@ -1128,6 +1140,13 @@ Handle_SERVER( int Line, char *Var, char *Arg )
|
||||
New_Server.flags |= CONF_SFLAG_DISABLED;
|
||||
return;
|
||||
}
|
||||
if (strcasecmp(Var, "ServiceMask") == 0) {
|
||||
len = strlcpy(New_Server.svs_mask, ngt_LowerStr(Arg),
|
||||
sizeof(New_Server.svs_mask));
|
||||
if (len >= sizeof(New_Server.svs_mask))
|
||||
Config_Error_TooLong(Line, Var);
|
||||
return;
|
||||
}
|
||||
|
||||
Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
|
||||
NGIRCd_ConfFile, Line, Var );
|
||||
|
@ -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
|
||||
@ -8,8 +8,6 @@
|
||||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conf.h,v 1.49 2008/03/18 20:12:47 fw Exp $
|
||||
*
|
||||
* Configuration management (header)
|
||||
*/
|
||||
|
||||
@ -47,11 +45,14 @@ typedef struct _Conf_Server
|
||||
RES_STAT res_stat; /* Status of the resolver */
|
||||
int flags; /* Flags */
|
||||
CONN_ID conn_id; /* ID of server connection or NONE */
|
||||
ng_ipaddr_t bind_addr; /* source address to use for outgoing connections */
|
||||
ng_ipaddr_t bind_addr; /* source address to use for outgoing
|
||||
connections */
|
||||
ng_ipaddr_t dst_addr[2]; /* list of addresses to connect to */
|
||||
#ifdef SSL_SUPPORT
|
||||
bool SSLConnect; /* connect() using SSL? */
|
||||
#endif
|
||||
char svs_mask[CLIENT_ID_LEN]; /* Mask of nick names that are
|
||||
services */
|
||||
} CONF_SERVER;
|
||||
|
||||
|
||||
@ -181,6 +182,8 @@ GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
|
||||
GLOBAL bool Conf_DisableServer PARAMS(( char *Name ));
|
||||
GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ));
|
||||
|
||||
GLOBAL bool Conf_IsService PARAMS((int ConfServer, char *Nick));
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -368,7 +368,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
|
||||
* RFC 1459: announce the new client only after receiving the
|
||||
* USER command, first we need more information! */
|
||||
if (Req->argc < 7) {
|
||||
LogDebug("User \"%s\" is beeing registered (RFC 1459) ...",
|
||||
LogDebug("Client \"%s\" is beeing registered (RFC 1459) ...",
|
||||
Client_Mask(c));
|
||||
Client_SetType(c, CLIENT_GOTNICK);
|
||||
} else
|
||||
@ -743,11 +743,17 @@ Kill_Nick( char *Nick, char *Reason )
|
||||
static void
|
||||
Introduce_Client(CLIENT *From, CLIENT *Client)
|
||||
{
|
||||
char *type;
|
||||
|
||||
Client_SetType(Client, CLIENT_USER);
|
||||
|
||||
if (From) {
|
||||
LogDebug("User \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
|
||||
Client_Mask(Client), Client_Modes(Client),
|
||||
if (Conf_IsService(Conf_GetServer(Client_Conn(From)), Client_ID(Client))) {
|
||||
type = "Service";
|
||||
} else
|
||||
type = "User";
|
||||
LogDebug("%s \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
|
||||
type, Client_Mask(Client), Client_Modes(Client),
|
||||
Client_ID(From), Client_ID(Client_Introducer(Client)),
|
||||
Client_Hops(Client), Client_Hops(Client) > 1 ? "s": "");
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user