mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-13 10:20:28 +00:00
Add new server config option to disable automatic connect. (Tassilo Schweyer)
This commit is contained in:
parent
fd1091541b
commit
2275add327
@ -14,6 +14,8 @@ ngIRCd HEAD
|
||||
|
||||
- Fixed code that prevented GCC 2.95 to compile ngIRCd.
|
||||
- Adjust path names in manual pages according to "./configure" settings.
|
||||
- Add new server config option to disable automatic connect. (Similar to -p
|
||||
option to ngircd, but only for the specified server) (Tassilo Schweyer)
|
||||
|
||||
ngIRCd 0.10.2 (2007-06-08)
|
||||
|
||||
@ -694,4 +696,4 @@ ngIRCd 0.0.1, 31.12.2001
|
||||
|
||||
|
||||
--
|
||||
$Id: ChangeLog,v 1.317 2007/06/13 14:32:13 alex Exp $
|
||||
$Id: ChangeLog,v 1.318 2007/06/28 05:15:12 fw Exp $
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"
|
||||
.\" $Id: ngircd.conf.5.tmpl,v 1.2 2006/12/29 14:09:49 fw Exp $
|
||||
.\" $Id: ngircd.conf.5.tmpl,v 1.3 2007/06/28 05:15:14 fw Exp $
|
||||
.\"
|
||||
.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
|
||||
.SH NAME
|
||||
@ -214,6 +214,9 @@ Foreign password for this connection. This password has to be configured as
|
||||
.TP
|
||||
\fBGroup\fR
|
||||
Group of this server (optional).
|
||||
\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.
|
||||
.SH [CHANNEL]
|
||||
Pre-defined channels can be configured in
|
||||
.I [Channel]
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.97 2006/12/29 14:09:50 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.98 2007/06/28 05:15:18 fw Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
@ -230,7 +230,8 @@ Conf_Test( void )
|
||||
printf( " Port = %u\n", (unsigned int)Conf_Server[i].port );
|
||||
printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
|
||||
printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
|
||||
printf( " Group = %d\n\n", Conf_Server[i].group );
|
||||
printf( " Group = %d\n", Conf_Server[i].group );
|
||||
printf( " Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
|
||||
}
|
||||
|
||||
for( i = 0; i < Conf_Channel_Count; i++ ) {
|
||||
@ -336,6 +337,24 @@ Conf_EnableServer( char *Name, UINT16 Port )
|
||||
} /* Conf_EnableServer */
|
||||
|
||||
|
||||
GLOBAL bool
|
||||
Conf_EnablePassiveServer(const char *Name)
|
||||
{
|
||||
/* Enable specified server */
|
||||
int i;
|
||||
|
||||
assert( Name != NULL );
|
||||
for (i = 0; i < MAX_SERVERS; i++) {
|
||||
if ((strcasecmp( Conf_Server[i].name, Name ) == 0) && (Conf_Server[i].port > 0)) {
|
||||
/* BINGO! Enable server */
|
||||
Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} /* Conf_EnablePassiveServer */
|
||||
|
||||
|
||||
GLOBAL bool
|
||||
Conf_DisableServer( char *Name )
|
||||
{
|
||||
@ -920,6 +939,11 @@ Handle_SERVER( int Line, char *Var, char *Arg )
|
||||
New_Server.group = atoi( Arg );
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "Passive" ) == 0 ) {
|
||||
if (Check_ArgIsTrue(Arg))
|
||||
New_Server.flags |= CONF_SFLAG_DISABLED;
|
||||
return;
|
||||
}
|
||||
|
||||
Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
|
||||
NGIRCd_ConfFile, Line, Var );
|
||||
|
@ -8,7 +8,7 @@
|
||||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conf.h,v 1.42 2006/12/29 14:09:50 fw Exp $
|
||||
* $Id: conf.h,v 1.43 2007/06/28 05:15:18 fw Exp $
|
||||
*
|
||||
* Configuration management (header)
|
||||
*/
|
||||
@ -142,6 +142,7 @@ GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
|
||||
GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
|
||||
|
||||
GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port ));
|
||||
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 ));
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.27 2006/07/23 15:43:18 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.28 2007/06/28 05:15:18 fw Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
@ -191,12 +191,12 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req)
|
||||
Client_ID(Client));
|
||||
|
||||
/* Bad number of parameters? */
|
||||
if ((Req->argc != 2) && (Req->argc != 5))
|
||||
if ((Req->argc != 1) && (Req->argc != 2) && (Req->argc != 5))
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
/* Invalid port number? */
|
||||
if (atoi(Req->argv[1]) < 1)
|
||||
if ((Req->argc > 1) && atoi(Req->argv[1]) < 1)
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
@ -204,14 +204,22 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req)
|
||||
"Got CONNECT command from \"%s\" for \"%s\".", Client_Mask(Client),
|
||||
Req->argv[0]);
|
||||
|
||||
if (Req->argc == 2) {
|
||||
switch (Req->argc) {
|
||||
case 1:
|
||||
if (!Conf_EnablePassiveServer(Req->argv[0]))
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
|
||||
Client_ID(Client),
|
||||
Req->argv[0]);
|
||||
break;
|
||||
case 2:
|
||||
/* Connect configured server */
|
||||
if (!Conf_EnableServer
|
||||
(Req->argv[0], (UINT16) atoi(Req->argv[1])))
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
|
||||
Client_ID(Client),
|
||||
Req->argv[0]);
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
/* Add server */
|
||||
if (!Conf_AddServer
|
||||
(Req->argv[0], (UINT16) atoi(Req->argv[1]), Req->argv[2],
|
||||
|
Loading…
Reference in New Issue
Block a user