mirror of
https://github.com/Wind4/vlmcsd.git
synced 2025-06-23 20:34:31 +02:00
vlmcsd-1108-2017-01-19-Hotbird64
This commit is contained in:
@ -674,7 +674,20 @@ void loadKmsData()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
void exitOnWarningLevel(const int_fast8_t level)
|
||||
{
|
||||
if (ExitLevel >= level)
|
||||
{
|
||||
printerrorf("Fatal: Exiting on warning level %i or greater\n", (int)ExitLevel);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
#endif // !NO_SOCKETS
|
||||
|
||||
#endif // IS_LIBRARY
|
||||
|
||||
|
||||
#if __ANDROID__ && !defined(USE_THREADS) // Bionic does not wrap these syscalls (intentionally because Google fears, developers don't know how to use it)
|
||||
|
||||
#ifdef __NR_shmget
|
||||
|
@ -40,6 +40,13 @@ void getExeName();
|
||||
__pure BOOL getArgumentBool(int_fast8_t *result, const char *const argument);
|
||||
char* vlmcsd_strdup(const char* src);
|
||||
|
||||
#if defined(NO_SOCKETS) || IS_LIBRARY
|
||||
#define exitOnWarningLevel(x)
|
||||
#else // !NO_SOCKETS
|
||||
void exitOnWarningLevel(const int_fast8_t level);
|
||||
#endif // !NO_SOCKETS
|
||||
|
||||
|
||||
#if __ANDROID__ && !defined(USE_THREADS) // Bionic does not wrap these syscalls (intentionally because Google fears, developers don't know how to use it)
|
||||
int shmget(key_t key, size_t size, int shmflg);
|
||||
void *shmat(int shmid, const void *shmaddr, int shmflg);
|
||||
|
@ -570,8 +570,12 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
// if (IsWindowsVistaOrGreater()) //Doesn't work with older version of MingW32-w64 toolchain
|
||||
if ((GetVersion() & 0xff) > 5)
|
||||
{
|
||||
# endif // _WIN32
|
||||
printerrorf("Warning: %s does not support socket option IPV6_V6ONLY: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
}
|
||||
# endif // _WIN32
|
||||
# endif // _PEDANTIC
|
||||
}
|
||||
# endif
|
||||
@ -661,6 +665,10 @@ BOOL addListeningSocket(const char *const addr)
|
||||
numsockets++;
|
||||
result = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
exitOnWarningLevel(1);
|
||||
}
|
||||
}
|
||||
|
||||
freeaddrinfo(aiList);
|
||||
|
@ -75,6 +75,8 @@ int_fast8_t logverbose = 0;
|
||||
#endif // NO_LOG
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
int_fast8_t ExitLevel = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
int_fast8_t nodaemon = 0;
|
||||
#endif // _WIN32
|
||||
@ -84,7 +86,7 @@ int_fast8_t InetdMode = 0;
|
||||
int_fast8_t nodaemon = 1;
|
||||
#endif // _WIN32
|
||||
int_fast8_t InetdMode = 1;
|
||||
#endif
|
||||
#endif // NO_SOCKETS
|
||||
|
||||
PVlmcsdHeader_t KmsData = NULL;
|
||||
#ifndef NO_EXTERNAL_DATA
|
||||
@ -104,7 +106,7 @@ int_fast8_t RandomizationLevel = 1;
|
||||
uint16_t Lcid = 0;
|
||||
#endif
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
#if !defined(NO_SOCKETS) && !defined(USE_MSRPC)
|
||||
#ifdef SIMPLE_SOCKETS
|
||||
SOCKET s_server;
|
||||
#else
|
||||
@ -120,7 +122,7 @@ HANDLE MaxTaskSemaphore;
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // !defined(NO_LIMIT) && !__minix__
|
||||
#endif // NO_SOCKETS
|
||||
#endif // !defined(NO_SOCKETS) && !defined(USE_MSRPC)
|
||||
|
||||
#ifdef _NTSERVICE
|
||||
int_fast8_t IsNTService = TRUE;
|
||||
|
@ -133,6 +133,7 @@ extern int_fast8_t UseClientRpcBTFN;
|
||||
#endif // USE_MSRPC
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
extern int_fast8_t ExitLevel;
|
||||
extern char *defaultport;
|
||||
#endif // NO_SOCKETS
|
||||
|
||||
|
20
src/vlmcsd.c
20
src/vlmcsd.c
@ -84,7 +84,7 @@
|
||||
#include "wintap.h"
|
||||
#endif
|
||||
|
||||
static const char* const optstring = "N:B:m:t:w:0:3:6:H:A:R:u:g:L:p:i:P:l:r:U:W:C:c:F:O:o:T:K:E:M:j:SseDdVvqkZ";
|
||||
static const char* const optstring = "N:B:m:t:w:0:3:6:H:A:R:u:g:L:p:i:P:l:r:U:W:C:c:F:O:o:x:T:K:E:M:j:SseDdVvqkZ";
|
||||
|
||||
#if !defined(NO_SOCKETS) && !defined(USE_MSRPC) && !defined(SIMPLE_SOCKETS)
|
||||
static uint_fast8_t maxsockets = 0;
|
||||
@ -123,6 +123,9 @@ static IniFileParameter_t IniFileParameterList[] =
|
||||
{ "Office2010", INI_PARAM_OFFICE2010 },
|
||||
{ "Office2013", INI_PARAM_OFFICE2013 },
|
||||
{ "Office2016", INI_PARAM_OFFICE2016 },
|
||||
# ifndef NO_SOCKETS
|
||||
{ "ExitLevel", INI_PARAM_EXIT_LEVEL },
|
||||
# endif // NO_SOCKETS
|
||||
# ifndef NO_TAP
|
||||
{ "VPN", INI_PARAM_VPN },
|
||||
# endif // NO_TAP
|
||||
@ -296,6 +299,7 @@ static __noreturn void usage()
|
||||
" -O <v>[=<a>][/<c>]\tuse VPN adapter <v> with IPv4 address <a> and CIDR <c>\n"
|
||||
# endif
|
||||
# ifndef NO_SOCKETS
|
||||
" -x <level>\t\texit if warning <level> reached (default 0)\n"
|
||||
# if !defined(USE_MSRPC) && !defined(SIMPLE_SOCKETS)
|
||||
" -L <address>[:<port>]\tlisten on IP address <address> with optional <port>\n"
|
||||
" -P <port>\t\tset TCP port <port> for subsequent -L statements (default 1688)\n"
|
||||
@ -725,6 +729,15 @@ static BOOL setIniFileParameter(uint_fast8_t id, const char *const iniarg)
|
||||
|
||||
# endif // USE_MSRPC
|
||||
|
||||
# ifndef NO_SOCKETS
|
||||
|
||||
case INI_PARAM_EXIT_LEVEL:
|
||||
success = getIniFileArgumentInt(&result, iniarg, 0, 1);
|
||||
if (success) ExitLevel = (int_fast8_t)result;
|
||||
break;
|
||||
|
||||
# endif // NO_SOCKETS
|
||||
|
||||
# if HAVE_FREEBIND
|
||||
|
||||
case INI_PARAM_FREEBIND:
|
||||
@ -1131,6 +1144,11 @@ static void parseGeneralArguments() {
|
||||
|
||||
# ifndef NO_SOCKETS
|
||||
|
||||
case 'x':
|
||||
ignoreIniFileParameter(INI_PARAM_EXIT_LEVEL);
|
||||
ExitLevel = getOptionArgumentInt((char)o, 0, 1);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
ignoreIniFileParameter(INI_PARAM_PORT);
|
||||
# if !defined(SIMPLE_SOCKETS) && !defined(USE_MSRPC)
|
||||
|
@ -58,6 +58,7 @@ int server_main(int argc, CARGV argv);
|
||||
#define INI_PARAM_START_EMPTY 27
|
||||
#define INI_PARAM_DATA_FILE 28
|
||||
#define INI_PARAM_VPN 29
|
||||
#define INI_PARAM_EXIT_LEVEL 30
|
||||
|
||||
#define INI_FILE_PASS_1 1
|
||||
#define INI_FILE_PASS_2 2
|
||||
|
@ -297,6 +297,7 @@ static DWORD WINAPI TapMirror(LPVOID data)
|
||||
|
||||
free(ActiveTapName);
|
||||
CloseHandle(TapHandle);
|
||||
exitOnWarningLevel(1);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user