mirror of
https://github.com/osmarks/ngircd.git
synced 2025-06-21 15:54:08 +00:00
Implement WEBIRC command
The WEBIRC command is used by some Web-to-IRC gateways to set the correct user name and host name of users instead of their own. Syntax: WEBIRC <password> <username> <hostname> <ip-address> The <password> must be set using the new configuration variable "WebircPassword" in the [Global] section of ngircd.conf. Please note that the <ip-address> is currently not used by ngIRCd (we don't store it in the CLIENT structure, only the resolved hostname).
This commit is contained in:
parent
53fc0ebff6
commit
6e8cf51bb2
@ -28,9 +28,15 @@
|
|||||||
# LINKS requests for example.
|
# LINKS requests for example.
|
||||||
Info = Server Info Text
|
Info = Server Info Text
|
||||||
|
|
||||||
# Global password for all users needed to connect to the server
|
# Global password for all users needed to connect to the server.
|
||||||
|
# (Default: not set)
|
||||||
;Password = abc
|
;Password = abc
|
||||||
|
|
||||||
|
# Password required for using the WEBIRC command used by some
|
||||||
|
# Web-to-IRC gateways. If not set/empty, the WEBIRC command can't
|
||||||
|
# be used. (Default: not set)
|
||||||
|
;WebircPassword = xyz
|
||||||
|
|
||||||
# Information about the server and the administrator, used by the
|
# Information about the server and the administrator, used by the
|
||||||
# ADMIN command. Not required by server but by RFC!
|
# ADMIN command. Not required by server but by RFC!
|
||||||
;AdminInfo1 = Description
|
;AdminInfo1 = Description
|
||||||
|
@ -73,6 +73,11 @@ example.
|
|||||||
Global password for all users needed to connect to the server. The default
|
Global password for all users needed to connect to the server. The default
|
||||||
is empty, so no password is required.
|
is empty, so no password is required.
|
||||||
.TP
|
.TP
|
||||||
|
\fBWebircPassword\fR
|
||||||
|
Password required for using the WEBIRC command used by some Web-to-IRC
|
||||||
|
gateways. If not set or empty, the WEBIRC command can't be used.
|
||||||
|
Default: not set.
|
||||||
|
.TP
|
||||||
\fBAdminInfo1\fR, \fBAdminInfo2\fR, \fBAdminEMail\fR
|
\fBAdminInfo1\fR, \fBAdminInfo2\fR, \fBAdminEMail\fR
|
||||||
Information about the server and the administrator, used by the ADMIN
|
Information about the server and the administrator, used by the ADMIN
|
||||||
command.
|
command.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2009 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -291,16 +291,17 @@ Conf_Test( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
puts( "[GLOBAL]" );
|
puts( "[GLOBAL]" );
|
||||||
printf( " Name = %s\n", Conf_ServerName );
|
printf(" Name = %s\n", Conf_ServerName);
|
||||||
printf( " Info = %s\n", Conf_ServerInfo );
|
printf(" Info = %s\n", Conf_ServerInfo);
|
||||||
printf( " Password = %s\n", Conf_ServerPwd );
|
printf(" Password = %s\n", Conf_ServerPwd);
|
||||||
printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 );
|
printf(" WebircPassword = %s\n", Conf_WebircPwd);
|
||||||
printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
|
printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1);
|
||||||
printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
|
printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2);
|
||||||
printf( " MotdFile = %s\n", Conf_MotdFile );
|
printf(" AdminEMail = %s\n", Conf_ServerAdminMail);
|
||||||
printf( " MotdPhrase = %s\n", Conf_MotdPhrase );
|
printf(" MotdFile = %s\n", Conf_MotdFile);
|
||||||
printf( " ChrootDir = %s\n", Conf_Chroot );
|
printf(" MotdPhrase = %s\n", Conf_MotdPhrase);
|
||||||
printf( " PidFile = %s\n", Conf_PidFile);
|
printf(" ChrootDir = %s\n", Conf_Chroot);
|
||||||
|
printf(" PidFile = %s\n", Conf_PidFile);
|
||||||
printf(" Listen = %s\n", Conf_ListenAddress);
|
printf(" Listen = %s\n", Conf_ListenAddress);
|
||||||
fputs(" Ports = ", stdout);
|
fputs(" Ports = ", stdout);
|
||||||
ports_puts(&Conf_ListenPorts);
|
ports_puts(&Conf_ListenPorts);
|
||||||
@ -845,6 +846,13 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
|||||||
Config_Error_TooLong( Line, Var );
|
Config_Error_TooLong( Line, Var );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (strcasecmp(Var, "WebircPassword") == 0) {
|
||||||
|
/* Password required for WEBIRC command */
|
||||||
|
len = strlcpy(Conf_WebircPwd, Arg, sizeof(Conf_WebircPwd));
|
||||||
|
if (len >= sizeof(Conf_WebircPwd))
|
||||||
|
Config_Error_TooLong(Line, Var);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if( strcasecmp( Var, "AdminInfo1" ) == 0 ) {
|
if( strcasecmp( Var, "AdminInfo1" ) == 0 ) {
|
||||||
/* Administrative info #1 */
|
/* Administrative info #1 */
|
||||||
len = strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 ));
|
len = strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 ));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -188,6 +188,9 @@ GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *H
|
|||||||
|
|
||||||
GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
|
GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
|
||||||
|
|
||||||
|
/* Password required by WEBIRC command */
|
||||||
|
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1999,10 +1999,14 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
|
|||||||
c = Conn_GetClient( i );
|
c = Conn_GetClient( i );
|
||||||
assert( c != NULL );
|
assert( c != NULL );
|
||||||
|
|
||||||
/* Only update client information of unregistered clients */
|
/* Only update client information of unregistered clients.
|
||||||
if( Client_Type( c ) == CLIENT_UNKNOWN ) {
|
* Note: user commands (e. g. WEBIRC) are always read _after_ reading
|
||||||
strlcpy(My_Connections[i].host, readbuf, sizeof( My_Connections[i].host));
|
* the resolver results, so we don't have to worry to override settings
|
||||||
Client_SetHostname( c, readbuf);
|
* from these commands here. */
|
||||||
|
if(Client_Type(c) == CLIENT_UNKNOWN) {
|
||||||
|
strlcpy(My_Connections[i].host, readbuf,
|
||||||
|
sizeof(My_Connections[i].host));
|
||||||
|
Client_SetHostname(c, readbuf);
|
||||||
#ifdef IDENTAUTH
|
#ifdef IDENTAUTH
|
||||||
++identptr;
|
++identptr;
|
||||||
if (*identptr) {
|
if (*identptr) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -557,6 +557,31 @@ IRC_SERVICE(CLIENT *Client, REQUEST *Req)
|
|||||||
} /* IRC_SERVICE */
|
} /* IRC_SERVICE */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for the IRC command "WEBIRC".
|
||||||
|
* Syntax: WEBIRC <password> <username> <real-hostname> <real-IP-address>
|
||||||
|
*/
|
||||||
|
GLOBAL bool
|
||||||
|
IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
|
||||||
|
{
|
||||||
|
/* Exactly 4 parameters are requited */
|
||||||
|
if (Req->argc != 4)
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||||
|
Client_ID(Client), Req->command);
|
||||||
|
|
||||||
|
if (!Conf_WebircPwd[0] || strcmp(Req->argv[0], Conf_WebircPwd) != 0)
|
||||||
|
return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
|
||||||
|
Client_ID(Client));
|
||||||
|
|
||||||
|
LogDebug("Connection %d: got valid WEBIRC command: user=%s, host=%s, ip=%s",
|
||||||
|
Client_Conn(Client), Req->argv[1], Req->argv[2], Req->argv[3]);
|
||||||
|
|
||||||
|
Client_SetUser(Client, Req->argv[1], true);
|
||||||
|
Client_SetHostname(Client, Req->argv[2]);
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_WEBIRC */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,6 +19,7 @@ GLOBAL bool IRC_PASS PARAMS((CLIENT *Client, REQUEST *Req));
|
|||||||
GLOBAL bool IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
GLOBAL bool IRC_USER PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_USER PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
GLOBAL bool IRC_SERVICE PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_SERVICE PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
|
GLOBAL bool IRC_WEBIRC PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
GLOBAL bool IRC_PING PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_PING PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
GLOBAL bool IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
GLOBAL bool IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req));
|
GLOBAL bool IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -103,6 +103,7 @@ static COMMAND My_Commands[] =
|
|||||||
{ "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
{ "WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 0, 0, 0 },
|
||||||
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
|
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
|
||||||
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user