mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 03:03:12 +02:00
Removed some useless code and added more modules
This commit is contained in:
+19
-3
@@ -32,8 +32,8 @@ R_MODULES=m_sethost.so m_chghost.so m_chgident.so m_setname.so \
|
||||
m_kline.so m_lag.so m_message.so m_nachat.so m_oper.so m_pingpong.so \
|
||||
m_quit.so m_rakill.so m_rping.so m_sendumode.so m_sqline.so \
|
||||
m_tsctl.so m_unkline.so m_unsqline.so m_unzline.so m_whois.so \
|
||||
m_zline.so m_tkl.so invisibility.so \
|
||||
scan.so scan_socks.so scan_http.so web/httpd.so
|
||||
m_zline.so m_tkl.so m_vhost.so m_cycle.so m_svsjoin.so m_svspart.so \
|
||||
invisibility.so scan.so scan_socks.so scan_http.so web/httpd.so
|
||||
|
||||
COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \
|
||||
m_sdesc.c m_svsmode.c m_swhois.c m_svsmotd.c m_svsnline.c \
|
||||
@@ -42,7 +42,7 @@ COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \
|
||||
m_kline.c m_lag.c m_message.c m_nachat.c m_oper.c m_pingpong.c \
|
||||
m_quit.c m_rakill.c m_rping.c m_sendumode.c m_sqline.c \
|
||||
m_tsctl.c m_unkline.c m_unsqline.c m_unzline.c m_whois.c \
|
||||
m_zline.c m_tkl.c
|
||||
m_zline.c m_tkl.c m_vhost.c m_cycle.c m_svsjoin.c m_svspart.c
|
||||
|
||||
|
||||
MODULES=commands.so $(R_MODULES)
|
||||
@@ -226,6 +226,22 @@ m_tkl.so: m_tkl.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o m_tkl.so m_tkl.c
|
||||
|
||||
m_vhost.so: m_vhost.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o m_vhost.so m_vhost.c
|
||||
|
||||
m_cycle.so: m_cycle.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o m_cycle.so m_cycle.c
|
||||
|
||||
m_svsjoin.so: m_svsjoin.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o m_svsjoin.so m_svsjoin.c
|
||||
|
||||
m_svspart.so: m_svspart.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o m_svspart.so m_svspart.c
|
||||
|
||||
scan.so: scan.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o scan.so scan.c
|
||||
|
||||
@@ -85,7 +85,8 @@ extern int m_message_Init(ModuleInfo *modinfo), m_whois_Init(ModuleInfo *modinfo
|
||||
extern int m_kill_Init(ModuleInfo *modinfo), m_pingpong_Init(ModuleInfo *modinfo), m_oper_Init(ModuleInfo *modinfo);
|
||||
extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo), m_zline_Init(ModuleInfo *modinfo);
|
||||
extern int m_unzline_Init(ModuleInfo *modinfo), m_kline_Init(ModuleInfo *modinfo), m_unkline_Init(ModuleInfo *modinfo);
|
||||
extern int m_sqline_Init(ModuleInfo *modinfo), m_unsqline_Init(ModuleInfo *modinfo), m_tkl_Init(ModuleInfo *modinfo);
|
||||
extern int m_vhost_Init(ModuleInfo *modinfo), m_cycle_Init(ModuleInfo *modinfo), m_svsjoin_Init(ModuleInfo *modinfo);
|
||||
extern int m_svspart_Init(ModuleInfo *modinfo);
|
||||
#ifdef GUEST
|
||||
extern int m_guest_Init(ModuleInfo *modinfo);
|
||||
#endif
|
||||
@@ -109,6 +110,8 @@ extern int m_kill_Load(int module_load), m_pingpong_Load(int module_load), m_ope
|
||||
extern int m_akill_Load(int module_load), m_rakill_Load(int module_load), m_zline_Load(int module_load);
|
||||
extern int m_unzline_Load(int module_load), m_kline_Load(int module_load), m_unkline_Load(int module_load);
|
||||
extern int m_sqline_Load(int module_load), m_unsqline_Load(int module_load), m_tkl_Load(int module_load);
|
||||
extern int m_vhost_Load(int module_load), m_cycle_Load(int module_load), m_svsjoin_Load(int module_load);
|
||||
extern int m_svspart_Load(int module_load);
|
||||
#ifdef GUEST
|
||||
extern int m_guest_Load(int module_load);
|
||||
#endif
|
||||
@@ -128,7 +131,8 @@ extern int m_sendumode_Unload(), m_tsctl_Unload(), m_htm_Unload(), m_chgname_Unl
|
||||
extern int m_message_Unload(), m_whois_Unload(), m_quit_Unload(), m_kill_Unload();
|
||||
extern int m_pingpong_Unload(), m_oper_Unload(), m_akill_Unload(), m_rakill_Unload();
|
||||
extern int m_zline_Unload(), m_unzline_Unload(), m_kline_Unload(), m_unkline_Unload();
|
||||
extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload();
|
||||
extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload(), m_vhost_Unload();
|
||||
extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload();
|
||||
#ifdef GUEST
|
||||
extern int m_guest_Unload();
|
||||
#endif
|
||||
@@ -193,6 +197,10 @@ int l_commands_Init(ModuleInfo *modinfo)
|
||||
m_sqline_Init(&ModCmdsInfo);
|
||||
m_unsqline_Init(&ModCmdsInfo);
|
||||
m_tkl_Init(&ModCmdsInfo);
|
||||
m_vhost_Init(&ModCmdsInfo);
|
||||
m_cycle_Init(&ModCmdsInfo);
|
||||
m_svsjoin_Init(&ModCmdsInfo);
|
||||
m_svspart_Init(&ModCmdsInfo);
|
||||
#ifdef GUEST
|
||||
m_guest_Init(&ModCmdsInfo);
|
||||
#endif
|
||||
@@ -255,6 +263,10 @@ int l_commands_Load(int module_load)
|
||||
m_tkl_Load(module_load);
|
||||
m_sqline_Load(module_load);
|
||||
m_unsqline_Load(module_load);
|
||||
m_vhost_Load(module_load);
|
||||
m_cycle_Load(module_load);
|
||||
m_svsjoin_Load(module_load);
|
||||
m_svspart_Load(module_load);
|
||||
#ifdef GUEST
|
||||
m_guest_Load(module_load);
|
||||
#endif
|
||||
@@ -313,6 +325,10 @@ int l_commands_Unload(int module_unload)
|
||||
m_unkline_Unload();
|
||||
m_sqline_Unload();
|
||||
m_unsqline_Unload();
|
||||
m_vhost_Unload();
|
||||
m_cycle_Unload();
|
||||
m_svsjoin_Unload();
|
||||
m_svspart_Unload();
|
||||
#ifdef GUEST
|
||||
m_guest_Unload();
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Unreal Internet Relay Chat Daemon, src/modules/m_cycle.c
|
||||
* (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
|
||||
*
|
||||
* 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 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "numeric.h"
|
||||
#include "msg.h"
|
||||
#include "channel.h"
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/timeb.h>
|
||||
#include <fcntl.h>
|
||||
#include "h.h"
|
||||
#include "proto.h"
|
||||
#ifdef STRIPBADWORDS
|
||||
#include "badwords.h"
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include "version.h"
|
||||
#endif
|
||||
|
||||
DLLFUNC int m_cycle(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
|
||||
/* Place includes here */
|
||||
#define MSG_CYCLE "CYCLE"
|
||||
#define TOK_CYCLE "BP"
|
||||
|
||||
#ifndef DYNAMIC_LINKING
|
||||
ModuleHeader m_cycle_Header
|
||||
#else
|
||||
#define m_cycle_Header Mod_Header
|
||||
ModuleHeader Mod_Header
|
||||
#endif
|
||||
= {
|
||||
"cycle", /* Name of module */
|
||||
"$Id$", /* Version */
|
||||
"command /cycle", /* Short description of module */
|
||||
"3.2-b8-1",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* The purpose of these ifdefs, are that we can "static" link the ircd if we
|
||||
* want to
|
||||
*/
|
||||
|
||||
/* This is called on module init, before Server Ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
|
||||
#else
|
||||
int m_cycle_Init(ModuleInfo *modinfo)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* We call our add_Command crap here
|
||||
*/
|
||||
add_Command(MSG_CYCLE, TOK_CYCLE, m_cycle, MAXPARA);
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Is first run when server is 100% ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Load(int module_load)
|
||||
#else
|
||||
int m_cycle_Load(int module_load)
|
||||
#endif
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Called when module is unloaded */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Unload(int module_unload)
|
||||
#else
|
||||
int m_cycle_Unload(int module_unload)
|
||||
#endif
|
||||
{
|
||||
if (del_Command(MSG_CYCLE, TOK_CYCLE, m_cycle) < 0)
|
||||
{
|
||||
sendto_realops("Failed to delete commands when unloading %s",
|
||||
m_cycle_Header.name);
|
||||
}
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* m_cycle() - Stskeeps
|
||||
* parv[0] = prefix
|
||||
* parv[1] = channels
|
||||
*/
|
||||
|
||||
CMD_FUNC(m_cycle)
|
||||
{
|
||||
char channels[1024];
|
||||
|
||||
if (parc < 2)
|
||||
return 0;
|
||||
parv[2] = "cycling";
|
||||
strncpy(channels, parv[1], 1020);
|
||||
(void)m_part(cptr, sptr, 3, parv);
|
||||
parv[1] = channels;
|
||||
parv[2] = NULL;
|
||||
return m_join(cptr, sptr, 2, parv);
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Unreal Internet Relay Chat Daemon, src/modules/m_svsjoin.c
|
||||
* (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
|
||||
*
|
||||
* 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 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "numeric.h"
|
||||
#include "msg.h"
|
||||
#include "channel.h"
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/timeb.h>
|
||||
#include <fcntl.h>
|
||||
#include "h.h"
|
||||
#include "proto.h"
|
||||
#ifdef STRIPBADWORDS
|
||||
#include "badwords.h"
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include "version.h"
|
||||
#endif
|
||||
|
||||
DLLFUNC int m_svsjoin(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
|
||||
/* Place includes here */
|
||||
#define MSG_SVSJOIN "SVSJOIN"
|
||||
#define TOK_SVSJOIN "BR"
|
||||
|
||||
#ifndef DYNAMIC_LINKING
|
||||
ModuleHeader m_svsjoin_Header
|
||||
#else
|
||||
#define m_svsjoin_Header Mod_Header
|
||||
ModuleHeader Mod_Header
|
||||
#endif
|
||||
= {
|
||||
"svsjoin", /* Name of module */
|
||||
"$Id$", /* Version */
|
||||
"command /svsjoin", /* Short description of module */
|
||||
"3.2-b8-1",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* The purpose of these ifdefs, are that we can "static" link the ircd if we
|
||||
* want to
|
||||
*/
|
||||
|
||||
/* This is called on module init, before Server Ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
|
||||
#else
|
||||
int m_svsjoin_Init(ModuleInfo *modinfo)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* We call our add_Command crap here
|
||||
*/
|
||||
add_Command(MSG_SVSJOIN, TOK_SVSJOIN, m_svsjoin, MAXPARA);
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Is first run when server is 100% ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Load(int module_load)
|
||||
#else
|
||||
int m_svsjoin_Load(int module_load)
|
||||
#endif
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Called when module is unloaded */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Unload(int module_unload)
|
||||
#else
|
||||
int m_svsjoin_Unload(int module_unload)
|
||||
#endif
|
||||
{
|
||||
if (del_Command(MSG_SVSJOIN, TOK_SVSJOIN, m_svsjoin) < 0)
|
||||
{
|
||||
sendto_realops("Failed to delete commands when unloading %s",
|
||||
m_svsjoin_Header.name);
|
||||
}
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/* m_svsjoin() - Lamego - Wed Jul 21 20:04:48 1999
|
||||
Copied off PTlink IRCd (C) PTlink coders team.
|
||||
parv[0] - sender
|
||||
parv[1] - nick to make join
|
||||
parv[2] - channel(s) to join
|
||||
*/
|
||||
CMD_FUNC(m_svsjoin)
|
||||
{
|
||||
aClient *acptr;
|
||||
if (!IsULine(sptr))
|
||||
return 0;
|
||||
|
||||
if (parc != 3 || !(acptr = find_person(parv[1], NULL)))
|
||||
return 0;
|
||||
|
||||
if (MyClient(acptr))
|
||||
{
|
||||
parv[0] = parv[1];
|
||||
parv[1] = parv[2];
|
||||
(void)m_join(acptr, acptr, 2, parv);
|
||||
}
|
||||
else
|
||||
sendto_one(acptr, ":%s SVSJOIN %s %s", parv[0],
|
||||
parv[1], parv[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Unreal Internet Relay Chat Daemon, src/modules/m_svspart.c
|
||||
* (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
|
||||
*
|
||||
* 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 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "numeric.h"
|
||||
#include "msg.h"
|
||||
#include "channel.h"
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/timeb.h>
|
||||
#include <fcntl.h>
|
||||
#include "h.h"
|
||||
#include "proto.h"
|
||||
#ifdef STRIPBADWORDS
|
||||
#include "badwords.h"
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include "version.h"
|
||||
#endif
|
||||
|
||||
DLLFUNC int m_svspart(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
|
||||
/* Place includes here */
|
||||
#define MSG_SVSPART "SVSPART"
|
||||
#define TOK_SVSPART "BT"
|
||||
|
||||
#ifndef DYNAMIC_LINKING
|
||||
ModuleHeader m_svspart_Header
|
||||
#else
|
||||
#define m_svspart_Header Mod_Header
|
||||
ModuleHeader Mod_Header
|
||||
#endif
|
||||
= {
|
||||
"svspart", /* Name of module */
|
||||
"$Id$", /* Version */
|
||||
"command /svspart", /* Short description of module */
|
||||
"3.2-b8-1",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* The purpose of these ifdefs, are that we can "static" link the ircd if we
|
||||
* want to
|
||||
*/
|
||||
|
||||
/* This is called on module init, before Server Ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
|
||||
#else
|
||||
int m_svspart_Init(ModuleInfo *modinfo)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* We call our add_Command crap here
|
||||
*/
|
||||
add_Command(MSG_SVSPART, TOK_SVSPART, m_svspart, MAXPARA);
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Is first run when server is 100% ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Load(int module_load)
|
||||
#else
|
||||
int m_svspart_Load(int module_load)
|
||||
#endif
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Called when module is unloaded */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Unload(int module_unload)
|
||||
#else
|
||||
int m_svspart_Unload(int module_unload)
|
||||
#endif
|
||||
{
|
||||
if (del_Command(MSG_SVSPART, TOK_SVSPART, m_svspart) < 0)
|
||||
{
|
||||
sendto_realops("Failed to delete commands when unloading %s",
|
||||
m_svspart_Header.name);
|
||||
}
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/* m_svspart() - Lamego - Wed Jul 21 20:04:48 1999
|
||||
Copied off PTlink IRCd (C) PTlink coders team.
|
||||
Modified for PART by Stskeeps
|
||||
parv[0] - sender
|
||||
parv[1] - nick to make part
|
||||
parv[2] - channel(s) to part
|
||||
*/
|
||||
CMD_FUNC(m_svspart)
|
||||
{
|
||||
aClient *acptr;
|
||||
if (!IsULine(sptr))
|
||||
return 0;
|
||||
|
||||
if (parc != 3 || !(acptr = find_person(parv[1], NULL))) return 0;
|
||||
|
||||
if (MyClient(acptr))
|
||||
{
|
||||
parv[0] = parv[1];
|
||||
parv[1] = parv[2];
|
||||
(void)m_part(acptr, acptr, 2, parv);
|
||||
}
|
||||
else
|
||||
sendto_one(acptr, ":%s SVSPART %s %s", parv[0],
|
||||
parv[1], parv[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Unreal Internet Relay Chat Daemon, src/modules/m_vhost.c
|
||||
* (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
|
||||
*
|
||||
* 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 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "numeric.h"
|
||||
#include "msg.h"
|
||||
#include "channel.h"
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/timeb.h>
|
||||
#include <fcntl.h>
|
||||
#include "h.h"
|
||||
#include "proto.h"
|
||||
#ifdef STRIPBADWORDS
|
||||
#include "badwords.h"
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include "version.h"
|
||||
#endif
|
||||
|
||||
DLLFUNC int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
|
||||
/* Place includes here */
|
||||
#define MSG_VHOST "VHOST"
|
||||
#define TOK_VHOST "BE"
|
||||
|
||||
#ifndef DYNAMIC_LINKING
|
||||
ModuleHeader m_vhost_Header
|
||||
#else
|
||||
#define m_vhost_Header Mod_Header
|
||||
ModuleHeader Mod_Header
|
||||
#endif
|
||||
= {
|
||||
"vhost", /* Name of module */
|
||||
"$Id$", /* Version */
|
||||
"command /vhost", /* Short description of module */
|
||||
"3.2-b8-1",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* The purpose of these ifdefs, are that we can "static" link the ircd if we
|
||||
* want to
|
||||
*/
|
||||
|
||||
/* This is called on module init, before Server Ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
|
||||
#else
|
||||
int m_vhost_Init(ModuleInfo *modinfo)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* We call our add_Command crap here
|
||||
*/
|
||||
add_Command(MSG_VHOST, TOK_VHOST, m_vhost, MAXPARA);
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Is first run when server is 100% ready */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Load(int module_load)
|
||||
#else
|
||||
int m_vhost_Load(int module_load)
|
||||
#endif
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Called when module is unloaded */
|
||||
#ifdef DYNAMIC_LINKING
|
||||
DLLFUNC int Mod_Unload(int module_unload)
|
||||
#else
|
||||
int m_vhost_Unload(int module_unload)
|
||||
#endif
|
||||
{
|
||||
if (del_Command(MSG_VHOST, TOK_VHOST, m_vhost) < 0)
|
||||
{
|
||||
sendto_realops("Failed to delete commands when unloading %s",
|
||||
m_vhost_Header.name);
|
||||
}
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
ConfigItem_vhost *vhost;
|
||||
ConfigItem_oper_from *from;
|
||||
char *user, *pwd, host[NICKLEN+USERLEN+HOSTLEN+6], host2[NICKLEN+USERLEN+HOSTLEN+6];
|
||||
int len, length;
|
||||
int i;
|
||||
if (parc < 3)
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
|
||||
me.name, parv[0], "VHOST");
|
||||
return 0;
|
||||
|
||||
}
|
||||
if (!MyClient(sptr))
|
||||
return 0;
|
||||
|
||||
user = parv[1];
|
||||
pwd = parv[2];
|
||||
if (strlen(user) > HOSTLEN)
|
||||
*(user + HOSTLEN) = '\0';
|
||||
|
||||
if (!(vhost = Find_vhost(user))) {
|
||||
sendto_snomask(SNO_VHOST,
|
||||
"[\2vhost\2] Failed login for vhost %s by %s!%s@%s - incorrect password",
|
||||
user, sptr->name,
|
||||
sptr->user->username,
|
||||
sptr->user->realhost);
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** [\2vhost\2] Login for %s failed - password incorrect",
|
||||
me.name, sptr->name, user);
|
||||
return 0;
|
||||
}
|
||||
strlcpy(host, make_user_host(sptr->user->username, sptr->user->realhost), sizeof host);
|
||||
strlcpy(host2, make_user_host(sptr->user->username, (char *)Inet_ia2p(&sptr->ip)), sizeof host2);
|
||||
for (from = (ConfigItem_oper_from *)vhost->from; from; from = (ConfigItem_oper_from *)from->next) {
|
||||
if (!match(from->name, host) || !match(from->name, host2))
|
||||
break;
|
||||
}
|
||||
if (!from) {
|
||||
sendto_snomask(SNO_VHOST,
|
||||
"[\2vhost\2] Failed login for vhost %s by %s!%s@%s - host does not match",
|
||||
user, sptr->name, sptr->user->username, sptr->user->realhost);
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** No vHost lines available for your host",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
i = Auth_Check(cptr, vhost->auth, pwd);
|
||||
if (i > 0)
|
||||
{
|
||||
char olduser[USERLEN+1];
|
||||
if (sptr->user->virthost)
|
||||
{
|
||||
MyFree(sptr->user->virthost);
|
||||
sptr->user->virthost = NULL;
|
||||
}
|
||||
len = strlen(vhost->virthost);
|
||||
length = len > HOSTLEN ? HOSTLEN : len;
|
||||
sptr->user->virthost = MyMalloc(length + 1);
|
||||
strlcpy(sptr->user->virthost, vhost->virthost, length + 1);
|
||||
if (vhost->virtuser) {
|
||||
strcpy(olduser, sptr->user->username);
|
||||
strlcpy(sptr->user->username, vhost->virtuser, USERLEN);
|
||||
}
|
||||
sptr->umodes |= UMODE_HIDE;
|
||||
sptr->umodes |= UMODE_SETHOST;
|
||||
sendto_serv_butone_token(cptr, sptr->name,
|
||||
MSG_SETHOST, TOK_SETHOST,
|
||||
"%s", vhost->virthost);
|
||||
sendto_one(sptr, ":%s MODE %s :+tx",
|
||||
sptr->name, sptr->name);
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Your vhost is now %s%s%s",
|
||||
me.name, sptr->name, vhost->virtuser ? vhost->virtuser : "",
|
||||
vhost->virtuser ? "@" : "", vhost->virthost);
|
||||
sendto_snomask(SNO_VHOST,
|
||||
"[\2vhost\2] %s (%s!%s@%s) is now using vhost %s%s%s",
|
||||
user, sptr->name,
|
||||
vhost->virtuser ? olduser : sptr->user->username,
|
||||
sptr->user->realhost, vhost->virtuser ? vhost->virtuser : "",
|
||||
vhost->virtuser ? "@" : "", vhost->virthost);
|
||||
return 0;
|
||||
}
|
||||
if (i == -1)
|
||||
{
|
||||
sendto_snomask(SNO_VHOST,
|
||||
"[\2vhost\2] Failed login for vhost %s by %s!%s@%s - incorrect password",
|
||||
user, sptr->name,
|
||||
sptr->user->username,
|
||||
sptr->user->realhost);
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** [\2vhost\2] Login for %s failed - password incorrect",
|
||||
me.name, sptr->name, user);
|
||||
return 0;
|
||||
}
|
||||
/* Belay that order, Lt. (upon -2)*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user