1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 14:23:12 +02:00

Remove /ADDLINE: it's (too) easy to create a broken configuration file this way and then have an un-rehashable and un-bootable IRCd without having shell access. Use SSH or SFTP/SCP instead. Or even better: remote includes, of course :)

This commit is contained in:
Bram Matthys
2015-07-12 15:34:08 +02:00
parent bbb121383b
commit d33f1ca8f6
4 changed files with 2 additions and 129 deletions
+1 -5
View File
@@ -46,7 +46,7 @@ R_MODULES= \
m_sajoin.so m_sapart.so m_samode.so m_kick.so m_topic.so \
m_invite.so m_list.so m_time.so m_svskill.so m_sjoin.so \
m_pass.so m_userhost.so m_ison.so m_silence.so m_knock.so \
m_umode2.so m_squit.so m_protoctl.so m_addline.so m_addomotd.so \
m_umode2.so m_squit.so m_protoctl.so m_addomotd.so \
m_wallops.so m_admin.so m_globops.so m_locops.so \
m_trace.so m_netinfo.so m_links.so m_help.so m_rules.so \
m_close.so m_map.so m_eos.so m_server.so m_stats.so \
@@ -304,10 +304,6 @@ m_protoctl.so: m_protoctl.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_protoctl.so m_protoctl.c
m_addline.so: m_addline.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_addline.so m_addline.c
m_addmotd.so: m_addmotd.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_addmotd.so m_addmotd.c
-119
View File
@@ -1,119 +0,0 @@
/*
* IRC - Internet Relay Chat, src/modules/out.c
* (C) 2004 The UnrealIRCd Team
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* 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 "proto.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 <fcntl.h>
#include "h.h"
#ifdef _WIN32
#include "version.h"
#endif
DLLFUNC int m_addline(aClient *cptr, aClient *sptr, int parc, char *parv[]);
#define MSG_ADDLINE "ADDLINE"
ModuleHeader MOD_HEADER(m_addline)
= {
"m_addline",
"$Id$",
"command /addline",
"3.2-b8-1",
NULL
};
MOD_INIT(m_addline)
{
CommandAdd(modinfo->handle, MSG_ADDLINE, m_addline, 1, 0);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}
MOD_LOAD(m_addline)
{
return MOD_SUCCESS;
}
MOD_UNLOAD(m_addline)
{
return MOD_SUCCESS;
}
/*
** m_addline (write a line to unrealircd.conf)
**
** De-Potvinized by codemastr
*/
DLLFUNC CMD_FUNC(m_addline)
{
FILE *conf;
char *text;
text = parc > 1 ? parv[1] : NULL;
if (!ValidatePermissionsForPath("server:addline",sptr,NULL,NULL,NULL))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
return 0;
}
if (parc < 2)
{
sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
me.name, sptr->name, "ADDLINE");
return 0;
}
/* writes to current -f */
conf = fopen(configfile, "a");
if (conf == NULL)
{
return 0;
}
/* Display what they wrote too */
sendnotice(sptr, "*** Wrote (%s) to %s", text, configfile);
fprintf(conf, "// Added by %s\n", make_nick_user_host(sptr->name,
sptr->user->username, sptr->user->realhost));
/* for (i=1 ; i<parc ; i++)
{
if (i!=parc-1)
fprintf (conf,"%s ",parv[i]);
else
fprintf (conf,"%s\n",parv[i]);
}
* I dunno what Potvin was smoking when he made this code, but it plain SUX
* this should work just as good, and no need for a loop -- codemastr */
fprintf(conf, "%s\n", text);
fclose(conf);
return 1;
}