Merge pull request #28 from joonicks/dev

some minor updates + dcc chat crash bug fixed
This commit is contained in:
joonicks 2024-01-19 18:18:18 +01:00 committed by GitHub
commit 1e31d2dc91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 65 additions and 31 deletions

View File

@ -124,6 +124,7 @@ int passmatch(char *plain, char *encoded)
* use SHA512 to hash passwords
*/
char *crypt(const char *, const char *);
char *CRYPT_FUNC(const char *, const char *);
char *makepass(char *plain)
@ -153,6 +154,7 @@ int passmatch(char *plain, char *encoded)
* use MD5 to hash passwords
*/
char *crypt(const char *, const char *);
char *CRYPT_FUNC(const char *, const char *);
char *makepass(char *plain)

View File

@ -353,6 +353,17 @@ void do_convert(COMMAND_ARGS)
errno = EINVAL;
switch(*ops)
{
case 'b':
errno = 0;
for(num=0;*srcnum;)
{
num = num << 1;
if (*srcnum != '0' && *srcnum != '1')
return;
num += *srcnum - '0';
srcnum++;
}
break;
case 'c':
num = srcnum[0];
if (srcnum[1] != 0)

24
src/main.c Normal file → Executable file
View File

@ -994,17 +994,25 @@ int main(int argc, char **argv, char **envp)
break;
case 'h':
to_file(1,TEXT_USAGE,executable);
to_file(1,TEXT_FSWITCH
to_file(1,
TEXT_CSWITCH
TEXT_PSWITCH1
TEXT_PSWITCH2
#ifdef DEBUG
TEXT_DSWITCH
#endif /* DEBUG */
TEXT_ESWITCH
TEXT_FSWITCH
TEXT_HSWITCH
#ifdef DEBUG
TEXT_OSWITCH
TEXT_PSWITCH1
TEXT_PSWITCH2
#endif /* DEBUG */
TEXT_TSWITCH
TEXT_VSWITCH
#ifdef DEBUG
TEXT_XSWITCH
#endif /* DEBUG */
TEXT_HSWITCH
TEXT_VSWITCH);
);
_exit(0);
case 'c':
makecore = TRUE;
@ -1092,6 +1100,12 @@ int main(int argc, char **argv, char **envp)
}
#ifdef NEWBIE
#ifdef SESSION
if (stringcmp(CFGFILE,configfile) && stringcmp(SESSIONFILE,configfile))
{
to_file(1,"warning: current configuration file overrides session file\n");
}
#endif /* SESSION */
if (stat(configfile,&st));
{
if ((st.st_mode & (S_IWGRP|S_IWOTH)) != 0)

View File

@ -1,7 +1,7 @@
/*
EnergyMech, IRC bot software
Parts Copyright (c) 1997-2021 proton
Parts Copyright (c) 1997-2024 proton
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
@ -99,7 +99,8 @@ void send_spy(const char *src, const char *format, ...)
}
#ifdef DEBUG
debug("(send_spy) src %s format = '%s'\n",src,format);
debug("(send_spy) src <%s> format = '%s', current = '%s' (%i)\n",src,format,
(current == NULL) ? "<NULL>" : nullstr(current->nick),(current == NULL) ? -1 : current->guid);
#endif /* DEBUG */
for(spy=current->spylist;spy;spy=spy->next)
@ -108,11 +109,11 @@ void send_spy(const char *src, const char *format, ...)
{
if (src != SPYSTR_RAWIRC)
continue;
/* dont use four char server messages such as "PING :..." */
/* dont use four-char server messages such as "PING :..." */
if (tempsrc[5] == ':')
#ifdef DEBUG
{
debug("(send_spy) RANDSRC: skipping four char server message\n");
debug("(send_spy) RANDSRC: skipping four-char server message\n");
#endif /* DEBUG */
continue;
#ifdef DEBUG
@ -195,7 +196,6 @@ void send_spy(const char *src, const char *format, ...)
va_end(msg);
printmsg = tempdata;
}
switch(spy->t_dest)
{
case SPY_DCC:
@ -595,13 +595,12 @@ void stats_plusminususer(Chan *chan, int plusminus)
*/
/*
help:SPY:[STATUS|MESSAGE|RAWIRC|URL|RANDSRC|[guid:|botnick:] [channel|> filename]
help:SPY:[STATUS|MESSAGE|RAWIRC|URL|RANDSRC|[guid: ]channel] [channel|> filename]
Spy on a certain source of messages. When you join DCC chat,
the STATUS source is added by default as a spy source for you.
If no arguments are given, the current list of active spy
channels is shown. Output is not line buffered and can cause
excess flood if not careful.
channels is shown.
(sources)
STATUS Status messages.
@ -610,7 +609,6 @@ excess flood if not careful.
URL URLs seen by the bot.
RANDSRC Produce random data from <RAWIRC>, can only output to file.
guid: Messages from a bot specified by guid.
botnick: Messages from a bot specified by nick.
channel Activities on the specified channel.
(destinations)
@ -685,7 +683,7 @@ spy_usage:
if (*src != ':' && !ischannel(src+1))
goto spy_usage;
src++;
t_src = SPY_CHANNEL;
t_dest = t_src = SPY_CHANNEL;
/*
* TODO: check access
*/
@ -702,13 +700,13 @@ spy_usage:
if (backup->guid == guid)
{
destbot = backup;
goto guid_ok;
}
}
if (destbot == NULL)
{
to_user(from,"Unknown bot guid: %i",guid);
return;
guid_ok:
;
}
}
else
{
@ -763,10 +761,10 @@ guid_ok:
spy_dest_ok:
#ifdef DEBUG
debug("(do_spy) src = `%s'; t_src = %i (%s); dest = `%s'; t_dest = %i (%s)\n",
src,t_src,SPY_DEFS[t_src-1],nullstr(dest),t_dest,SPY_DEFS[t_dest-1]);
debug("(do_spy) src = `%s'; t_src = %i (%s); dest = `%s'; t_dest = %i (%s), CurrentDCC "mx_pfmt"\n",
src,t_src,SPY_DEFS[t_src-1],nullstr(dest),t_dest,SPY_DEFS[t_dest-1],CurrentDCC);
if (guid >= 0)
debug("(do_spy) spying from remote bot guid %i (%s) channel %s\n",guid,(destbot) ? destbot->nick : "unknown",src);
debug("(do_spy) spying from remote bot guid %i (%s), channel %s\n",guid,(destbot) ? destbot->nick : "unknown",src);
#endif /* DEBUG */
if (t_dest == SPY_DCC)
@ -795,8 +793,6 @@ spy_dest_ok:
return;
}
set_mallocdoer(do_spy);
sz = sizeof(Spy);
if (t_dest != SPY_DCC)
@ -805,6 +801,7 @@ spy_dest_ok:
if (t_src == SPY_CHANNEL)
sz += strlen(src);
set_mallocdoer(do_spy);
spy = Calloc(sz);
if (t_dest != SPY_DCC)
@ -847,6 +844,7 @@ spy_dest_ok:
}
else
{
if (t_dest != SPY_DCC)
spy->data.destbot = -1;
spy->next = current->spylist;
current->spylist = spy;

11
src/text.h Normal file → Executable file
View File

@ -140,7 +140,16 @@
#define TEXT_CSWITCH " -c make core file instead of coredebug/reset\n"
#define TEXT_HSWITCH " -h show this help\n"
#define TEXT_VSWITCH " -v show EnergyMech version\n"
#define TEXT_PSWITCH1 " -p <string> encrypt <string> using the password hashing algorithm,\n"
#define TEXT_ESWITCH " -e <command> run a single command, then exit\n"
#define TEXT_TSWITCH " -t run normal startup, but exit right before going into main loop\n"
#ifdef SHACRYPT
#define TEXT_PSWITCH1 " -p <string> encrypt <string> using the password hashing algorithm (SHA-512),\n"
#elif MD5CRYPT
#define TEXT_PSWITCH1 " -p <string> encrypt <string> using the password hashing algorithm (MD5),\n"
#else
#define TEXT_PSWITCH1 " -p <string> encrypt <string> using the password hashing algorithm (EnergyMech internal),\n"
#endif
#define TEXT_PSWITCH2 " output the result and then quit.\n"
#define TEXT_DSWITCH " -d start mech in debug mode\n"