Commits (2)
......@@ -1146,7 +1146,7 @@ static int start(const char* svc_name, int argc, char** argv)
/****************************************************************************/
int main(int argc, char** argv)
{
char* ctrl_dir;
const char* ctrl_dir;
char* arg;
char* p;
char str[MAX_PATH+1];
......@@ -1171,7 +1171,7 @@ int main(int argc, char** argv)
ctrl_dir = get_ctrl_dir(/* warn: */TRUE);
sbbs_get_ini_fname(ini_file, ctrl_dir, NULL /* auto-host_name */);
sbbs_get_ini_fname(ini_file, ctrl_dir);
/* Initialize BBS startup structure */
memset(&bbs_startup,0,sizeof(bbs_startup));
......
......@@ -157,7 +157,7 @@ int main(int argc, char **argv)
{
FILE *text_dat;
char path[MAX_PATH+1];
char *p;
const char *p;
char *cstr;
char *comment;
char *macro;
......
......@@ -29,6 +29,7 @@
#include <process.h>
#include "genwrap.h"
#include "findstr.h"
#include "dirwrap.h"
#include "gen_defs.h"
#include "sockwrap.h"
......@@ -77,6 +78,7 @@ struct {
ulong data_rate;
bool server_echo;
char client_file[MAX_PATH + 1];
char ip_filter_file[MAX_PATH + 1];
char busy_notice[INI_MAX_VALUE_LEN];
char answer_banner[INI_MAX_VALUE_LEN];
enum {
......@@ -1007,9 +1009,16 @@ void listen_thread(void* arg)
SOCKET newsock = accept(listening_sock, (SOCKADDR*)&newaddr, &addrlen);
if(newsock == INVALID_SOCKET)
continue;
char tmp[256];
char ipaddr[256];
inet_addrtop(&newaddr, ipaddr, sizeof(ipaddr));
dprintf("Connection accepted from TCP port %hu at %s"
,inet_addrport(&newaddr), inet_addrtop(&newaddr, tmp, sizeof(tmp)));
,inet_addrport(&newaddr), ipaddr);
if(findstr(ipaddr, cfg.ip_filter_file)) {
dprintf("IP address blocked: %s", ipaddr);
shutdown(newsock, SD_SEND);
closesocket(newsock);
continue;
}
if(sock != INVALID_SOCKET) { // In-use
send(newsock, cfg.busy_notice, strlen(cfg.busy_notice), /* flags: */0);
shutdown(newsock, SD_SEND);
......@@ -1051,6 +1060,8 @@ bool read_ini(const char* ini_fname)
SAFECOPY(cfg.answer_banner, p);
if((p = iniGetString(ini, ROOT_SECTION, "ClientFile", NULL, value)) != NULL)
SAFECOPY(cfg.client_file, p);
if((p = iniGetString(ini, ROOT_SECTION, "IpFilterFile", NULL, value)) != NULL)
SAFECOPY(cfg.ip_filter_file, p);
return true;
}
......
......@@ -98,9 +98,9 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL;SBBS_EXPORTS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../sbbs3/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../sbbs3/;../encode/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -116,9 +116,9 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL;SBBS_EXPORTS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../sbbs3/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../sbbs3/;../encode/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -136,7 +136,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../sbbs3/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../sbbs3/;../encode/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -154,7 +154,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);TELNET_NO_DLL</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../sbbs3/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../sbbs3/;../encode/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -167,6 +167,9 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\encode\utf8.c" />
<ClCompile Include="..\sbbs3\findstr.c" />
<ClCompile Include="..\sbbs3\str_util.c" />
<ClCompile Include="..\sbbs3\telnet.c" />
<ClCompile Include="vdmodem.c" />
</ItemGroup>
......