1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 21:43:13 +02:00

Removed some useless code and added more modules

This commit is contained in:
codemastr
2002-08-09 20:26:04 +00:00
parent 1aa70c7b77
commit bb95bdfa7c
14 changed files with 679 additions and 254 deletions
+2
View File
@@ -1455,3 +1455,5 @@ seen. gmtime warning still there
- SSL fixes to deal with not allowing SSLv2
*** beta11 released ***
- Removed src/s_unreal.c contained 2 functions, 1 never used, 1 used once
- Removed /hash (did nothing), removed /post (replaced by scan_http)
- Modulized /vhost, /cycle, /svsjoin, /svspart
+6 -8
View File
@@ -299,32 +299,30 @@
extern int m_topic(), m_join(), m_part(), m_mode();
extern int m_wallops(), m_kick();
extern int m_nick(), m_error(), m_samode();
extern int m_invite(), m_svskill(), m_identify();
extern int m_invite(), m_svskill();
extern int m_chatops(), m_dns();
extern int m_gnotice(), m_goper(), m_globops(), m_locops();
extern int m_protoctl(), m_tkl();
extern int m_motd(), m_user(), m_list();
extern int m_server(), m_info(), m_links(), m_summon(), m_stats();
extern int m_users(), m_version(), m_help();
extern int m_services(), m_identify();
extern int m_squit(), m_connect();
extern int m_pass(), m_trace();
extern int m_time(), m_names(), m_admin();
extern int m_lusers(), m_umode(), m_close();
extern int m_motd(), m_whowas(), m_silence();
extern int m_service(), m_userhost(), m_ison(), m_watch();
extern int m_remgline(), m_map(), m_dalinfo();
extern int m_map(), m_dalinfo();
extern int m_addline(), m_rules();
extern int m_knock(),m_credits();
extern int m_license();
extern int m_netinfo(), m_addmotd(), m_addomotd();
extern int m_svsjoin(), m_sajoin(), m_svspart(), m_sapart();
extern int m_sajoin(), m_sapart();
extern int m_svsfline();
extern int m_vhost(), m_botmotd(), m_sjoin();
extern int m_botmotd(), m_sjoin();
extern int m_umode2(), m_dccdeny(), m_undccdeny();
extern int m_post(), m_cycle(), m_opermotd();
extern int m_opermotd();
extern int m_module(), m_alias(), m_tkl(), m_opermotd();
extern int m_hash(), m_rehash(), m_die(), m_restart();
extern int m_rehash(), m_die(), m_restart();
#endif
+14 -3
View File
@@ -46,8 +46,8 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB
SRC/M_PINGPONG.OBJ SRC/M_QUIT.OBJ SRC/M_RAKILL.OBJ SRC/M_RPING.OBJ SRC/M_SENDUMODE.OBJ \
SRC/M_SQLINE.OBJ SRC/M_KILL.OBJ SRC/M_TSCTL.OBJ SRC/M_UNKLINE.OBJ \
SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ SRC/M_ZLINE.OBJ \
SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/INVISIBILITY.OBJ
SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/M_VHOST.OBJ \
SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/INVISIBILITY.OBJ
ALL: CONF UNREAL.EXE WIRCD.EXE
@@ -260,7 +260,6 @@ src/m_svsmode.obj: src/modules/m_svsmode.c $(INCLUDES)
src/m_tkl.obj: src/modules/m_tkl.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_tkl.c
src/m_swhois.obj: src/modules/m_swhois.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_swhois.c
@@ -354,6 +353,18 @@ src/m_whois.obj: src/modules/m_whois.c $(INCLUDES)
src/m_zline.obj: src/modules/m_zline.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_zline.c
src/m_vhost.obj: src/modules/m_vhost.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_vhost.c
src/m_cycle.obj: src/modules/m_cycle.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_cycle.c
src/m_svsjoin.obj: src/modules/m_svsjoin.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_svsjoin.c
src/m_svspart.obj: src/modules/m_svspart.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/m_svspart.c
src/scan.obj: src/modules/scan.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/scan.c
-21
View File
@@ -2871,27 +2871,6 @@ CMD_FUNC(channel_link)
return 0;
}
/*
* 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);
}
/*
** m_join
** parv[0] = sender prefix
-17
View File
@@ -425,23 +425,6 @@ aChannel *hash_find_channel(char *name, aChannel *chptr)
}
return chptr;
}
/*
* NOTE: this command is not supposed to be an offical part of the ircd
* protocol. It is simply here to help debug and to monitor the
* performance of the hash functions and table, enabling a better
* algorithm to be sought if this one becomes troublesome. -avalon
*
* Needs rewriting for DOUGH_HASH, consider this a place holder until
* thats done. Hopefully for hybrid-5, if not. tough. - Dianora
*
*/
int m_hash(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
return 0;
}
aChannel *hash_get_chan_bucket(unsigned int hashv)
{
if (hashv > CH_MAX)
+19 -3
View File
@@ -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
+18 -2
View File
@@ -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
+130
View File
@@ -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);
}
+139
View File
@@ -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;
}
+139
View File
@@ -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;
}
+212
View File
@@ -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;
}
-7
View File
@@ -1,4 +1,3 @@
/************************************************************************
* Unreal Internet Relay Chat Daemon, src/packet.c
* Copyright (C) 1990 Jarkko Oikarinen and
@@ -174,7 +173,6 @@ void init_CommandHash(void)
add_Command(MSG_GLOBOPS, TOK_GLOBOPS, m_globops, 1);
add_Command(MSG_CHATOPS, TOK_CHATOPS, m_chatops, 1);
add_Command(MSG_LOCOPS, TOK_LOCOPS, m_locops, 1);
add_Command(MSG_HASH, TOK_HASH, m_hash, MAXPARA);
add_Command(MSG_DNS, TOK_DNS, m_dns, MAXPARA);
add_Command(MSG_REHASH, TOK_REHASH, m_rehash, MAXPARA);
add_Command(MSG_RESTART, TOK_RESTART, m_restart, MAXPARA);
@@ -189,20 +187,15 @@ void init_CommandHash(void)
add_Command(MSG_NETINFO, TOK_NETINFO, m_netinfo, MAXPARA);
add_Command(MSG_ADDMOTD, TOK_ADDMOTD, m_addmotd, 1);
add_Command(MSG_ADDOMOTD, TOK_ADDOMOTD, m_addomotd, 1);
add_Command(MSG_SVSJOIN, TOK_SVSJOIN, m_svsjoin, MAXPARA);
add_Command(MSG_SAJOIN, TOK_SAJOIN, m_sajoin, MAXPARA);
add_Command(MSG_SVSPART, TOK_SVSPART, m_svspart, MAXPARA);
add_Command(MSG_SAPART, TOK_SAPART, m_sapart, MAXPARA);
add_Command(MSG_SVSFLINE, TOK_SVSFLINE, m_svsfline, MAXPARA);
add_Command(MSG_VHOST, TOK_VHOST, m_vhost, MAXPARA);
add_Command(MSG_BOTMOTD, TOK_BOTMOTD, m_botmotd, MAXPARA);
add_Command(MSG_SJOIN, TOK_SJOIN, m_sjoin, MAXPARA);
add_Command(MSG_UMODE2, TOK_UMODE2, m_umode2, MAXPARA);
add_Command(MSG_DCCDENY, TOK_DCCDENY, m_dccdeny, 2);
add_Command(MSG_UNDCCDENY, TOK_UNDCCDENY, m_undccdeny, MAXPARA);
/* add_Command(MSG_SHUN, TOK_SHUN, m_shun, MAXPARA); */
add_Command(MSG_NEWJOIN, TOK_JOIN, m_join, MAXPARA);
add_Command(MSG_CYCLE, TOK_CYCLE, m_cycle, MAXPARA);
add_Command(MSG_MODULE, TOK_MODULE, m_module, MAXPARA);
add_Command(MSG_TKL, TOK_TKL, m_tkl, MAXPARA);
-102
View File
@@ -331,108 +331,6 @@ int channel_canjoin(aClient *sptr, char *name)
return 1;
}
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;
}
/* irc logs.. */
void ircd_log(int flags, char *format, ...)
{
-91
View File
@@ -645,45 +645,6 @@ extern char *canonize(char *buffer)
extern char cmodestring[512];
CMD_FUNC(m_post)
{
char *tkllayer[9] = {
me.name, /*0 server.name */
"+", /*1 +|- */
"z", /*2 G */
"*", /*3 user */
NULL, /*4 host */
NULL,
NULL, /*6 expire_at */
NULL, /*7 set_at */
NULL /*8 reason */
};
char hostip[128], mo[128], mo2[128];
if (!MyClient(sptr))
return 0;
if (IsRegistered(sptr))
return 0;
strcpy(hostip, (char *)inetntoa((char *)&sptr->ip));
sendto_one(sptr,
":%s NOTICE AUTH :*** Proxy connection detected (bad!)", me.name);
sendto_snomask(SNO_EYES, "Attempted WWW Proxy connect from client %s",
get_client_host(sptr));
exit_client(cptr, sptr, &me, "HTTP proxy connection");
tkllayer[4] = hostip;
tkllayer[5] = me.name;
ircsprintf(mo, "%li", 0 + TStime());
ircsprintf(mo2, "%li", TStime());
tkllayer[6] = mo;
tkllayer[7] = mo2;
tkllayer[8] = "HTTP Proxy";
return m_tkl(&me, &me, 9, tkllayer);
}
/*
** register_user
** This function is called when both NICK and USER messages
@@ -2696,33 +2657,7 @@ CMD_FUNC(m_silence)
return 0;
}
/* 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;
}
/* m_sajoin() - Lamego - Wed Jul 21 20:04:48 1999
Copied off PTlink IRCd (C) PTlink coders team.
@@ -2771,33 +2706,7 @@ CMD_FUNC(m_sajoin)
return 0;
}
/* 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;
}
/* m_sapart() - Lamego - Wed Jul 21 20:04:48 1999
Copied off PTlink IRCd (C) PTlink coders team.