diff --git a/src/auth.c b/src/auth.c index 401650f..cf5c7e7 100644 --- a/src/auth.c +++ b/src/auth.c @@ -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) diff --git a/src/calc.c b/src/calc.c index 9baa719..803bc9e 100644 --- a/src/calc.c +++ b/src/calc.c @@ -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) diff --git a/src/main.c b/src/main.c old mode 100644 new mode 100755 index 8fc0e13..c482471 --- a/src/main.c +++ b/src/main.c @@ -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 - TEXT_CSWITCH - TEXT_PSWITCH1 - TEXT_PSWITCH2 + to_file(1, + TEXT_CSWITCH #ifdef DEBUG - TEXT_DSWITCH - TEXT_OSWITCH - TEXT_XSWITCH + TEXT_DSWITCH #endif /* DEBUG */ - TEXT_HSWITCH - TEXT_VSWITCH); + 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 */ + ); _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) diff --git a/src/spy.c b/src/spy.c index ed84ddc..0cf4631 100644 --- a/src/spy.c +++ b/src/spy.c @@ -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) ? "" : 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 , 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; } } - to_user(from,"Unknown bot guid: %i",guid); - return; -guid_ok: - ; + if (destbot == NULL) + { + to_user(from,"Unknown bot guid: %i",guid); + return; + } } 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,7 +844,8 @@ spy_dest_ok: } else { - spy->data.destbot = -1; + if (t_dest != SPY_DCC) + spy->data.destbot = -1; spy->next = current->spylist; current->spylist = spy; spy_typecount(current); diff --git a/src/text.h b/src/text.h old mode 100644 new mode 100755 index 7ca9a6e..54d343e --- a/src/text.h +++ b/src/text.h @@ -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 encrypt using the password hashing algorithm,\n" +#define TEXT_ESWITCH " -e 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 encrypt using the password hashing algorithm (SHA-512),\n" +#elif MD5CRYPT +#define TEXT_PSWITCH1 " -p encrypt using the password hashing algorithm (MD5),\n" +#else +#define TEXT_PSWITCH1 " -p encrypt 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"