1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 18:54:47 +02:00

Compare commits

...

16 Commits

Author SHA1 Message Date
Adam de4f0cc28f Anope 1.9.2-p1 Release 2010-06-26 13:52:20 -04:00
Adam d747f544c4 Made db-convert handle old corrupted databases from 1.8 that used mysql with rdb 2010-06-25 19:07:50 -05:00
Adam b1f85c575f Backported the example.conf change from r7bb90e1922b7 2010-06-24 00:41:53 -05:00
DukePyrolator 9104822c09 Merge branch '1.9.2-p1' of ssh://dukepyrolator@anope.git.sourceforge.net/gitroot/anope/anope into 1.9.2-p1 2010-06-22 22:27:35 +02:00
DukePyrolator f58d611edc changed the name of the logfile from servics.log.<date> to <date>.services.log to make windows users happy 2010-06-22 22:21:49 +02:00
Adam 0ac122c2d8 Made db-convert really convert nickalias lastseen/lastused/lastquit 2010-06-22 13:45:07 -04:00
Adam 40db8af50a Fixed a typo in the example.conf for m_helpchan 2010-06-22 11:27:29 -04:00
Adam 4d8f68e0cc Fixed some more problems with db-convert 2010-06-21 17:51:34 -04:00
Adam 7956bd839c Fixed db_plain to write databases on windows 2010-06-21 17:51:34 -04:00
Adam f63aed908f Fixed windows problems with clearing the runtime directory 2010-06-21 17:51:34 -04:00
Adam 8b9ba96767 Added m_helpchan to replace the cores helpchannel functionality 2010-06-20 19:45:10 -04:00
Adam 64b9fa419f Fixed the name of cs_forbid in chanserv:modules so it really loads 2010-06-20 19:43:09 -04:00
Adam 63c5fa3a44 Made db-converter add all of the core clients when converting a 1.8 database 2010-06-20 19:41:50 -04:00
Adam 87aa70f2a9 Made db-converter only write mlock params if there really is one, fixes some problems with converting mlock for certain databases 2010-06-20 19:41:43 -04:00
Adam- 89412e46c2 Fixed bug #1171 - Fixed defcon so it works on Windows
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@3010 5417fbe8-f217-4b02-8779-1006273d7864
2010-06-20 19:41:34 -04:00
Adam dacdafef0f Branch for 1.9.2-p1 2010-06-20 19:38:58 -04:00
10 changed files with 144 additions and 59 deletions
+20 -9
View File
@@ -195,12 +195,6 @@ serverinfo
*/
networkinfo
{
/*
* For the given channel, every user that has or gets op status of the channel
* will automatically receive the +h user mode. This directive is optional.
*/
helpchannel = "#help"
/*
* If set, Services will output log messages to the given channel. This
* directive is optional.
@@ -266,6 +260,13 @@ options
* NOTE: enc_old is Anope's previous (broken) MD5 implementation, if your databases
* were made using that module, continue to use it and do not use enc_md5.
*
* NOTE: enc_sha1 relies on how the OS stores 2+ byte data internally, and is
* potentially broken when moving between 2 different OSes, such as moving from
* Linux to Windows. It is recommended that you use enc_sha256 instead if you want
* to use an SHA-based encryption. If you choose to do so, it is also recommended
* that you first try to get everyone's passwords converted to enc_sha256 before
* switching OSes by placing enc_sha256 at the beginning of the list.
*
* Supported:
* - enc_none (plain text, no encryption)
* - enc_old (old, broken MD5 encryption)
@@ -273,8 +274,8 @@ options
* - enc_sha1 (SHA1 encryption)
* - enc_sha256 (SHA256 encryption with random salts)
*
* The first module in this list is the active encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* The first module in this list is the active encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the active encryption module on next identify.
* Changing the order of the modules requires the services to restart.
*/
@@ -929,7 +930,7 @@ chanserv
* The core modules to load for ChanServ. This is a space separated list that corresponds
* to the base names of the modules for ChanServ. This directive is optional, but highly recommended.
*/
modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info forbid cs_suspend cs_status cs_unban"
modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_forbid cs_suspend cs_status cs_unban"
/*
* The default options for newly registered channels. Note that changing these options
@@ -1520,6 +1521,16 @@ db_plain
database = "anope.db"
}
#module { name = "m_helpchan" }
m_helpchan
{
/*
* For the given channel, every user that has or gets op status of the channel
* will automatically receive the +h user mode. This directive is optional.
*/
helpchannel = "#help"
}
hs_request
{
/*
+3 -3
View File
@@ -608,7 +608,6 @@ int ServerConfig::Read(bool bail)
{"serverinfo", "hostname", "", new ValueContainerChar(&Config.ServiceHost), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "pid", "services.pid", new ValueContainerChar(&Config.PIDFilename), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "motd", "services.motd", new ValueContainerChar(&Config.MOTDFilename), DT_CHARPTR, ValidateNotEmpty},
{"networkinfo", "helpchannel", "", new ValueContainerChar(&Config.HelpChannel), DT_CHARPTR, NoValidation},
{"networkinfo", "logchannel", "", new ValueContainerChar(&Config.LogChannel), DT_CHARPTR, NoValidation},
{"networkinfo", "logbot", "no", new ValueContainerBool(&Config.LogBot), DT_BOOLEAN, NoValidation},
{"networkinfo", "networkname", "", new ValueContainerChar(&Config.NetworkName), DT_CHARPTR, ValidateNotEmpty},
@@ -1701,9 +1700,10 @@ int read_config(int reload)
/**
* Check all DEFCON dependiencies...
**/
if (Config.DefConLevel) {
if (Config.DefConLevel)
{
/* Build DefCon's */
DefCon.reserve(6);
DefCon.resize(6);
DefCon[5].reset();
for (unsigned int level = 1; level < 5; ++level) {
DefCon[level] = 0;
+5 -1
View File
@@ -44,6 +44,7 @@ static void ReadDatabase(Module *m = NULL)
EventReturn MOD_RESULT;
MDType Type = MD_NONE;
db.clear();
db.open(DatabaseFile.c_str(), std::ios_base::in);
if (!db.is_open())
@@ -71,6 +72,8 @@ static void ReadDatabase(Module *m = NULL)
buf.erase(buf.begin());
if (!buf.empty() && !sep.StreamEnd())
params.push_back(buf + " " + sep.GetRemaining());
else if (!sep.StreamEnd())
params.push_back(sep.GetRemaining());
else if (!buf.empty())
params.push_back(buf);
break;
@@ -584,7 +587,7 @@ class DBPlain : public Module
{
ircdproto->SendGlobops(findbot(Config.s_OperServ), "Unable to backup database!");
Alog() << "Unable to back up database!";
if (!Config.NoBackupOkay)
quitting = 1;
@@ -928,6 +931,7 @@ class DBPlain : public Module
{
BackupDatabase();
db.clear();
db.open(DatabaseFile.c_str(), std::ios_base::out | std::ios_base::trunc);
if (!db.is_open())
+1 -1
View File
@@ -34,7 +34,7 @@ static int get_logname(char *name, int count, struct tm *tm)
/* fix bug 577 */
strftime(timestamp, sizeof(timestamp), "%Y%m%d", tm);
snprintf(name, count, "logs/%s.%s", log_filename.c_str(), timestamp);
snprintf(name, count, "logs/%s.%s", timestamp, log_filename.c_str());
curday = tm->tm_yday;
return 1;
-2
View File
@@ -59,8 +59,6 @@ Module::~Module()
for (i = 0; i < NUM_LANGS; i++)
this->DeleteLanguage(i);
remove(this->filename.c_str());
int idx;
CommandHash *current = NULL;
+10 -5
View File
@@ -19,9 +19,7 @@ void ModuleManager::LoadModuleList(std::list<std::string> &ModuleList)
{
for (std::list<std::string>::iterator it = ModuleList.begin(); it != ModuleList.end(); ++it)
{
Module *m = findModule(it->c_str());
if (!m)
ModuleManager::LoadModule(*it, NULL);
ModuleManager::LoadModule(*it, NULL);
}
}
@@ -53,11 +51,13 @@ static int moduleCopyFile(const char *name, const char *output)
#ifndef _WIN32
if ((srcfp = mkstemp(const_cast<char *>(output))) == -1)
return MOD_ERR_FILE_IO;
#else
if (!mktemp(const_cast<char *>(output)))
return MOD_ERR_FILE_IO;
#endif
{
fclose(source);
return MOD_ERR_FILE_IO;
}
Alog(LOG_DEBUG) << "Runtime module location: " << output;
@@ -66,6 +66,7 @@ static int moduleCopyFile(const char *name, const char *output)
#else
if ((target = fopen(output, "wb")) == NULL) {
#endif
fclose(source);
return MOD_ERR_FILE_IO;
}
while ((ch = fgetc(source)) != EOF) {
@@ -291,6 +292,7 @@ void ModuleManager::DeleteModule(Module *m)
DetachAll(m);
handle = m->handle;
std::string filename = m->filename;
ano_modclearerr();
destroy_func = function_cast<void (*)(Module *)>(dlsym(m->handle, "destroy_module"));
@@ -309,6 +311,9 @@ void ModuleManager::DeleteModule(Module *m)
if ((dlclose(handle)) != 0)
Alog() << dlerror();
}
if (!filename.empty())
DeleteFile(filename.c_str());
}
bool ModuleManager::Attach(Implementation i, Module* mod)
+13 -19
View File
@@ -717,16 +717,6 @@ void Module::DeleteLanguage(int langNumber)
void ModuleRunTimeDirCleanUp()
{
#ifndef _WIN32
DIR *dirp;
struct dirent *dp;
#else
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH + 1];
WIN32_FIND_DATA FileData;
char buffer[_MAX_PATH];
#endif
char dirbuf[BUFSIZE];
char filebuf[BUFSIZE];
@@ -736,9 +726,12 @@ void ModuleRunTimeDirCleanUp()
#ifndef _WIN32
DIR *dirp;
struct dirent *dp;
if ((dirp = opendir(dirbuf)) == NULL)
{
Alog(LOG_DEBUG) << "cannot open directory (" << dirbuf << ")";
Alog(LOG_DEBUG) << "Cannot open directory (" << dirbuf << ")";
return;
}
while ((dp = readdir(dirp)) != NULL) {
@@ -749,16 +742,16 @@ void ModuleRunTimeDirCleanUp()
continue;
}
snprintf(filebuf, BUFSIZE, "%s/%s", dirbuf, dp->d_name);
unlink(filebuf);
DeleteFile(filebuf);
}
closedir(dirp);
#else
/* Get the current working directory: */
if (_getcwd(buffer, _MAX_PATH) == NULL)
{
Alog(LOG_DEBUG) << "Unable to set Current working directory";
}
snprintf(szDir, sizeof(szDir), "%s\\%s\\*", buffer, dirbuf);
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH + 1];
WIN32_FIND_DATA FileData;
snprintf(szDir, sizeof(szDir), "%s/*", dirbuf);
hList = FindFirstFile(szDir, &FileData);
if (hList != INVALID_HANDLE_VALUE) {
@@ -766,7 +759,8 @@ void ModuleRunTimeDirCleanUp()
while (!fFinished) {
if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
snprintf(filebuf, BUFSIZE, "%s/%s", dirbuf, FileData.cFileName);
DeleteFile(filebuf);
if (!DeleteFile(filebuf))
Alog(LOG_DEBUG) << "Error deleting file " << filebuf << " - GetLastError() reports " << dlerror();
}
if (!FindNextFile(hList, &FileData)) {
if (GetLastError() == ERROR_NO_MORE_FILES) {
+48
View File
@@ -0,0 +1,48 @@
/*
* (C) 2003-2010 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "module.h"
class HelpChannel : public Module
{
ci::string HelpChan;
public:
HelpChannel(const std::string &modname, const std::string &creator) : Module(modname, creator)
{
this->SetAuthor("Anope");
this->SetVersion(VERSION_STRING);
this->SetType(SUPPORTED);
Implementation i[] = { I_OnChannelModeSet, I_OnReload };
ModuleManager::Attach(i, this, 2);
OnReload(true);
}
EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const std::string &param)
{
if (Name == CMODE_OP && c && c->ci && c->name == this->HelpChan)
{
User *u = finduser(param);
if (u)
u->SetMode(findbot(Config.s_OperServ), UMODE_HELPOP);
}
return EVENT_CONTINUE;
}
void OnReload(bool)
{
ConfigReader config;
this->HelpChan = config.ReadValue("m_helpchan", "helpchannel", "", 0).c_str();
}
};
MODULE_INIT(HelpChannel)
+42 -17
View File
@@ -280,12 +280,9 @@ int main(int argc, char *argv[])
na = (NickAlias *)calloc(1, sizeof(NickAlias));
READ(read_string(&na->nick, f));
char *mask;
char *real;
char *quit;
READ(read_string(&mask, f));
READ(read_string(&real, f));
READ(read_string(&quit, f));
READ(read_string(&na->last_usermask, f));
READ(read_string(&na->last_realname, f));
READ(read_string(&na->last_quit, f));
READ(read_int32(&tmp32, f));
na->time_registered = tmp32;
@@ -296,9 +293,6 @@ int main(int argc, char *argv[])
na->nc = findcore(s, 0);
na->nc->aliascount++;
free(s);
free(mask);
free(real);
free(quit);
*nalast = na;
nalast = &na->next;
@@ -397,7 +391,7 @@ int main(int argc, char *argv[])
if (nc->accesscount)
{
for (j = 0, access = nc->access; j < nc->accesscount; j++, access++)
for (j = 0, access = nc->access; j < nc->accesscount && *access; j++, access++)
fs << "MD ACCESS " << *access << std::endl;
}
@@ -497,6 +491,37 @@ int main(int argc, char *argv[])
}
if (input == "y")
broken = 1;
input = "";
while (input != "y" && input != "n")
{
std::cout << std::endl << "Are you converting a 1.8.x database? (y/n) " << std::endl << "? ";
std::cin >> input;
}
/* 1.8 doesn't have nickserv etc in bot.db, create them */
if (input == "y")
{
time_t now = time(NULL);
fs << "BI NickServ NickServ services.anope.org " << now << " 0 :NickServ" << std::endl;
fs << "MD FLAGS NICKSERV" << std::endl;
fs << "BI ChanServ ChanServ services.anope.org " << now << " 0 :ChanServ" << std::endl;
fs << "MD FLAGS CHANSERV" << std::endl;
fs << "BI BotServ BotServ services.anope.org " << now << " 0 :BotServ" << std::endl;
fs << "MD FLAGS BOTSERV" << std::endl;
fs << "BI HostServ HostServ services.anope.org " << now << " 0 :HostServ" << std::endl;
fs << "MD FLAGS HOSTSERV" << std::endl;
fs << "BI OperServ OperServ services.anope.org " << now << " 0 :OperServ" << std::endl;
fs << "MD FLAGS OPERSERV" << std::endl;
fs << "BI MemoServ MemoServ services.anope.org " << now << " 0 :MemoServ" << std::endl;
fs << "MD FLAGS MEMOSERV" << std::endl;
fs << "BI Global Global services.anope.org " << now << " 0: Global" << std::endl;
fs << "MD FLAGS GLOBAL" << std::endl;
}
while ((c = getc_db(f)) == 1) {
READ(read_string(&nick, f));
@@ -808,7 +833,7 @@ int main(int argc, char *argv[])
<< ((ci->flags & CI_SIGNKICK_LEVEL) ? " SIGNKICKLEVEL" : "")
<< ((ci->flags & CI_XOP ) ? " XOP" : "")
<< ((ci->flags & CI_SUSPENDED ) ? " SUSPENDED" : "") << std::endl;
if (ci->desc)
if (ci->desc && *ci->desc)
fs << "MD DESC :" << ci->desc << std::endl;
if (ci->url)
fs << "MD URL :" << ci->url << std::endl;
@@ -854,16 +879,16 @@ int main(int argc, char *argv[])
process_mlock_modes(fs, ci->mlock_off, ircd);
fs << std::endl;
}
if (ci->mlock_limit || ci->mlock_key || ci->mlock_flood || ci->mlock_redirect)
if (ci->mlock_limit || (ci->mlock_key && *ci->mlock_key) || (ci->mlock_flood && *ci->mlock_flood) || (ci->mlock_redirect && *ci->mlock_redirect))
{
fs << "MD MLP";
if (ci->mlock_limit)
fs << " CMODE_LIMIT " << ci->mlock_limit;
if (ci->mlock_key)
if (ci->mlock_key && *ci->mlock_key)
fs << " CMODE_KEY " << ci->mlock_key;
if (ci->mlock_flood)
if (ci->mlock_flood && *ci->mlock_flood)
fs << " CMODE_FLOOD " << ci->mlock_flood;
if (ci->mlock_redirect)
if (ci->mlock_redirect && *ci->mlock_redirect)
fs << " CMODE_REDIRECT " << ci->mlock_redirect;
fs << std::endl;
}
@@ -931,8 +956,8 @@ int main(int argc, char *argv[])
fs << "MD BI BADWORD "
<< (( ci->badwords[j].type == 0 ) ? "ANY " : "" )
<< (( ci->badwords[j].type == 1 ) ? "SINGLE " : "" )
<< (( ci->badwords[j].type == 3 ) ? "START " : "" )
<< (( ci->badwords[j].type == 4 ) ? "END " : "" )
<< (( ci->badwords[j].type == 2 ) ? "START " : "" )
<< (( ci->badwords[j].type == 3 ) ? "END " : "" )
<< ":" << ci->badwords[j].word << std::endl;
}
}
+2 -2
View File
@@ -8,8 +8,8 @@
VERSION_MAJOR="1"
VERSION_MINOR="9"
VERSION_PATCH="2"
VERSION_EXTRA=""
VERSION_BUILD="3007"
VERSION_EXTRA="-p1"
VERSION_BUILD="1"