Compare commits
No commits in common. "master" and "svn934" have entirely different histories.
|
@ -1,12 +0,0 @@
|
||||||
VisualStudio/
|
|
||||||
bin/
|
|
||||||
build/
|
|
||||||
buildroot-configs/
|
|
||||||
floppy/
|
|
||||||
hotbird64-mass-build/
|
|
||||||
lib/
|
|
||||||
src/VisualStudio-Linux-Remote/
|
|
||||||
*.vcxproj*
|
|
||||||
*.html
|
|
||||||
*.pdf
|
|
||||||
*.txt
|
|
|
@ -1,6 +0,0 @@
|
||||||
[submodule "debian"]
|
|
||||||
path = debian
|
|
||||||
url = https://github.com/Wind4/vlmcsd-debian.git
|
|
||||||
[submodule "docker"]
|
|
||||||
path = docker
|
|
||||||
url = https://github.com/Wind4/vlmcsd-docker.git
|
|
577
GNUmakefile
577
GNUmakefile
|
@ -1,19 +1,32 @@
|
||||||
.NOTPARALLEL:
|
################################################################################
|
||||||
|
|
||||||
MAX_THREADS ?= 16
|
.PHONY: clean
|
||||||
|
|
||||||
PROGRAM_NAME ?= bin/vlmcsd
|
PROGRAM_NAME ?= vlmcsd
|
||||||
CLIENT_NAME ?= bin/vlmcs
|
CLIENT_NAME ?= vlmcs
|
||||||
MULTI_NAME ?= bin/vlmcsdmulti
|
MULTI_NAME ?= vlmcsdmulti
|
||||||
OBJ_NAME ?= build/libkms-static.o
|
OBJ_NAME ?= libkms-static.o
|
||||||
A_NAME ?= lib/libkms.a
|
A_NAME ?= libkms.a
|
||||||
|
CONFIG ?= config.h
|
||||||
|
COMPILER_LANGUAGE ?= c
|
||||||
|
|
||||||
BASE_PROGRAM_NAME=$(notdir $(PROGRAM_NAME))
|
# crypto library to use for standard algos, could save ~1-2kb ;)
|
||||||
BASE_CLIENT_NAME=$(notdir $(CLIENT_NAME))
|
# can be either 'openssl', 'polarssl' or anything other for internal impl
|
||||||
BASE_MULTI_NAME=$(notdir $(MULTI_NAME))
|
CRYPTO ?= internal
|
||||||
BASE_DLL_NAME=$(notdir $(DLL_NAME))
|
|
||||||
BASE_A_NAME=$(notdir $(A_NAME))
|
|
||||||
|
|
||||||
|
# use DNS_PARSER=internal if your OS doesn't supply the DNS parser routines
|
||||||
|
DNS_PARSER ?= OS
|
||||||
|
|
||||||
|
# You should supply your own version string here
|
||||||
|
|
||||||
|
VLMCSD_VERSION ?= $(shell test -d .svn && echo svn`svnversion`)
|
||||||
|
|
||||||
|
FEATURES ?= full
|
||||||
|
VERBOSE ?= NO
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
CC ?= gcc
|
||||||
TARGETPLATFORM := $(shell LANG=en_US.UTF-8 $(CC) -v 2>&1 | grep '^Target: ' | cut -f 2 -d ' ')
|
TARGETPLATFORM := $(shell LANG=en_US.UTF-8 $(CC) -v 2>&1 | grep '^Target: ' | cut -f 2 -d ' ')
|
||||||
|
|
||||||
ifneq (,$(findstring darwin,$(TARGETPLATFORM)))
|
ifneq (,$(findstring darwin,$(TARGETPLATFORM)))
|
||||||
|
@ -21,7 +34,7 @@ ifneq (,$(findstring darwin,$(TARGETPLATFORM)))
|
||||||
UNIX := 1
|
UNIX := 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(findstring android,$(TARGETPLATFORM)))
|
ifneq (,$(findstring androideabi,$(TARGETPLATFORM)))
|
||||||
ANDROID := 1
|
ANDROID := 1
|
||||||
UNIX := 1
|
UNIX := 1
|
||||||
ELF := 1
|
ELF := 1
|
||||||
|
@ -93,63 +106,460 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CYGWIN),1)
|
ifeq ($(CYGWIN),1)
|
||||||
DLL_NAME ?= lib/cygkms.dll
|
DLL_NAME ?= cygkms.dll
|
||||||
else ifeq ($(WIN),1)
|
else ifeq ($(WIN),1)
|
||||||
DLL_NAME ?= lib/libkms.dll
|
DLL_NAME ?= libkms.dll
|
||||||
else ifeq ($(DARWIN),1)
|
else ifeq ($(DARWIN),1)
|
||||||
DLL_NAME ?= lib/libkms.dylib
|
DLL_NAME ?= libkms.dylib
|
||||||
else
|
else
|
||||||
DLL_NAME ?= lib/libkms.so
|
DLL_NAME ?= libkms.so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.DEFAULT:
|
BASECFLAGS = -DVLMCSD_COMPILER=\"$(notdir $(CC))\" -DVLMCSD_PLATFORM=\"$(TARGETPLATFORM)\" -DCONFIG=\"$(CONFIG)\" -DBUILD_TIME=$(shell date '+%s') -g -Os -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections -fdata-sections
|
||||||
+@(test -d bin || mkdir bin) & (test -d lib || mkdir lib) & (test -d build || mkdir build)
|
BASELDFLAGS =
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C src $@ FROM_PARENT=1 PROGRAM_NAME=$(PROGRAM_NAME) CLIENT_NAME=$(CLIENT_NAME) MULTI_NAME=$(MULTI_NAME) DLL_NAME=$(DLL_NAME) A_NAME=$(A_NAME)
|
STRIPFLAGS =
|
||||||
|
CLIENTLDFLAGS =
|
||||||
|
SERVERLDFLAGS =
|
||||||
|
|
||||||
all:
|
ifndef SAFE_MODE
|
||||||
+@(test -d bin || mkdir bin) & (test -d lib || mkdir lib) & (test -d build || mkdir build)
|
BASECFLAGS += -fvisibility=hidden -pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C src $@ FROM_PARENT=1 PROGRAM_NAME=$(PROGRAM_NAME) CLIENT_NAME=$(CLIENT_NAME) MULTI_NAME=$(MULTI_NAME) DLL_NAME=$(DLL_NAME) A_NAME=$(A_NAME)
|
|
||||||
|
ifeq ($(ELF),1)
|
||||||
|
BASELDFLAGS += -Wl,-z,norelro
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring gcc,$(notdir $(CC))))
|
||||||
|
BASECFLAGS += -flto
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(NOLIBS),1)
|
||||||
|
NOLRESOLV=1
|
||||||
|
NOLPTHREAD=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(NO_DNS),1)
|
||||||
|
ifneq ($(ANDROID),1)
|
||||||
|
ifneq ($(NOLRESOLV),1)
|
||||||
|
|
||||||
|
ifeq ($(MINGW),1)
|
||||||
|
CLIENTLDFLAGS += -ldnsapi
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LINUX),1)
|
||||||
|
CLIENTLDFLAGS += -lresolv
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HURD),1)
|
||||||
|
CLIENTLDFLAGS += -lresolv
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DARWIN),1)
|
||||||
|
CLIENTLDFLAGS += -lresolv
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CYGWIN),1)
|
||||||
|
DNS_PARSER := internal
|
||||||
|
CLIENTLDFLAGS += -lresolv
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OPENBSD),1)
|
||||||
|
DNS_PARSER := internal
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(SOLARIS),1)
|
||||||
|
CLIENTLDFLAGS += -lresolv
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
BASECFLAGS += -DNO_DNS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CAT),2)
|
||||||
|
BASECFLAGS += "-Wall"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DARWIN), 1)
|
||||||
|
STRIPFLAGS += -Wl,-S -Wl,-x
|
||||||
|
BASECFLAGS += -Wno-deprecated-declarations
|
||||||
|
else ifeq ($(shell uname), SunOS)
|
||||||
|
STRIPFLAGS += -s
|
||||||
|
ifeq ($(notdir $(LD_ALTEXEC)),gld)
|
||||||
|
BASELDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
BASELDFLAGS += -lsocket
|
||||||
|
else
|
||||||
|
ifneq ($(CC),tcc)
|
||||||
|
BASELDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
STRIPFLAGS += -s
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBRARY_CFLAGS = -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_EXTENDED_PRODUCT_LIST -DNO_BASIC_PRODUCT_LIST -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION
|
||||||
|
|
||||||
|
ifeq ($(FEATURES), embedded)
|
||||||
|
BASECFLAGS += -DNO_HELP -DNO_USER_SWITCH -DNO_BASIC_PRODUCT_LIST -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_VERBOSE_LOG -DNO_VERSION_INFORMATION
|
||||||
|
else ifeq ($(FEATURES), autostart)
|
||||||
|
BASECFLAGS += -DNO_HELP -DNO_VERSION_INFORMATION
|
||||||
|
else ifeq ($(FEATURES), minimum)
|
||||||
|
BASECFLAGS += $(LIBRARY_CFLAGS)
|
||||||
|
else ifeq ($(FEATURES), most)
|
||||||
|
BASECFLAGS += -DNO_SIGHUP -DNO_PID_FILE -DNO_LIMIT
|
||||||
|
else ifeq ($(FEATURES), inetd)
|
||||||
|
BASECFLAGS += -DNO_SIGHUP -DNO_SOCKETS -DNO_PID_FILE -DNO_LIMIT -DNO_VERSION_INFORMATION
|
||||||
|
else ifeq ($(FEATURES), fixedepids)
|
||||||
|
BASECFLAGS += -DNO_SIGHUP -DNO_CL_PIDS -DNO_RANDOM_EPID -DNO_INI_FILE
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef INI
|
||||||
|
BASECFLAGS += -DINI_FILE=\"$(INI)\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(THREADS), 1)
|
||||||
|
BASECFLAGS += -DUSE_THREADS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CHILD_HANDLER), 1)
|
||||||
|
BASECFLAGS += -DCHILD_HANDLER
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(NO_TIMEOUT), 1)
|
||||||
|
BASECFLAGS += -DNO_TIMEOUT
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef WINDOWS
|
||||||
|
BASECFLAGS += -DEPID_WINDOWS=\"$(WINDOWS)\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef OFFICE2010
|
||||||
|
BASECFLAGS += -DEPID_OFFICE2010=\"$(OFFICE2010)\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef OFFICE2013
|
||||||
|
BASECFLAGS += -DEPID_OFFICE2013=\"$(OFFICE2013)\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef HWID
|
||||||
|
BASECFLAGS += -DHWID=$(HWID)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef TERMINAL_WIDTH
|
||||||
|
BASECFLAGS += -DTERMINAL_FIXED_WIDTH=$(TERMINAL_WIDTH) -DDISPLAY_WIDTH=\"$(TERMINAL_WIDTH)\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(NOPROCFS), 1)
|
||||||
|
BASECFLAGS += -DNO_PROCFS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(AUXV), 1)
|
||||||
|
BASECFLAGS += -DUSE_AUXV
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ANDROID), 1)
|
||||||
|
ifneq ($(MINIX), 1)
|
||||||
|
ifneq ($(NOLPTHREAD), 1)
|
||||||
|
|
||||||
|
ifeq ($(THREADS), 1)
|
||||||
|
SERVERLDFLAGS += -lpthread
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (,$(findstring NO_LIMIT,$(CFLAGS) $(BASECFLAGS)))
|
||||||
|
SERVERLDFLAGS += -lpthread
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(MULTI_NAME): BASECFLAGS += -DMULTI_CALL_BINARY=1
|
||||||
|
|
||||||
|
all: $(CLIENT_NAME) $(PROGRAM_NAME)
|
||||||
|
|
||||||
|
#ifdef CAT
|
||||||
|
allmulti: $(CLIENT_NAME) $(PROGRAM_NAME) $(MULTI_NAME)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ifneq ($(strip $(VLMCSD_VERSION)),)
|
||||||
|
BASECFLAGS += -DVERSION=\"$(VLMCSD_VERSION),\ built\ $(shell date -u '+%Y-%m-%d %H:%M:%S' | sed -e 's/ /\\ /g')\ UTC\"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CAT
|
||||||
|
BASECFLAGS += -DONE_FILE
|
||||||
|
endif
|
||||||
|
|
||||||
|
SRCS = crypto.c kms.c endian.c output.c shared_globals.c helpers.c
|
||||||
|
HEADERS = $(CONFIG) types.h rpc.h vlmcsd.h endian.h crypto.h kms.h network.h output.h shared_globals.h vlmcs.h helpers.h
|
||||||
|
DEPS = $(MULTI_SRCS:.c=.d)
|
||||||
|
|
||||||
|
VLMCSD_SRCS = vlmcsd.c $(SRCS)
|
||||||
|
VLMCSD_OBJS = $(VLMCSD_SRCS:.c=.o)
|
||||||
|
|
||||||
|
VLMCS_SRCS = vlmcs.c $(SRCS)
|
||||||
|
VLMCS_OBJS = $(VLMCS_SRCS:.c=.o)
|
||||||
|
|
||||||
|
MULTI_SRCS = vlmcsd.c vlmcs.c vlmcsdmulti.c $(SRCS)
|
||||||
|
MULTI_OBJS = $(SRCS:.c=.o) vlmcsd-m.o vlmcs-m.o vlmcsdmulti-m.o
|
||||||
|
|
||||||
|
DLL_SRCS = libkms.c $(SRCS)
|
||||||
|
DLL_OBJS = $(DLL_SRCS:.c=.o)
|
||||||
|
|
||||||
|
PDFDOCS = vlmcs.1.pdf vlmcsd.7.pdf vlmcsd.8.pdf vlmcsdmulti.1.pdf vlmcsd.ini.5.pdf vlmcsd-floppy.7.pdf
|
||||||
|
HTMLDOCS = $(PDFDOCS:.pdf=.html)
|
||||||
|
UNIXDOCS = $(PDFDOCS:.pdf=.unix.txt)
|
||||||
|
DOSDOCS = $(PDFDOCS:.pdf=.dos.txt)
|
||||||
|
|
||||||
|
ifneq ($(NO_DNS),1)
|
||||||
|
|
||||||
|
VLMCS_SRCS += dns_srv.c
|
||||||
|
MULTI_SRCS += dns_srv.c
|
||||||
|
MULTI_OBJS += dns_srv.o
|
||||||
|
|
||||||
|
ifeq ($(DNS_PARSER),internal)
|
||||||
|
ifneq ($(MINGW),1)
|
||||||
|
VLMCS_SRCS += ns_parse.c ns_name.c
|
||||||
|
MULTI_SRCS += ns_parse.c ns_name.c
|
||||||
|
MULTI_OBJS += ns_parse.o ns_name.o
|
||||||
|
BASECFLAGS += "-DDNS_PARSER_INTERNAL"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MSRPC),1)
|
||||||
|
VLMCSD_SRCS += msrpc-server.c
|
||||||
|
VLMCS_SRCS += msrpc-client.c
|
||||||
|
MULTI_SRCS += msrpc-server.c msrpc-client.c
|
||||||
|
MULTI_OBJS += msrpc-server-m.o msrpc-client-m.o
|
||||||
|
DLL_SRCS += msrpc-server.c
|
||||||
|
BASECFLAGS += -DUSE_MSRPC -Wno-unknown-pragmas
|
||||||
|
BASELDFLAGS += -lrpcrt4
|
||||||
|
else
|
||||||
|
SRCS += network.c rpc.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(WIN)" "1"
|
||||||
|
VLMCSD_SRCS += ntservice.c
|
||||||
|
MULTI_SRCS += ntservice.c
|
||||||
|
MULTI_OBJS += ntservice.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CRYPTO), openssl_with_aes)
|
||||||
|
BASECFLAGS += -D_CRYPTO_OPENSSL -D_USE_AES_FROM_OPENSSL
|
||||||
|
BASELDFLAGS += -lcrypto
|
||||||
|
SRCS += crypto_openssl.c
|
||||||
|
else ifeq ($(CRYPTO), openssl_with_aes_soft)
|
||||||
|
BASECFLAGS += -D_CRYPTO_OPENSSL -D_USE_AES_FROM_OPENSSL -D_OPENSSL_SOFTWARE
|
||||||
|
BASELDFLAGS += -lcrypto
|
||||||
|
SRCS += crypto_openssl.c
|
||||||
|
else ifeq ($(CRYPTO), openssl)
|
||||||
|
BASECFLAGS += -D_CRYPTO_OPENSSL
|
||||||
|
BASELDFLAGS += -lcrypto
|
||||||
|
SRCS += crypto_openssl.c
|
||||||
|
else ifeq ($(CRYPTO), polarssl)
|
||||||
|
BASECFLAGS += -D_CRYPTO_POLARSSL
|
||||||
|
BASELDFLAGS += -lpolarssl
|
||||||
|
else ifeq ($(CRYPTO), windows)
|
||||||
|
BASECFLAGS += -D_CRYPTO_WINDOWS
|
||||||
|
SRCS += crypto_windows.c
|
||||||
|
else
|
||||||
|
BASECFLAGS += -D_CRYPTO_INTERNAL
|
||||||
|
SRCS += crypto_internal.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(STRIP),0)
|
||||||
|
BASELDFLAGS += $(STRIPFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OPENSSL_HMAC),0)
|
||||||
|
BASECFLAGS += -D_OPENSSL_NO_HMAC
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEPENDENCIES),2)
|
||||||
|
BASECFLAGS += -MMD
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(VERBOSE),3)
|
||||||
|
COMPILER := $(shell printf "%-40s" $(notdir $(CC)))
|
||||||
|
ARCHIVER := $(shell printf "%-40s" $(notdir $(AR)))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCMD := AR
|
||||||
|
|
||||||
|
ifdef CAT
|
||||||
|
LDCMD := CC/LD
|
||||||
|
else
|
||||||
|
LDCMD := LD
|
||||||
|
endif
|
||||||
|
|
||||||
|
-include $(MULTI_SRCS:.c=.d)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
ifeq ($(VERBOSE),1)
|
||||||
|
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -c $<
|
||||||
|
ifeq ($(DEPENDENCIES),1)
|
||||||
|
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -MM -MF $*.d $<
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@echo "$(COMPILER) CC $@ <- $<"
|
||||||
|
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -c $<
|
||||||
|
ifeq ($(DEPENDENCIES),1)
|
||||||
|
@echo "$(COMPILER) DEP $*.d <- $<"
|
||||||
|
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -MM -MF $*.d $<
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
%-m.o: %.c
|
||||||
|
ifeq ($(VERBOSE),1)
|
||||||
|
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -o $@ -c $<
|
||||||
|
ifeq ($(DEPENDENCIES),1)
|
||||||
|
$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -MM -MF $*.d $<
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@echo "$(COMPILER) CC $@ <- $<"
|
||||||
|
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -o $@ -c $<
|
||||||
|
ifeq ($(DEPENDENCIES),1)
|
||||||
|
@echo "$(COMPILER) DEP $*.d <- $<"
|
||||||
|
@$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -MM -MF $*.d $<
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifdef CAT
|
||||||
|
BUILDCOMMAND = cat $^ | $(CC) -x$(COMPILER_LANGUAGE) -o $@ -
|
||||||
|
VLMCSD_PREREQUISITES = $(VLMCSD_SRCS)
|
||||||
|
VLMCS_PREREQUISITES = $(VLMCS_SRCS)
|
||||||
|
MULTI_PREREQUISITES = $(MULTI_SRCS)
|
||||||
|
DLL_PREREQUISITES = $(DLL_SRCS)
|
||||||
|
OBJ_PREREQUISITES = $(DLL_SRCS)
|
||||||
|
else
|
||||||
|
BUILDCOMMAND = $(CC) -o $@ $^
|
||||||
|
VLMCSD_PREREQUISITES = $(VLMCSD_OBJS)
|
||||||
|
VLMCS_PREREQUISITES = $(VLMCS_OBJS)
|
||||||
|
MULTI_PREREQUISITES = $(MULTI_OBJS)
|
||||||
|
DLL_PREREQUISITES = $(DLL_OBJS)
|
||||||
|
OBJ_PREREQUISITES = $(DLL_OBJS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(VERBOSE),1)
|
||||||
|
BUILDCOMMANDPREFIX = +
|
||||||
|
else
|
||||||
|
BUILDCOMMANDPREFIX = +@
|
||||||
|
endif
|
||||||
|
|
||||||
|
INFOCOMMAND = +@echo "$(COMPILER) $(LDCMD) $@ <- $^"
|
||||||
|
ARINFOCOMMAND = +@echo "$(ARCHIVER) $(ARCMD) $@ <. $^"
|
||||||
|
|
||||||
|
VLMCSD_COMMAND = $(BUILDCOMMANDPREFIX)$(BUILDCOMMAND) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(BASELDFLAGS) $(LDFLAGS) $(SERVERLDFLAGS)
|
||||||
|
VLMCS_COMMAND = $(BUILDCOMMANDPREFIX)$(BUILDCOMMAND) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(BASELDFLAGS) $(LDFLAGS) $(CLIENTLDFLAGS)
|
||||||
|
MULTI_COMMAND = $(BUILDCOMMANDPREFIX)$(BUILDCOMMAND) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(BASELDFLAGS) $(LDFLAGS) $(CLIENTLDFLAGS) $(SERVERLDFLAGS)
|
||||||
|
DLL_COMMAND = $(BUILDCOMMANDPREFIX)$(BUILDCOMMAND) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(BASELDFLAGS) $(LDFLAGS) $(SERVERLDFLAGS) -fvisibility=hidden -shared -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC
|
||||||
|
OBJ_COMMAND = $(BUILDCOMMANDPREFIX)$(BUILDCOMMAND) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(BASELDFLAGS) $(LDFLAGS) $(SERVERLDFLAGS) -fvisibility=hidden -c -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC
|
||||||
|
|
||||||
|
$(PROGRAM_NAME): $(VLMCSD_PREREQUISITES)
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(INFOCOMMAND)
|
||||||
|
endif
|
||||||
|
$(VLMCSD_COMMAND)
|
||||||
|
|
||||||
|
$(CLIENT_NAME): $(VLMCS_PREREQUISITES)
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(INFOCOMMAND)
|
||||||
|
endif
|
||||||
|
$(VLMCS_COMMAND)
|
||||||
|
|
||||||
|
$(MULTI_NAME): $(MULTI_PREREQUISITES)
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(INFOCOMMAND)
|
||||||
|
endif
|
||||||
|
$(MULTI_COMMAND)
|
||||||
|
|
||||||
|
$(DLL_NAME): $(DLL_PREREQUISITES)
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(INFOCOMMAND)
|
||||||
|
endif
|
||||||
|
$(DLL_COMMAND)
|
||||||
|
|
||||||
|
ifndef CAT
|
||||||
|
$(OBJ_NAME):
|
||||||
|
+@echo Cannot make $@ without CAT defined. Please create $(A_NAME)
|
||||||
|
else
|
||||||
|
$(OBJ_NAME): $(OBJ_PREREQUISITES)
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(INFOCOMMAND)
|
||||||
|
endif
|
||||||
|
$(OBJ_COMMAND)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CAT
|
||||||
|
$(A_NAME): $(OBJ_NAME)
|
||||||
|
else
|
||||||
|
$(A_NAME): BASECFLAGS += -fvisibility=hidden -DIS_LIBRARY=1 $(LIBRARY_CFLAGS) -UNO_SOCKETS -UUSE_MSRPC
|
||||||
|
$(A_NAME): $(DLL_OBJS)
|
||||||
|
endif
|
||||||
|
ifneq ($(VERBOSE),1)
|
||||||
|
$(ARINFOCOMMAND)
|
||||||
|
endif
|
||||||
|
+@rm -f $@
|
||||||
|
$(BUILDCOMMANDPREFIX)$(AR) rcs $@ $^
|
||||||
|
|
||||||
|
%.pdf : %
|
||||||
|
ifeq ($(shell uname), Darwin)
|
||||||
|
groff -Tps -mandoc -c $< | pstopdf -i -o $@
|
||||||
|
else
|
||||||
|
groff -Tpdf -mandoc -c $< > $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
%.html : %
|
||||||
|
groff -Thtml -mandoc -c $< > $@
|
||||||
|
|
||||||
|
%.unix.txt : %
|
||||||
|
groff -P -c -Tutf8 -mandoc -c $< | col -bx > $@
|
||||||
|
|
||||||
|
%.dos.txt : %.unix.txt
|
||||||
|
# unix2dos -n $< $@
|
||||||
|
# sed -e 's/$$/\r/' $< > $@
|
||||||
|
awk 'sub("$$", "\r")' $< > $@
|
||||||
|
|
||||||
|
pdfdocs : $(PDFDOCS)
|
||||||
|
|
||||||
|
dosdocs : $(DOSDOCS)
|
||||||
|
|
||||||
|
unixdocs : $(UNIXDOCS)
|
||||||
|
|
||||||
|
htmldocs : $(HTMLDOCS)
|
||||||
|
|
||||||
|
alldocs : $(UNIXDOCS) $(HTMLDOCS) $(PDFDOCS) $(DOSDOCS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C src $@ FROM_PARENT=1 PROGRAM_NAME=$(PROGRAM_NAME) CLIENT_NAME=$(CLIENT_NAME) MULTI_NAME=$(MULTI_NAME) DLL_NAME=$(DLL_NAME) A_NAME=$(A_NAME)
|
rm -f *.o *.d *_all.c libkms_all_*.c $(PROGRAM_NAME) $(MULTI_NAME) $(DLL_NAME) $(CLIENT_NAME) $(PDFDOCS) $(DOSDOCS) $(UNIXDOCS) $(HTMLDOCS) $(OBJ_NAME) $(A_NAME) *.a
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
|
||||||
|
|
||||||
alldocs:
|
dnsclean:
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
rm -f dns_srv.o
|
||||||
|
|
||||||
dosdocs:
|
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
|
||||||
|
|
||||||
unixdocs:
|
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
|
||||||
|
|
||||||
htmldocs:
|
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
|
||||||
|
|
||||||
pdfdocs:
|
|
||||||
+@$(MAKE) -j$(MAX_THREADS) -C man $@
|
|
||||||
|
|
||||||
GNUmakefile:
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Type"
|
@echo "Type"
|
||||||
@echo " ${MAKE} - to build $(BASE_PROGRAM_NAME) and $(BASE_CLIENT_NAME)"
|
@echo " ${MAKE} - to build $(PROGRAM_NAME) and $(CLIENT_NAME)"
|
||||||
@echo " ${MAKE} clean - to remove all targets and temporary files"
|
@echo " ${MAKE} clean - to remove $(PROGRAM_NAME) and $(CLIENT_NAME)"
|
||||||
|
@echo " ${MAKE} help - to see this help"
|
||||||
@echo " ${MAKE} pdfdocs - Create PDF versions of the documentation (Requires groff with PDF support)."
|
@echo " ${MAKE} pdfdocs - Create PDF versions of the documentation (Requires groff with PDF support)."
|
||||||
@echo " ${MAKE} htmldocs - Create HTML versions of the documentation."
|
@echo " ${MAKE} htmldocs - Create HTML versions of the documentation."
|
||||||
@echo " ${MAKE} unixdocs - Create Unix TXT versions of the documentation."
|
@echo " ${MAKE} unixdocs - Create Unix TXT versions of the documentation."
|
||||||
@echo " ${MAKE} dosdocs - Create DOS/Windows TXT versions of the documentation."
|
@echo " ${MAKE} dosdocs - Create DOS/Windows TXT versions of the documentation."
|
||||||
@echo " ${MAKE} alldocs - Create all versions of the documentation."
|
@echo " ${MAKE} alldocs - Create all versions of the documentation."
|
||||||
@echo " ${MAKE} vlmcsd - to build KMS server $(PROGRAM_NAME)"
|
@echo " ${MAKE} -j <x> - Use <x> parallel tasks (SMP support) when compiling $(PROGRAM_NAME) and $(CLIENT_NAME)"
|
||||||
@echo " ${MAKE} vlmcs - to build KMS client $(CLIENT_NAME)"
|
@echo ""
|
||||||
@echo " ${MAKE} vlmcsdmulti - to build $(BASE_PROGRAM_NAME) and $(BASE_CLIENT_NAME) in a single multi-call binary $(MULTI_NAME)"
|
@echo " ${MAKE} $(PROGRAM_NAME) - to build the server only."
|
||||||
@echo " ${MAKE} libkms - to build the shared library $(DLL_NAME)"
|
@echo " ${MAKE} $(CLIENT_NAME) - to build the client only."
|
||||||
@echo " ${MAKE} libkms-static - to build the static library $(A_NAME)"
|
@echo " ${MAKE} $(MULTI_NAME) - to build $(PROGRAM_NAME) and $(CLIENT_NAME) in a single multi-call binary"
|
||||||
|
@echo " ${MAKE} $(DLL_NAME) - to build the shared library $(DLL_NAME)"
|
||||||
|
@echo " ${MAKE} $(A_NAME) - to build the static library $(A_NAME)"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Options"
|
@echo "Options"
|
||||||
@echo " CONFIG=<x> Compile <x> as instead of config.h."
|
@echo " CONFIG=<x> Compile <x> as instead of config.h."
|
||||||
@echo " INI=<x> Compile $(BASE_PROGRAM_NAME) with default ini file <x>"
|
@echo " INI=<x> Compile $(PROGRAM_NAME) with default ini file <x>"
|
||||||
@echo " DATA=<x> Compile $(BASE_PROGRAM_NAME) and $(BASE_CLIENT_NAME) with default KMS data file <x>"
|
|
||||||
@echo " PROGRAM_NAME=<x> Use <x> as output file name for the KMS server. Defaults to vlmcsd."
|
@echo " PROGRAM_NAME=<x> Use <x> as output file name for the KMS server. Defaults to vlmcsd."
|
||||||
@echo " CLIENT_NAME=<x> Use <x> as output file name for the KMS client. Defaults to vlmcs."
|
@echo " CLIENT_NAME=<x> Use <x> as output file name for the KMS client. Defaults to vlmcs."
|
||||||
@echo " MULTI_NAME=<x> Use <x> as output file name for the multi-call binary. Defaults to vlmcsdmulti."
|
@echo " MULTI_NAME=<x> Use <x> as output file name for the multi-call binary. Defaults to vlmcsdmulti."
|
||||||
|
@ -161,7 +571,7 @@ help:
|
||||||
@echo " CRYPTO=windows Use Windows CryptoAPI instead of internal crypto code for SHA256/HMAC calculations."
|
@echo " CRYPTO=windows Use Windows CryptoAPI instead of internal crypto code for SHA256/HMAC calculations."
|
||||||
@echo " MSRPC=1 Use Microsoft RPC instead of vlmcsd's internal RPC. Only works with Windows and Cygwin targets."
|
@echo " MSRPC=1 Use Microsoft RPC instead of vlmcsd's internal RPC. Only works with Windows and Cygwin targets."
|
||||||
@echo " CC=<x> Use compiler <x>. Supported compilers are gcc, icc, tcc and clang. Others may or may not work."
|
@echo " CC=<x> Use compiler <x>. Supported compilers are gcc, icc, tcc and clang. Others may or may not work."
|
||||||
@echo " AR=<x> Use <x> instead of ar to build $(BASE_A_NAME). Set to gcc-ar if you want to use gcc's LTO feature."
|
@echo " AR=<x> Use <x> instead of ar to build $(A_NAME). Set to gcc-ar if you want to use gcc's LTO feature."
|
||||||
@echo " COMPILER_LANGUAGE=<x> May be c or c++."
|
@echo " COMPILER_LANGUAGE=<x> May be c or c++."
|
||||||
@echo " TERMINAL_WIDTH=<x> Assume a fixed terminal width of <x> columns. Use in case of problems only."
|
@echo " TERMINAL_WIDTH=<x> Assume a fixed terminal width of <x> columns. Use in case of problems only."
|
||||||
@echo " VLMCSD_VERSION=<x> Sets <x> as your version identifier. Defaults to \"private build\"."
|
@echo " VLMCSD_VERSION=<x> Sets <x> as your version identifier. Defaults to \"private build\"."
|
||||||
|
@ -170,24 +580,27 @@ help:
|
||||||
@echo " PLATFORMFLAGS=<x> Pass <x> as additional arguments to the compiler and the linker."
|
@echo " PLATFORMFLAGS=<x> Pass <x> as additional arguments to the compiler and the linker."
|
||||||
@echo " BASECFLAGS=<x> Pass only <x> as arguments to the compiler (advanced users only)."
|
@echo " BASECFLAGS=<x> Pass only <x> as arguments to the compiler (advanced users only)."
|
||||||
@echo " BASELDFLAGS=<x> Pass only <x> as arguments to the linker (advanced users only)."
|
@echo " BASELDFLAGS=<x> Pass only <x> as arguments to the linker (advanced users only)."
|
||||||
@echo " STRIP=0 Don't strip debug information from $(BASE_PROGRAM_NAME) and $(BASE_CLIENT_NAME) (for developers)."
|
@echo " STRIP=0 Don't strip debug information from $(PROGRAM_NAME) and $(CLIENT_NAME) (for developers)."
|
||||||
@echo " VERBOSE=1 Be verbose when making targets."
|
@echo " VERBOSE=1 Be verbose when making targets."
|
||||||
@echo " VERBOSE=3 Show name of compiler."
|
@echo " VERBOSE=3 Show name of compiler."
|
||||||
@echo " THREADS=1 Use threads instead of fork(). Automatically set for native Windows. Recommended for Cygwin."
|
@echo " THREADS=1 Use threads instead of fork(). Automatically set for native Windows. Recommended for Cygwin."
|
||||||
|
@echo " WINDOWS=<x> Use <x> as the default ePID for Windows (when using $(PROGRAM_NAME) with -r 0)."
|
||||||
|
@echo " OFFICE2010=<x> Use <x> as the default ePID for Office2010 (when using $(PROGRAM_NAME) with -r 0)."
|
||||||
|
@echo " OFFICE2013=<x> Use <x> as the default ePID for Office2013 (when using $(PROGRAM_NAME) with -r 0)."
|
||||||
@echo " HWID=<x> Use <x> as the default HWID (when it can't be found in an ini file)."
|
@echo " HWID=<x> Use <x> as the default HWID (when it can't be found in an ini file)."
|
||||||
@echo " FEATURES=full Compile $(BASE_PROGRAM_NAME) with all features (default)."
|
@echo " FEATURES=full Compile $(PROGRAM_NAME) with all features (default)."
|
||||||
@echo " FEATURES=most Compile $(BASE_PROGRAM_NAME) without rarely used features."
|
@echo " FEATURES=most Compile $(PROGRAM_NAME) without rarely used features."
|
||||||
@echo " FEATURES=embedded Compile $(BASE_PROGRAM_NAME) with typical features for embedded systems."
|
@echo " FEATURES=embedded Compile $(PROGRAM_NAME) with typical features for embedded systems."
|
||||||
@echo " FEATURES=autostart Removes features typically not needed if you place $(BASE_PROGRAM_NAME) in an autostart script."
|
@echo " FEATURES=autostart Removes features typically not needed if you place $(PROGRAM_NAME) in an autostart script."
|
||||||
@echo " FEATURES=inetd Compile $(BASE_PROGRAM_NAME) for running through an internet superserver only."
|
@echo " FEATURES=inetd Compile $(PROGRAM_NAME) for running through an internet superserver only."
|
||||||
@echo " FEATURES=minimum Compiles only basic features of $(BASE_PROGRAM_NAME)."
|
@echo " FEATURES=minimum Compiles only basic features of $(PROGRAM_NAME)."
|
||||||
@echo " FEATURES=fixedepids $(BASE_PROGRAM_NAME) only uses bultin internal ePIDs."
|
@echo " FEATURES=fixedepids $(PROGRAM_NAME) only uses bultin internal ePIDs."
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Useful CFLAGS to save memory when running $(BASE_PROGRAM_NAME) on very small embedded devices (finer control than FEATURES=)"
|
@echo "Useful CFLAGS to save memory when running $(PROGRAM_NAME) on very small embedded devices (finer control than FEATURES=)"
|
||||||
@echo " -DNO_STRICT_MODES Don't support enhanced emulator detection prevention."
|
@echo " -DNO_EXTENDED_PRODUCT_LIST Don't compile the detailed product list."
|
||||||
@echo " -DNO_CLIENT_LIST Don't support maintaining a client list (CMIDs)."
|
@echo " -DNO_BASIC_PRODUCT_LIST Don't compile the basic product list."
|
||||||
@echo " -DNO_VERBOSE_LOG Don't support verbose logging. Removes -v option."
|
@echo " -DNO_VERBOSE_LOG Don't support verbose logging. Removes -v option."
|
||||||
@echo " -DNO_LOG Don't add support for logging. Implies -DNO_VERBOSE_LOG."
|
@echo " -DNO_LOG Don't add support for logging. Implies -DNO_VERBOSE_LOG -DNO_EXTENDED_PRODUCT_LIST and -DNO_BASIC_PRODUCT_LIST."
|
||||||
@echo " -DNO_RANDOM_EPID Don't support random ePIDs."
|
@echo " -DNO_RANDOM_EPID Don't support random ePIDs."
|
||||||
@echo " -DNO_INI_FILE Don't support reading ePIDs/HWIDs from a file."
|
@echo " -DNO_INI_FILE Don't support reading ePIDs/HWIDs from a file."
|
||||||
@echo " -DNO_PID_FILE Don't support writing a PID file. Removes -p option."
|
@echo " -DNO_PID_FILE Don't support writing a PID file. Removes -p option."
|
||||||
|
@ -195,19 +608,13 @@ help:
|
||||||
@echo " -DNO_HELP Don't support command line help."
|
@echo " -DNO_HELP Don't support command line help."
|
||||||
@echo " -DNO_CUSTOM_INTERVALS Don't support custom intervals for retry and refresh activation. Removes -A and -R options."
|
@echo " -DNO_CUSTOM_INTERVALS Don't support custom intervals for retry and refresh activation. Removes -A and -R options."
|
||||||
@echo " -DNO_FREEBIND Don't support binding to foreign IP addresses. Removes -F0 and -F1 options. Only affects FreeBSD and Linux."
|
@echo " -DNO_FREEBIND Don't support binding to foreign IP addresses. Removes -F0 and -F1 options. Only affects FreeBSD and Linux."
|
||||||
@echo " -DNO_SOCKETS Don't support standalone operation. Requires an internet superserver to start $(BASE_PROGRAM_NAME)."
|
@echo " -DSIMPLE_SOCKETS Compile $(PROGRAM_NAME) with basic socket support only. Removes -L option."
|
||||||
@echo " -DSIMPLE_SOCKETS Compile $(BASE_PROGRAM_NAME) with basic socket support only. Removes -L option."
|
@echo " -DNO_SOCKETS Don't support standalone operation. Requires an internet superserver to start $(PROGRAM_NAME)."
|
||||||
@echo " -DSIMPLE_RPC Don't support RPC with NDR64 and BTFN in $(BASE_PROGRAM_NAME) (but do in $(BASE_CLIENT_NAME)). Makes emulator detection easy."
|
@echo " -DNO_CL_PIDS Don't support specifying ePIDs and HwId from the command line in $(PROGRAM_NAME)."
|
||||||
@echo " -DNO_TAP Compile $(BASE_PROGRAM_NAME) without VPN support (Windows and Cygwin only)."
|
@echo " -DNO_LIMIT Don't support limiting concurrent clients in $(PROGRAM_NAME)."
|
||||||
@echo " -DNO_CL_PIDS Don't support specifying ePIDs and HwId from the command line in $(BASE_PROGRAM_NAME)."
|
@echo " -DNO_SIGHUP Don't support SIGHUP handling in $(PROGRAM_NAME)."
|
||||||
@echo " -DNO_LIMIT Don't support limiting concurrent clients in $(BASE_PROGRAM_NAME)."
|
@echo " -DNO_VERSION_INFORMATION Don't support displaying version information in $(PROGRAM_NAME) and $(CLIENT_NAME). Removes -V option."
|
||||||
@echo " -DNO_SIGHUP Don't support SIGHUP handling in $(BASE_PROGRAM_NAME)."
|
@echo " -DENABLE_DEPRECATED_OPTIONS Enable command line options that provide compatibility with previous versions of $(PROGRAM_NAME)."
|
||||||
@echo " -DNO_VERSION_INFORMATION Don't support displaying version information in $(BASE_PROGRAM_NAME) and $(BASE_CLIENT_NAME). Removes -V option."
|
|
||||||
@echo " -DNO_PRIVATE_IP_DETECT Don't support protection against clients with public IP addresses in $(BASE_PROGRAM_NAME)"
|
|
||||||
@echo " -DSMALL_AES Use a smaller (saves about 200 bytes) but slower implementation of AES."
|
|
||||||
@echo " -DNO_EXTERNAL_DATA Don't support loading an external database. Mutually exclusive with -DNO_INTERNAL_DATA"
|
|
||||||
@echo " -DNO_INTERNAL_DATA Don't compile an internal database. Mutually exclusive with -DNO_EXTERNAL_DATA"
|
|
||||||
@echo " -DUNSAFE_DATA_LOAD Don't check the KMS data file for integrity. Saves some bytes but is dangerous."
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Troubleshooting options"
|
@echo "Troubleshooting options"
|
||||||
@echo " CAT=1 Combine all sources in a single in-memory file and compile directly to target."
|
@echo " CAT=1 Combine all sources in a single in-memory file and compile directly to target."
|
||||||
|
@ -219,15 +626,15 @@ help:
|
||||||
@echo " OPENSSL_HMAC=0 Compile for openssl versions that don't have HMAC support (required on some embedded devices)."
|
@echo " OPENSSL_HMAC=0 Compile for openssl versions that don't have HMAC support (required on some embedded devices)."
|
||||||
@echo " NO_TIMEOUT=1 Do not set timeouts for sockets (for systems that don't support it)."
|
@echo " NO_TIMEOUT=1 Do not set timeouts for sockets (for systems that don't support it)."
|
||||||
@echo " CHILD_HANDLER=1 Install a handler for SIGCHLD (for systems that don't support SA_NOCLDWAIT)."
|
@echo " CHILD_HANDLER=1 Install a handler for SIGCHLD (for systems that don't support SA_NOCLDWAIT)."
|
||||||
@echo " NO_DNS=1 Compile $(BASE_CLIENT_NAME) without support for detecting KMS servers via DNS."
|
@echo " NO_DNS=1 Compile $(CLIENT_NAME) without support for detecting KMS servers via DNS."
|
||||||
@echo " NO_GETIFADDRS=1 Compile $(BASE_PROGRAM_NAME) without using getifaddrs()."
|
@echo " DNS_PARSER=internal Use $(CLIENT_NAME) internal DNS parsing routines. No effect on MingW (native Windows)."
|
||||||
@echo " GETIFADDRS=musl Compile $(BASE_PROGRAM_NAME) with its own implementation of getifaddrs() based on musl."
|
|
||||||
@echo " DNS_PARSER=internal Use $(BASE_CLIENT_NAME) internal DNS parsing routines. No effect on MingW (native Windows)."
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Other useful CFLAGS"
|
@echo "Other useful CFLAGS"
|
||||||
@echo " -DNO_COMPILER_UAA Do not use compiler support for byte swapping and unaligned access"
|
@echo " -DSUPPORT_WINE Add code that the Windows version of $(PROGRAM_NAME) runs on Wine if MSRPC=1"
|
||||||
@echo " -DFULL_INTERNAL_DATA Embed full internal KMS data in $(BASE_PROGRAM_NAME)."
|
|
||||||
@echo " -DSUPPORT_WINE Add code that the Windows version of $(BASE_PROGRAM_NAME) runs on Wine if MSRPC=1"
|
|
||||||
@echo " -D_PEDANTIC Report rare error/warning conditions instead of silently ignoring them."
|
@echo " -D_PEDANTIC Report rare error/warning conditions instead of silently ignoring them."
|
||||||
@echo " -DFD_SETSIZE=<x> Allow <x> -L statements in $(BASE_PROGRAM_NAME) (default: 64 on Windows, 1024 on most Unixes)."
|
@echo " -DINCLUDE_BETAS Include SKU / activation IDs for obsolete beta/preview products."
|
||||||
|
@echo " -DFD_SETSIZE=<x> Allow <x> -L statements in $(PROGRAM_NAME) (default: 64 on Windows, 1024 on most Unixes)."
|
||||||
|
@echo " -flto Use link time optimization. Not supported by old compilers (gcc < 4.7). Use whenever supported."
|
||||||
|
@echo " -flto=jobserver Utilize all CPUs during link time optimization. Requires ${MAKE} -j <cpus>"
|
||||||
|
@echo " -fno-stack-protector No stack checking. Smaller binaries."
|
||||||
|
@echo " -pipe Use pipes instead of temporary files (faster compilation, extends the life of your SSD)."
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
#define TRANSMIT_AS_TABLE_SIZE 0
|
#define TRANSMIT_AS_TABLE_SIZE 0
|
||||||
#define WIRE_MARSHAL_TABLE_SIZE 0
|
#define WIRE_MARSHAL_TABLE_SIZE 0
|
||||||
|
|
||||||
#if !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
||||||
{
|
{
|
||||||
short Pad;
|
short Pad;
|
||||||
|
@ -70,8 +68,6 @@ extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||||
|
|
||||||
#endif // !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
#define GENERIC_BINDING_TABLE_SIZE 0
|
#define GENERIC_BINDING_TABLE_SIZE 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,6 +231,8 @@ int RequestActivation(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // !MULTI_CALL_BINARY
|
||||||
|
|
||||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||||
{
|
{
|
||||||
0
|
0
|
||||||
|
@ -243,6 +241,7 @@ static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||||
//typedef void *(__RPC_API midl_user_allocate_t)(size_t);
|
//typedef void *(__RPC_API midl_user_allocate_t)(size_t);
|
||||||
typedef void *(__RPC_API *midl_allocate_t)(size_t);
|
typedef void *(__RPC_API *midl_allocate_t)(size_t);
|
||||||
|
|
||||||
|
#if !MULTI_CALL_BINARY
|
||||||
/*static*/ const MIDL_STUB_DESC KMSServer_StubDesc =
|
/*static*/ const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||||
{
|
{
|
||||||
(void *)& KMSServer___RpcClientInterface,
|
(void *)& KMSServer___RpcClientInterface,
|
|
@ -33,8 +33,6 @@
|
||||||
|
|
||||||
#include "KMSServer_h.h"
|
#include "KMSServer_h.h"
|
||||||
|
|
||||||
#if !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
#define TYPE_FORMAT_STRING_SIZE 43
|
#define TYPE_FORMAT_STRING_SIZE 43
|
||||||
#define PROC_FORMAT_STRING_SIZE 61
|
#define PROC_FORMAT_STRING_SIZE 61
|
||||||
#define EXPR_FORMAT_STRING_SIZE 1
|
#define EXPR_FORMAT_STRING_SIZE 1
|
||||||
|
@ -72,8 +70,6 @@ extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||||
|
|
||||||
#endif // !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
#define GENERIC_BINDING_TABLE_SIZE 0
|
#define GENERIC_BINDING_TABLE_SIZE 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,12 +233,14 @@ int RequestActivation(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //!MULTI_CALL_BINARY
|
||||||
|
|
||||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||||
{
|
{
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
#endif /* defined(_M_AMD64)*/
|
#endif /* defined(_M_AMD64)*/
|
||||||
|
|
||||||
|
@ -278,8 +276,6 @@ static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||||
#include "ndr64types.h"
|
#include "ndr64types.h"
|
||||||
#include "pshpack8.h"
|
#include "pshpack8.h"
|
||||||
|
|
||||||
#if !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -367,6 +363,7 @@ NDR64_FORMAT_UINT32
|
||||||
__midl_frag1_t;
|
__midl_frag1_t;
|
||||||
extern const __midl_frag1_t __midl_frag1;
|
extern const __midl_frag1_t __midl_frag1;
|
||||||
|
|
||||||
|
#if !MULTI_CALL_BINARY
|
||||||
/*static*/ const __midl_frag13_t __midl_frag13 =
|
/*static*/ const __midl_frag13_t __midl_frag13 =
|
||||||
{
|
{
|
||||||
/* */
|
/* */
|
||||||
|
@ -655,7 +652,6 @@ extern const __midl_frag1_t __midl_frag1;
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
||||||
#if !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
static const FormatInfoRef KMSServer_Ndr64ProcTable[] =
|
static const FormatInfoRef KMSServer_Ndr64ProcTable[] =
|
||||||
{
|
{
|
||||||
|
@ -665,6 +661,7 @@ static const FormatInfoRef KMSServer_Ndr64ProcTable[] =
|
||||||
//typedef void *__RPC_USER MIDL_user_allocate_t(SIZE_T)
|
//typedef void *__RPC_USER MIDL_user_allocate_t(SIZE_T)
|
||||||
typedef void *(__RPC_API *midl_allocate_t)(size_t);
|
typedef void *(__RPC_API *midl_allocate_t)(size_t);
|
||||||
|
|
||||||
|
#if !MULTI_CALL_BINARY
|
||||||
/*static*/ const MIDL_STUB_DESC KMSServer_StubDesc =
|
/*static*/ const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||||
{
|
{
|
||||||
(void *)& KMSServer___RpcClientInterface,
|
(void *)& KMSServer___RpcClientInterface,
|
||||||
|
@ -688,6 +685,7 @@ typedef void *(__RPC_API *midl_allocate_t)(size_t);
|
||||||
(void *)& KMSServer_ProxyInfo, /* proxy/server info */
|
(void *)& KMSServer_ProxyInfo, /* proxy/server info */
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
#endif // !MULTI_CALL_BINARY
|
||||||
|
|
||||||
static const MIDL_SYNTAX_INFO KMSServer_SyntaxInfo [ 2 ] =
|
static const MIDL_SYNTAX_INFO KMSServer_SyntaxInfo [ 2 ] =
|
||||||
{
|
{
|
||||||
|
@ -713,8 +711,6 @@ static const MIDL_SYNTAX_INFO KMSServer_SyntaxInfo [ 2 ] =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !MULTI_CALL_BINARY
|
|
||||||
|
|
||||||
/*static*/ const MIDL_STUBLESS_PROXY_INFO KMSServer_ProxyInfo =
|
/*static*/ const MIDL_STUBLESS_PROXY_INFO KMSServer_ProxyInfo =
|
||||||
{
|
{
|
||||||
&KMSServer_StubDesc,
|
&KMSServer_StubDesc,
|
|
@ -18,10 +18,6 @@
|
||||||
*/
|
*/
|
||||||
/* @@MIDL_FILE_HEADING( ) */
|
/* @@MIDL_FILE_HEADING( ) */
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
#include "winsock2.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||||
|
|
||||||
|
|
7
README
7
README
|
@ -1,14 +1,13 @@
|
||||||
To view the documentation cd to the directory containing the distribution
|
To view the documentation cd to the directory containing the distribution
|
||||||
files and type
|
files and type
|
||||||
|
|
||||||
man man/vlmcsd.8
|
man ./vlmcsd.8
|
||||||
to see documentation for vlmcsd
|
to see documentation for vlmcsd
|
||||||
|
|
||||||
man man/vlmcs.1
|
man ./vlmcs.1
|
||||||
to see documentation for vlmcs
|
to see documentation for vlmcs
|
||||||
|
|
||||||
man man/vlmcsd.7
|
man ./vlmcsd.7
|
||||||
to see general documentation for kms
|
to see general documentation for kms
|
||||||
|
|
||||||
If you don't have man, you may also use the .txt, .html and .pdf files
|
If you don't have man, you may also use the .txt, .html and .pdf files
|
||||||
in the man directory
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
/*
|
/*
|
||||||
* Define your own version identifier here, e.g. '#define VERSION "my vlmcsd based on 1103"'
|
* Define your own version identifier here, e.g. '#define VERSION "my vlmcsd based on svn560"'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSION "private build"
|
#define VERSION "private build"
|
||||||
|
@ -31,9 +31,25 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define default ePIDs and HWID here. Preferrably grab ePIDs and HWID
|
||||||
|
* from a real KMS server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EPID_WINDOWS
|
||||||
|
#define EPID_WINDOWS "06401-00206-271-398432-03-1033-9600.0000-1422016"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPID_OFFICE2010
|
||||||
|
#define EPID_OFFICE2010 "06401-00096-199-198384-03-1033-9600.0000-1422016"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPID_OFFICE2013
|
||||||
|
#define EPID_OFFICE2013 "06401-00206-234-384729-03-1033-9600.0000-1422016"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HWID // HwId from the Ratiborus VM
|
#ifndef HWID // HwId from the Ratiborus VM
|
||||||
#define HWID 0x3A, 0x1C, 0x04, 0x96, 0x00, 0xB6, 0x00, 0x76
|
#define HWID 0x36, 0x4F, 0x46, 0x3A, 0x88, 0x63, 0xD3, 0x5F
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,11 +70,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef INI_FILE
|
#ifndef INI_FILE
|
||||||
/*
|
/*
|
||||||
* Uncomment and customize the following line if you want vlmcsd to look for an ini file
|
* Uncomment and customize the following line if you want vlmcsd to look for an ini file
|
||||||
* at a default location.
|
* at a default location
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define INI_FILE "/etc/vlmcsd.ini"
|
//#define INI_FILE "/etc/vlmcsd.ini"
|
||||||
|
@ -67,17 +82,24 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DATA_FILE
|
|
||||||
/*
|
/*
|
||||||
* Uncomment and customize the following line if you want vlmcsd to look for a KMS data file
|
* -------------------------------
|
||||||
* at a custom default location.
|
* Backward compatibility
|
||||||
|
* -------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define DATA_FILE "/etc/vlmcsd.kmd"
|
|
||||||
|
|
||||||
#endif // DATA_FILE
|
#if !defined(ENABLE_DEPRECATED_OPTIONS)
|
||||||
|
/*
|
||||||
|
* comment out the following line if you want vlmcsd no to support command line options
|
||||||
|
* that have been present in previous versions of vlmcsd and are now obsolete
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define ENABLE_DEPRECATED_OPTIONS
|
||||||
|
|
||||||
|
#endif // ENABLE_DEPRECATED_OPTIONS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -159,16 +181,24 @@
|
||||||
/*
|
/*
|
||||||
* Cygwin, Linux, Android, NetBSD, DragonflyBSD:
|
* Cygwin, Linux, Android, NetBSD, DragonflyBSD:
|
||||||
* Do not rely on a properly mounted proc filesystem and use the less reliable
|
* Do not rely on a properly mounted proc filesystem and use the less reliable
|
||||||
* argv[0] to determine the program's executable name.
|
* argv[0] to determine the program's executable name when restarting vlmcsd
|
||||||
* Use only if absolutely necessary (very old versions of these OSses).
|
* by sending a SIGHUP signal. Use only if absolutely necessary (very old versions
|
||||||
|
* of these OSses).
|
||||||
*
|
*
|
||||||
* Minix, OpenBSD:
|
* FreeBSD:
|
||||||
* This option has no effect since the OS always must use the less reliable argv[0].
|
* Do not use sysctl and but the less reliable
|
||||||
|
* argv[0] to determine the program's executable name when restarting vlmcsd
|
||||||
|
* by sending a SIGHUP signal. Use only if absolutely necessary (very old FreeBSD).
|
||||||
*
|
*
|
||||||
* FreeBSD, Mac OS X, iOS, Solaris, Windows:
|
* OpenBSD:
|
||||||
|
* This option has no effect since OpenBSD always must use the less reliable argv[0].
|
||||||
|
*
|
||||||
|
* Mac OS X, Solaris:
|
||||||
* This option is not neccessary (and has no effect) since these OSses provide
|
* This option is not neccessary (and has no effect) since these OSses provide
|
||||||
* a reliable way to determine the executable name.
|
* a reliable way to determine the executable name.
|
||||||
*
|
*
|
||||||
|
* Windows:
|
||||||
|
* This option is not used because Windows doesn't support signals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define NO_PROCFS
|
//#define NO_PROCFS
|
||||||
|
@ -181,9 +211,9 @@
|
||||||
#ifndef USE_AUXV
|
#ifndef USE_AUXV
|
||||||
/*
|
/*
|
||||||
* Linux only:
|
* Linux only:
|
||||||
* Use the process' ELF aux vector to determine the executable name.
|
* Use the process' ELF aux vector to determine the executable name when restarting
|
||||||
* This is actually the best method but is supported only with
|
* vlmcsd by sending a SIGHUP signal. This is actually the best method but is supported
|
||||||
*
|
* only with
|
||||||
* * the musl library
|
* * the musl library
|
||||||
* * the glbic library 2.16 or newer
|
* * the glbic library 2.16 or newer
|
||||||
*
|
*
|
||||||
|
@ -191,7 +221,7 @@
|
||||||
* Use it only if your system supports it and you do not plan to use the binary on older systems.
|
* Use it only if your system supports it and you do not plan to use the binary on older systems.
|
||||||
* It won't work on debian 7 or Red Hat 6.x.
|
* It won't work on debian 7 or Red Hat 6.x.
|
||||||
*
|
*
|
||||||
* It is safe to try this by yourself. vlmcsd won't compile if your system doesn't support it.
|
* It it safe to try this by yourself. vlmcsd won't compile if your system doesn't support it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define USE_AUXV
|
//#define USE_AUXV
|
||||||
|
@ -328,13 +358,21 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FULL_INTERNAL_DATA
|
|
||||||
/*
|
/*
|
||||||
* Includes the full database in vlmcsd.
|
* ------------------------------------------------------------------------------------------
|
||||||
|
* Extra features not compiled by default because they are rarely needed
|
||||||
|
* ------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define FULL_INTERNAL_DATA
|
|
||||||
#endif // FULL_INTERNAL_DATA
|
#ifndef INCLUDE_BETAS
|
||||||
|
/*
|
||||||
|
* Uncomment the following #define if you want obsolete beta/preview SKUs
|
||||||
|
* to be included in the extended product list.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define INCLUDE_BETAS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,14 +399,35 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_TAP
|
#ifndef NO_EXTENDED_PRODUCT_LIST
|
||||||
/*
|
/*
|
||||||
* Do not compile support for using a VPN adapter under Windows. Disables -O command line option.
|
* Do not compile the extended product list. Removes the list of Activation GUIDs (aka
|
||||||
|
* Client SKU Id, License Id) and their respective product names (e.g. Windows 8.1 Enterprise).
|
||||||
|
*
|
||||||
|
* This affects logging only and does not have an effect on activation itself. As long as you
|
||||||
|
* do not also define NO_BASIC_PRODUCT_LIST more generic names like Windows 8.1 or Office 2013
|
||||||
|
* will still be logged. Saves a lot of space without loosing much functionality.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define NO_TAP
|
//#define NO_EXTENDED_PRODUCT_LIST
|
||||||
|
|
||||||
#endif // NO_TAP
|
#endif // NO_EXTENDED_PRODUCT_LIST
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NO_BASIC_PRODUCT_LIST
|
||||||
|
/*
|
||||||
|
* Do not compile the basic product list. Removes the list KMS GUIDs (aka Server SKU Id) and their
|
||||||
|
* respective product names. Only affects logging not activation. This has a negative impact only
|
||||||
|
* if you activate a product that is not (yet) in the extended product list. On the other hand you
|
||||||
|
* do not save much space by not compiling this list.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define NO_BASIC_PRODUCT_LIST
|
||||||
|
|
||||||
|
#endif // NO_BASIC_PRODUCT_LIST
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,7 +461,7 @@
|
||||||
/*
|
/*
|
||||||
* Disables logging completely. You can neither log to a file nor to the console. -D and -f will
|
* Disables logging completely. You can neither log to a file nor to the console. -D and -f will
|
||||||
* start vlmcsd in foreground. -e will not be available. Disables ini file directive LogFile.
|
* start vlmcsd in foreground. -e will not be available. Disables ini file directive LogFile.
|
||||||
* Implies NO_VERBOSE_LOG.
|
* Implies NO_VERBOSE_LOG, NO_EXTENDED_PRODUCT_LIST and NO_BASIC_PRODUCT_LIST.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define NO_LOG
|
//#define NO_LOG
|
||||||
|
@ -412,33 +471,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_STRICT_MODES
|
|
||||||
/*
|
|
||||||
* Disables emulator detection protection. Removes -M0, -M1, -E0, -E1, -K0, -K1, -K2 and -K3 from
|
|
||||||
* vlmcsd command line options and WhitelistingLevel from INI file parameters. vlmcsd always behaves
|
|
||||||
* as if it was started with -K0, -M0.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define NO_STRICT_MODES
|
|
||||||
|
|
||||||
#endif // NO_STRICT_MODES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_CLIENT_LIST
|
|
||||||
/*
|
|
||||||
* Disables the ability to maintain a list of Client Machine IDs (CMIDs). Removes -M0, -M1, -E0 and -E1
|
|
||||||
* from vlmcsd command line options.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define NO_CLIENT_LIST
|
|
||||||
|
|
||||||
#endif // !NO_CLIENT_LIST
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_RANDOM_EPID
|
#ifndef NO_RANDOM_EPID
|
||||||
/*
|
/*
|
||||||
* Disables the ability to generate random ePIDs. Useful if you managed to grab ePID/HWID from a
|
* Disables the ability to generate random ePIDs. Useful if you managed to grab ePID/HWID from a
|
||||||
|
@ -479,46 +511,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_EXTERNAL_DATA
|
|
||||||
/*
|
|
||||||
* Disables the abilty to load external KMS data from a file. Disables command line options -j
|
|
||||||
* and ini file parameter KmsData. Implies UNSAFE_DATA_LOAD.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define NO_EXTERNAL_DATA
|
|
||||||
|
|
||||||
#endif // NO_EXTERNAL_DATA
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_INTERNAL_DATA
|
|
||||||
/*
|
|
||||||
* Compiles vlmcsd and vlmcs without an internal database. If no database is found at
|
|
||||||
* either the default location or the file specified with command line option -j.,
|
|
||||||
* the program exits with an error message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define NO_INTERNAL_DATA
|
|
||||||
|
|
||||||
#endif // NO_INTERNAL_DATA
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UNSAFE_DATA_LOAD
|
|
||||||
/*
|
|
||||||
* Does not check an external KMS data file for integrity.
|
|
||||||
* This save some bytes but it dangerous if you load a KMS data file from an unknown source.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define UNSAFE_DATA_LOAD
|
|
||||||
|
|
||||||
#endif // UNSAFE_DATA_LOAD
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_USER_SWITCH
|
#ifndef NO_USER_SWITCH
|
||||||
/*
|
/*
|
||||||
* Disables switching to another uid and/or gid after starting the program and setting up the sockets.
|
* Disables switching to another uid and/or gid after starting the program and setting up the sockets.
|
||||||
|
@ -564,19 +556,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_PRIVATE_IP_DETECT
|
|
||||||
/*
|
|
||||||
* Disables the ability to protect vlmcsd against KMS requests from public IP addresses.
|
|
||||||
* Removes -o from the command line.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define NO_PRIVATE_IP_DETECT
|
|
||||||
|
|
||||||
#endif // NO_PRIVATE_IP_DETECT
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_SOCKETS
|
#ifndef NO_SOCKETS
|
||||||
/*
|
/*
|
||||||
* Disables standalone startup of vlmcsd. If you use this config directive, you must start vlmcsd from an internet
|
* Disables standalone startup of vlmcsd. If you use this config directive, you must start vlmcsd from an internet
|
||||||
|
@ -643,19 +622,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SIMPLE_RPC
|
|
||||||
/*
|
|
||||||
* Uses a simple version of the RPC protocol which does not support NDR64 and BTFN.
|
|
||||||
* Supports RPC with the features present in Windows XP and earlier only. Using this creates
|
|
||||||
* smaller binaries but makes emulator detection easier.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#define SIMPLE_RPC
|
|
||||||
#endif // !SIMPLE_RPC
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SIMPLE_SOCKETS
|
#ifndef SIMPLE_SOCKETS
|
||||||
/*
|
/*
|
||||||
* Disables the ability to choose IP addresses using the -L option in vlmcsd. vlmcsd will listen on all IP addresses.
|
* Disables the ability to choose IP addresses using the -L option in vlmcsd. vlmcsd will listen on all IP addresses.
|
||||||
|
@ -668,6 +634,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Don't change anything BELOW this line */
|
/* Don't change anything BELOW this line */
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,28 @@ const BYTE AesKeyV6[] = {
|
||||||
0xA9, 0x4A, 0x41, 0x95, 0xE2, 0x01, 0x43, 0x2D, 0x9B, 0xCB, 0x46, 0x04, 0x05, 0xD8, 0x4A, 0x21 };
|
0xA9, 0x4A, 0x41, 0x95, 0xE2, 0x01, 0x43, 0x2D, 0x9B, 0xCB, 0x46, 0x04, 0x05, 0xD8, 0x4A, 0x21 };
|
||||||
|
|
||||||
static const BYTE SBox[] = {
|
static const BYTE SBox[] = {
|
||||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B,
|
||||||
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
|
0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
|
||||||
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26,
|
||||||
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
|
0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
||||||
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
|
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2,
|
||||||
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
0xEB, 0x27, 0xB2, 0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
|
||||||
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
|
0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED,
|
||||||
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
|
0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
||||||
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F,
|
||||||
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
|
0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
|
||||||
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
|
0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, 0xCD, 0x0C, 0x13, 0xEC,
|
||||||
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
||||||
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
|
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14,
|
||||||
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
|
0xDE, 0x5E, 0x0B, 0xDB, 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
|
||||||
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, 0xE7, 0xC8, 0x37, 0x6D,
|
||||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
||||||
|
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F,
|
||||||
|
0x4B, 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
|
||||||
|
0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98, 0x11,
|
||||||
|
0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
||||||
|
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F,
|
||||||
|
0xB0, 0x54, 0xBB, 0x16
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +123,7 @@ void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int RijndaelKeyB
|
||||||
|
|
||||||
memcpy(Ctx->Key, Key, RijndaelKeyBytes);
|
memcpy(Ctx->Key, Key, RijndaelKeyBytes);
|
||||||
|
|
||||||
for ( i = (uint_fast8_t)RijndaelKeyDwords; i < ( Ctx->rounds + 1 ) << 2; i++ )
|
for ( i = RijndaelKeyDwords; i < ( Ctx->rounds + 1 ) << 2; i++ )
|
||||||
{
|
{
|
||||||
temp = Ctx->Key[ i - 1 ];
|
temp = Ctx->Key[ i - 1 ];
|
||||||
|
|
||||||
|
@ -215,45 +221,31 @@ void AesCmacV4(BYTE *Message, size_t MessageSize, BYTE *MacOut)
|
||||||
|
|
||||||
#if !defined(_CRYPTO_OPENSSL) || !defined(_USE_AES_FROM_OPENSSL)
|
#if !defined(_CRYPTO_OPENSSL) || !defined(_USE_AES_FROM_OPENSSL)
|
||||||
|
|
||||||
#ifndef SMALL_AES
|
|
||||||
|
|
||||||
static const BYTE SBoxR[] = {
|
static const BYTE SBoxR[] = {
|
||||||
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
|
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E,
|
||||||
0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
|
0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87,
|
||||||
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32,
|
||||||
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
|
0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
||||||
0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
|
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49,
|
||||||
0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16,
|
||||||
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
|
0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50,
|
||||||
0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
|
0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
||||||
0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05,
|
||||||
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
|
0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02,
|
||||||
0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
|
0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41,
|
||||||
0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
||||||
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
|
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8,
|
||||||
0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
|
0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89,
|
||||||
0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B,
|
||||||
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
|
0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
||||||
|
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59,
|
||||||
|
0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
|
||||||
|
0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D,
|
||||||
|
0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
||||||
|
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63,
|
||||||
|
0x55, 0x21, 0x0C, 0x7D
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GetSBoxR(x) SBoxR[x]
|
|
||||||
|
|
||||||
#else // SMALL_AES
|
|
||||||
|
|
||||||
static uint8_t SBoxR(uint8_t byte)
|
|
||||||
{
|
|
||||||
uint8_t i;
|
|
||||||
|
|
||||||
for (i = 0; TRUE; i++)
|
|
||||||
{
|
|
||||||
if (byte == SBox[i]) return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GetSBoxR(x) SBoxR(x)
|
|
||||||
|
|
||||||
#endif // SMALL_AES
|
|
||||||
|
|
||||||
|
|
||||||
static void ShiftRowsR(BYTE *state)
|
static void ShiftRowsR(BYTE *state)
|
||||||
{
|
{
|
||||||
|
@ -272,9 +264,7 @@ static void SubBytesR(BYTE *block)
|
||||||
uint_fast8_t i;
|
uint_fast8_t i;
|
||||||
|
|
||||||
for (i = 0; i < AES_BLOCK_BYTES; i++)
|
for (i = 0; i < AES_BLOCK_BYTES; i++)
|
||||||
{
|
block[i] = SBoxR[ block[i] ];
|
||||||
block[i] = GetSBoxR( block[i] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
#include "endian.h"
|
#include "endian.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
//#define AES_ROUNDS (10)
|
||||||
#define AES_KEY_BYTES (16) // 128 Bits
|
#define AES_KEY_BYTES (16) // 128 Bits
|
||||||
#define AES_BLOCK_BYTES (16)
|
#define AES_BLOCK_BYTES (16)
|
||||||
#define AES_BLOCK_WORDS (AES_BLOCK_BYTES / sizeof(DWORD))
|
#define AES_BLOCK_WORDS (AES_BLOCK_BYTES / sizeof(DWORD))
|
||||||
#define AES_KEY_DWORDS (AES_KEY_BYTES / sizeof(DWORD))
|
#define AES_KEY_DWORDS (AES_KEY_BYTES / sizeof(DWORD))
|
||||||
|
//#define V4_ROUNDS (11)
|
||||||
#define V4_KEY_BYTES (20) // 160 Bits
|
#define V4_KEY_BYTES (20) // 160 Bits
|
||||||
|
|
||||||
#define ROR32(v, n) ( (v) << (32 - n) | (v) >> n )
|
#define ROR32(v, n) ( (v) << (32 - n) | (v) >> n )
|
||||||
|
@ -37,7 +39,7 @@ typedef struct {
|
||||||
void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int AesKeyBytes);
|
void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int AesKeyBytes);
|
||||||
void AesEncryptBlock(const AesCtx *const Ctx, BYTE *block);
|
void AesEncryptBlock(const AesCtx *const Ctx, BYTE *block);
|
||||||
void AesDecryptBlock(const AesCtx *const Ctx, BYTE *block);
|
void AesDecryptBlock(const AesCtx *const Ctx, BYTE *block);
|
||||||
void AesEncryptCbc(const AesCtx *const Ctx, BYTE *restrict iv, BYTE *restrict data, size_t *restrict len);
|
void AesEncryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t *len);
|
||||||
void AesDecryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t len);
|
void AesDecryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t len);
|
||||||
void MixColumnsR(BYTE *restrict state);
|
void MixColumnsR(BYTE *restrict state);
|
||||||
|
|
|
@ -95,7 +95,7 @@ static void Sha256Update(Sha256Ctx *Ctx, BYTE *data, size_t len)
|
||||||
unsigned int b_len = Ctx->Len & 63,
|
unsigned int b_len = Ctx->Len & 63,
|
||||||
r_len = (b_len ^ 63) + 1;
|
r_len = (b_len ^ 63) + 1;
|
||||||
|
|
||||||
Ctx->Len += (unsigned int)len;
|
Ctx->Len += len;
|
||||||
|
|
||||||
if ( len < r_len )
|
if ( len < r_len )
|
||||||
{
|
{
|
|
@ -39,7 +39,7 @@ static int_fast8_t AcquireCryptContext()
|
||||||
{
|
{
|
||||||
if (!hRsaAesProvider)
|
if (!hRsaAesProvider)
|
||||||
{
|
{
|
||||||
return (int_fast8_t)CryptAcquireContextW
|
return CryptAcquireContextW
|
||||||
(
|
(
|
||||||
&hRsaAesProvider, // Provider handle
|
&hRsaAesProvider, // Provider handle
|
||||||
NULL, // No key container name
|
NULL, // No key container name
|
||||||
|
@ -163,7 +163,7 @@ int_fast8_t Sha256Hmac(const BYTE* key, BYTE* restrict data, DWORD len, BYTE* re
|
||||||
if (hKey) CryptDestroyKey(hKey);
|
if (hKey) CryptDestroyKey(hKey);
|
||||||
if (hHmacHash) CryptDestroyHash(hHmacHash);
|
if (hHmacHash) CryptDestroyHash(hHmacHash);
|
||||||
|
|
||||||
return (int_fast8_t)success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _WIN32 || __CYGWIN__
|
#endif // _WIN32 || __CYGWIN__
|
|
@ -11,9 +11,6 @@
|
||||||
#else // _WIN32 || __CYGWIN__
|
#else // _WIN32 || __CYGWIN__
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#if _MSC_VER
|
|
||||||
#include "Wincrypt.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _Sha2356HmacCtx
|
typedef struct _Sha2356HmacCtx
|
||||||
{
|
{
|
||||||
|
@ -21,7 +18,7 @@ typedef struct _Sha2356HmacCtx
|
||||||
HCRYPTKEY hKey;
|
HCRYPTKEY hKey;
|
||||||
} Sha256HmacCtx;
|
} Sha256HmacCtx;
|
||||||
|
|
||||||
int_fast8_t Sha256(BYTE* restrict data, DWORD DataSize, BYTE* restrict hash);
|
int_fast8_t Sha256(BYTE *data, DWORD len, BYTE *hash);
|
||||||
int_fast8_t Sha256Hmac(const BYTE* key, BYTE* restrict data, DWORD len, BYTE* restrict hmac);
|
int_fast8_t Sha256Hmac(const BYTE* key, BYTE* restrict data, DWORD len, BYTE* restrict hmac);
|
||||||
|
|
||||||
/*int_fast8_t Sha256HmacInit(Sha256HmacCtx *Ctx, BYTE *key, uint8_t keySize);
|
/*int_fast8_t Sha256HmacInit(Sha256HmacCtx *Ctx, BYTE *key, uint8_t keySize);
|
1
debian
1
debian
|
@ -1 +0,0 @@
|
||||||
Subproject commit 96200e41ef8b25388b2fa0f78c29133424b2c425
|
|
|
@ -309,7 +309,7 @@ int getKmsServerList(kms_server_dns_ptr** serverlist, const char *const restrict
|
||||||
|
|
||||||
memset(kms_server, 0, sizeof(kms_server_dns_t));
|
memset(kms_server, 0, sizeof(kms_server_dns_t));
|
||||||
|
|
||||||
vlmcsd_snprintf(kms_server->serverName, sizeof(kms_server->serverName), "%s:%hu", dns_iterator->Data.SRV.pNameTarget, dns_iterator->Data.SRV.wPort);
|
snprintf(kms_server->serverName, sizeof(kms_server->serverName), "%s:%hu", dns_iterator->Data.SRV.pNameTarget, dns_iterator->Data.SRV.wPort);
|
||||||
kms_server->priority = dns_iterator->Data.SRV.wPriority;
|
kms_server->priority = dns_iterator->Data.SRV.wPriority;
|
||||||
kms_server->weight = dns_iterator->Data.SRV.wWeight;
|
kms_server->weight = dns_iterator->Data.SRV.wWeight;
|
||||||
|
|
|
@ -96,7 +96,7 @@ typedef enum __ns_class {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int getKmsServerList(kms_server_dns_ptr** serverlist, const char *const restrict query);
|
int getKmsServerList(kms_server_dns_ptr** serverlist, const char *restrict query);
|
||||||
void sortSrvRecords(kms_server_dns_ptr* serverlist, const int answers);
|
void sortSrvRecords(kms_server_dns_ptr* serverlist, const int answers);
|
||||||
|
|
||||||
#endif // NO_DNS
|
#endif // NO_DNS
|
1
docker
1
docker
|
@ -1 +0,0 @@
|
||||||
Subproject commit 4195d04f687973a514e3fb663bd87161afd46697
|
|
|
@ -6,67 +6,67 @@
|
||||||
#include "endian.h"
|
#include "endian.h"
|
||||||
|
|
||||||
#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
|
#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
|
||||||
&& defined(BS16) && defined(BS32) && defined(BS64) && !defined(NO_COMPILER_UAA)
|
&& defined(BS16) && defined(BS32) && defined(BS64)
|
||||||
|
|
||||||
#else // ! defined(__BYTE_ORDER)
|
#else // ! defined(__BYTE_ORDER)
|
||||||
|
|
||||||
void PUT_UAA64BE(void *p, unsigned long long v, unsigned int i)
|
void PUT_UAA64BE(void *p, unsigned long long v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned long long *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned long long *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v >> 56);
|
_p[ 0 ] = v >> 56;
|
||||||
_p[ 1 ] = (unsigned char)(v >> 48);
|
_p[ 1 ] = v >> 48;
|
||||||
_p[ 2 ] = (unsigned char)(v >> 40);
|
_p[ 2 ] = v >> 40;
|
||||||
_p[ 3 ] = (unsigned char)(v >> 32);
|
_p[ 3 ] = v >> 32;
|
||||||
_p[ 4 ] = (unsigned char)(v >> 24);
|
_p[ 4 ] = v >> 24;
|
||||||
_p[ 5 ] = (unsigned char)(v >> 16);
|
_p[ 5 ] = v >> 16;
|
||||||
_p[ 6 ] = (unsigned char)(v >> 8);
|
_p[ 6 ] = v >> 8;
|
||||||
_p[ 7 ] = (unsigned char)(v);
|
_p[ 7 ] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PUT_UAA32BE(void *p, unsigned int v, unsigned int i)
|
void PUT_UAA32BE(void *p, unsigned int v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v >> 24);
|
_p[ 0 ] = v >> 24;
|
||||||
_p[ 1 ] = (unsigned char)(v >> 16);
|
_p[ 1 ] = v >> 16;
|
||||||
_p[ 2 ] = (unsigned char)(v >> 8);
|
_p[ 2 ] = v >> 8;
|
||||||
_p[ 3 ] = (unsigned char)(v);
|
_p[ 3 ] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PUT_UAA16BE(void *p, unsigned short v, unsigned int i)
|
void PUT_UAA16BE(void *p, unsigned short v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned short *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned short *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v >> 8);
|
_p[ 0 ] = v >> 8;
|
||||||
_p[ 1 ] = (unsigned char)(v);
|
_p[ 1 ] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PUT_UAA64LE(void *p, unsigned long long v, unsigned int i)
|
void PUT_UAA64LE(void *p, unsigned long long v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned long long *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned long long *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v);
|
_p[ 0 ] = v;
|
||||||
_p[ 1 ] = (unsigned char)(v >> 8);
|
_p[ 1 ] = v >> 8;
|
||||||
_p[ 2 ] = (unsigned char)(v >> 16);
|
_p[ 2 ] = v >> 16;
|
||||||
_p[ 3 ] = (unsigned char)(v >> 24);
|
_p[ 3 ] = v >> 24;
|
||||||
_p[ 4 ] = (unsigned char)(v >> 32);
|
_p[ 4 ] = v >> 32;
|
||||||
_p[ 5 ] = (unsigned char)(v >> 40);
|
_p[ 5 ] = v >> 40;
|
||||||
_p[ 6 ] = (unsigned char)(v >> 48);
|
_p[ 6 ] = v >> 48;
|
||||||
_p[ 7 ] = (unsigned char)(v >> 56);
|
_p[ 7 ] = v >> 56;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PUT_UAA32LE(void *p, unsigned int v, unsigned int i)
|
void PUT_UAA32LE(void *p, unsigned int v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v);
|
_p[ 0 ] = v;
|
||||||
_p[ 1 ] = (unsigned char)(v >> 8);
|
_p[ 1 ] = v >> 8;
|
||||||
_p[ 2 ] = (unsigned char)(v >> 16);
|
_p[ 2 ] = v >> 16;
|
||||||
_p[ 3 ] = (unsigned char)(v >> 24);
|
_p[ 3 ] = v >> 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PUT_UAA16LE(void *p, unsigned short v, unsigned int i)
|
void PUT_UAA16LE(void *p, unsigned short v, unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned char *_p = (unsigned char *)&((unsigned short *)p)[i];
|
unsigned char *_p = (unsigned char *)&((unsigned short *)p)[i];
|
||||||
_p[ 0 ] = (unsigned char)(v);
|
_p[ 0 ] = v;
|
||||||
_p[ 1 ] = (unsigned char)(v >> 8);
|
_p[ 1 ] = v >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,12 +136,8 @@ unsigned short GET_UAA16LE(void *p, unsigned int i)
|
||||||
(unsigned short)_p[ 0 ] |
|
(unsigned short)_p[ 0 ] |
|
||||||
(unsigned short)_p[ 1 ] << 8;
|
(unsigned short)_p[ 1 ] << 8;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
|
|
||||||
&& defined(BS16) && defined(BS32) && defined(BS64)
|
|
||||||
#else
|
|
||||||
unsigned short BE16(unsigned short x)
|
unsigned short BE16(unsigned short x)
|
||||||
{
|
{
|
||||||
return GET_UAA16BE(&x, 0);
|
return GET_UAA16BE(&x, 0);
|
||||||
|
@ -167,7 +163,7 @@ unsigned long long BE64(unsigned long long x)
|
||||||
return GET_UAA64BE(&x, 0);
|
return GET_UAA64BE(&x, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long LE64(unsigned long long x)
|
inline unsigned long long LE64(unsigned long long x)
|
||||||
{
|
{
|
||||||
return GET_UAA64LE(&x, 0);
|
return GET_UAA64LE(&x, 0);
|
||||||
}
|
}
|
|
@ -9,17 +9,17 @@
|
||||||
//
|
//
|
||||||
// Unaligned access
|
// Unaligned access
|
||||||
//
|
//
|
||||||
|
|
||||||
#if !defined(NO_COMPILER_UAA)
|
|
||||||
#define UAA16(p, i) (((PACKED16*)p)->val[i])
|
#define UAA16(p, i) (((PACKED16*)p)->val[i])
|
||||||
#define UAA32(p, i) (((PACKED32*)p)->val[i])
|
#define UAA32(p, i) (((PACKED32*)p)->val[i])
|
||||||
#define UAA64(p, i) (((PACKED64*)p)->val[i])
|
#define UAA64(p, i) (((PACKED64*)p)->val[i])
|
||||||
#endif
|
|
||||||
|
#define UA64(p) UAA64(p, 0)
|
||||||
|
#define UA32(p) UAA32(p, 0)
|
||||||
|
#define UA16(p) UAA16(p, 0)
|
||||||
|
|
||||||
//
|
//
|
||||||
//Byteswap: Use compiler support if available
|
//Byteswap: Use compiler support if available
|
||||||
//
|
//
|
||||||
#ifndef NO_COMPILER_UAA
|
|
||||||
#ifdef __has_builtin // Clang supports this
|
#ifdef __has_builtin // Clang supports this
|
||||||
|
|
||||||
#if __has_builtin(__builtin_bswap16)
|
#if __has_builtin(__builtin_bswap16)
|
||||||
|
@ -56,7 +56,6 @@
|
||||||
#endif // GNU C > 4.7
|
#endif // GNU C > 4.7
|
||||||
#endif // __GNUC__ > 4
|
#endif // __GNUC__ > 4
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
#endif // NO_COMPILER_UAA
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Byteorder
|
// Byteorder
|
||||||
|
@ -199,10 +198,6 @@
|
||||||
#define __BE64(x) BS64(x)
|
#define __BE64(x) BS64(x)
|
||||||
#define __LE64(x) (x)
|
#define __LE64(x) (x)
|
||||||
|
|
||||||
#define PUT_UA16(p, v) PUT_UA16LE(p, v)
|
|
||||||
#define PUT_UA32(p, v) PUT_UA32LE(p, v)
|
|
||||||
#define PUT_UA64(p, v) PUT_UA64LE(p, v)
|
|
||||||
|
|
||||||
#else // __BYTE_ORDER == __BIG_ENDIAN
|
#else // __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
|
||||||
#define __BE16(x) (x)
|
#define __BE16(x) (x)
|
||||||
|
@ -212,38 +207,8 @@
|
||||||
#define __BE64(x) (x)
|
#define __BE64(x) (x)
|
||||||
#define __LE64(x) BS64(x)
|
#define __LE64(x) BS64(x)
|
||||||
|
|
||||||
#define PUT_UA16(p, v) PUT_UA16BE(p, v)
|
|
||||||
#define PUT_UA32(p, v) PUT_UA32BE(p, v)
|
|
||||||
#define PUT_UA64(p, v) PUT_UA64BE(p, v)
|
|
||||||
|
|
||||||
#endif // __BYTE_ORDER
|
#endif // __BYTE_ORDER
|
||||||
|
|
||||||
#define BE16(x) __BE16(x)
|
|
||||||
#define LE16(x) __LE16(x)
|
|
||||||
#define BE32(x) __BE32(x)
|
|
||||||
#define LE32(x) __LE32(x)
|
|
||||||
#define BE64(x) __BE64(x)
|
|
||||||
#define LE64(x) __LE64(x)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
extern unsigned short BE16(unsigned short x);
|
|
||||||
|
|
||||||
extern unsigned short LE16(unsigned short x);
|
|
||||||
|
|
||||||
extern unsigned int BE32(unsigned int x);
|
|
||||||
|
|
||||||
extern unsigned int LE32(unsigned int x);
|
|
||||||
|
|
||||||
extern unsigned long long BE64(unsigned long long x);
|
|
||||||
|
|
||||||
extern unsigned long long LE64(unsigned long long x);
|
|
||||||
|
|
||||||
#endif // defined(__BYTE_ORDER)
|
|
||||||
|
|
||||||
#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) \
|
|
||||||
&& defined(BS16) && defined(BS32) && defined(BS64) &&!defined(NO_COMPILER_UAA)
|
|
||||||
|
|
||||||
#define PUT_UAA64BE(p, v, i) ( UAA64(p, i) = __BE64(v) )
|
#define PUT_UAA64BE(p, v, i) ( UAA64(p, i) = __BE64(v) )
|
||||||
#define PUT_UAA32BE(p, v, i) ( UAA32(p, i) = __BE32(v) )
|
#define PUT_UAA32BE(p, v, i) ( UAA32(p, i) = __BE32(v) )
|
||||||
#define PUT_UAA16BE(p, v, i) ( UAA16(p, i) = __BE16(v) )
|
#define PUT_UAA16BE(p, v, i) ( UAA16(p, i) = __BE16(v) )
|
||||||
|
@ -260,6 +225,12 @@ extern unsigned long long LE64(unsigned long long x);
|
||||||
#define GET_UAA32LE(p, i) __LE32(UAA32(p, i))
|
#define GET_UAA32LE(p, i) __LE32(UAA32(p, i))
|
||||||
#define GET_UAA16LE(p, i) __LE16(UAA16(p, i))
|
#define GET_UAA16LE(p, i) __LE16(UAA16(p, i))
|
||||||
|
|
||||||
|
#define BE16(x) __BE16(x)
|
||||||
|
#define LE16(x) __LE16(x)
|
||||||
|
#define BE32(x) __BE32(x)
|
||||||
|
#define LE32(x) __LE32(x)
|
||||||
|
#define BE64(x) __BE64(x)
|
||||||
|
#define LE64(x) __LE64(x)
|
||||||
|
|
||||||
#else // ! defined(__BYTE_ORDER)
|
#else // ! defined(__BYTE_ORDER)
|
||||||
|
|
||||||
|
@ -289,9 +260,22 @@ extern unsigned long long GET_UAA64LE(void* p, unsigned int i);
|
||||||
extern unsigned int GET_UAA32LE(void *p, unsigned int i);
|
extern unsigned int GET_UAA32LE(void *p, unsigned int i);
|
||||||
|
|
||||||
extern unsigned short GET_UAA16LE(void *p, unsigned int i);
|
extern unsigned short GET_UAA16LE(void *p, unsigned int i);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
extern unsigned short BE16(unsigned short x);
|
||||||
|
|
||||||
|
extern unsigned short LE16(unsigned short x);
|
||||||
|
|
||||||
|
extern unsigned int BE32(unsigned int x);
|
||||||
|
|
||||||
|
extern unsigned int LE32(unsigned int x);
|
||||||
|
|
||||||
|
extern unsigned long long BE64(unsigned long long x);
|
||||||
|
|
||||||
|
extern unsigned long long LE64(unsigned long long x);
|
||||||
|
|
||||||
|
#endif // defined(__BYTE_ORDER)
|
||||||
|
|
||||||
|
|
||||||
#define PUT_UA64BE(p, v) PUT_UAA64BE(p, v, 0)
|
#define PUT_UA64BE(p, v) PUT_UAA64BE(p, v, 0)
|
||||||
#define PUT_UA32BE(p, v) PUT_UAA32BE(p, v, 0)
|
#define PUT_UA32BE(p, v) PUT_UAA32BE(p, v, 0)
|
BIN
etc/vlmcsd.kmd
BIN
etc/vlmcsd.kmd
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,254 @@
|
||||||
|
#
|
||||||
|
# Automatically generated file; DO NOT EDIT.
|
||||||
|
# uClibc-ng 1.0.15 C Library Configuration
|
||||||
|
#
|
||||||
|
# TARGET_alpha is not set
|
||||||
|
# TARGET_arc is not set
|
||||||
|
# TARGET_arm is not set
|
||||||
|
# TARGET_avr32 is not set
|
||||||
|
# TARGET_bfin is not set
|
||||||
|
# TARGET_c6x is not set
|
||||||
|
# TARGET_cris is not set
|
||||||
|
# TARGET_frv is not set
|
||||||
|
# TARGET_h8300 is not set
|
||||||
|
# TARGET_hppa is not set
|
||||||
|
TARGET_i386=y
|
||||||
|
# TARGET_ia64 is not set
|
||||||
|
# TARGET_lm32 is not set
|
||||||
|
# TARGET_m68k is not set
|
||||||
|
# TARGET_metag is not set
|
||||||
|
# TARGET_microblaze is not set
|
||||||
|
# TARGET_mips is not set
|
||||||
|
# TARGET_nios2 is not set
|
||||||
|
# TARGET_or1k is not set
|
||||||
|
# TARGET_powerpc is not set
|
||||||
|
# TARGET_sh is not set
|
||||||
|
# TARGET_sparc is not set
|
||||||
|
# TARGET_x86_64 is not set
|
||||||
|
# TARGET_xtensa is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Target Architecture Features and Options
|
||||||
|
#
|
||||||
|
TARGET_ARCH="i386"
|
||||||
|
FORCE_OPTIONS_FOR_ARCH=y
|
||||||
|
# CONFIG_386 is not set
|
||||||
|
CONFIG_486=y
|
||||||
|
# CONFIG_586 is not set
|
||||||
|
# CONFIG_686 is not set
|
||||||
|
TARGET_SUBARCH="i486"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Using ELF file format
|
||||||
|
#
|
||||||
|
ARCH_HAS_DEPRECATED_SYSCALLS=y
|
||||||
|
ARCH_LITTLE_ENDIAN=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Using Little Endian
|
||||||
|
#
|
||||||
|
ARCH_HAS_MMU=y
|
||||||
|
ARCH_USE_MMU=y
|
||||||
|
UCLIBC_HAS_FLOATS=y
|
||||||
|
UCLIBC_HAS_FPU=y
|
||||||
|
DO_C99_MATH=y
|
||||||
|
DO_XSI_MATH=y
|
||||||
|
# UCLIBC_HAS_FENV is not set
|
||||||
|
# UCLIBC_HAS_LONG_DOUBLE_MATH is not set
|
||||||
|
KERNEL_HEADERS="/root/openadk/target_generic-x86_uclibc-ng/usr/include"
|
||||||
|
HAVE_DOT_CONFIG=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# General Library Settings
|
||||||
|
#
|
||||||
|
DOPIC=y
|
||||||
|
ARCH_HAS_UCONTEXT=y
|
||||||
|
HAVE_SHARED=y
|
||||||
|
# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
|
||||||
|
LDSO_LDD_SUPPORT=y
|
||||||
|
LDSO_CACHE_SUPPORT=y
|
||||||
|
# LDSO_PRELOAD_ENV_SUPPORT is not set
|
||||||
|
# LDSO_PRELOAD_FILE_SUPPORT is not set
|
||||||
|
LDSO_BASE_FILENAME="ld.so"
|
||||||
|
# LDSO_STANDALONE_SUPPORT is not set
|
||||||
|
# LDSO_PRELINK_SUPPORT is not set
|
||||||
|
# UCLIBC_STATIC_LDCONFIG is not set
|
||||||
|
LDSO_RUNPATH=y
|
||||||
|
LDSO_RUNPATH_OF_EXECUTABLE=y
|
||||||
|
LDSO_SAFE_RUNPATH=y
|
||||||
|
LDSO_SEARCH_INTERP_PATH=y
|
||||||
|
LDSO_LD_LIBRARY_PATH=y
|
||||||
|
LDSO_NO_CLEANUP=y
|
||||||
|
UCLIBC_CTOR_DTOR=y
|
||||||
|
# LDSO_GNU_HASH_SUPPORT is not set
|
||||||
|
# HAS_NO_THREADS is not set
|
||||||
|
UCLIBC_HAS_THREADS_NATIVE=y
|
||||||
|
UCLIBC_HAS_THREADS=y
|
||||||
|
UCLIBC_HAS_TLS=y
|
||||||
|
PTHREADS_DEBUG_SUPPORT=y
|
||||||
|
UCLIBC_HAS_SYSLOG=y
|
||||||
|
UCLIBC_HAS_LFS=y
|
||||||
|
MALLOC=y
|
||||||
|
# MALLOC_SIMPLE is not set
|
||||||
|
# MALLOC_STANDARD is not set
|
||||||
|
MALLOC_GLIBC_COMPAT=y
|
||||||
|
# UCLIBC_HAS_OBSTACK is not set
|
||||||
|
UCLIBC_DYNAMIC_ATEXIT=y
|
||||||
|
COMPAT_ATEXIT=y
|
||||||
|
UCLIBC_HAS_UTMPX=y
|
||||||
|
UCLIBC_HAS_UTMP=y
|
||||||
|
UCLIBC_SUSV2_LEGACY=y
|
||||||
|
UCLIBC_SUSV3_LEGACY=y
|
||||||
|
UCLIBC_HAS_CONTEXT_FUNCS=y
|
||||||
|
# UCLIBC_SUSV3_LEGACY_MACROS is not set
|
||||||
|
UCLIBC_SUSV4_LEGACY=y
|
||||||
|
# UCLIBC_STRICT_HEADERS is not set
|
||||||
|
# UCLIBC_HAS_STUBS is not set
|
||||||
|
UCLIBC_HAS_SHADOW=y
|
||||||
|
UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
|
||||||
|
UCLIBC_HAS___PROGNAME=y
|
||||||
|
UCLIBC_HAS_PTY=y
|
||||||
|
ASSUME_DEVPTS=y
|
||||||
|
UNIX98PTY_ONLY=y
|
||||||
|
UCLIBC_HAS_GETPT=y
|
||||||
|
UCLIBC_HAS_LIBUTIL=y
|
||||||
|
UCLIBC_HAS_TM_EXTENSIONS=y
|
||||||
|
UCLIBC_HAS_TZ_CACHING=y
|
||||||
|
UCLIBC_HAS_TZ_FILE=y
|
||||||
|
UCLIBC_HAS_TZ_FILE_READ_MANY=y
|
||||||
|
UCLIBC_TZ_FILE_PATH="/etc/TZ"
|
||||||
|
UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Advanced Library Settings
|
||||||
|
#
|
||||||
|
UCLIBC_PWD_BUFFER_SIZE=256
|
||||||
|
UCLIBC_GRP_BUFFER_SIZE=256
|
||||||
|
|
||||||
|
#
|
||||||
|
# Support various families of functions
|
||||||
|
#
|
||||||
|
UCLIBC_LINUX_MODULE_26=y
|
||||||
|
# UCLIBC_LINUX_MODULE_24 is not set
|
||||||
|
UCLIBC_LINUX_SPECIFIC=y
|
||||||
|
UCLIBC_HAS_GNU_ERROR=y
|
||||||
|
UCLIBC_BSD_SPECIFIC=y
|
||||||
|
UCLIBC_HAS_BSD_ERR=y
|
||||||
|
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
|
||||||
|
# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
|
||||||
|
# UCLIBC_NTP_LEGACY is not set
|
||||||
|
UCLIBC_SV4_DEPRECATED=y
|
||||||
|
UCLIBC_HAS_REALTIME=y
|
||||||
|
UCLIBC_HAS_ADVANCED_REALTIME=y
|
||||||
|
UCLIBC_HAS_EPOLL=y
|
||||||
|
UCLIBC_HAS_XATTR=y
|
||||||
|
# UCLIBC_HAS_PROFILING is not set
|
||||||
|
UCLIBC_HAS_CRYPT_IMPL=y
|
||||||
|
UCLIBC_HAS_SHA256_CRYPT_IMPL=y
|
||||||
|
# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set
|
||||||
|
UCLIBC_HAS_CRYPT=y
|
||||||
|
UCLIBC_HAS_NETWORK_SUPPORT=y
|
||||||
|
UCLIBC_HAS_SOCKET=y
|
||||||
|
UCLIBC_HAS_IPV4=y
|
||||||
|
UCLIBC_HAS_IPV6=y
|
||||||
|
# UCLIBC_HAS_RPC is not set
|
||||||
|
UCLIBC_USE_NETLINK=y
|
||||||
|
UCLIBC_SUPPORT_AI_ADDRCONFIG=y
|
||||||
|
UCLIBC_HAS_BSD_RES_CLOSE=y
|
||||||
|
UCLIBC_HAS_COMPAT_RES_STATE=y
|
||||||
|
# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
|
||||||
|
UCLIBC_HAS_RESOLVER_SUPPORT=y
|
||||||
|
UCLIBC_HAS_LIBRESOLV_STUB=y
|
||||||
|
UCLIBC_HAS_LIBNSL_STUB=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# String and Stdio Support
|
||||||
|
#
|
||||||
|
UCLIBC_HAS_STRING_GENERIC_OPT=y
|
||||||
|
UCLIBC_HAS_STRING_ARCH_OPT=y
|
||||||
|
UCLIBC_HAS_STDIO_FUTEXES=y
|
||||||
|
UCLIBC_HAS_CTYPE_TABLES=y
|
||||||
|
UCLIBC_HAS_CTYPE_SIGNED=y
|
||||||
|
# UCLIBC_HAS_CTYPE_UNSAFE is not set
|
||||||
|
UCLIBC_HAS_CTYPE_CHECKED=y
|
||||||
|
# UCLIBC_HAS_CTYPE_ENFORCED is not set
|
||||||
|
UCLIBC_HAS_WCHAR=y
|
||||||
|
# UCLIBC_HAS_LOCALE is not set
|
||||||
|
UCLIBC_HAS_HEXADECIMAL_FLOATS=y
|
||||||
|
UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
|
||||||
|
UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
|
||||||
|
# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
|
||||||
|
# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
|
||||||
|
# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
|
||||||
|
# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
|
||||||
|
UCLIBC_HAS_STDIO_BUFSIZ_4096=y
|
||||||
|
# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
|
||||||
|
UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
|
||||||
|
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
|
||||||
|
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
|
||||||
|
# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
|
||||||
|
UCLIBC_HAS_STDIO_GETC_MACRO=y
|
||||||
|
UCLIBC_HAS_STDIO_PUTC_MACRO=y
|
||||||
|
UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
|
||||||
|
# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
|
||||||
|
UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
|
||||||
|
# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
|
||||||
|
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
|
||||||
|
UCLIBC_HAS_PRINTF_M_SPEC=y
|
||||||
|
UCLIBC_HAS_ERRNO_MESSAGES=y
|
||||||
|
# UCLIBC_HAS_SYS_ERRLIST is not set
|
||||||
|
UCLIBC_HAS_SIGNUM_MESSAGES=y
|
||||||
|
# UCLIBC_HAS_SYS_SIGLIST is not set
|
||||||
|
UCLIBC_HAS_GNU_GETOPT=y
|
||||||
|
UCLIBC_HAS_GETOPT_LONG=y
|
||||||
|
UCLIBC_HAS_GNU_GETSUBOPT=y
|
||||||
|
UCLIBC_HAS_ARGP=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Big and Tall
|
||||||
|
#
|
||||||
|
UCLIBC_HAS_REGEX=y
|
||||||
|
# UCLIBC_HAS_REGEX_OLD is not set
|
||||||
|
UCLIBC_HAS_FNMATCH=y
|
||||||
|
# UCLIBC_HAS_FNMATCH_OLD is not set
|
||||||
|
UCLIBC_HAS_WORDEXP=y
|
||||||
|
UCLIBC_HAS_NFTW=y
|
||||||
|
UCLIBC_HAS_FTW=y
|
||||||
|
UCLIBC_HAS_FTS=y
|
||||||
|
UCLIBC_HAS_GLOB=y
|
||||||
|
UCLIBC_HAS_GNU_GLOB=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Library Installation Options
|
||||||
|
#
|
||||||
|
RUNTIME_PREFIX="/"
|
||||||
|
DEVEL_PREFIX="/usr/"
|
||||||
|
MULTILIB_DIR="lib"
|
||||||
|
HARDWIRED_ABSPATH=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Security options
|
||||||
|
#
|
||||||
|
# UCLIBC_BUILD_PIE is not set
|
||||||
|
UCLIBC_HAS_ARC4RANDOM=y
|
||||||
|
# ARC4RANDOM_USES_NODEV is not set
|
||||||
|
# UCLIBC_HAS_SSP is not set
|
||||||
|
UCLIBC_BUILD_RELRO=y
|
||||||
|
UCLIBC_BUILD_NOW=y
|
||||||
|
UCLIBC_BUILD_NOEXECSTACK=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Development/debugging options
|
||||||
|
#
|
||||||
|
CROSS_COMPILER_PREFIX=""
|
||||||
|
UCLIBC_EXTRA_CFLAGS=""
|
||||||
|
# DODEBUG is not set
|
||||||
|
# DOSTRIP is not set
|
||||||
|
# DOASSERTS is not set
|
||||||
|
# SUPPORT_LD_DEBUG is not set
|
||||||
|
# SUPPORT_LD_DEBUG_EARLY is not set
|
||||||
|
# UCLIBC_MALLOC_DEBUGGING is not set
|
||||||
|
# UCLIBC_HAS_BACKTRACE is not set
|
||||||
|
WARNINGS="-Wall"
|
||||||
|
# EXTRA_WARNINGS is not set
|
||||||
|
# DOMULTI is not set
|
Binary file not shown.
|
@ -0,0 +1,369 @@
|
||||||
|
/*
|
||||||
|
* Helper functions used by other modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG
|
||||||
|
#define CONFIG "config.h"
|
||||||
|
#endif // CONFIG
|
||||||
|
#include CONFIG
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <errno.h>
|
||||||
|
#endif // _WIN32
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "helpers.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "endian.h"
|
||||||
|
#include "shared_globals.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* UCS2 <-> UTF-8 functions
|
||||||
|
* All functions use little endian UCS2 since we only need it to communicate with Windows via RPC
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Convert one character from UTF-8 to UCS2
|
||||||
|
// Returns 0xffff, if utf-8 evaluates to > 0xfffe (outside basic multilingual pane)
|
||||||
|
WCHAR utf8_to_ucs2_char (const unsigned char *input, const unsigned char **end_ptr)
|
||||||
|
{
|
||||||
|
*end_ptr = input;
|
||||||
|
if (input[0] == 0)
|
||||||
|
return ~0;
|
||||||
|
|
||||||
|
if (input[0] < 0x80) {
|
||||||
|
*end_ptr = input + 1;
|
||||||
|
return LE16(input[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((input[0] & 0xE0) == 0xE0) {
|
||||||
|
|
||||||
|
if (input[1] == 0 || input[2] == 0)
|
||||||
|
return ~0;
|
||||||
|
|
||||||
|
*end_ptr = input + 3;
|
||||||
|
|
||||||
|
return
|
||||||
|
LE16((input[0] & 0x0F)<<12 |
|
||||||
|
(input[1] & 0x3F)<<6 |
|
||||||
|
(input[2] & 0x3F));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((input[0] & 0xC0) == 0xC0) {
|
||||||
|
if (input[1] == 0)
|
||||||
|
return ~0;
|
||||||
|
|
||||||
|
*end_ptr = input + 2;
|
||||||
|
|
||||||
|
return
|
||||||
|
LE16((input[0] & 0x1F)<<6 |
|
||||||
|
(input[1] & 0x3F));
|
||||||
|
}
|
||||||
|
return ~0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert one character from UCS2 to UTF-8
|
||||||
|
// Returns length of UTF-8 char (1, 2 or 3) or -1 on error (UTF-16 outside UCS2)
|
||||||
|
// char *utf8 must be large enough to hold 3 bytes
|
||||||
|
int ucs2_to_utf8_char (const WCHAR ucs2_le, char *utf8)
|
||||||
|
{
|
||||||
|
const WCHAR ucs2 = LE16(ucs2_le);
|
||||||
|
|
||||||
|
if (ucs2 < 0x80) {
|
||||||
|
utf8[0] = ucs2;
|
||||||
|
utf8[1] = '\0';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ucs2 >= 0x80 && ucs2 < 0x800) {
|
||||||
|
utf8[0] = (ucs2 >> 6) | 0xC0;
|
||||||
|
utf8[1] = (ucs2 & 0x3F) | 0x80;
|
||||||
|
utf8[2] = '\0';
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ucs2 >= 0x800 && ucs2 < 0xFFFF) {
|
||||||
|
|
||||||
|
if (ucs2 >= 0xD800 && ucs2 <= 0xDFFF) {
|
||||||
|
/* Ill-formed (UTF-16 ouside of BMP) */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
utf8[0] = ((ucs2 >> 12) ) | 0xE0;
|
||||||
|
utf8[1] = ((ucs2 >> 6 ) & 0x3F) | 0x80;
|
||||||
|
utf8[2] = ((ucs2 ) & 0x3F) | 0x80;
|
||||||
|
utf8[3] = '\0';
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Converts UTF8 to UCS2. Returns size in bytes of the converted string or -1 on error
|
||||||
|
size_t utf8_to_ucs2(WCHAR* const ucs2_le, const char* const utf8, const size_t maxucs2, const size_t maxutf8)
|
||||||
|
{
|
||||||
|
const unsigned char* current_utf8 = (unsigned char*)utf8;
|
||||||
|
WCHAR* current_ucs2_le = ucs2_le;
|
||||||
|
|
||||||
|
for (; *current_utf8; current_ucs2_le++)
|
||||||
|
{
|
||||||
|
size_t size = (char*)current_utf8 - utf8;
|
||||||
|
|
||||||
|
if (size >= maxutf8) return (size_t)-1;
|
||||||
|
if (((*current_utf8 & 0xc0) == 0xc0) && (size >= maxutf8 - 1)) return (size_t)-1;
|
||||||
|
if (((*current_utf8 & 0xe0) == 0xe0) && (size >= maxutf8 - 2)) return (size_t)-1;
|
||||||
|
if (current_ucs2_le - ucs2_le >= (intptr_t)maxucs2 - 1) return (size_t)-1;
|
||||||
|
|
||||||
|
*current_ucs2_le = utf8_to_ucs2_char(current_utf8, ¤t_utf8);
|
||||||
|
current_ucs2_le[1] = 0;
|
||||||
|
|
||||||
|
if (*current_ucs2_le == (WCHAR)-1) return (size_t)-1;
|
||||||
|
}
|
||||||
|
return current_ucs2_le - ucs2_le;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Converts UCS2 to UTF-8. Return TRUE or FALSE
|
||||||
|
BOOL ucs2_to_utf8(const WCHAR* const ucs2_le, char* utf8, size_t maxucs2, size_t maxutf8)
|
||||||
|
{
|
||||||
|
char utf8_char[4];
|
||||||
|
const WCHAR* current_ucs2 = ucs2_le;
|
||||||
|
unsigned int index_utf8 = 0;
|
||||||
|
|
||||||
|
for(*utf8 = 0; *current_ucs2; current_ucs2++)
|
||||||
|
{
|
||||||
|
if (current_ucs2 - ucs2_le > (intptr_t)maxucs2) return FALSE;
|
||||||
|
int len = ucs2_to_utf8_char(*current_ucs2, utf8_char);
|
||||||
|
if (index_utf8 + len > maxutf8) return FALSE;
|
||||||
|
strncat(utf8, utf8_char, len);
|
||||||
|
index_utf8+=len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of UTF-8 <-> UCS2 conversion */
|
||||||
|
|
||||||
|
|
||||||
|
// Checks, whether a string is a valid integer number between min and max. Returns TRUE or FALSE. Puts int value in *value
|
||||||
|
BOOL stringToInt(const char *const szValue, const unsigned int min, const unsigned int max, unsigned int *const value)
|
||||||
|
{
|
||||||
|
char *nextchar;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
long long result = strtoll(szValue, &nextchar, 10);
|
||||||
|
|
||||||
|
if (errno || result < (long long)min || result > (long long)max || *nextchar)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*value = (unsigned int)result;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Converts a String Guid to a host binary guid in host endianess
|
||||||
|
int_fast8_t string2Uuid(const char *const restrict input, GUID *const restrict guid)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (strlen(input) < GUID_STRING_LENGTH) return FALSE;
|
||||||
|
if (input[8] != '-' || input[13] != '-' || input[18] != '-' || input[23] != '-') return FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i < GUID_STRING_LENGTH; i++)
|
||||||
|
{
|
||||||
|
if (i == 8 || i == 13 || i == 18 || i == 23) continue;
|
||||||
|
|
||||||
|
const char c = toupper((int)input[i]);
|
||||||
|
|
||||||
|
if (c < '0' || c > 'F' || (c > '9' && c < 'A')) return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char inputCopy[GUID_STRING_LENGTH + 1];
|
||||||
|
strncpy(inputCopy, input, GUID_STRING_LENGTH + 1);
|
||||||
|
inputCopy[8] = inputCopy[13] = inputCopy[18] = 0;
|
||||||
|
|
||||||
|
hex2bin((BYTE*)&guid->Data1, inputCopy, 8);
|
||||||
|
hex2bin((BYTE*)&guid->Data2, inputCopy + 9, 4);
|
||||||
|
hex2bin((BYTE*)&guid->Data3, inputCopy + 14, 4);
|
||||||
|
hex2bin(guid->Data4, input + 19, 16);
|
||||||
|
|
||||||
|
guid->Data1 = BE32(guid->Data1);
|
||||||
|
guid->Data2 = BE16(guid->Data2);
|
||||||
|
guid->Data3 = BE16(guid->Data3);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// convert GUID to little-endian
|
||||||
|
void LEGUID(GUID *const restrict out, const GUID* const restrict in)
|
||||||
|
{
|
||||||
|
#if __BYTE_ORDER != __LITTLE_ENDIAN
|
||||||
|
out->Data1 = LE32(in->Data1);
|
||||||
|
out->Data2 = LE16(in->Data2);
|
||||||
|
out->Data3 = LE16(in->Data3);
|
||||||
|
memcpy(out->Data4, in->Data4, sizeof(out->Data4));
|
||||||
|
#else
|
||||||
|
memcpy(out, in, sizeof(GUID));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Checks a command line argument if it is numeric and between min and max. Returns the numeric value or exits on error
|
||||||
|
__pure unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max)
|
||||||
|
{
|
||||||
|
unsigned int result;
|
||||||
|
|
||||||
|
if (!stringToInt(optarg, min, max, &result))
|
||||||
|
{
|
||||||
|
printerrorf("Fatal: Option \"-%c\" must be numeric between %u and %u.\n", o, min, max);
|
||||||
|
exit(!0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Resets getopt() to start parsing from the beginning
|
||||||
|
void optReset(void)
|
||||||
|
{
|
||||||
|
#if __minix__ || defined(__BSD__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
|
||||||
|
optind = 1;
|
||||||
|
optreset = 1; // Makes newer BSD getopt happy
|
||||||
|
#elif defined(__UCLIBC__) // uClibc headers also define __GLIBC__ so be careful here
|
||||||
|
optind = 0; // uClibc seeks compatibility with GLIBC
|
||||||
|
#elif defined(__GLIBC__)
|
||||||
|
optind = 0; // Makes GLIBC getopt happy
|
||||||
|
#else // Standard for most systems
|
||||||
|
optind = 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(USE_MSRPC)
|
||||||
|
|
||||||
|
// Returns a static message buffer containing text for a given Win32 error. Not thread safe (same as strerror)
|
||||||
|
char* win_strerror(const int message)
|
||||||
|
{
|
||||||
|
#define STRERROR_BUFFER_SIZE 256
|
||||||
|
static char buffer[STRERROR_BUFFER_SIZE];
|
||||||
|
|
||||||
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, message, 0, buffer, STRERROR_BUFFER_SIZE, NULL);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(_WIN32) || defined(USE_MSRPC)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parses an address in the form host:[port] in addr
|
||||||
|
* returns host and port in seperate strings
|
||||||
|
*/
|
||||||
|
void parseAddress(char *const addr, char** szHost, char** szPort)
|
||||||
|
{
|
||||||
|
*szHost = addr;
|
||||||
|
|
||||||
|
# ifndef NO_SOCKETS
|
||||||
|
*szPort = (char*)defaultport;
|
||||||
|
# else // NO_SOCKETS
|
||||||
|
*szPort = "1688";
|
||||||
|
# endif // NO_SOCKETS
|
||||||
|
|
||||||
|
char *lastcolon = strrchr(addr, ':');
|
||||||
|
char *firstcolon = strchr(addr, ':');
|
||||||
|
char *closingbracket = strrchr(addr, ']');
|
||||||
|
|
||||||
|
if (*addr == '[' && closingbracket) //Address in brackets
|
||||||
|
{
|
||||||
|
*closingbracket = 0;
|
||||||
|
(*szHost)++;
|
||||||
|
|
||||||
|
if (closingbracket[1] == ':')
|
||||||
|
*szPort = closingbracket + 2;
|
||||||
|
}
|
||||||
|
else if (firstcolon && firstcolon == lastcolon) //IPv4 address or hostname with port
|
||||||
|
{
|
||||||
|
*firstcolon = 0;
|
||||||
|
*szPort = firstcolon + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize random generator (needs to be done in each thread)
|
||||||
|
void randomNumberInit()
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
srand((unsigned int)(tv.tv_sec ^ tv.tv_usec));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// We always exit immediately if any OOM condition occurs
|
||||||
|
__noreturn void OutOfMemory(void)
|
||||||
|
{
|
||||||
|
errorout("Fatal: Out of memory");
|
||||||
|
exit(!0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void* vlmcsd_malloc(size_t len)
|
||||||
|
{
|
||||||
|
void* buf = malloc(len);
|
||||||
|
if (!buf) OutOfMemory();
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Converts hex digits to bytes in big-endian order.
|
||||||
|
* Ignores any non-hex characters
|
||||||
|
*/
|
||||||
|
void hex2bin(BYTE *const bin, const char *hex, const size_t maxbin)
|
||||||
|
{
|
||||||
|
static const char *const hexdigits = "0123456789ABCDEF";
|
||||||
|
char* nextchar;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; (i < 16) && utf8_to_ucs2_char((const unsigned char*)hex, (const unsigned char**)&nextchar) != (WCHAR)-1; hex = nextchar)
|
||||||
|
{
|
||||||
|
const char* pos = strchr(hexdigits, toupper((int)*hex));
|
||||||
|
if (!pos) continue;
|
||||||
|
|
||||||
|
if (!(i & 1)) bin[i >> 1] = 0;
|
||||||
|
bin[i >> 1] |= (char)(pos - hexdigits);
|
||||||
|
if (!(i & 1)) bin[i >> 1] <<= 4;
|
||||||
|
i++;
|
||||||
|
if (i >> 1 > maxbin) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__pure BOOL getArgumentBool(int_fast8_t *result, const char *const argument)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
!strncasecmp(argument, "true", 4) ||
|
||||||
|
!strncasecmp(argument, "on", 2) ||
|
||||||
|
!strncasecmp(argument, "yes", 3) ||
|
||||||
|
!strncasecmp(argument, "1", 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*result = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
!strncasecmp(argument, "false", 5) ||
|
||||||
|
!strncasecmp(argument, "off", 3) ||
|
||||||
|
!strncasecmp(argument, "no", 2) ||
|
||||||
|
!strncasecmp(argument, "0", 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*result = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#if __ANDROID__
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#endif // __ANDROID__
|
|
||||||
|
|
||||||
#define GUID_LE 0
|
#define GUID_LE 0
|
||||||
#define GUID_BE 1
|
#define GUID_BE 1
|
||||||
#define GUID_SWAP 2
|
#define GUID_SWAP 2
|
||||||
|
@ -20,38 +16,19 @@
|
||||||
BOOL stringToInt(const char *const szValue, const unsigned int min, const unsigned int max, unsigned int *const value);
|
BOOL stringToInt(const char *const szValue, const unsigned int min, const unsigned int max, unsigned int *const value);
|
||||||
unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max);
|
unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max);
|
||||||
void optReset(void);
|
void optReset(void);
|
||||||
__pure DWORD timeSpanString2Seconds(const char *const restrict argument);
|
|
||||||
#define timeSpanString2Minutes(x) (timeSpanString2Seconds(x) / 60)
|
|
||||||
char* win_strerror(const int message);
|
char* win_strerror(const int message);
|
||||||
int ucs2_to_utf8_char (const WCHAR ucs2_le, char *utf8);
|
int ucs2_to_utf8_char (const WCHAR ucs2_le, char *utf8);
|
||||||
size_t utf8_to_ucs2(WCHAR* const ucs2_le, const char* const utf8, const size_t maxucs2, const size_t maxutf8);
|
size_t utf8_to_ucs2(WCHAR* const ucs2_le, const char* const utf8, const size_t maxucs2, const size_t maxutf8);
|
||||||
WCHAR utf8_to_ucs2_char (const unsigned char * input, const unsigned char ** end_ptr);
|
WCHAR utf8_to_ucs2_char (const unsigned char * input, const unsigned char ** end_ptr);
|
||||||
BOOL ucs2_to_utf8(const WCHAR* const ucs2_le, char* utf8, size_t maxucs2, size_t maxutf8);
|
BOOL ucs2_to_utf8(const WCHAR* const ucs2_le, char* utf8, size_t maxucs2, size_t maxutf8);
|
||||||
int_fast8_t string2UuidLE(const char *const restrict input, GUID *const restrict guid);
|
int_fast8_t string2Uuid(const char *const restrict input, GUID *const restrict guid);
|
||||||
void randomNumberInit();
|
void randomNumberInit();
|
||||||
|
void LEGUID(GUID *const restrict result, const GUID* const restrict guid);
|
||||||
void parseAddress(char *const addr, char** szHost, char** szPort);
|
void parseAddress(char *const addr, char** szHost, char** szPort);
|
||||||
__noreturn void OutOfMemory(void);
|
__noreturn void OutOfMemory(void);
|
||||||
void* vlmcsd_malloc(size_t len);
|
void* vlmcsd_malloc(size_t len);
|
||||||
void hex2bin(BYTE *const bin, const char *hex, const size_t maxbin);
|
void hex2bin(BYTE *const bin, const char *hex, const size_t maxbin);
|
||||||
void loadKmsData();
|
|
||||||
#if !defined(DATA_FILE) || !defined(NO_SIGHUP)
|
|
||||||
void getExeName();
|
|
||||||
#endif // !defined(DATA_FILE) || !defined(NO_SIGHUP)
|
|
||||||
__pure BOOL getArgumentBool(int_fast8_t *result, const char *const argument);
|
__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);
|
|
||||||
int shmdt(const void *shmaddr);
|
|
||||||
int shmctl(int shmid, int cmd, /*struct shmid_ds*/void *buf);
|
|
||||||
#endif // __ANDROID__ && !defined(USE_THREADS)
|
|
||||||
|
|
||||||
#endif // HELPERS_H
|
#endif // HELPERS_H
|
|
@ -6,12 +6,8 @@
|
||||||
#endif // CONFIG
|
#endif // CONFIG
|
||||||
#include CONFIG
|
#include CONFIG
|
||||||
|
|
||||||
#if _MSC_VER
|
|
||||||
//#include <time.h>
|
|
||||||
#else
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif // _MSC_VER
|
#include <stdlib.h>
|
||||||
//#include <stdlib.h>
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
//
|
//
|
||||||
// REQUEST... types are actually fixed size
|
// REQUEST... types are actually fixed size
|
||||||
|
@ -54,15 +50,6 @@
|
||||||
#define ActivationInterval VLActivationInterval
|
#define ActivationInterval VLActivationInterval
|
||||||
#define RenewalInterval VLRenewalInterval
|
#define RenewalInterval VLRenewalInterval
|
||||||
|
|
||||||
#define MAX_CLIENTS 671
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GUID Guid[MAX_CLIENTS];
|
|
||||||
int_fast16_t CurrentCount;
|
|
||||||
int_fast16_t MaxCount;
|
|
||||||
int_fast16_t CurrentPosition;
|
|
||||||
} ClientList_t, *PClientList_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VERSION_INFO;
|
VERSION_INFO;
|
||||||
|
@ -228,154 +215,49 @@ typedef union
|
||||||
|
|
||||||
typedef BYTE hwid_t[8];
|
typedef BYTE hwid_t[8];
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
UseNdr64 = 1 << 0,
|
|
||||||
UseForEpid = 1 << 1,
|
|
||||||
MayBeServer = 1 << 2,
|
|
||||||
} HostBuildFlag;
|
|
||||||
|
|
||||||
typedef struct CsvlkData
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t EPidOffset;
|
|
||||||
char* EPid;
|
|
||||||
};
|
|
||||||
|
|
||||||
int64_t ReleaseDate;
|
|
||||||
uint32_t GroupId;
|
|
||||||
uint32_t MinKeyId;
|
|
||||||
uint32_t MaxKeyId;
|
|
||||||
uint8_t MinActiveClients;
|
|
||||||
uint8_t Reserved[3];
|
|
||||||
|
|
||||||
} CsvlkData_t, *PCsvlkData_t;
|
|
||||||
|
|
||||||
typedef struct VlmcsdData
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
GUID Guid;
|
|
||||||
uint8_t GuidBytes[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t NameOffset;
|
|
||||||
char* Name;
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t AppIndex;
|
|
||||||
uint8_t KmsIndex;
|
|
||||||
uint8_t ProtocolVersion;
|
|
||||||
uint8_t NCountPolicy;
|
|
||||||
uint8_t IsRetail;
|
|
||||||
uint8_t IsPreview;
|
|
||||||
uint8_t EPidIndex;
|
|
||||||
uint8_t reserved;
|
|
||||||
|
|
||||||
} VlmcsdData_t, *PVlmcsdData_t;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
union
|
GUID guid;
|
||||||
{
|
const char* name;
|
||||||
uint64_t Offset;
|
const char* pid;
|
||||||
void* Pointer;
|
uint8_t AppIndex;
|
||||||
};
|
uint8_t KmsIndex;
|
||||||
} DataPointer_t;
|
} KmsIdList;
|
||||||
|
|
||||||
#define KMS_OPTIONS_USENDR64 1 << 0
|
#define KMS_PARAM_MAJOR AppIndex
|
||||||
|
#define KMS_PARAM_REQUIREDCOUNT KmsIndex
|
||||||
|
|
||||||
typedef struct HostBuild
|
#define APP_ID_WINDOWS 0
|
||||||
{
|
#define APP_ID_OFFICE2010 1
|
||||||
union
|
#define APP_ID_OFFICE2013 2
|
||||||
{
|
|
||||||
uint64_t DisplayNameOffset;
|
|
||||||
char* DisplayName;
|
|
||||||
};
|
|
||||||
|
|
||||||
int64_t ReleaseDate;
|
#define KMS_ID_VISTA 0
|
||||||
int32_t BuildNumber;
|
#define KMS_ID_WIN7 1
|
||||||
int32_t PlatformId;
|
#define KMS_ID_WIN8_VL 2
|
||||||
HostBuildFlag Flags;
|
#define KMS_ID_WIN_BETA 3
|
||||||
uint8_t reserved[4];
|
#define KMS_ID_WIN8_RETAIL 4
|
||||||
|
#define KMS_ID_WIN81_VL 5
|
||||||
|
#define KMS_ID_WIN81_RETAIL 6
|
||||||
|
#define KMS_ID_WIN2008A 7
|
||||||
|
#define KMS_ID_WIN2008B 8
|
||||||
|
#define KMS_ID_WIN2008C 9
|
||||||
|
#define KMS_ID_WIN2008R2A 10
|
||||||
|
#define KMS_ID_WIN2008R2B 11
|
||||||
|
#define KMS_ID_WIN2008R2C 12
|
||||||
|
#define KMS_ID_WIN2012 13
|
||||||
|
#define KMS_ID_WIN2012R2 14
|
||||||
|
#define KMS_ID_OFFICE2010 15
|
||||||
|
#define KMS_ID_OFFICE2013 16
|
||||||
|
#define KMS_ID_WIN_SRV_BETA 17
|
||||||
|
#define KMS_ID_OFFICE2016 18
|
||||||
|
#define KMS_ID_WIN10_VL 19
|
||||||
|
#define KMS_ID_WIN10_RETAIL 20
|
||||||
|
|
||||||
} HostBuild_t, *PHostBuild_t;
|
#define PWINGUID &AppList[APP_ID_WINDOWS].guid
|
||||||
|
#define POFFICE2010GUID &AppList[APP_ID_OFFICE2010].guid
|
||||||
|
#define POFFICE2013GUID &AppList[APP_ID_OFFICE2013].guid
|
||||||
|
|
||||||
typedef struct VlmcsdHeader
|
typedef BOOL(__stdcall *RequestCallback_t)(const REQUEST *const baseRequest, RESPONSE *const baseResponse, BYTE *const hwId, const char* const ipstr);
|
||||||
{
|
|
||||||
BYTE Magic[4];
|
|
||||||
VERSION_INFO;
|
|
||||||
uint8_t CsvlkCount;
|
|
||||||
uint8_t Flags;
|
|
||||||
uint8_t Reserved[2];
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
int32_t Counts[5];
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int32_t AppItemCount;
|
|
||||||
int32_t KmsItemCount;
|
|
||||||
int32_t SkuItemCount;
|
|
||||||
int32_t HostBuildCount;
|
|
||||||
int32_t reserved2Counts;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
DataPointer_t Datapointers[5];
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t AppItemOffset;
|
|
||||||
PVlmcsdData_t AppItemList;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t KmsItemOffset;
|
|
||||||
PVlmcsdData_t KmsItemList;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t SkuItemOffset;
|
|
||||||
PVlmcsdData_t SkuItemList;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t HostBuildOffset;
|
|
||||||
PHostBuild_t HostBuildList;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
uint64_t Reserved2Offset;
|
|
||||||
void* Reserved2List;
|
|
||||||
};
|
|
||||||
|
|
||||||
CsvlkData_t CsvlkData[1];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
} VlmcsdHeader_t, *PVlmcsdHeader_t;
|
|
||||||
|
|
||||||
//#define EPID_INDEX_WINDOWS 0
|
|
||||||
//#define EPID_INDEX_OFFICE2010 1
|
|
||||||
//#define EPID_INDEX_OFFICE2013 2
|
|
||||||
//#define EPID_INDEX_OFFICE2016 3
|
|
||||||
//#define EPID_INDEX_WINCHINAGOV 4
|
|
||||||
|
|
||||||
typedef HRESULT(__stdcall *RequestCallback_t)(REQUEST* baseRequest, RESPONSE *const baseResponse, BYTE *const hwId, const char* const ipstr);
|
|
||||||
|
|
||||||
size_t CreateResponseV4(REQUEST_V4 *const Request, BYTE *const response_data, const char* const ipstr);
|
size_t CreateResponseV4(REQUEST_V4 *const Request, BYTE *const response_data, const char* const ipstr);
|
||||||
size_t CreateResponseV6(REQUEST_V6 *restrict Request, BYTE *const response_data, const char* const ipstr);
|
size_t CreateResponseV6(REQUEST_V6 *restrict Request, BYTE *const response_data, const char* const ipstr);
|
||||||
|
@ -383,28 +265,23 @@ BYTE *CreateRequestV4(size_t *size, const REQUEST* requestBase);
|
||||||
BYTE *CreateRequestV6(size_t *size, const REQUEST* requestBase);
|
BYTE *CreateRequestV6(size_t *size, const REQUEST* requestBase);
|
||||||
void randomPidInit();
|
void randomPidInit();
|
||||||
void get16RandomBytes(void* ptr);
|
void get16RandomBytes(void* ptr);
|
||||||
RESPONSE_RESULT DecryptResponseV6(RESPONSE_V6* response_v6, int responseSize, BYTE* const response, const BYTE* const rawRequest, BYTE* hwid);
|
RESPONSE_RESULT DecryptResponseV6(RESPONSE_V6* Response_v6, int responseSize, BYTE* const response, const BYTE* const request, BYTE* hwid);
|
||||||
RESPONSE_RESULT DecryptResponseV4(RESPONSE_V4* response_v4, const int responseSize, BYTE* const rawResponse, const BYTE* const rawRequest);
|
RESPONSE_RESULT DecryptResponseV4(RESPONSE_V4* Response_v4, const int responseSize, BYTE* const response, const BYTE* const request);
|
||||||
void getUnixTimeAsFileTime(FILETIME* ts);
|
void getUnixTimeAsFileTime(FILETIME *const ts);
|
||||||
__pure int64_t fileTimeToUnixTime(FILETIME* ts);
|
__pure int64_t fileTimeToUnixTime(const FILETIME *const ts);
|
||||||
|
const char* getProductNameHE(const GUID *const guid, const KmsIdList *const List, ProdListIndex_t *const i);
|
||||||
|
const char* getProductNameLE(const GUID *const guid, const KmsIdList *const List, ProdListIndex_t *const i);
|
||||||
|
__pure ProdListIndex_t getExtendedProductListSize();
|
||||||
|
__pure ProdListIndex_t getAppListSize(void);
|
||||||
|
|
||||||
#ifndef IS_LIBRARY
|
extern const KmsIdList ProductList[];
|
||||||
int32_t getProductIndex(const GUID* guid, const PVlmcsdData_t list, const int32_t count, char** name, char** ePid);
|
extern const KmsIdList AppList[];
|
||||||
#if !defined(NO_INI_FILE)||!defined(NO_VERBOSE_LOG)
|
extern const KmsIdList ExtendedProductList[];
|
||||||
const char* getNextString(const char* s);
|
|
||||||
#endif // !defined(NO_INI_FILE)||!defined(NO_VERBOSE_LOG)
|
|
||||||
#endif // IS_LIBRARY
|
|
||||||
|
|
||||||
#ifndef NO_STRICT_MODES
|
|
||||||
void InitializeClientLists();
|
|
||||||
void CleanUpClientLists();
|
|
||||||
#endif // !NO_STRICT_MODES
|
|
||||||
|
|
||||||
extern RequestCallback_t CreateResponseBase;
|
extern RequestCallback_t CreateResponseBase;
|
||||||
|
|
||||||
#ifdef _PEDANTIC
|
#ifdef _PEDANTIC
|
||||||
uint16_t IsValidLcid(const uint16_t lcid);
|
uint16_t IsValidLcid(const uint16_t Lcid);
|
||||||
uint32_t IsValidHostBuild(const int32_t hostBuild);
|
|
||||||
#endif // _PEDANTIC
|
#endif // _PEDANTIC
|
||||||
|
|
||||||
#endif // __kms_h
|
#endif // __kms_h
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
* libkms.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG
|
||||||
|
#define CONFIG "config.h"
|
||||||
|
#endif // CONFIG
|
||||||
|
#include CONFIG
|
||||||
|
|
||||||
|
#ifdef EXTERNAL
|
||||||
|
#undef EXTERNAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EXTERNAL dllexport
|
||||||
|
|
||||||
|
#define DLLVERSION 0x30001
|
||||||
|
|
||||||
|
#include "libkms.h"
|
||||||
|
#include "shared_globals.h"
|
||||||
|
#include "network.h"
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif // WIN32
|
||||||
|
|
||||||
|
#ifdef IS_LIBRARY
|
||||||
|
char ErrorMessage[MESSAGE_BUFFER_SIZE];
|
||||||
|
#endif // IS_LIBRARY
|
||||||
|
|
||||||
|
static int_fast8_t IsServerStarted = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendActivationRequest
|
||||||
|
(
|
||||||
|
const char* const hostname,
|
||||||
|
const int port,
|
||||||
|
RESPONSE* baseResponse,
|
||||||
|
const REQUEST* const baseRequest,
|
||||||
|
RESPONSE_RESULT* result, BYTE *hwid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return !0; // not yet implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, RequestCallback_t requestCallback)
|
||||||
|
{
|
||||||
|
#ifndef SIMPLE_SOCKETS
|
||||||
|
char listenAddress[64];
|
||||||
|
|
||||||
|
if (IsServerStarted) return !0;
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
# ifndef USE_MSRPC
|
||||||
|
// Windows Sockets must be initialized
|
||||||
|
WSADATA wsadata;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if ((error = WSAStartup(0x0202, &wsadata)))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
# endif // USE_MSRPC
|
||||||
|
# endif // _WIN32
|
||||||
|
|
||||||
|
CreateResponseBase = requestCallback;
|
||||||
|
|
||||||
|
int maxsockets = 0;
|
||||||
|
int_fast8_t haveIPv4 = FALSE;
|
||||||
|
int_fast8_t haveIPv6 = FALSE;
|
||||||
|
|
||||||
|
if (checkProtocolStack(AF_INET)) { haveIPv4 = TRUE; maxsockets++; }
|
||||||
|
if (checkProtocolStack(AF_INET6)) { haveIPv6 = TRUE; maxsockets++; }
|
||||||
|
|
||||||
|
if(!maxsockets) return !0;
|
||||||
|
|
||||||
|
SocketList = (SOCKET*)vlmcsd_malloc(sizeof(SOCKET) * (size_t)maxsockets);
|
||||||
|
numsockets = 0;
|
||||||
|
|
||||||
|
if (haveIPv4)
|
||||||
|
{
|
||||||
|
snprintf(listenAddress, 64, "0.0.0.0:%u", (unsigned int)port);
|
||||||
|
addListeningSocket(listenAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haveIPv6)
|
||||||
|
{
|
||||||
|
snprintf(listenAddress, 64, "[::]:%u", (unsigned int)port);
|
||||||
|
addListeningSocket(listenAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!numsockets)
|
||||||
|
{
|
||||||
|
free(SocketList);
|
||||||
|
return !0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsServerStarted = TRUE;
|
||||||
|
|
||||||
|
runServer();
|
||||||
|
|
||||||
|
IsServerStarted = FALSE;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
# else // SIMPLE_SOCKETS
|
||||||
|
|
||||||
|
if (IsServerStarted) return !0;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
# ifndef USE_MSRPC
|
||||||
|
// Windows Sockets must be initialized
|
||||||
|
WSADATA wsadata;
|
||||||
|
|
||||||
|
if ((error = WSAStartup(0x0202, &wsadata)))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
# endif // USE_MSRPC
|
||||||
|
# endif // _WIN32
|
||||||
|
|
||||||
|
defaultport = vlmcsd_malloc(16);
|
||||||
|
snprintf((char*)defaultport, (size_t)16, "%i", port);
|
||||||
|
|
||||||
|
CreateResponseBase = requestCallback;
|
||||||
|
error = listenOnAllAddresses();
|
||||||
|
if (error) return error;
|
||||||
|
|
||||||
|
IsServerStarted = TRUE;
|
||||||
|
runServer();
|
||||||
|
IsServerStarted = FALSE;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
# endif // SIMPLE_SOCKETS
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StopKmsServer()
|
||||||
|
{
|
||||||
|
if (!IsServerStarted) return !0;
|
||||||
|
|
||||||
|
closeAllListeningSockets();
|
||||||
|
|
||||||
|
# ifndef SIMPLE_SOCKETS
|
||||||
|
if (SocketList) free(SocketList);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) int __cdecl GetLibKmsVersion()
|
||||||
|
{
|
||||||
|
return DLLVERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) const char* const __cdecl GetEmulatorVersion()
|
||||||
|
{
|
||||||
|
return VERSION;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* libkms.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIBKMS_H_
|
||||||
|
#define LIBKMS_H_
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "kms.h"
|
||||||
|
#include "rpc.h"
|
||||||
|
|
||||||
|
#ifndef EXTERNC
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERNC EXTERN "C"
|
||||||
|
#else
|
||||||
|
#define EXTERNC
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl SendActivationRequest(const char* const hostname, const int port, RESPONSE* baseResponse, const REQUEST* const baseRequest, RESPONSE_RESULT* result, BYTE *hwid);
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, RequestCallback_t requestCallback);
|
||||||
|
EXTERNC __declspec(EXTERNAL) DWORD __cdecl StopKmsServer();
|
||||||
|
EXTERNC __declspec(EXTERNAL) int __cdecl GetLibKmsVersion();
|
||||||
|
EXTERNC __declspec(EXTERNAL) const char* const __cdecl GetEmulatorVersion();
|
||||||
|
//EXTERN_C __declspec(EXTERNAL) unsigned int __cdecl GetRandom32();
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LIBKMS_H_ */
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/local/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-Dragon* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j12"
|
||||||
|
REUSEOBJFLAGS="-j12"
|
||||||
|
|
||||||
|
CF="-flto=12 -static-libgcc -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CF45="-static-libgcc -pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFCLANG="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-Wl,-z,norelro -Wl,--hash-style=sysv -Wl,--build-id=none"
|
||||||
|
LFCLANG="-Wl,-z,norelro -Wl,--hash-style=sysv"
|
||||||
|
export CC=gcc5
|
||||||
|
|
||||||
|
gmake $MAKEFLAGS MULTI_NAME=vlmcsdmulti-DragonFly-x64 PROGRAM_NAME=vlmcsd-DragonFly-x64 CLIENT_NAME=vlmcs-DragonFly-x64 CFLAGS="$CF" LDFLAGS="$LF" allmulti
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
|
||||||
|
strip -s --strip-unneeded --remove-section=.eh_frame_hdr --remove-section=.eh_frame --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
cp -af vlmcsd-DragonFly-x64 /usr/local/sbin/vlmcsd
|
||||||
|
cp -af vlmcs-DragonFly-x64 /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-Dragon* vlmcs-* root@ubuntu64:x/binaries/DragonFly/intel/
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/local/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-Free* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j12"
|
||||||
|
REUSEOBJFLAGS="-j12"
|
||||||
|
|
||||||
|
CF="-flto=12 -static-libgcc -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFCLANG="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none"
|
||||||
|
LFCLANG="-Wl,-z,norelro -Wl,--hash-style=gnu"
|
||||||
|
|
||||||
|
gmake $MAKEFLAGS allmulti CAT=2 MULTI_NAME=vlmcsdmulti-FreeBSD-10.3-x64-gcc CLIENT_NAME=vlmcs-FreeBSD-10.3-x64-gcc PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x64-gcc CC=gcc5 CFLAGS="$CF" LDFLAGS="$LF"
|
||||||
|
gmake $MAKEFLAGS MULTI_NAME=vlmcsdmulti-FreeBSD-10.3-x64 CLIENT_NAME=vlmcs-FreeBSD-10.3-x64 PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x64 CC=clang38 CFLAGS="$CFCLANG" LDFLAGS="$LF" allmulti
|
||||||
|
gmake $MAKEFLAGS MULTI_NAME=vlmcsdmulti-FreeBSD-10.3-x86 CLIENT_NAME=vlmcs-FreeBSD-10.3-x86 PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x86 CC=clang38 CFLAGS="$CFCLANG -m32" LDFLAGS="$LF"
|
||||||
|
gmake $MAKEFLAGS allmulti CAT=2 MULTI_NAME=vlmcsdmulti-FreeBSD-10.3-x86-gcc CLIENT_NAME=vlmcs-FreeBSD-10.3-x86-gcc PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x86-gcc CC=gcc5 CFLAGS="$CF -m32 -DCOMPAT_32BIT" LDFLAGS="-L/usr/lib32 -B/usr/lib32 $LF"
|
||||||
|
gmake $MAKEFLAGS CAT=2 vlmcsd-FreeBSD-10.3-x64-threads-gcc PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x64-threads-gcc THREADS=1 CC=gcc5 CFLAGS="$CF" LDFLAGS="-lpthread $LF"
|
||||||
|
gmake $MAKEFLAGS vlmcsd-FreeBSD-10.3-x64-threads PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x64-threads THREADS=1 CC=clang38 CFLAGS="$CFCLANG" LDFLAGS="-lpthread $LF"
|
||||||
|
gmake $MAKEFLAGS vlmcsd-FreeBSD-10.3-x86-threads PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x86-threads THREADS=1 CC=clang38 CFLAGS="$CFCLANG -m32" LDFLAGS="-lpthread $LF"
|
||||||
|
gmake $MAKEFLAGS CAT=2 vlmcsd-FreeBSD-10.3-x86-threads-gcc PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x86-threads-gcc THREADS=1 CC=gcc5 CFLAGS="$CF -m32 -DCOMPAT_32BIT" LDFLAGS="-lpthread -L/usr/lib32 -B/usr/lib32 $LF"
|
||||||
|
gmake $MAKEFLAGS CRYPTO=openssl_with_aes CLIENT_NAME=vlmcs-FreeBSD-10.3-x64-openssl1.0.1-EXPERIMENTAL PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x64-openssl1.0.1-EXPERIMENTAL CC=clang38 CFLAGS="$CFCLANG" LDFLAGS="$LF"
|
||||||
|
gmake $MAKEFLAGS CRYPTO=openssl_with_aes CLIENT_NAME=vlmcs-FreeBSD-10.3-x86-openssl1.0.1-EXPERIMENTAL PROGRAM_NAME=vlmcsd-FreeBSD-10.3-x86-openssl1.0.1-EXPERIMENTAL CC=clang38 CFLAGS="$CFCLANG -m32" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
|
||||||
|
strip -s --strip-unneeded --remove-section=.eh_frame_hdr --remove-section=.eh_frame --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
sudo cp -af vlmcsd-FreeBSD-10.3-x86-gcc /usr/local/sbin/vlmcsd
|
||||||
|
sudo cp -af vlmcs-FreeBSD-10.3-x86-gcc /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-Free* vlmcs-* root@ubuntu64:x/binaries/FreeBSD/intel/
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-hurd* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j1"
|
||||||
|
|
||||||
|
export CC=gcc
|
||||||
|
CF="-flto=jobserver -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-fuse-ld=gold -lresolv -Wl,-z,norelro,--hash-style=gnu,--build-id=none"
|
||||||
|
|
||||||
|
make $MAKEFLAGS MULTI_NAME=vlmcsdmulti-hurd-x86-glibc vlmcsdmulti-hurd-x86-glibc PROGRAM_NAME=vlmcsd-hurd-x86-glibc CLIENT_NAME=vlmcs-hurd-x86-glibc CFLAGS="$CF" LDFLAGS="$LF" allmulti
|
||||||
|
|
||||||
|
make clean
|
||||||
|
|
||||||
|
sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
cp -af vlmcsd-hurd-x86-glibc /usr/local/sbin/vlmcsd
|
||||||
|
cp -af vlmcs-hurd-x86-glibc /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy man pages
|
||||||
|
mkdir -p /usr/local/man/man1 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man5 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man8 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man7 2>/dev/null
|
||||||
|
cp -af vlmcs.1 vlmcsdmulti.1 /usr/local/man/man1/
|
||||||
|
cp -af vlmcsd.7 /usr/local/man/man7/
|
||||||
|
cp -af vlmcsd.8 /usr/local/man/man8/
|
||||||
|
cp -af vlmcsd.ini.5 /usr/local/man/man5/
|
||||||
|
bzip2 -f -9 /usr/local/man/man5/vlmcsd.ini.5 /usr/local/man/man1/vlmcs.1 /usr/local/man/man1/vlmcsdmulti.1 /usr/local/man/man7/vlmcsd.7 /usr/local/man/man8/vlmcsd.8
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-hurd* vlmcs-* root@ubuntu64.internal:x/binaries/Hurd/intel/
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-Free* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j`nproc`"
|
||||||
|
|
||||||
|
export CC=gcc
|
||||||
|
CF="-flto=jobserver -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-lresolv -Wl,-z,norelro,--hash-style=gnu,--build-id=none"
|
||||||
|
|
||||||
|
export PROGRAM_NAME=vlmcsd-FreeBSD-10.1-x64-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-FreeBSD-10.1-x64-glibc
|
||||||
|
export MULTI_NAME=vlmcsdmulti-FreeBSD-10.1-x64-glibc
|
||||||
|
|
||||||
|
make $MAKEFLAGS CFLAGS="$CF -m64" LDFLAGS="$LF" CAT=2 allmulti
|
||||||
|
|
||||||
|
export PROGRAM_NAME=vlmcsd-FreeBSD-10.1-x86-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-FreeBSD-10.1-x86-glibc
|
||||||
|
export MULTI_NAME=vlmcsdmulti-FreeBSD-10.1-x86-glibc
|
||||||
|
|
||||||
|
make $MAKEFLAGS CFLAGS="$CF -m32" LDFLAGS="$LF" CAT=2 allmulti
|
||||||
|
|
||||||
|
sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
cp -af $PROGRAM_NAME /usr/local/sbin/vlmcsd
|
||||||
|
cp -af $CLIENT_NAME /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy man pages
|
||||||
|
mkdir -p /usr/local/man/man1 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man5 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man8 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man7 2>/dev/null
|
||||||
|
cp -af vlmcs.1 vlmcsdmulti.1 /usr/local/man/man1/
|
||||||
|
cp -af vlmcsd.7 /usr/local/man/man7/
|
||||||
|
cp -af vlmcsd.8 /usr/local/man/man8/
|
||||||
|
cp -af vlmcsd.ini.5 /usr/local/man/man5/
|
||||||
|
bzip2 -f -9 /usr/local/man/man5/vlmcsd.ini.5 /usr/local/man/man1/vlmcs.1 /usr/local/man/man1/vlmcsdmulti.1 /usr/local/man/man7/vlmcsd.7 /usr/local/man/man8/vlmcsd.8
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-Free* vlmcs-* root@ubuntu64.internal:x/binaries/FreeBSD/intel/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export VLMCSD_VERSION=svn$(ssh root@ubuntu64.internal "cd x; svnversion")
|
||||||
|
scp -p make_minix root@ubuntu64.internal:x
|
||||||
|
scp -pr root@ubuntu64.internal:x/* .
|
||||||
|
|
||||||
|
|
||||||
|
# Compile vlmcsd binaries for Minix 3
|
||||||
|
|
||||||
|
SUFFIX=-minix-$(uname -r)-x86
|
||||||
|
export CC=clang
|
||||||
|
export CFLAGS="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
export LDFLAGS="-Wl,--hash-style=sysv -Wl,-z,norelro -Wl,--build-id=none"
|
||||||
|
export PROGRAM_NAME=vlmcsd$SUFFIX
|
||||||
|
export CLIENT_NAME=vlmcs$SUFFIX
|
||||||
|
export MULTI_NAME=vlmcsdmulti$SUFFIX
|
||||||
|
|
||||||
|
gmake clean
|
||||||
|
gmake -B allmulti
|
||||||
|
|
||||||
|
strip -s --strip-unneeded --remove-section .eh_frame_hdr --remove-section .eh_frame --remove-section .ident --remove-section .note.minix.ident --remove-section .note.netbsd.pax --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag *$SUFFIX
|
||||||
|
|
||||||
|
scp -p *$SUFFIX root@ubuntu64.internal:x/binaries/Minix/intel/
|
|
@ -0,0 +1,121 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SMALLCC="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
SMALLLD="-pipe -Wl,--hash-style=sysv -Wl,-z,norelro -Wl,--build-id=none"
|
||||||
|
SMALL="$SMALLCC $SMALLLD"
|
||||||
|
|
||||||
|
rm -f vlmcsd vlmcs vlmcsdmulti vlmcsd-s390* vlmcsd-sparc64* vlmcsd-mips64* vlmcs-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
## IBM S/390
|
||||||
|
|
||||||
|
export CFLAGS="$SMALLCC"
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -m31 -mesa -mpacked-stack -msmall-exec"
|
||||||
|
export LDFLAGS="$SMALLLD -Wl,--hash-style=gnu"
|
||||||
|
export THREADS=0
|
||||||
|
export FEATURES=full
|
||||||
|
export CC=s390x-linux-gnu-gcc
|
||||||
|
export VERBOSE=3
|
||||||
|
|
||||||
|
export MULTI_NAME=vlmcsdmulti-s390-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-s390-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-s390-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -m64 -mzarch -mpacked-stack -msmall-exec"
|
||||||
|
export MULTI_NAME=vlmcsdmulti-s390x-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-s390x-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-s390x-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## SPARC64
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -mcpu=v7"
|
||||||
|
export LDFLAGS="$SMALLLD"
|
||||||
|
export CC=sparc64-linux-gnu-gcc
|
||||||
|
|
||||||
|
export MULTI_NAME=vlmcsdmulti-sparc64v9-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-sparc64v9-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-sparc64v9-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## MIPS64 BIG-ENDIAN
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -mips64 -mno-mips16"
|
||||||
|
export LDFLAGS="$SMALLLD"
|
||||||
|
export CC=mips64-linux-gnuabi64-gcc
|
||||||
|
|
||||||
|
export MULTI_NAME=vlmcsdmulti-mips64-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-mips64-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-mips64-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -mips64 -mmicromips"
|
||||||
|
export MULTI_NAME=vlmcsdmulti-mips64mm-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-mips64mm-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-mips64mm-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
|
||||||
|
## MIPS64 LITTLE-ENDIAN
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -mips64 -mno-mips16"
|
||||||
|
export LDFLAGS="$SMALLLD"
|
||||||
|
export CC=mips64el-linux-gnuabi64-gcc
|
||||||
|
|
||||||
|
export MULTI_NAME=vlmcsdmulti-mips64el-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-mips64el-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-mips64el-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
export PLATFORMFLAGS="-flto=jobserver -fwhole-program -mips64 -mmicromips"
|
||||||
|
export MULTI_NAME=vlmcsdmulti-mips64elmm-glibc
|
||||||
|
export CLIENT_NAME=vlmcs-mips64elmm-glibc
|
||||||
|
export PROGRAM_NAME=vlmcsd-mips64elmm-glibc
|
||||||
|
|
||||||
|
make -B -j`nproc` allmulti
|
||||||
|
|
||||||
|
sstrip -z $CLIENT_NAME $PROGRAM_NAME $MULTI_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" == "nocopy" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /usr/local/man/man1 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man5 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man8 2>/dev/null
|
||||||
|
mkdir -p /usr/local/man/man7 2>/dev/null
|
||||||
|
cp -a vlmcs.1 vlmcsdmulti.1 /usr/local/man/man1/
|
||||||
|
cp -a vlmcsd.7 /usr/local/man/man7/
|
||||||
|
cp -a vlmcsd.8 /usr/local/man/man8/
|
||||||
|
cp -a vlmcsd.ini.5 /usr/local/man/man5/
|
||||||
|
pbzip2 -f -9 /usr/local/man/man5/vlmcsd.ini.5 /usr/local/man/man1/vlmcs.1 /usr/local/man/man1/vlmcsdmulti.1 /usr/local/man/man7/vlmcsd.7 /usr/local/man/man8/vlmcsd.8
|
||||||
|
|
||||||
|
scp -p vlmcsdmulti-s390-glibc vlmcs-s390-glibc vlmcsd-s390-glibc vlmcsdmulti-s390x-glibc vlmcs-s390x-glibc vlmcsd-s390x-glibc ubuntu64.internal:x/binaries/Linux/s390/glibc
|
||||||
|
scp -p vlmcsdmulti-sparc64v9-glibc vlmcs-sparc64v9-glibc vlmcsd-sparc64v9-glibc ubuntu64.internal:x/binaries/Linux/sparc/glibc
|
||||||
|
scp -p vlmcsdmulti-mips64-glibc vlmcs-mips64-glibc vlmcsd-mips64-glibc vlmcsdmulti-mips64mm-glibc vlmcs-mips64mm-glibc vlmcsd-mips64mm-glibc ubuntu64.internal:x/binaries/Linux/mips/big-endian/glibc
|
||||||
|
scp -p vlmcsdmulti-mips64el-glibc vlmcs-mips64el-glibc vlmcsd-mips64el-glibc vlmcsdmulti-mips64elmm-glibc vlmcs-mips64elmm-glibc vlmcsd-mips64elmm-glibc ubuntu64.internal:x/binaries/Linux/mips/little-endian/glibc
|
||||||
|
scp -p -P 2222 vlmcsdmulti-s390-glibc vlmcs-s390-glibc vlmcsd-s390-glibc vlmcsdmulti-s390x-glibc vlmcs-s390x-glibc vlmcsd-s390x-glibc s390:vlmcsd
|
||||||
|
scp -p -P 2222 vlmcsdmulti-s390-glibc vlmcsdmulti-s390x-glibc s390:/usr/local/sbin
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/pkg/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-NetBSD* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
gmake clean
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j12"
|
||||||
|
REUSEOBJFLAGS="-j12"
|
||||||
|
|
||||||
|
CF="-flto=12 -static-libgcc -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CF45="-flto=12 -static-libgcc -pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFCLANG="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-Wl,-z,norelro -Wl,--hash-style=sysv -Wl,--build-id=none"
|
||||||
|
LFCLANG="-Wl,-z,norelro -Wl,--hash-style=sysv"
|
||||||
|
|
||||||
|
gmake $MAKEFLAGS CC=/usr/pkg/gcc5/bin/gcc PROGRAM_NAME=vlmcsd-NetBSD-x64 CLIENT_NAME=vlmcs-NetBSD-x64 MULTI_NAME=vlmcsdmulti-NetBSD-x64 allmulti CFLAGS="$CF" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
gmake allmulti CC=gcc $MAKEFLAGS CAT=2 MULTI_NAME=vlmcsdmulti-NetBSD-x86 PROGRAM_NAME=vlmcsd-NetBSD-x86 CLIENT_NAME=vlmcs-NetBSD-x86 CFLAGS="$CF45 -m32" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
#gmake $MAKEFLAGS CC=clang PROGRAM_NAME=vlmcsd-NetBSD-x64-clang CLIENT_NAME=vlmcs-NetBSD-x64-clang CFLAGS="$CFCLANG" LDFLAGS="$LFCLANG"
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
|
||||||
|
strip -s --strip-unneeded -R .ident -R .got -R .note.netbsd.pax -R .gnu.version -R .eh_frame -R .note.gnu.gold-version -R .comment -R .note -R .note.gnu.build-id -R .note.ABI-tag vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
#sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
cp -af vlmcsd-NetBSD-x86 /usr/local/sbin/vlmcsd
|
||||||
|
cp -af vlmcs-NetBSD-x86 /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-Net* vlmcs-* root@ubuntu64:x/binaries/NetBSD/intel/
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/local/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm -f vlmcsd-Open* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j12"
|
||||||
|
REUSEOBJFLAGS="-j12"
|
||||||
|
|
||||||
|
CF="-static-libgcc -pipe -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CF45="-static-libgcc -pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFCLANG="-pipe -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
LF="-Wl,-z,norelro"
|
||||||
|
LFCLANG="-Wl,-z,norelro"
|
||||||
|
|
||||||
|
gmake -Bj12 allmulti $MAKEFLAGS CC=egcc MULTI_NAME=vlmcsdmulti-OpenBSD-x64 PROGRAM_NAME=vlmcsd-OpenBSD-x64 CLIENT_NAME=vlmcs-OpenBSD-x64 CFLAGS="$CF" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
#gmake allmulti $MAKEFLAGS CAT=2 MULTI_NAME=vlmcsdmulti-OpenBSD-x86 PROGRAM_NAME=vlmcsd-OpenBSD-x86 CLIENT_NAME=vlmcs-OpenBSD-x86 CFLAGS="$CF45 -m32" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
#gmake $MAKEFLAGS CC=clang PROGRAM_NAME=vlmcsd-OpenBSD-x64-clang CLIENT_NAME=vlmcs-OpenBSD-x64-clang CFLAGS="$CFCLANG" LDFLAGS="$LFCLANG"
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
|
||||||
|
strip -s --strip-unneeded --remove-section=.eh_frame_hdr --remove-section=.eh_frame --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
#sstrip -z vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
cp -f vlmcsd-OpenBSD-x64 /usr/local/sbin/vlmcsd
|
||||||
|
cp -f vlmcs-OpenBSD-x64 /usr/local/bin/vlmcs
|
||||||
|
|
||||||
|
# Copy everything to distribution server
|
||||||
|
scp -p vlmcsdmulti-* vlmcsd-Open* vlmcs-* root@ubuntu64:x/binaries/OpenBSD/intel/
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export DNS_PARSER=OS
|
||||||
|
|
||||||
|
rm vlmcsd-Mac* vlmcsd-iOS* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm vlmcsd vlmcs vlmcsdmulti 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-Bj"
|
||||||
|
REUSEOBJFLAGS="-j"
|
||||||
|
CFGCC="-static-libgcc -mdynamic-no-pic -Os -flto=jobserver -fwhole-program -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFCLANG="-mdynamic-no-pic -Os -flto -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
CFGCC42="-static-libgcc -mdynamic-no-pic -Os -fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants"
|
||||||
|
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x86 CLIENT_NAME=vlmcs-MacOSX-x86 PROGRAM_NAME=vlmcsd-MacOSX-x86 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.0" && \
|
||||||
|
make $MAKEFLAGS vlmcsd-MacOSX-x86-threads THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x86-threads CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.0" && \
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x64 CLIENT_NAME=vlmcs-MacOSX-x64 PROGRAM_NAME=vlmcsd-MacOSX-x64 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.0" && \
|
||||||
|
make $MAKEFLAGS vlmcsd-MacOSX-x64-threads THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x64-threads CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.0" && \
|
||||||
|
#make $MAKEFLAGS CLIENT_NAME=vlmcs-MacOSX-x86-openssl-EXPERIMENTAL PROGRAM_NAME=vlmcsd-MacOSX-x86-openssl-EXPERIMENTAL CRYPTO=openssl_with_aes_soft CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.4" && \
|
||||||
|
#make $MAKEFLAGS CLIENT_NAME=vlmcs-MacOSX-x64-openssl-EXPERIMENTAL PROGRAM_NAME=vlmcsd-MacOSX-x64-openssl-EXPERIMENTAL CRYPTO=openssl_with_aes_soft CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.4" && \
|
||||||
|
|
||||||
|
#make $MAKEFLAGS CLIENT_NAME=vlmcs-iOS-7.1-armv7 PROGRAM_NAME=vlmcsd-iOS-7.1-armv7 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-mthumb -m32 -arch armv7 -miphoneos-version-min=1.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk" && \
|
||||||
|
#rm -f vlmcs.o vlmcsd.o vlmcsdmulti.o *_all.* && \
|
||||||
|
#make $REUSEOBJFLAGS vlmcsdmulti-iOS-7.1-armv7 MULTI_NAME=vlmcsdmulti-iOS-7.1-armv7 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-mthumb -m32 -arch armv7 -miphoneos-version-min=1.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk" && \
|
||||||
|
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-iOS-armv7 CLIENT_NAME=vlmcs-iOS-armv7 PROGRAM_NAME=vlmcsd-iOS-armv7 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-mthumb -m32 -arch armv7 -miphoneos-version-min=1.0 -isysroot ~/toolchains/iPhoneOS.sdk" && \
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-iOS-armv8-aarch64 CLIENT_NAME=vlmcs-iOS-armv8-aarch64 PROGRAM_NAME=vlmcsd-iOS-armv8-aarch64 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-m64 -arch arm64 -miphoneos-version-min=7.0 -isysroot ~/toolchains/iPhoneOS.sdk" && \
|
||||||
|
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-iOS-6.1-armv7 CLIENT_NAME=vlmcs-iOS-6.1-armv7 PROGRAM_NAME=vlmcsd-iOS-6.1-armv7 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-mthumb -m32 -arch armv7 -miphoneos-version-min=1.0 --sysroot ~/toolchains/iPhoneOS6.1.sdk -isysroot ~/toolchains/iPhoneOS6.1.sdk" && \
|
||||||
|
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-iOS-5.1-armv7-clang3.4 CLIENT_NAME=vlmcs-iOS-5.1-armv7-clang3.4 PROGRAM_NAME=vlmcsd-iOS-5.1-armv7-clang3.4 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-mthumb -m32 -arch armv7 -miphoneos-version-min=1.0 --sysroot ~/toolchains/iPhoneOS5.1.sdk -isysroot ~/toolchains/iPhoneOS5.1.sdk" && \
|
||||||
|
|
||||||
|
#PATH=~/toolchains/iOS5.1-MacOS-Lion/usr/bin:$PATH clang --version
|
||||||
|
PATH=~/toolchains/iOS5.1-MacOS-Lion/usr/bin:$PATH make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-iOS-5.1-armv6-clang3.1 CLIENT_NAME=vlmcs-iOS-5.1-armv6-clang3.1 PROGRAM_NAME=vlmcsd-iOS-5.1-armv6-clang3.1 CC=clang CFLAGS="$CFCLANG" PLATFORMFLAGS="-arch armv6 -miphoneos-version-min=1.0 --sysroot ~/toolchains/iPhoneOS5.1.sdk -isysroot ~/toolchains/iPhoneOS5.1.sdk" && \
|
||||||
|
|
||||||
|
#PATH=~/toolchains/gcc4.2/usr/bin/bin:$PATH make $MAKEFLAGS CLIENT_NAME=vlmcs-iOS-4.1-armv6-llvm-gcc4.2 PROGRAM_NAME=vlmcsd-iOS-4.1-armv6-llvm-gcc4.2 CC=llvm-g++-4.2 CFLAGS="$CFGCC42" PLATFORMFLAGS="-arch armv6 -miphoneos-version-min=1.0 --sysroot ~/toolchains/iPhoneOS4.1.sdk -isysroot ~/toolchains/iPhoneOS4.1.sdk" && \
|
||||||
|
#rm -f vlmcs.o vlmcsd.o vlmcsdmulti.o *_all.* && \
|
||||||
|
#PATH=~/toolchains/gcc4.2/usr/bin/bin:$PATH make $REUSEOBJFLAGS vlmcsdmulti-iOS-4.1-armv6-llvm-gcc4.2 MULTI_NAME=vlmcsdmulti-iOS-4.1-armv6-llvm-gcc4.2 CC=llvm-g++-4.2 CFLAGS="$CFGCC42" PLATFORMFLAGS="-arch armv6 -miphoneos-version-min=1.0 --sysroot ~/toolchains/iPhoneOS4.1.sdk -isysroot ~/toolchains/iPhoneOS4.1.sdk" && \
|
||||||
|
|
||||||
|
#PATH=~/toolchains/gcc4.2/usr/bin:$PATH make $MAKEFLAGS CLIENT_NAME=vlmcs-iOS-4.1-armv7-clang PROGRAM_NAME=vlmcsd-iOS-4.1-armv7-llvm-clang CC=~/toolchains/gcc4.2/usr/bin/bin/clang CFLAGS="$CFGCC42" PLATFORMFLAGS="-mthumb -arch armv7 -miphoneos-version-min=4.1 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk" && \
|
||||||
|
#rm -f vlmcs.o vlmcsd.o vlmcsdmulti.o && \
|
||||||
|
#PATH=~/toolchains/gcc4.2/usr/bin:$PATH make $REUSEOBJFLAGS vlmcsdmulti-iOS-4.1-armv7-llvm-clang MULTI_NAME=vlmcsdmulti-iOS-4.1-armv7-llvm-clang CC=~/toolchains/gcc4.2/usr/bin/bin/clang CFLAGS="$CFGCC42" PLATFORMFLAGS="-mthumb -arch armv7 -miphoneos-version-min=4.1 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk" && \
|
||||||
|
|
||||||
|
|
||||||
|
PATH=~/toolchains/gcc4.2/usr/bin:$PATH make -Bj allmulti SAFE_MODE=1 MULTI_NAME=vlmcsdmulti-MacOSX-ppc PROGRAM_NAME=vlmcsd-MacOSX-ppc CLIENT_NAME=vlmcs-MacOSX-ppc CC=gcc CFLAGS="$CFGCC42 -isysroot ~/toolchains/MacOSX10.5.sdk -arch ppc -mmacosx-version-min=10.0" && \
|
||||||
|
|
||||||
|
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x86-gcc CLIENT_NAME=vlmcs-MacOSX-x86-gcc PROGRAM_NAME=vlmcsd-MacOSX-x86-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
|
||||||
|
make $MAKEFLAGS vlmcsd-MacOSX-x86-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x86-threads-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
|
||||||
|
make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x64-gcc CLIENT_NAME=vlmcs-MacOSX-x64-gcc PROGRAM_NAME=vlmcsd-MacOSX-x64-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
|
||||||
|
make $MAKEFLAGS vlmcsd-MacOSX-x64-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x64-threads-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
|
||||||
|
|
||||||
|
# Sign the iOS binaries
|
||||||
|
#ldid -S *iOS*
|
||||||
|
|
||||||
|
#strip vlmcs-* vlmcsd-* vlmcsdmulti-*
|
||||||
|
|
||||||
|
rm -f *.o *_all.*
|
||||||
|
rm -fr *.dSYM
|
||||||
|
|
||||||
|
sudo cp -p vlmcs-MacOSX-x86-gcc /usr/local/bin/vlmcs
|
||||||
|
sudo cp -p vlmcsd-MacOSX-x86-gcc /usr/local/bin/vlmcsd
|
||||||
|
|
||||||
|
sudo mkdir -p /usr/local/share/man/man8
|
||||||
|
sudo mkdir -p /usr/local/share/man/man1
|
||||||
|
sudo mkdir -p /usr/local/share/man/man7
|
||||||
|
sudo mkdir -p /usr/local/share/man/man5
|
||||||
|
|
||||||
|
sudo cp -p vlmcsd.8 /usr/local/share/man/man8
|
||||||
|
sudo cp -p vlmcs.1 vlmcsdmulti.1 /usr/local/share/man/man1
|
||||||
|
sudo cp -p vlmcsd-floppy.7 vlmcsd.7 /usr/local/share/man/man7
|
||||||
|
sudo cp -p vlmcsd.ini.5 //usr/local/share/man/man5
|
||||||
|
|
||||||
|
# Copy the stuff to distribution server
|
||||||
|
scp -p vlmcsd-MacOSX-x* vlmcs-MacOSX-x* vlmcsdmulti-MacOSX-x* root@ubuntu64:x/binaries/MacOSX/intel
|
||||||
|
scp -p vlmcsd-MacOSX-ppc* vlmcs-MacOSX-ppc* vlmcsdmulti-MacOSX-ppc* root@ubuntu64:x/binaries/MacOSX/ppc
|
||||||
|
scp -p vlmcsd-iOS* vlmcs-iOS* vlmcsdmulti-iOS* root@ubuntu64:x/binaries/iOS/arm
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export VERBOSE=3
|
||||||
|
export CAT=2
|
||||||
|
|
||||||
|
if [ `uname -s` != "SunOS" ]; then
|
||||||
|
echo "This is no SunOS operating system."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
SOLARIS_VERSION=`uname -v`
|
||||||
|
|
||||||
|
rm -f vlmcsd-Solaris* vlmcs-* vlmcsdmulti-* *_all.* 2>/dev/null
|
||||||
|
rm -f vlmcsdmulti vlmcsd vlmcs 2>/dev/null
|
||||||
|
|
||||||
|
MAKEFLAGS="-B -j`nproc`"
|
||||||
|
REUSEOBJFLAGS="-j`nproc`"
|
||||||
|
|
||||||
|
CF="-fno-common -fno-exceptions -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fmerge-all-constants -Wno-char-subscripts"
|
||||||
|
LF="-fwhole-program -Wl,-z,norelro -Wl,--hash-style=sysv -Wl,--build-id=none"
|
||||||
|
|
||||||
|
|
||||||
|
# 32 bit
|
||||||
|
if [ "$CAT" != "" ]; then
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld vlmcs-Solaris$SOLARIS_VERSION-x86 vlmcsd-Solaris$SOLARIS_VERSION-x86 vlmcsdmulti-Solaris$SOLARIS_VERSION-x86 CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x86 PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x86 MULTI_NAME=vlmcsdmulti-Solaris$SOLARIS_VERSION-x86 CC=gcc CFLAGS="$CF" LDFLAGS="$LF"
|
||||||
|
else
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld MULTI_NAME=vlmcsdmulti-Solaris$SOLARIS_VERSION-x86 CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x86 PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x86 CC=gcc CFLAGS="$CF" LDFLAGS="$LF" allmulti
|
||||||
|
fi
|
||||||
|
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld vlmcsd-Solaris$SOLARIS_VERSION-x86-threads PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x86-threads CC=gcc THREADS=1 CFLAGS="$CF" LDFLAGS="-lpthread $LF"
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x86-openssl1.0-EXPERIMENTAL CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x86-openssl1.0-EXPERIMENTAL CC=gcc CFLAGS="$CF" LDFLAGS="$LF"
|
||||||
|
|
||||||
|
# 64 bit
|
||||||
|
|
||||||
|
LF="$LF -Wl,-melf_x86_64_sol2"
|
||||||
|
|
||||||
|
if [ "$CAT" != "" ]; then
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld vlmcsdmulti-Solaris$SOLARIS_VERSION-x64 vlmcs-Solaris$SOLARIS_VERSION-x64 vlmcsd-Solaris$SOLARIS_VERSION-x64 MULTI_NAME=vlmcsdmulti-Solaris$SOLARIS_VERSION-x64 CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x64 PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x64 CC=gcc CFLAGS="$CF" LDFLAGS="$LF" PLATFORMFLAGS="-m64"
|
||||||
|
else
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld MULTI_NAME=vlmcsdmulti-Solaris$SOLARIS_VERSION-x64 CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x64 PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x64 CC=gcc CFLAGS="$CF" LDFLAGS="$LF" PLATFORMFLAGS="-m64" allmulti
|
||||||
|
fi
|
||||||
|
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld vlmcsd-Solaris$SOLARIS_VERSION-x64-threads PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x64-threads CC=gcc THREADS=1 CFLAGS="$CF" LDFLAGS="$LF -lpthread" PLATFORMFLAGS="-m64"
|
||||||
|
gmake $MAKEFLAGS LD_ALTEXEC=/usr/bin/gld CLIENT_NAME=vlmcs-Solaris$SOLARIS_VERSION-x64-openssl1.0-EXPERIMENTAL CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-Solaris$SOLARIS_VERSION-x64-openssl1.0-EXPERIMENTAL CC=gcc CFLAGS="$CF" LDFLAGS="$LF" PLATFORMFLAGS="-m64"
|
||||||
|
|
||||||
|
rm -f *.o *_all.*
|
||||||
|
|
||||||
|
gstrip -s --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag vlmcs-* vlmcsd-*
|
||||||
|
#gstrip -s --strip-unneeded --remove-section=.eh_frame_hdr --remove-section=.eh_frame --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag vlmcs-* vlmcsd-*
|
||||||
|
#sstrip -z vlmcs-* vlmcsd-*
|
||||||
|
|
||||||
|
# Copy stuff to distribution server
|
||||||
|
scp -p vlmcsd-Sola* vlmcs-* vlmcsdmulti-* root@ubuntu64:x/binaries/Solaris/intel
|
|
@ -0,0 +1,84 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm -f cygkms*.dll libkms*.dll vlmcs-* vlmcsd-win* vlmcsd-cyg* vlmcsdmulti-* *_all.* vlmcsd.exe vlmcs.exe vlmcsdmulti.exe 2> /dev/null
|
||||||
|
|
||||||
|
export CAT=2
|
||||||
|
export VERBOSE=3
|
||||||
|
NUMCPU=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||||
|
|
||||||
|
CF="-Wno-missing-braces -fno-common -fno-exceptions -fno-non-call-exceptions -fno-stack-protector -fmerge-all-constants -fno-unwind-tables -fno-asynchronous-unwind-tables -pipe"
|
||||||
|
CFMSRPC="-Wno-missing-braces -Wno-unused-variable $CF" # -fno-common -fno-stack-protector -fmerge-all-constants -pipe"
|
||||||
|
PF32=""
|
||||||
|
PF64="-mpreferred-stack-boundary=4 -march=nocona -mtune=generic"
|
||||||
|
LFCYG32="-fwhole-program -Wl,--nxcompat,--dynamicbase,--tsaware,--large-address-aware,--disable-long-section-names"
|
||||||
|
LFWIN32="-fwhole-program -lws2_32 -Wl,--nxcompat,--dynamicbase,--tsaware,--large-address-aware,--disable-long-section-names"
|
||||||
|
LFCYG64="-fwhole-program -Wl,--nxcompat,--dynamicbase,--tsaware,--disable-long-section-names,--high-entropy-va"
|
||||||
|
LFWIN64="-fwhole-program -lws2_32 -Wl,--nxcompat,--dynamicbase,--tsaware,--disable-long-section-names,--high-entropy-va"
|
||||||
|
|
||||||
|
MAKEFLAGS="-j$NUMCPU -B"
|
||||||
|
REUSEFLAGS="-j$NUMCPU"
|
||||||
|
|
||||||
|
make $MAKEFLAGS cygkms32.dll FEATURES=minimum THREADS=1 DLL_NAME=cygkms32.dll DNS_PARSER=internal CC=i686-pc-cygwin-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF32" LDFLAGS="$LFCYG32 -Wl,--no-seh"
|
||||||
|
make $MAKEFLAGS cygkms64.dll FEATURES=minimum THREADS=1 DLL_NAME=cygkms64.dll DNS_PARSER=internal CC=x86_64-pc-cygwin-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64 -Wl,--no-seh"
|
||||||
|
make $MAKEFLAGS all vlmcsdmulti-cygwin-x86 THREADS=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-x86 PROGRAM_NAME=vlmcsd-cygwin-x86 MULTI_NAME=vlmcsdmulti-cygwin-x86 CC=i686-pc-cygwin-gcc.exe CFLAGS="$CF" PLATFORMFLAGS="$PF32" LDFLAGS="$LFCYG32 -Wl,--no-seh"
|
||||||
|
make $MAKEFLAGS all vlmcsdmulti-cygwin-x64 THREADS=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-x64 PROGRAM_NAME=vlmcsd-cygwin-x64 MULTI_NAME=vlmcsdmulti-cygwin-x64 CC=x86_64-pc-cygwin-gcc.exe CFLAGS="$CF" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64 -Wl,--no-seh"
|
||||||
|
make $MAKEFLAGS MSRPC=1 THREADS=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-msrpc-x86 PROGRAM_NAME=vlmcsd-cygwin-msrpc-x86 MULTI_NAME=vlmcsdmulti-cygwin-msrpc-x86 CC=i686-pc-cygwin-gcc.exe CFLAGS="$CF -fasynchronous-unwind-tables" PLATFORMFLAGS="$PF32" LDFLAGS="$LFCYG32"
|
||||||
|
make $MAKEFLAGS MSRPC=1 THREADS=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-msrpc-x64 PROGRAM_NAME=vlmcsd-cygwin-msrpc-x64 MULTI_NAME=vlmcsdmulti-cygwin-msrpc-x64 CC=x86_64-pc-cygwin-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64"
|
||||||
|
unset CAT
|
||||||
|
make $MAKEFLAGS vlmcsdmulti-cygwin-msrpc-x64 MSRPC=1 THREADS=1 DNS_PARSER=internal MULTI_NAME=vlmcsdmulti-cygwin-msrpc-x64 CC=x86_64-pc-cygwin-gcc.exe CFLAGS="$CFMSRPC -flto=jobserver" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64"
|
||||||
|
make $MAKEFLAGS vlmcsdmulti-cygwin-msrpc-x86 MSRPC=1 THREADS=1 DNS_PARSER=internal MULTI_NAME=vlmcsdmulti-cygwin-msrpc-x86 CC=i686-pc-cygwin-gcc.exe CFLAGS="$CFMSRPC -flto=jobserver" PLATFORMFLAGS="$PF32" LDFLAGS="$LFCYG32"
|
||||||
|
export CAT=2
|
||||||
|
|
||||||
|
make $MAKEFLAGS THREADS=1 MSRPC=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-msrpc-x86-openssl-EXPERIMENTAL CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-cygwin-x86-openssl-EXPERIMENTAL CC=i686-pc-cygwin-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF32" LDFLAGS="$LFCYG32"
|
||||||
|
make $MAKEFLAGS THREADS=1 MSRPC=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-msrpc-x64-openssl-EXPERIMENTAL CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-cygwin-x64-openssl-EXPERIMENTAL CC=x86_64-pc-cygwin-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64"
|
||||||
|
|
||||||
|
export CAT=2
|
||||||
|
|
||||||
|
#make $MAKEFLAGS libkms32.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms32.dll CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF32" LDFLAGS="-static-libgcc $LFWIN32"
|
||||||
|
#make $MAKEFLAGS libkms64.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms64.dll CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF64" LDFLAGS="-static-libgcc $LFWIN64"
|
||||||
|
#make $MAKEFLAGS all vlmcsdmulti-Windows-x86 THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x86 PROGRAM_NAME=vlmcsd-Windows-x86 MULTI_NAME=vlmcsdmulti-Windows-x86 CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF" PLATFORMFLAGS="$PF32" LDFLAGS="$LFWIN32"
|
||||||
|
#make $MAKEFLAGS all vlmcsdmulti-Windows-x64 THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x64 PROGRAM_NAME=vlmcsd-Windows-x64 MULTI_NAME=vlmcsdmulti-Windows-x64 CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF" PLATFORMFLAGS="$PF64" LDFLAGS="$LFWIN64"
|
||||||
|
#make -Bj MSRPC=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-msrpc-x86 PROGRAM_NAME=vlmcsd-Windows-msrpc-x86 MULTI_NAME=vlmcsdmulti-Windows-msrpc-x86 CC=i686-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF32" LDFLAGS="-Wl,--nxcompat,--dynamicbase,--tsaware,--large-address-aware"
|
||||||
|
#make $MAKEFLAGS THREADS=1 MSRPC=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-msrpc-x64 PROGRAM_NAME=vlmcsd-Windows-msrpc-x64 MULTI_NAME=vlmcsdmulti-Windows-msrpc-x64 CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64"
|
||||||
|
#unset CAT
|
||||||
|
#make $MAKEFLAGS vlmcsdmulti-Windows-msrpc-x86 THREADS=1 MSRPC=1 CRYPTO=windows MULTI_NAME=vlmcsdmulti-Windows-msrpc-x86 CC=i686-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF32" LDFLAGS="-Wl,--nxcompat,--dynamicbase,--tsaware,--large-address-aware"
|
||||||
|
#make $MAKEFLAGS vlmcsdmulti-Windows-msrpc-x64 THREADS=1 MSRPC=1 CRYPTO=windows MULTI_NAME=vlmcsdmulti-Windows-msrpc-x64 CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC" PLATFORMFLAGS="$PF64" LDFLAGS="$LFCYG64"
|
||||||
|
export CAT=2
|
||||||
|
|
||||||
|
rm -f *_all.* *.o 2> /dev/null &
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Copying MingW binaries from distribution server"
|
||||||
|
|
||||||
|
scp -p root@ubuntu64:x/binaries/Windows/intel/* .
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Installing binaries"
|
||||||
|
|
||||||
|
cp -p vlmcs-cygwin-x64.exe /usr/local/bin/vlmcs &
|
||||||
|
cp -p vlmcsd-cygwin-x64.exe /usr/local/bin/vlmcsd &
|
||||||
|
cp -p cygkms64.dll /usr/local/bin/cygkms.dll &
|
||||||
|
|
||||||
|
cp -p libkms32.dll /cygdrive/c/nttools/x86 &
|
||||||
|
cp -p libkms64.dll /cygdrive/c/nttools/x64 &
|
||||||
|
cp -p vlmcsdmulti-Windows-x86.exe /cygdrive/c/nttools/x86/vlmcsdmulti.exe
|
||||||
|
|
||||||
|
cmd /C mklink c:\\nttools\\x86\\vlmcsd.exe vlmcsdmulti.exe 2> /dev/null &
|
||||||
|
cmd /C mklink c:\\nttools\\x86\\vlmcs.exe vlmcsdmulti.exe 2> /dev/null &
|
||||||
|
|
||||||
|
echo "Installing man pages"
|
||||||
|
|
||||||
|
mkdir -p /usr/share/man/man8
|
||||||
|
mkdir -p /usr/share/man/man1
|
||||||
|
mkdir -p /usr/share/man/man7
|
||||||
|
mkdir -p /usr/share/man/man5
|
||||||
|
|
||||||
|
cp -p vlmcsd.7 vlmcsd-floppy.7 /usr/share/man/man7
|
||||||
|
cp -p vlmcsd.8 /usr/share/man/man8
|
||||||
|
cp -p vlmcsd.ini.5 /usr/share/man/man5
|
||||||
|
cp -p vlmcs.1 vlmcsdmulti.1 /usr/share/man/man1
|
||||||
|
|
||||||
|
bzip2 -f /usr/share/man/man7/vlmcsd-floppy.7 /usr/share/man/man5/vlmcsd.ini.5 /usr/share/man/man7/vlmcsd.7 /usr/share/man/man8/vlmcsd.8 /usr/share/man/man1/vlmcs.1 /usr/share/man/man1/vlmcsdmulti.1 &
|
||||||
|
|
||||||
|
# Copy stuff to distribution server
|
||||||
|
scp -p vlmcsd-cyg* vlmcsd-Win* vlmcs-* vlmcsdmulti-* *.dll root@ubuntu64:x/binaries/Windows/intel
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# To use on x64 hosted native multilib compiler toolchain
|
||||||
|
#
|
||||||
|
|
||||||
|
rm vlmcsd-*
|
||||||
|
rm vlmcsd
|
||||||
|
|
||||||
|
MAKEFLAGS="-j -B"
|
||||||
|
|
||||||
|
make $MAKEFLAGS PROGRAM_NAME=vlmcsd-mingw64-x86 CC=x86_64-w64-mingw32-gcc.exe CFLAGS="-flto -m32" "PLATFORMFLAGS=-march=i686 -mtune=generic" "LDFLAGS=-lcrypto -lz -lkernel32 -ladvapi32 -lws2_32 -lgdi32"
|
||||||
|
make $MAKEFLAGS PROGRAM_NAME=vlmcsd-mingw64-x64 CC=x86_64-w64-mingw32-gcc.exe CFLAGS="-flto" "PLATFORMFLAGS=-mtune=generic" "LDFLAGS=-lcrypto -lz -lkernel32 -ladvapi32 -lws2_32 -lgdi32"
|
||||||
|
make $MAKEFLAGS CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-mingw64-x86-openssl CC=x86_64-w64-mingw32-gcc.exe CFLAGS="-flto -m32" "PLATFORMFLAGS=-march=i686 -mtune=generic" "LDFLAGS=-lcrypto -lz -lkernel32 -ladvapi32 -lws2_32 -lgdi32"
|
||||||
|
make $MAKEFLAGS CRYPTO=openssl_with_aes PROGRAM_NAME=vlmcsd-mingw64-x64-openssl CC=x86_64-w64-mingw32-gcc.exe CFLAGS="-flto" "PLATFORMFLAGS=-mtune=generic" "LDFLAGS=-lcrypto -lz -lkernel32 -ladvapi32 -lws2_32 -lgdi32"
|
||||||
|
|
||||||
|
rm *.o
|
|
@ -1,44 +0,0 @@
|
||||||
################################################################################
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
|
|
||||||
PDFDOCS = vlmcs.1.pdf vlmcsd.7.pdf vlmcsd.8.pdf vlmcsdmulti.1.pdf vlmcsd.ini.5.pdf vlmcsd-floppy.7.pdf
|
|
||||||
HTMLDOCS = $(PDFDOCS:.pdf=.html)
|
|
||||||
UNIXDOCS = $(PDFDOCS:.pdf=.unix.txt)
|
|
||||||
DOSDOCS = $(PDFDOCS:.pdf=.dos.txt)
|
|
||||||
|
|
||||||
%.pdf : %
|
|
||||||
ifeq ($(shell uname), Darwin)
|
|
||||||
groff -Tps -mandoc -c $< | pstopdf -i -o $@
|
|
||||||
else
|
|
||||||
groff -Tpdf -mandoc -c $< > $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
%.html : %
|
|
||||||
groff -Thtml -mandoc -c $< > $@
|
|
||||||
|
|
||||||
%.unix.txt : %
|
|
||||||
groff -P -c -Tascii -mandoc -c $< | col -bx > $@
|
|
||||||
|
|
||||||
%.dos.txt : %.unix.txt
|
|
||||||
# unix2dos -n $< $@
|
|
||||||
# sed -e 's/$$/\r/' $< > $@
|
|
||||||
awk 'sub("$$", "\r")' $< > $@
|
|
||||||
|
|
||||||
alldocs : $(UNIXDOCS) $(HTMLDOCS) $(PDFDOCS) $(DOSDOCS)
|
|
||||||
|
|
||||||
pdfdocs : $(PDFDOCS)
|
|
||||||
|
|
||||||
dosdocs : $(DOSDOCS)
|
|
||||||
|
|
||||||
unixdocs : $(UNIXDOCS)
|
|
||||||
|
|
||||||
htmldocs : $(HTMLDOCS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(PDFDOCS) $(DOSDOCS) $(UNIXDOCS) $(HTMLDOCS)
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "Help is available by typing 'make help' in directory $(shell realpath `pwd`/..). Use 'cd ..' to get there."
|
|
||||||
|
|
206
man/vlmcsd.ini.5
206
man/vlmcsd.ini.5
|
@ -1,206 +0,0 @@
|
||||||
.TH VLMCSD.INI 5 "October 2018" "Hotbird64" "KMS Activation Manual"
|
|
||||||
.LO 8
|
|
||||||
|
|
||||||
.SH NAME
|
|
||||||
\fBvlmcsd.ini\fR \- vlmcsd KMS emulator configuration file
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B vlmcsd.ini
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBvlmcsd.ini\fR (or simply called the "ini file") is a configuration file for \fBvlmcsd\fR(8). By default vlmcsd does not use a configuration file. It is completely optional and for advanced users only. You must use the \fB-i\fR option on the vlmcsd command line to use an ini file. There is no default name or default location for the ini file.
|
|
||||||
.PP
|
|
||||||
Everything, that can be configured in the ini file, may also be specified on the command line. Any configuration option specified on the command line takes precedence over the respective configuration line in the ini file.
|
|
||||||
.PP
|
|
||||||
\fBBenefits of a configuration file\fR
|
|
||||||
.PP
|
|
||||||
While you can use the configuration file to simply modify the default behavior of vlmcsd, it can also be used to change the configuration of vlmcsd after you sent a HUP \fBsignal\fR(7). Whenever you send SIGHUP, the configuration file will be re-read. Any changes you made to the ini file will be reflected after vlmcsd received the hangup signal.
|
|
||||||
.PP
|
|
||||||
\fBDifferences between command line and configuration file\fR
|
|
||||||
.PP
|
|
||||||
If you specify an illegal option or option argument on the command line, vlmcsd displays help and exits. If you specify an incorrect \fIkeyword\fR or \fIargument\fR in the ini file, vlmcsd displays a warning with some information, ignores the respective line and continues. This is intentional and prevents vlmcsd from aborting after a SIGHUP if the configuration was modified incorrectly.
|
|
||||||
|
|
||||||
.SH SYNTAX
|
|
||||||
vlmcsd.ini is a UTF-8 encoded text file with each line being in the format \fIkeyword\fR = \fIargument\fR. The \fIkeyword\fR is not case-sensitive. The \fIargument\fR is treated literally. It is neither required nor allowed to enclose the \fIargument\fR in any form of quote characters except when quote characters are part of the argument itself. Whitespace characters are ignored only
|
|
||||||
|
|
||||||
- at the beginning of a line
|
|
||||||
.br
|
|
||||||
- between the \fIkeyword\fR and '='
|
|
||||||
.br
|
|
||||||
- between '=' and the \fIargument\fR
|
|
||||||
|
|
||||||
Lines, that start with '#' or ';' are treated as comments. Empty lines are ignored as well. If a \fIkeyword\fR is repeated in another line, vlmcsd will use the \fIargument\fR of the last occurence of the \fIkeyword\fR. An exception to this is the Listen \fIkeyword\fR which can be specified multiple times and causes vlmcsd to listen on more than one IP address and/or port.
|
|
||||||
.PP
|
|
||||||
Some \fIargument\fRs are binary arguments that need to be either TRUE or FALSE. You can use "Yes", "On" or "1" as an alias for TRUE and "No", "Off" or "0" as an alias for FALSE. Binary arguments are case-insensitive.
|
|
||||||
|
|
||||||
.SH KEYWORDS
|
|
||||||
The following \fIkeyword\fRs are defined (not all keywords may be available depending on the operating system and the options used when \fBvlmcsd\fR(8) was compiled):
|
|
||||||
|
|
||||||
.IP "\fBListen\fR"
|
|
||||||
This defines on what combinations of IP addresses and ports vlmcsd should listen. \fBListen\fR can be specified more than once. The \fIargument\fR has the form \fIipaddress\fR[:\fIport\fR]. If you omit the \fIport\fR, the default port of 1688 is used. If the \fIipaddress\fR contains colons and a \fIport\fR is used, you must enclose the \fIipaddress\fR in brackets. The default is to listen to 0.0.0.0:1688 and [::]:1688 which means listen to all IPv4 and all IPv6 addresses. See the \fB-L\fR option in \fBvlmcsd\fR(8) for more info about the syntax. If you use \fB-L\fR or \fB-P\fR on the command line, all \fBListen\fR keywords in the ini file will be ignored. The \fBListen\fR keyword cannot be used if vlmcsd has been compiled to use Microsoft RPC (Windows and Cygwin only) or simple sockets.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
Listen = 192.168.1.123:1688
|
|
||||||
.br
|
|
||||||
Listen = 0.0.0.0:1234
|
|
||||||
.br
|
|
||||||
Listen = [fe80::1721:12ff:fe81:d36b%eth0]:1688
|
|
||||||
|
|
||||||
.IP "\fBPort\fR"
|
|
||||||
Can only be used if vlmcsd has been compiled to use simple sockets or on Windows and Cygwin if \fBvlmcsd\fR(8) has been compiled to use Microsoft RPC. Otherwise you must use \fBListen\fR instead. Causes vlmcsd to listen on that port instead of 1688.
|
|
||||||
|
|
||||||
.IP "\fBFreeBind\fR"
|
|
||||||
Can be TRUE or FALSE. If TRUE, you can use the \fBListen\fR keyword with IP addresses that are currently not defined on your system. \fBvlmcsd\fR(8) will start listening on these IP addresses as soon as they become available. This keyword is only available under Linux and FreeBSD because no other OS currently supports that feature. FreeBSD supports this only for IPv4 and requires the PRIV_NETINET_BINDANY privilege which is normally assigned to proccesses of the root user.
|
|
||||||
|
|
||||||
.IP "\fBPublicIPProtectionLevel\fR"
|
|
||||||
Set the level of protection against KMS activations from public IP addresses.
|
|
||||||
|
|
||||||
0 = No protection (default)
|
|
||||||
.br
|
|
||||||
1\ =\ Listen on private IP addresses only (plus those specified by one or more \fBListen\fR statements)
|
|
||||||
.br
|
|
||||||
2\ =\ Disconnect clients with public IP addresses without activating
|
|
||||||
.br
|
|
||||||
3\ =\ Combines 1 and 2
|
|
||||||
|
|
||||||
For details on public IP protection levels see \fBvlmcsd\fR(8) command line option \fB-o\fR.
|
|
||||||
|
|
||||||
.IP "\fBVPN\fR"
|
|
||||||
Has to be in the form \fIvpn-adapter-name\fR[=\fIipv4-address\fR][/\fIcidr-mask\fR][:\fIdhcp-lease-duration\fR].
|
|
||||||
|
|
||||||
Enables a compatible VPN adapter to create additional local IPv4 addresses (like 127.0.0.1) that appear as remote IPv4 addresses to the system. This allows product activation using a local instance of vlmcsd. This feature is only available in Windows and Cygwin builds of vlmcsd since it is not of any use on other operating systems. Compatible VPN adapters are Tap-windows version 8.2 or higher (from OpenVPN) and the TeamViewer VPN adapter. There is a special \fIvpn-adapter-name\fR. A single period (.) instructs vlmcsd to use the first available compatible VPN adapter. The \fIvpn-adapter-name\fR is \fBnot\fR case-sensitive. If the \fIvpn-adapter-name\fR contains spaces (e.g. Ethernet 3), do \fBnot\fR enclose it in quotes.
|
|
||||||
|
|
||||||
The default \fIipv4-address\fR is 10.10.10.9 and the default \fIcidr-mask\fR is 30. If you are using the default values, your VPN adapter uses an IPv4 address of 10.10.10.9 and you can set your activation client to use the easy to remember address 10.10.10.10 (e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs /sethst:10.10.10.10).
|
|
||||||
|
|
||||||
The \fIdhcp-lease-duration\fR is a number optionally followed by s, m, h, d or w to indicate seconds, minutes, hours, days or weeks. The default \fIdhcp-lease-duration\fR is 1d (one day). It is normally not required to change this value.
|
|
||||||
|
|
||||||
It is advised not to manually configure your OpenVPN TAP or TeamViewer VPN adapter in "Network Connections". If you set the IPv4 configuration manually anyway, the IPv4 address and the subnet mask must match the \fBVPN=\fR directive. It is safe leave the IPv4 configuration to automatic (DHCP). vlmcsd will wait up to four seconds for the DHCP configuration to complete before binding to and listenin on any interfaces.
|
|
||||||
|
|
||||||
You should be aware that only one program can use a VPN adapter at a time. If you use the TeamViewer VPN adapter for example, you will not be able to use the VPN feature of TeamViewer as long as vlmcsd is running. The same applies to OpenVPN TAP adapters that are in use by other programs (for example OpenVPN, QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid conflicts is to install Tap-Windows from OpenVPN, cd to C:\\Program Files\\TAP-Windows\\bin and run addtap.bat to install an additional TAP adapter. Go to "Network Connections" and rename the new adapter to "vlmcsd" and specify \fBVPN=vlmcsd\fR to use it.
|
|
||||||
|
|
||||||
.IP "\fBExitLevel"
|
|
||||||
Can be either 0 (the default) or 1. Controls under what circumstances vlmcsd will exit. Using the default of \fB0\fR vlmcsd stays active as long as it can perform some useful operations. If vlmcsd is run by any form of a watchdog, e.g. NT service manager (Windows), systemd (Linux) or launchd (Mac OS / iOS), it may be desirable to end vlmcsd and let the watchdog restart it. This is especially true if some pre-requisites are not yet met but will be some time later, e.g. network is not yet fully setup.
|
|
||||||
|
|
||||||
By using \fBExitLevel = 0\fR vlmcsd will
|
|
||||||
|
|
||||||
.RS 12
|
|
||||||
exit if none of the listening sockets specified with \fB-L\fR can be used. It continues if at least one socket can be setup for listening.
|
|
||||||
|
|
||||||
exit any TAP mirror thread (Windows version only) if there is an error condition while reading or writing from or to the VPN adapter but continue to work without utilizing a VPN adapter.
|
|
||||||
.RE
|
|
||||||
.IP
|
|
||||||
By using \fBExitLevel = 1\fR vlmcsd will
|
|
||||||
|
|
||||||
.RS 12
|
|
||||||
exit if not all listening sockets specified with \fB-L\fR can be used.
|
|
||||||
|
|
||||||
exit completely if there is a problem with a VPN adapter it is using. This may happen for instance if the VPN adapter has been disabled using "Control Panel - Network - Adapter Settings" while vlmcsd is using it.
|
|
||||||
|
|
||||||
.RE
|
|
||||||
.IP
|
|
||||||
Please note that \fBExitLevel = 1\fR is kind of a workaround option. While it may help under some circumstances, it is better to solve the problem at its origin, e.g. properly implementing dependencies in your startup script to ensure all network interfaces and the VPN adapter you will use are completely setup before you start vlmcsd.
|
|
||||||
|
|
||||||
.IP "\fBUseNDR64\fR"
|
|
||||||
Can be TRUE or FALSE. Specifies whether you want to use the NDR64 transfer syntax. See options \fB-n0\fR and \fB-n1\fR in \fBvlmcsd\fR(8). The default is TRUE.
|
|
||||||
|
|
||||||
.IP "\fBUseBTFN\fR"
|
|
||||||
Can be TRUE or FALSE. Specifies whether you want to use bind time feature negotiation in RPC. See options \fB-b0\fR and \fB-b1\fR in \fBvlmcsd\fR(8). The default is TRUE.
|
|
||||||
|
|
||||||
.IP "\fBRandomizationLevel\fR"
|
|
||||||
The \fIargument\fR must 0, 1 or 2. This specifies the ePID randomization level. See options \fB-r0\fR, \fB-r1\fR and \fB-r2\fR in \fBvlmcsd\fR(8). The default randomization level is 1. A \fBRandomizationLevel\fR of 2 is not recommended and should be treated as a debugging level.
|
|
||||||
|
|
||||||
.IP "\fBLCID\fR"
|
|
||||||
Use a specific culture id (LCID) even if the ePID is randomized. The \fIargument\fR must be a number between 1 and 32767. While any number in that range is valid, you should use an offcial LCID. A list of assigned LCIDs can be found at http://msdn.microsoft.com/en\-us/goglobal/bb964664.aspx. On the command line you control this setting with option \fB-C\fR.
|
|
||||||
|
|
||||||
.IP "\fBHostBuild\fR"
|
|
||||||
Use a specific host build number in the ePID even if it is randomized. The \fIargument\fR must be a number between 1 and 65535. While you can use any number you should only use build numbers that a released build numbers of Windows Servers, e.g. 17763 for Windows Server 2019.
|
|
||||||
|
|
||||||
.IP "\fBMaxWorkers\fR"
|
|
||||||
The \fIargument\fR specifies the maximum number of worker processes or threads that will be used to serve activation requests concurrently. This is the same as specifying \fB-m\fR on the command line. Minimum is 1. The maximum is platform specific and is at least 32767 but is likely to be greater on most systems. The default is no limit.
|
|
||||||
|
|
||||||
.IP "\fBConnectionTimeout\fR"
|
|
||||||
Used to control when the vlmcsd disconnects idle TPC connections. The default is 30 seconds. This is the same setting as \fB-t\fR on the command line.
|
|
||||||
|
|
||||||
.IP "\fBDisconnectClientsImmediately\fR"
|
|
||||||
Set this to TRUE to disconnect a client after it got an activation response regardless whether a timeout has occured or not. The default is FALSE. Setting this to TRUE is non-standard behavior. Use only if you are experiencing DoS or DDoS attacks. On the command line you control this behavior with options \fB-d\fR and \fB-k\fR.
|
|
||||||
|
|
||||||
.IP "\fBPidFile\fR"
|
|
||||||
Write a pid file. The \fIargument\fR is the full pathname of a pid file. The pid file contains is single line containing the process id of the vlmcsd process. It can be used to stop (SIGTERM) or restart (SIGHUP) vlmcsd. This directive can be overriden using \fB-p\fR on the command line.
|
|
||||||
|
|
||||||
.IP "\fBLogFile\fR"
|
|
||||||
Write a log file. The \fIargument\fR is the full pathname of a log file. On a unixoid OS and with Cygwin you can use the special filename 'syslog' to log to the syslog facility. This is the same as specifying \fB-l\fR on the command line.
|
|
||||||
|
|
||||||
.IP "\fBKmsData\fR"
|
|
||||||
Use a KMS data file. The \fIargument\fR is the full pathname of a KMS data file. By default vlmcsd only contains the minimum product data that is required to perform all operations correctly. You may use a more complete KMS data file that contains all detailed product names. This is especially useful if you are logging KMS requests. If you don't log, there is no need to load an external KMS data file.
|
|
||||||
|
|
||||||
You may use \fBKmsData\ =\ \-\fR to prevent the default KMS data file to be loaded.
|
|
||||||
|
|
||||||
.IP "\fBLogDateAndTime\fR"
|
|
||||||
Can be TRUE or FALSE. The default is TRUE. If set to FALSE, logging output does not include date and time. This is useful if you log to \fBstdout\fR(3) which is redirected to another logging mechanism that already includes date and time in its output, for instance \fBsystemd-journald\fR(8). If you log to \fBsyslog\fR(3), \fBLogDateAndTime\fR is ignored and date and time will never be included in the output sent to \fBsyslog\fR(3). Using the command line you control this setting with options \fB-T0\fR and \fB-T1\fR.
|
|
||||||
|
|
||||||
.IP "\fBLogVerbose\fR"
|
|
||||||
Set this to either TRUE or FALSE. The default is FALSE. If set to TRUE, more details of each activation will be logged. You use \fB-v\fR and \fB-q\fR in the command line to control this setting. \fBLogVerbose\fR has an effect only if you specify a log file or redirect logging to \fBstdout\fR(3).
|
|
||||||
|
|
||||||
.IP "\fBWhitelistingLevel\fR"
|
|
||||||
Can be 0, 1, 2 or 3. The default is 0. Sets the whitelisting level to determine which products vlmcsd activates or refuses.
|
|
||||||
|
|
||||||
.RS 12
|
|
||||||
\fB0\fR: activate all products with an unknown, retail or beta/preview KMS ID.
|
|
||||||
.br
|
|
||||||
\fB1\fR: activate products with a retail or beta/preview KMS ID but refuse to activate products with an unknown KMS ID.
|
|
||||||
.br
|
|
||||||
\fB2\fR: activate products with an unknown KMS ID but refuse products with a retail or beta/preview KMS ID.
|
|
||||||
.br
|
|
||||||
\fB3\fR: activate only products with a known volume license RTM KMS ID and refuse all others.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.IP ""
|
|
||||||
The SKU ID is not checked. Like a genuine KMS server vlmcsd activates a product that has a random or unknown SKU ID. If you select \fB1\fR or \fB3\fR, vlmcsd also checks the Application ID for correctness. If Microsoft introduces a new KMS ID for a new product, you cannot activate it if you used \fB1\fR or \fB3\fR until a new version of vlmcsd is available.
|
|
||||||
|
|
||||||
.IP "\fBCheckClientTime\fR"
|
|
||||||
Can be TRUE or FALSE. The default is FALSE. If you set this to TRUE \fBvlmcsd\fR(8) checks if the client time differs no more than four hours from the system time. This is useful to prevent emulator detection. A client that tries to detect an emulator could simply send two subsequent request with two time stamps that differ more than four hours from each other. If both requests succeed, the server is an emulator. If you set this to TRUE on a system with no reliable time source, activations will fail. It is ok to set the correct system time after you started \fBvlmcsd\fR(8).
|
|
||||||
|
|
||||||
.IP "\fBMaintainClients\fR"
|
|
||||||
Can be TRUE or FALSE (the default). Disables (FALSE) or enables (TRUE) maintaining a list of client machine IDs (CMIDs). TRUE is useful to prevent emulator detection. By maintaing a CMID list, \fBvlmcsd\fR(8) reports current active clients exactly like a genuine KMS emulator. This includes bug compatibility to the extent that you can permanently kill a genuine KMS emulator by sending an "overcharge request" with a required client count of 376 or more and then request activation for 671 clients. \fBvlmcsd\fR(8) can be reset from this condition by restarting it. If FALSE is used, \fBvlmcsd\fR(8) reports current active clients as good as possible. If no client sends an "overcharge request", it is not possible to detect \fBvlmcsd\fR(8) as an emulator with \fBMaintainClients\fR\~=\~FALSE. Maintaining clients requires the allocation of a buffer that is about 50 kB in size. On hardware with few memory resources use it only if you really need it.
|
|
||||||
|
|
||||||
If you start \fBvlmcsd\fR(8) from an internet superserver, this setting cannot be used. Since \fBvlmcsd\fR(8) exits after each activation, it cannot maintain any state in memory.
|
|
||||||
|
|
||||||
.IP "\fBStartEmpty\fR"
|
|
||||||
This setting is ignored if you do not also specify \fBMaintainClients\fR\~=\~TRUE. If you specify FALSE (the default), \fBvlmcsd\fR(8) starts up as a fully "charged" KMS server. Clients activate immediately. \fBStartEmpty\fR\~=\~TRUE lets you start up \fBvlmcsd\fR(8) with an empty CMID list. Activation will start when the required minimum clients (25 for Windows Client OSses, 5 for Windows Server OSses and Office) have registered with the KMS server. As long as the minimum client count has not been reached, clients end up in HRESULT 0xC004F038 "The count reported by your Key Management Service (KMS) is insufficient. Please contact your system administrator". You may use \fBvlmcs\fR(1) or another KMS client emulator to "charge" \fBvlmcsd\fR(8). Setting this parameter to TRUE does not improve emulator detection prevention. It's primary purpose is to help developers of KMS clients to test "charging" a KMS server.
|
|
||||||
|
|
||||||
.IP "\fBActivationInterval\fR"
|
|
||||||
This is the same as specifying \fB-A\fR on the command line. See \fBvlmcsd\fR(8) for details. The default is 2 hours. Example: ActivationInterval\~=\~1h
|
|
||||||
|
|
||||||
.IP "\fBRenewalInterval\fR"
|
|
||||||
This is the same as specifying \fB-R\fR on the command line. See \fBvlmcsd\fR(8) for details. The default is 7 days. Example: RenewalInterval = 3d. Please note that the KMS client decides itself when to renew activation. Even though vlmcsd sends the renewal interval you specify, it is no more than some kind of recommendation to the client. Older KMS clients did follow the recommendation from a KMS server or emulator. Newer clients do not.
|
|
||||||
|
|
||||||
.IP "\fBUser\fR"
|
|
||||||
Run vlmcsd as another, preferrably less privileged, user. The \fIargument\fR can be a user name or a numeric user id. You must have the required privileges (capabilities on Linux) to change the security context of a process without providing any credentials (a password in most cases). On most unixoid OSses 'root' is the only user who has these privileges in the default configuration. This setting is not available in the native Windows version of vlmcsd. See \fB-u\fR in \fBvlmcsd\fR(8). This setting cannot be changed on the fly by sending SIGHUP to vlmcsd.
|
|
||||||
|
|
||||||
.IP "\fBGroup\fR"
|
|
||||||
Run vlmcsd as another, preferrably less privileged, group. The \fIargument\fR can be a group name or a numeric group id. You must have the required privileges (capabilities on Linux) to change the security context of a process without providing any credentials (a password in most cases). On most unixoid OSses 'root' is the only user who has these privileges in the default configuration. This setting is not available in the native Windows version of vlmcsd. See \fB-g\fR in \fBvlmcsd\fR(8). This setting cannot be changed on the fly by sending SIGHUP to vlmcsd.
|
|
||||||
|
|
||||||
.IP "\fB<csvlk-name>\fR"
|
|
||||||
The \fIargument\fR has the form \fIePID\fR [ / \fIHwId\fR ]. Always use \fIePID\fR and \fIHwId\fR for activations with \fB<csvlk-name>\fR. If specified, \fBRandomizationLevel\fR for the \fB<csvlk-name>\fR will be ignored. With the default vlmcsd.kmd database you can use the following \fB<csvlk-name>\fRs: Windows, Office2010, Office2013, Office2016, Office2019 and WinChinaGov. While vlmcsd is compatible with older databases, you must use at least database version 1.6 for this feature to work.
|
|
||||||
|
|
||||||
.SH "VALID EPIDS"
|
|
||||||
The ePID is currently a comment only. You can specify any string up to 63 bytes. In Windows 7 Microsoft has blacklisted few ( < 10 ) ePIDs that were used in KMSv5 versions of the "Ratiborus Virtual Machine". Microsoft has given up on blacklisting when KMS emulators appeared in the wild.
|
|
||||||
|
|
||||||
Even if you can use "Activated by cool hacker guys" as an ePID, you may wish to use ePIDs that cannot be detected as non-MS ePIDs. If you don't know how these "valid" ePIDs look like exactly, do not use GUIDS in vlmcsd.ini. vlmcsd provides internal mechanisms to generate valid ePIDs.
|
|
||||||
|
|
||||||
If you use non-ASCII characters in your ePID (you shouldn't do anyway), these must be in UTF-8 format. This is especially important when you run vlmcsd on Windows or cygwin because UTF-8 is not the default encoding for most editors.
|
|
||||||
|
|
||||||
If you are specifying an optional HWID it follows the same syntax as in the \fB\-H\fR option in \fBvlmcsd\fR(8) ecxept that you must not enclose a HWID in quotes even if it contains spaces.
|
|
||||||
|
|
||||||
.SH FILES
|
|
||||||
.IP "\fBvlmcsd.ini\fR(5)"
|
|
||||||
|
|
||||||
.SH AUTHOR
|
|
||||||
\fBvlmcsd\fR(8) was written by crony12, Hotbird64 and vityan666. With contributions from DougQaid.
|
|
||||||
|
|
||||||
.SH CREDITS
|
|
||||||
Thanks to abbodi1406, CODYQX4, deagles, eIcn, mikmik38, nosferati87, qad, Ratiborus, ...
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
\fBvlmcsd\fR(8), \fBvlmcsd\fR(7), \fBvlmcs\fR(1), \fBvlmcsdmulti\fR(1)
|
|
|
@ -72,13 +72,13 @@ RpcCtx connectToAddress(char *const addr, const int AddressFamily_unused, int_fa
|
||||||
|
|
||||||
if ((status = createStringBinding(addr, &stringBinding)) != RPC_S_OK)
|
if ((status = createStringBinding(addr, &stringBinding)) != RPC_S_OK)
|
||||||
{
|
{
|
||||||
printerrorf("%s\n", win_strerror(status));
|
errorout("%s\n", win_strerror(status));
|
||||||
return !0;
|
return !0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PreviousRpcCallFailed)
|
if (PreviousRpcCallFailed)
|
||||||
{
|
{
|
||||||
printerrorf("%s\n", win_strerror(PreviousRpcCallFailed));
|
errorout("%s\n", win_strerror(PreviousRpcCallFailed));
|
||||||
return !0;
|
return !0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ RpcCtx connectToAddress(char *const addr, const int AddressFamily_unused, int_fa
|
||||||
/*
|
/*
|
||||||
* Does not do RPC binding on the wire. Just initializes the interface
|
* Does not do RPC binding on the wire. Just initializes the interface
|
||||||
*/
|
*/
|
||||||
RpcStatus rpcBindClient(const RpcCtx handle, const int_fast8_t verbose, PRpcDiag_t rpcDiag)
|
RpcStatus rpcBindClient(const RpcCtx handle, const int_fast8_t verbose)
|
||||||
{
|
{
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ RpcStatus rpcBindClient(const RpcCtx handle, const int_fast8_t verbose, PRpcDiag
|
||||||
errorout("\n%s\n", win_strerror(status));
|
errorout("\n%s\n", win_strerror(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcDiag->HasRpcDiag = FALSE;
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +170,7 @@ RpcStatus closeRpc(const RpcCtx handle)
|
||||||
|
|
||||||
#if !MULTI_CALL_BINARY
|
#if !MULTI_CALL_BINARY
|
||||||
// Memory allocation function for RPC.
|
// Memory allocation function for RPC.
|
||||||
void *__RPC_USER midl_user_allocate(size_t len)
|
void *__RPC_USER midl_user_allocate(SIZE_T len)
|
||||||
{
|
{
|
||||||
return vlmcsd_malloc(len);
|
return vlmcsd_malloc(len);
|
||||||
}
|
}
|
|
@ -2,25 +2,21 @@
|
||||||
* msrpc-client.h
|
* msrpc-client.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_MSRPC
|
|
||||||
#ifndef MSRPC_CLIENT_H_
|
#ifndef MSRPC_CLIENT_H_
|
||||||
#define MSRPC_CLIENT_H_
|
#define MSRPC_CLIENT_H_
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "shared_globals.h"
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include "output.h"
|
|
||||||
|
|
||||||
typedef int_fast8_t RpcCtx;
|
typedef int_fast8_t RpcCtx;
|
||||||
typedef RPC_STATUS RpcStatus;
|
typedef RPC_STATUS RpcStatus;
|
||||||
|
|
||||||
RpcCtx connectToAddress(char *const addr, const int AddressFamily_unused, int_fast8_t showHostName);
|
RpcCtx connectToAddress(char *const addr, const int AddressFamily_unused, int_fast8_t showHostName);
|
||||||
int_fast8_t isDisconnected(const RpcCtx handle);
|
int_fast8_t isDisconnected(const RpcCtx handle);
|
||||||
RpcStatus rpcBindClient(const RpcCtx handle, const int_fast8_t verbose, PRpcDiag_t rpcDiag);
|
RpcStatus rpcBindClient(const RpcCtx handle, const int_fast8_t verbose);
|
||||||
RpcStatus rpcSendRequest(const RpcCtx handle, BYTE* KmsRequest, size_t requestSize, BYTE **KmsResponse, size_t *responseSize);
|
RpcStatus rpcSendRequest(const RpcCtx handle, BYTE* KmsRequest, size_t requestSize, BYTE **KmsResponse, size_t *responseSize);
|
||||||
RpcStatus closeRpc(RpcCtx s);
|
RpcStatus closeRpc(RpcCtx s);
|
||||||
|
|
||||||
#define INVALID_RPCCTX ((RpcCtx)~0)
|
#define INVALID_RPCCTX ((RpcCtx)~0)
|
||||||
#endif // USE_MSRPC
|
|
||||||
|
|
||||||
#endif /* MSRPC_CLIENT_H_ */
|
#endif /* MSRPC_CLIENT_H_ */
|
|
@ -9,10 +9,6 @@
|
||||||
#error MSRPC is only available with native Windows or Cygwin
|
#error MSRPC is only available with native Windows or Cygwin
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _WIN32 && !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
#include <winsock2.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "msrpc-server.h"
|
#include "msrpc-server.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "kms.h"
|
#include "kms.h"
|
||||||
|
@ -161,56 +157,6 @@ RPC_STATUS getClientIp(const RPC_BINDING_HANDLE clientBinding, RPC_CSTR *ipAddre
|
||||||
#endif // NO_LOG
|
#endif // NO_LOG
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_PRIVATE_IP_DETECT
|
|
||||||
static int_fast8_t IsPrivateIPAddress(char* ipAddress)
|
|
||||||
{
|
|
||||||
int family = strchr(ipAddress,'.') ? AF_INET : AF_INET6;
|
|
||||||
|
|
||||||
switch(family)
|
|
||||||
{
|
|
||||||
case AF_INET:
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char* current;
|
|
||||||
char* next;
|
|
||||||
uint32_t ip;
|
|
||||||
|
|
||||||
for (ip = 0, i = 0, current = ipAddress; i < 4; i++, current = next + 1)
|
|
||||||
{
|
|
||||||
ip = (ip << 8) | strtoul(current, &next, 10);
|
|
||||||
if (*next != '.') break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(ip & 0xff000000) == 0x7f000000 || // 127.x.x.x localhost
|
|
||||||
(ip & 0xffff0000) == 0xc0a80000 || // 192.168.x.x private routeable
|
|
||||||
(ip & 0xffff0000) == 0xa9fe0000 || // 169.254.x.x link local
|
|
||||||
(ip & 0xff000000) == 0x0a000000 || // 10.x.x.x private routeable
|
|
||||||
(ip & 0xfff00000) == 0xac100000 // 172.16-31.x.x private routeable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case AF_INET6:
|
|
||||||
{
|
|
||||||
if (!strcmp(ipAddress, "::1")) return TRUE;
|
|
||||||
if (strchr(ipAddress, ':') - ipAddress != 4) break;
|
|
||||||
|
|
||||||
int16_t firstWord;
|
|
||||||
hex2bin((BYTE*)&firstWord, ipAddress, 2);
|
|
||||||
if ((BE16(firstWord) & 0xe000) != 0x2000) return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif // NO_PRIVATE_IP_DETECT
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the callback function for the RPC request as defined in KMSServer.idl
|
* This is the callback function for the RPC request as defined in KMSServer.idl
|
||||||
|
@ -221,7 +167,7 @@ int ProcessActivationRequest(handle_t IDL_handle, int requestSize, unsigned char
|
||||||
{
|
{
|
||||||
RPC_CSTR clientIpAddress;
|
RPC_CSTR clientIpAddress;
|
||||||
RPC_STATUS result;
|
RPC_STATUS result;
|
||||||
int status = 0;
|
int status = RPC_S_OK;
|
||||||
|
|
||||||
result = getClientIp(IDL_handle, &clientIpAddress);
|
result = getClientIp(IDL_handle, &clientIpAddress);
|
||||||
|
|
||||||
|
@ -231,70 +177,36 @@ int ProcessActivationRequest(handle_t IDL_handle, int requestSize, unsigned char
|
||||||
|
|
||||||
# endif // NO_LOG
|
# endif // NO_LOG
|
||||||
|
|
||||||
# ifndef NO_PRIVATE_IP_DETECT
|
|
||||||
if (result && (PublicIPProtectionLevel & 2))
|
|
||||||
{
|
|
||||||
# ifndef NO_LOG
|
|
||||||
logger ("Cannot verify that client has a private IP address\n");
|
|
||||||
# endif
|
|
||||||
|
|
||||||
return 0x80070000 | RPC_S_ACCESS_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result && (PublicIPProtectionLevel & 2) && !IsPrivateIPAddress((char*)clientIpAddress))
|
|
||||||
{
|
|
||||||
# ifndef NO_LOG
|
|
||||||
logger("Client with public IP address rejected\n");
|
|
||||||
# endif
|
|
||||||
|
|
||||||
RpcStringFreeA(&clientIpAddress);
|
|
||||||
return 0x80070000 | RPC_S_ACCESS_DENIED;
|
|
||||||
}
|
|
||||||
# endif // NO_PRIVATE_IP_DETECT
|
|
||||||
|
|
||||||
// Discard any packet smaller than a v4 request
|
// Discard any packet smaller than a v4 request
|
||||||
if (requestSize < (int)sizeof(REQUEST_V4))
|
if (requestSize < (int)sizeof(REQUEST_V4))
|
||||||
{
|
{
|
||||||
if (!result) RpcStringFreeA(&clientIpAddress);
|
if (!result) RpcStringFreeA(&clientIpAddress);
|
||||||
return 0x8007000D;
|
return RPC_S_CANNOT_SUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
*response = (uint8_t *)midl_user_allocate(MAX_RESPONSE_SIZE);
|
*response = (uint8_t *)midl_user_allocate(MAX_RESPONSE_SIZE);
|
||||||
int kmsStatus = 0x8007000D;
|
|
||||||
int version = LE32(((REQUEST*)(request))->Version);
|
|
||||||
|
|
||||||
switch(version)
|
switch(LE16(((REQUEST*)(request))->MajorVer))
|
||||||
{
|
{
|
||||||
case 0x40000:
|
case 4:
|
||||||
kmsStatus = CreateResponseV4((REQUEST_V4 *)request, *response, (char*)clientIpAddress);
|
*responseSize = CreateResponseV4((REQUEST_V4 *)request, *response, (char*)clientIpAddress);
|
||||||
break;
|
break;
|
||||||
case 0x50000:
|
case 5:
|
||||||
case 0x60000:
|
case 6:
|
||||||
kmsStatus = CreateResponseV6((REQUEST_V6 *) request, *response, (char*)clientIpAddress);
|
*responseSize = CreateResponseV6((REQUEST_V6 *) request, *response, (char*)clientIpAddress);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
# ifndef NO_LOG
|
status = RPC_S_INVALID_ARG;
|
||||||
logger("Fatal: KMSv%u.%u unsupported\n", version >> 16, version & 0xffff);
|
|
||||||
# endif // NO_LOG
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kmsStatus < 0)
|
|
||||||
{
|
|
||||||
status = kmsStatus;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*responseSize = kmsStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result) RpcStringFreeA(&clientIpAddress);
|
if (!result) RpcStringFreeA(&clientIpAddress);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Memory allocation function for RPC.
|
// Memory allocation function for RPC.
|
||||||
void *__RPC_USER midl_user_allocate(size_t len)
|
void *__RPC_USER midl_user_allocate(SIZE_T len)
|
||||||
{
|
{
|
||||||
return vlmcsd_malloc(len);
|
return vlmcsd_malloc(len);
|
||||||
}
|
}
|
|
@ -9,42 +9,23 @@
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
#if HAVE_GETIFADDR && _WIN32
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/types.h>
|
#endif // WIN32
|
||||||
|
|
||||||
#if HAVE_GETIFADDR
|
|
||||||
|
|
||||||
#if __ANDROID__
|
|
||||||
#include "ifaddrs-android.h"
|
|
||||||
#elif defined(GETIFADDRS_MUSL)
|
|
||||||
#include "ifaddrs-musl.h"
|
|
||||||
#else // getifaddrs from OS
|
|
||||||
#include <ifaddrs.h>
|
|
||||||
#endif // getifaddrs from OS
|
|
||||||
|
|
||||||
#endif // HAVE_GETIFADDR
|
|
||||||
#endif // !WIN32
|
|
||||||
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "endian.h"
|
#include "endian.h"
|
||||||
//#include "output.h"
|
#include "output.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "shared_globals.h"
|
#include "shared_globals.h"
|
||||||
#include "rpc.h"
|
#include "rpc.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
typedef ssize_t (*sendrecv_t)(int, void*, size_t, int);
|
typedef ssize_t (*sendrecv_t)(int, void*, size_t, int);
|
||||||
#else
|
#else
|
||||||
|
@ -63,8 +44,9 @@ int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
n = f(sock, data, len, 0);
|
n = f(sock, data, len, 0);
|
||||||
} while (
|
}
|
||||||
(n < 0 && socket_errno == SOCKET_EINTR) || (n > 0 && (data += n, (len -= n) > 0)));
|
while (
|
||||||
|
( n < 0 && socket_errno == VLMCSD_EINTR ) || ( n > 0 && ( data += n, (len -= n) > 0 ) ));
|
||||||
|
|
||||||
return ! len;
|
return ! len;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +72,7 @@ static int_fast8_t ip2str(char *restrict result, const size_t resultLength, cons
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unsigned int)vlmcsd_snprintf(result, resultLength, socketAddress->sa_family == AF_INET6 ? fIPv6 : fIPv4, ipAddress, portNumber) > resultLength) return FALSE;
|
if ((unsigned int)snprintf(result, resultLength, socketAddress->sa_family == AF_INET6 ? fIPv6 : fIPv4, ipAddress, portNumber) > resultLength) return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +81,7 @@ static int_fast8_t getSocketList(struct addrinfo **saList, const char *const add
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
char *szHost, *szPort;
|
char *szHost, *szPort;
|
||||||
const size_t len = strlen(addr) + 1;
|
size_t len = strlen(addr) + 1;
|
||||||
|
|
||||||
// Don't alloca too much
|
// Don't alloca too much
|
||||||
if (len > 264) return FALSE;
|
if (len > 264) return FALSE;
|
||||||
|
@ -156,7 +138,7 @@ int_fast8_t isDisconnected(const SOCKET s)
|
||||||
|
|
||||||
if (!setBlockingEnabled(s, FALSE)) return TRUE;
|
if (!setBlockingEnabled(s, FALSE)) return TRUE;
|
||||||
|
|
||||||
const int n = recv(s, buffer, 1, MSG_PEEK);
|
int n = recv(s, buffer, 1, MSG_PEEK);
|
||||||
|
|
||||||
if (!setBlockingEnabled(s, TRUE)) return TRUE;
|
if (!setBlockingEnabled(s, TRUE)) return TRUE;
|
||||||
if (n == 0) return TRUE;
|
if (n == 0) return TRUE;
|
||||||
|
@ -165,68 +147,6 @@ int_fast8_t isDisconnected(const SOCKET s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
// Check, if a sockaddr is a private IPv4 or IPv6 address
|
|
||||||
static int_fast8_t isPrivateIPAddress(struct sockaddr* addr, socklen_t* length)
|
|
||||||
{
|
|
||||||
union v6addr
|
|
||||||
{
|
|
||||||
uint8_t bytes[16];
|
|
||||||
uint16_t words[8];
|
|
||||||
uint32_t dwords[4];
|
|
||||||
uint64_t qwords[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (addr == NULL) return FALSE;
|
|
||||||
|
|
||||||
switch (addr->sa_family)
|
|
||||||
{
|
|
||||||
case AF_INET6:
|
|
||||||
{
|
|
||||||
union v6addr* ipv6addr = (union v6addr*)&((struct sockaddr_in6*)addr)->sin6_addr;
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(ipv6addr->qwords[0] != 0 || BE64(ipv6addr->qwords[1]) != 1) && // ::1 IPv6 localhost
|
|
||||||
(BE16(ipv6addr->words[0]) & 0xe000) == 0x2000 // !2000::/3
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (length) *length = sizeof(struct sockaddr_in6);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case AF_INET:
|
|
||||||
{
|
|
||||||
const uint32_t ipv4addr = BE32(((struct sockaddr_in*)addr)->sin_addr.s_addr);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(ipv4addr & 0xff000000) != 0x7f000000 && // 127.x.x.x localhost
|
|
||||||
(ipv4addr & 0xffff0000) != 0xc0a80000 && // 192.168.x.x private routeable
|
|
||||||
(ipv4addr & 0xffff0000) != 0xa9fe0000 && // 169.254.x.x link local
|
|
||||||
(ipv4addr & 0xff000000) != 0x0a000000 && // 10.x.x.x private routeable
|
|
||||||
(ipv4addr & 0xfff00000) != 0xac100000 // 172.16-31.x.x private routeable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (length) *length = sizeof(struct sockaddr_in);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif // !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
|
|
||||||
|
|
||||||
// Connect to TCP address addr (e.g. "kms.example.com:1688") and return an
|
// Connect to TCP address addr (e.g. "kms.example.com:1688") and return an
|
||||||
// open socket for the connection if successful or INVALID_SOCKET otherwise
|
// open socket for the connection if successful or INVALID_SOCKET otherwise
|
||||||
SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fast8_t showHostName)
|
SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fast8_t showHostName)
|
||||||
|
@ -242,9 +162,13 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
|
||||||
// struct sockaddr_in* addr4 = (struct sockaddr_in*)sa->ai_addr;
|
// struct sockaddr_in* addr4 = (struct sockaddr_in*)sa->ai_addr;
|
||||||
// struct sockaddr_in6* addr6 = (struct sockaddr_in6*)sa->ai_addr;
|
// struct sockaddr_in6* addr6 = (struct sockaddr_in6*)sa->ai_addr;
|
||||||
|
|
||||||
if (ip2str(szAddr, sizeof(szAddr), sa->ai_addr, (socklen_t)sa->ai_addrlen))
|
if (ip2str(szAddr, sizeof(szAddr), sa->ai_addr, sa->ai_addrlen))
|
||||||
{
|
{
|
||||||
showHostName ? printf("Connecting to %s (%s) ... ", addr, szAddr) : printf("Connecting to %s ... ", szAddr);
|
if (showHostName)
|
||||||
|
printf("Connecting to %s (%s) ... ", addr, szAddr);
|
||||||
|
else
|
||||||
|
printf("Connecting to %s ... ", szAddr);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,13 +191,13 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
|
||||||
setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, (sockopt_t)&to, sizeof(to));
|
setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, (sockopt_t)&to, sizeof(to));
|
||||||
# endif // !defined(NO_TIMEOUT) && !__minix__
|
# endif // !defined(NO_TIMEOUT) && !__minix__
|
||||||
|
|
||||||
if (!connect(s, sa->ai_addr, (int)sa->ai_addrlen))
|
if (!connect(s, sa->ai_addr, sa->ai_addrlen))
|
||||||
{
|
{
|
||||||
printf("successful\n");
|
printf("successful\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printerrorf("%s: %s\n", szAddr, socket_errno == SOCKET_EINPROGRESS ? "Timed out" : vlmcsd_strerror(socket_errno));
|
errorout("%s\n", socket_errno == VLMCSD_EINPROGRESS ? "Timed out" : vlmcsd_strerror(socket_errno));
|
||||||
|
|
||||||
socketclose(s);
|
socketclose(s);
|
||||||
s = INVALID_SOCKET;
|
s = INVALID_SOCKET;
|
||||||
|
@ -290,35 +214,27 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_SOCKETS
|
#ifndef NO_SOCKETS
|
||||||
|
#ifdef SIMPLE_SOCKETS
|
||||||
|
|
||||||
static int_fast8_t allowSocketReuse(SOCKET s)
|
static int_fast8_t allowSocketReuse(SOCKET s)
|
||||||
{
|
{
|
||||||
# if !__CYGWIN__
|
# if !defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
|
||||||
BOOL socketOption = TRUE;
|
BOOL socketOption = TRUE;
|
||||||
|
|
||||||
# if !_WIN32
|
|
||||||
# define VLMCSD_SOCKET_OPTION SO_REUSEADDR
|
|
||||||
# else // _WIN32
|
# else // _WIN32
|
||||||
# define VLMCSD_SOCKET_OPTION SO_EXCLUSIVEADDRUSE
|
BOOL socketOption = FALSE;
|
||||||
# endif // _WIN32
|
# endif // _WIN32
|
||||||
|
|
||||||
if (setsockopt(s, SOL_SOCKET, VLMCSD_SOCKET_OPTION, (sockopt_t)&socketOption, sizeof(socketOption)))
|
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (sockopt_t)&socketOption, sizeof(socketOption)))
|
||||||
{
|
{
|
||||||
# ifdef _PEDANTIC
|
# ifdef _PEDANTIC
|
||||||
printerrorf("Warning: Socket option SO_REUSEADDR unsupported: %s\n", vlmcsd_strerror(socket_errno));
|
printerrorf("Warning: %s does not support socket option SO_REUSEADDR: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
||||||
# endif // _PEDANTIC
|
# endif // _PEDANTIC
|
||||||
}
|
}
|
||||||
|
|
||||||
# undef VLMCSD_SOCKET_OPTION
|
|
||||||
# endif // !__CYGWIN__
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SIMPLE_SOCKETS
|
|
||||||
|
|
||||||
int listenOnAllAddresses()
|
int listenOnAllAddresses()
|
||||||
{
|
{
|
||||||
uint32_t port_listen;
|
uint32_t port_listen;
|
||||||
|
@ -326,17 +242,16 @@ int listenOnAllAddresses()
|
||||||
if (!stringToInt(defaultport, 1, 65535, &port_listen))
|
if (!stringToInt(defaultport, 1, 65535, &port_listen))
|
||||||
{
|
{
|
||||||
printerrorf("Fatal: Port must be numeric between 1 and 65535.\n");
|
printerrorf("Fatal: Port must be numeric between 1 and 65535.\n");
|
||||||
exit(VLMCSD_EINVAL);
|
exit(!0);
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(AF_INET6) && defined(IPV6_V6ONLY)
|
|
||||||
|
|
||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sin6_family = AF_INET6;
|
addr.sin6_family = AF_INET6;
|
||||||
addr.sin6_port = BE16((uint16_t)port_listen);
|
addr.sin6_port = BE16((uint16_t)port_listen);
|
||||||
addr.sin6_addr = in6addr_any;
|
addr.sin6_addr = in6addr_any;
|
||||||
BOOL v6only = FALSE;
|
BOOL v6only = FALSE;
|
||||||
|
|
||||||
s_server = socket(AF_INET6, SOCK_STREAM, 0);
|
s_server = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
|
|
||||||
if (s_server == INVALID_SOCKET
|
if (s_server == INVALID_SOCKET
|
||||||
|
@ -346,28 +261,24 @@ int listenOnAllAddresses()
|
||||||
|| listen(s_server, SOMAXCONN) )
|
|| listen(s_server, SOMAXCONN) )
|
||||||
{
|
{
|
||||||
socketclose(s_server);
|
socketclose(s_server);
|
||||||
# endif // defined(AF_INET6) && defined(IPV6_V6ONLY)
|
struct sockaddr_in addr = {
|
||||||
struct sockaddr_in addr4 = {
|
|
||||||
.sin_family = AF_INET,
|
.sin_family = AF_INET,
|
||||||
.sin_port = BE16((uint16_t)port_listen),
|
.sin_port = BE16((uint16_t)port_listen),
|
||||||
.sin_addr.s_addr = BE32(INADDR_ANY)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
addr.sin_addr.s_addr = BE32(INADDR_ANY);
|
||||||
s_server = socket(AF_INET, SOCK_STREAM, 0);
|
s_server = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|
||||||
if ( s_server == INVALID_SOCKET
|
if ( s_server == INVALID_SOCKET
|
||||||
|| allowSocketReuse(s_server)
|
|| allowSocketReuse(s_server)
|
||||||
|| bind(s_server, (struct sockaddr *)&addr4, sizeof(addr4))
|
|| bind(s_server, (struct sockaddr *)&addr, sizeof(addr))
|
||||||
|| listen(s_server, SOMAXCONN) )
|
|| listen(s_server, SOMAXCONN) )
|
||||||
{
|
{
|
||||||
int error = socket_errno;
|
int error = socket_errno;
|
||||||
printerrorf("Fatal: Cannot bind to TCP port %u: %s\n", port_listen, vlmcsd_strerror(error));
|
printerrorf("Fatal: Cannot bind to TCP port %u: %s\n", port_listen, vlmcsd_strerror(error));
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(AF_INET6) && defined(IPV6_V6ONLY)
|
|
||||||
}
|
}
|
||||||
# endif // defined(AF_INET6) && defined(IPV6_V6ONLY)
|
|
||||||
|
|
||||||
#ifndef NO_LOG
|
#ifndef NO_LOG
|
||||||
logger("Listening on TCP port %u\n", port_listen);
|
logger("Listening on TCP port %u\n", port_listen);
|
||||||
|
@ -379,147 +290,6 @@ int listenOnAllAddresses()
|
||||||
#else // !SIMPLE_SOCKETS
|
#else // !SIMPLE_SOCKETS
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_GETIFADDR && !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
// Get list of private IP addresses.
|
|
||||||
// Returns 0 on success or an errno error code on failure
|
|
||||||
void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses)
|
|
||||||
{
|
|
||||||
# if _WIN32
|
|
||||||
|
|
||||||
PIP_ADAPTER_ADDRESSES firstAdapter, currentAdapter;
|
|
||||||
|
|
||||||
DWORD dwRetVal;
|
|
||||||
ULONG outBufLen = 16384;
|
|
||||||
const ULONG flags = GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME;
|
|
||||||
|
|
||||||
firstAdapter = (PIP_ADAPTER_ADDRESSES)vlmcsd_malloc(outBufLen);
|
|
||||||
|
|
||||||
if ((dwRetVal = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, firstAdapter, &outBufLen)) == ERROR_BUFFER_OVERFLOW)
|
|
||||||
{
|
|
||||||
free(firstAdapter);
|
|
||||||
firstAdapter = (PIP_ADAPTER_ADDRESSES)vlmcsd_malloc(outBufLen);
|
|
||||||
dwRetVal = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, firstAdapter, &outBufLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwRetVal != NO_ERROR)
|
|
||||||
{
|
|
||||||
printerrorf("FATAL: Could not get network address list: %s\n", vlmcsd_strerror(dwRetVal));
|
|
||||||
exit(dwRetVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (currentAdapter = firstAdapter, *numAddresses = 0; currentAdapter != NULL; currentAdapter = currentAdapter->Next)
|
|
||||||
{
|
|
||||||
PIP_ADAPTER_UNICAST_ADDRESS currentAddress;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
if (currentAdapter->OperStatus != IfOperStatusUp) continue;
|
|
||||||
|
|
||||||
for (currentAddress = currentAdapter->FirstUnicastAddress; currentAddress != NULL; currentAddress = currentAddress->Next)
|
|
||||||
{
|
|
||||||
if (isPrivateIPAddress(currentAddress->Address.lpSockaddr, &length)) (*numAddresses)++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*ipAddresses = (char**)vlmcsd_malloc(*numAddresses * sizeof(char*));
|
|
||||||
|
|
||||||
for (currentAdapter = firstAdapter, *numAddresses = 0; currentAdapter != NULL; currentAdapter = currentAdapter->Next)
|
|
||||||
{
|
|
||||||
PIP_ADAPTER_UNICAST_ADDRESS currentAddress;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
if (currentAdapter->OperStatus != IfOperStatusUp) continue;
|
|
||||||
|
|
||||||
for (currentAddress = currentAdapter->FirstUnicastAddress; currentAddress != NULL; currentAddress = currentAddress->Next)
|
|
||||||
{
|
|
||||||
if (!isPrivateIPAddress(currentAddress->Address.lpSockaddr, &length)) continue;
|
|
||||||
|
|
||||||
char *ipAddress = (char*)vlmcsd_malloc(64);
|
|
||||||
const int error = getnameinfo(currentAddress->Address.lpSockaddr, currentAddress->Address.iSockaddrLength, ipAddress, 64, NULL, 0, NI_NUMERICHOST);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
printerrorf("WARNING: Could not get IP address from interface list: %s\n", gai_strerror(error));
|
|
||||||
*ipAddress = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*ipAddresses)[(*numAddresses)++] = ipAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(firstAdapter);
|
|
||||||
|
|
||||||
# else // !_WIN32
|
|
||||||
|
|
||||||
struct ifaddrs *addrs, *addr;
|
|
||||||
|
|
||||||
if (getifaddrs(&addrs))
|
|
||||||
{
|
|
||||||
printerrorf("FATAL: Could not get network address list: %s\n", vlmcsd_strerror(errno));
|
|
||||||
exit(errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
socklen_t length;
|
|
||||||
|
|
||||||
for (addr = addrs, *numAddresses = 0; addr != NULL; addr = addr->ifa_next)
|
|
||||||
{
|
|
||||||
if (!isPrivateIPAddress(addr->ifa_addr, &length)) continue;
|
|
||||||
(*numAddresses)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ipAddresses = (char**)vlmcsd_malloc(*numAddresses * sizeof(char*));
|
|
||||||
|
|
||||||
for (addr = addrs, *numAddresses = 0; addr != NULL; addr = addr->ifa_next)
|
|
||||||
{
|
|
||||||
if (!isPrivateIPAddress(addr->ifa_addr, &length)) continue;
|
|
||||||
|
|
||||||
char *ipAddress = (char*)vlmcsd_malloc(64);
|
|
||||||
int error = getnameinfo(addr->ifa_addr, length, ipAddress, 64, NULL, 0, NI_NUMERICHOST);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
printerrorf("WARNING: Could not get IP address from interface list: %s\n", gai_strerror(error));
|
|
||||||
*ipAddress = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# if __UCLIBC__ || __gnu_hurd__
|
|
||||||
|
|
||||||
size_t adrlen = strlen(ipAddress);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
addr->ifa_addr->sa_family == AF_INET6 &&
|
|
||||||
adrlen > 5 &&
|
|
||||||
!strchr(ipAddress, '%') &&
|
|
||||||
(BE16(*(uint16_t*)&((struct sockaddr_in6*)addr->ifa_addr)->sin6_addr) & 0xffc0) == 0xfe80
|
|
||||||
)
|
|
||||||
{
|
|
||||||
size_t ifnamelen = strlen(addr->ifa_name);
|
|
||||||
char* workaroundIpAddress = (char*)vlmcsd_malloc(adrlen + ifnamelen + 2);
|
|
||||||
strcpy(workaroundIpAddress, ipAddress);
|
|
||||||
strcat(workaroundIpAddress, "%");
|
|
||||||
strcat(workaroundIpAddress, addr->ifa_name);
|
|
||||||
(*ipAddresses)[(*numAddresses)++] = workaroundIpAddress;
|
|
||||||
free(ipAddress);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(*ipAddresses)[(*numAddresses)++] = ipAddress;
|
|
||||||
}
|
|
||||||
# else // !(__UCLIBC__ || __gnu_hurd__)
|
|
||||||
|
|
||||||
(*ipAddresses)[(*numAddresses)++] = ipAddress;
|
|
||||||
|
|
||||||
# endif // !(__UCLIBC__ || __gnu_hurd__)
|
|
||||||
}
|
|
||||||
|
|
||||||
freeifaddrs(addrs);
|
|
||||||
|
|
||||||
# endif // !_WIN32
|
|
||||||
}
|
|
||||||
#endif // HAVE_GETIFADDR && !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a Listening socket for addrinfo sa and return socket s
|
// Create a Listening socket for addrinfo sa and return socket s
|
||||||
// szHost and szPort are for logging only
|
// szHost and szPort are for logging only
|
||||||
static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||||
|
@ -527,7 +297,7 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||||
int error;
|
int error;
|
||||||
char ipstr[64];
|
char ipstr[64];
|
||||||
|
|
||||||
ip2str(ipstr, sizeof(ipstr), ai->ai_addr, (socklen_t)ai->ai_addrlen);
|
ip2str(ipstr, sizeof(ipstr), ai->ai_addr, ai->ai_addrlen);
|
||||||
|
|
||||||
//*s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
//*s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||||
*s = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP);
|
*s = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
@ -566,17 +336,20 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
// if (IsWindowsVistaOrGreater()) //Doesn't work with older version of MingW32-w64 toolchain
|
// if (IsWindowsVistaOrGreater()) //Doesn't work with older version of MingW32-w64 toolchain
|
||||||
if ((GetVersion() & 0xff) > 5)
|
if ((GetVersion() & 0xff) > 5)
|
||||||
{
|
|
||||||
# endif // _WIN32
|
# endif // _WIN32
|
||||||
printerrorf("Warning: %s does not support socket option IPV6_V6ONLY: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
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 // _PEDANTIC
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
allowSocketReuse(*s);
|
# ifndef _WIN32
|
||||||
|
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (sockopt_t)&socketOption, sizeof(socketOption)))
|
||||||
|
{
|
||||||
|
# ifdef _PEDANTIC
|
||||||
|
printerrorf("Warning: %s does not support socket option SO_REUSEADDR: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
||||||
|
# endif // _PEDANTIC
|
||||||
|
}
|
||||||
|
# endif // _WIN32
|
||||||
|
|
||||||
# if HAVE_FREEBIND
|
# if HAVE_FREEBIND
|
||||||
# if (defined(IP_NONLOCALOK) || __FreeBSD_kernel__ || __FreeBSD__) && !defined(IPV6_BINDANY)
|
# if (defined(IP_NONLOCALOK) || __FreeBSD_kernel__ || __FreeBSD__) && !defined(IPV6_BINDANY)
|
||||||
|
@ -618,7 +391,7 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||||
|
|
||||||
# endif // HAVE_FREEBIND
|
# endif // HAVE_FREEBIND
|
||||||
|
|
||||||
if (bind(*s, ai->ai_addr, (int)ai->ai_addrlen) || listen(*s, SOMAXCONN))
|
if (bind(*s, ai->ai_addr, ai->ai_addrlen) || listen(*s, SOMAXCONN))
|
||||||
{
|
{
|
||||||
error = socket_errno;
|
error = socket_errno;
|
||||||
printerrorf("Warning: %s: %s\n", ipstr, vlmcsd_strerror(error));
|
printerrorf("Warning: %s: %s\n", ipstr, vlmcsd_strerror(error));
|
||||||
|
@ -661,10 +434,6 @@ BOOL addListeningSocket(const char *const addr)
|
||||||
numsockets++;
|
numsockets++;
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
exitOnWarningLevel(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(aiList);
|
freeaddrinfo(aiList);
|
||||||
|
@ -679,7 +448,7 @@ __pure int_fast8_t checkProtocolStack(const int addressfamily)
|
||||||
SOCKET s; // = INVALID_SOCKET;
|
SOCKET s; // = INVALID_SOCKET;
|
||||||
|
|
||||||
s = socket(addressfamily, SOCK_STREAM, 0);
|
s = socket(addressfamily, SOCK_STREAM, 0);
|
||||||
const int_fast8_t success = (s != INVALID_SOCKET);
|
int_fast8_t success = (s != INVALID_SOCKET);
|
||||||
|
|
||||||
socketclose(s);
|
socketclose(s);
|
||||||
return success;
|
return success;
|
||||||
|
@ -703,7 +472,7 @@ static SOCKET network_accept_any()
|
||||||
if (SocketList[i] > maxSocket) maxSocket = SocketList[i];
|
if (SocketList[i] > maxSocket) maxSocket = SocketList[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
status = select((int)maxSocket + 1, &ListeningSocketsList, NULL, NULL, NULL);
|
status = select(maxSocket + 1, &ListeningSocketsList, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (status < 0) return INVALID_SOCKET;
|
if (status < 0) return INVALID_SOCKET;
|
||||||
|
|
||||||
|
@ -730,6 +499,7 @@ void closeAllListeningSockets()
|
||||||
{
|
{
|
||||||
# ifdef SIMPLE_SOCKETS
|
# ifdef SIMPLE_SOCKETS
|
||||||
|
|
||||||
|
shutdown(s_server, VLMCSD_SHUT_RDWR);
|
||||||
socketclose(s_server);
|
socketclose(s_server);
|
||||||
|
|
||||||
# else // !SIMPLE_SOCKETS
|
# else // !SIMPLE_SOCKETS
|
||||||
|
@ -738,6 +508,7 @@ void closeAllListeningSockets()
|
||||||
|
|
||||||
for (i = 0; i < numsockets; i++)
|
for (i = 0; i < numsockets; i++)
|
||||||
{
|
{
|
||||||
|
shutdown(SocketList[i], VLMCSD_SHUT_RDWR);
|
||||||
socketclose(SocketList[i]);
|
socketclose(SocketList[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +535,7 @@ static void serveClient(const SOCKET s_client, const DWORD RpcAssocGroup)
|
||||||
|
|
||||||
# if !defined(NO_LOG) && defined(_PEDANTIC)
|
# if !defined(NO_LOG) && defined(_PEDANTIC)
|
||||||
|
|
||||||
const int result =
|
int result =
|
||||||
setsockopt(s_client, SOL_SOCKET, SO_RCVTIMEO, (sockopt_t)&to, sizeof(to)) ||
|
setsockopt(s_client, SOL_SOCKET, SO_RCVTIMEO, (sockopt_t)&to, sizeof(to)) ||
|
||||||
setsockopt(s_client, SOL_SOCKET, SO_SNDTIMEO, (sockopt_t)&to, sizeof(to));
|
setsockopt(s_client, SOL_SOCKET, SO_SNDTIMEO, (sockopt_t)&to, sizeof(to));
|
||||||
|
|
||||||
|
@ -783,7 +554,7 @@ static void serveClient(const SOCKET s_client, const DWORD RpcAssocGroup)
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
|
|
||||||
len = sizeof(addr);
|
len = sizeof addr;
|
||||||
|
|
||||||
if (getpeername(s_client, (struct sockaddr*)&addr, &len) ||
|
if (getpeername(s_client, (struct sockaddr*)&addr, &len) ||
|
||||||
!ip2str(ipstr, sizeof(ipstr), (struct sockaddr*)&addr, len))
|
!ip2str(ipstr, sizeof(ipstr), (struct sockaddr*)&addr, len))
|
||||||
|
@ -805,24 +576,7 @@ static void serveClient(const SOCKET s_client, const DWORD RpcAssocGroup)
|
||||||
logger(fIP, connection_type, cAccepted, ipstr);
|
logger(fIP, connection_type, cAccepted, ipstr);
|
||||||
#endif // NO_LOG
|
#endif // NO_LOG
|
||||||
|
|
||||||
# if !defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
|
|
||||||
if (!(PublicIPProtectionLevel & 2) || isPrivateIPAddress((struct sockaddr*)&addr, NULL))
|
|
||||||
{
|
|
||||||
rpcServer(s_client, RpcAssocGroup, ipstr);
|
rpcServer(s_client, RpcAssocGroup, ipstr);
|
||||||
}
|
|
||||||
# ifndef NO_LOG
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger("Client with public IP address rejected\n");
|
|
||||||
}
|
|
||||||
# endif // NO_LOG
|
|
||||||
|
|
||||||
# else // defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
|
|
||||||
rpcServer(s_client, RpcAssocGroup, ipstr);
|
|
||||||
|
|
||||||
# endif // defined(NO_PRIVATE_IP_DETECT)
|
|
||||||
|
|
||||||
# ifndef NO_LOG
|
# ifndef NO_LOG
|
||||||
logger(fIP, connection_type, cClosed, ipstr);
|
logger(fIP, connection_type, cClosed, ipstr);
|
||||||
|
@ -838,7 +592,7 @@ static void post_sem(void)
|
||||||
#if !defined(NO_LIMIT) && !__minix__
|
#if !defined(NO_LIMIT) && !__minix__
|
||||||
if (!InetdMode && MaxTasks != SEM_VALUE_MAX)
|
if (!InetdMode && MaxTasks != SEM_VALUE_MAX)
|
||||||
{
|
{
|
||||||
semaphore_post(MaxTaskSemaphore);
|
semaphore_post(Semaphore);
|
||||||
}
|
}
|
||||||
#endif // !defined(NO_LIMIT) && !__minix__
|
#endif // !defined(NO_LIMIT) && !__minix__
|
||||||
}
|
}
|
||||||
|
@ -849,7 +603,7 @@ static void wait_sem(void)
|
||||||
#if !defined(NO_LIMIT) && !__minix__
|
#if !defined(NO_LIMIT) && !__minix__
|
||||||
if (!InetdMode && MaxTasks != SEM_VALUE_MAX)
|
if (!InetdMode && MaxTasks != SEM_VALUE_MAX)
|
||||||
{
|
{
|
||||||
semaphore_wait(MaxTaskSemaphore);
|
semaphore_wait(Semaphore);
|
||||||
}
|
}
|
||||||
#endif // !defined(NO_LIMIT) && !__minix__
|
#endif // !defined(NO_LIMIT) && !__minix__
|
||||||
}
|
}
|
||||||
|
@ -876,17 +630,14 @@ static void *serveClientThreadProc(PCLDATA clData)
|
||||||
#ifndef NO_SOCKETS
|
#ifndef NO_SOCKETS
|
||||||
|
|
||||||
#if defined(USE_THREADS) && (defined(_WIN32) || defined(__CYGWIN__)) // Windows Threads
|
#if defined(USE_THREADS) && (defined(_WIN32) || defined(__CYGWIN__)) // Windows Threads
|
||||||
static int serveClientAsyncWinThreads(PCLDATA thr_CLData)
|
static int serveClientAsyncWinThreads(const PCLDATA thr_CLData)
|
||||||
{
|
{
|
||||||
wait_sem();
|
wait_sem();
|
||||||
|
|
||||||
HANDLE h = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)serveClientThreadProc, thr_CLData, 0, NULL);
|
HANDLE h = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)serveClientThreadProc, thr_CLData, 0, NULL);
|
||||||
|
|
||||||
if (h)
|
if (h)
|
||||||
{
|
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
return NO_ERROR;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
socketclose(thr_CLData->socket);
|
socketclose(thr_CLData->socket);
|
||||||
|
@ -894,6 +645,8 @@ static int serveClientAsyncWinThreads(PCLDATA thr_CLData)
|
||||||
post_sem();
|
post_sem();
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
#endif // defined(USE_THREADS) && defined(_WIN32) // Windows Threads
|
#endif // defined(USE_THREADS) && defined(_WIN32) // Windows Threads
|
||||||
|
|
||||||
|
@ -903,19 +656,18 @@ static int ServeClientAsyncPosixThreads(const PCLDATA thr_CLData)
|
||||||
{
|
{
|
||||||
pthread_t p_thr;
|
pthread_t p_thr;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
int error;
|
|
||||||
|
|
||||||
wait_sem();
|
wait_sem();
|
||||||
|
|
||||||
// Must set detached state to avoid memory leak
|
// Must set detached state to avoid memory leak
|
||||||
if ((error = pthread_attr_init(&attr)) ||
|
if (pthread_attr_init(&attr) ||
|
||||||
(error = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) ||
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) ||
|
||||||
(error = pthread_create(&p_thr, &attr, (void * (*)(void *))serveClientThreadProc, thr_CLData)))
|
pthread_create(&p_thr, &attr, (void * (*)(void *))serveClientThreadProc, thr_CLData))
|
||||||
{
|
{
|
||||||
socketclose(thr_CLData->socket);
|
socketclose(thr_CLData->socket);
|
||||||
free(thr_CLData);
|
free(thr_CLData);
|
||||||
post_sem();
|
post_sem();
|
||||||
return error;
|
return !0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -933,7 +685,7 @@ static void ChildSignalHandler(const int signal)
|
||||||
logger("Warning: Child killed/crashed by %s\n", strsignal(signal));
|
logger("Warning: Child killed/crashed by %s\n", strsignal(signal));
|
||||||
#endif // NO_LOG
|
#endif // NO_LOG
|
||||||
|
|
||||||
exit(ECHILD);
|
exit(!0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ServeClientAsyncFork(const SOCKET s_client, const DWORD RpcAssocGroup)
|
static int ServeClientAsyncFork(const SOCKET s_client, const DWORD RpcAssocGroup)
|
||||||
|
@ -967,7 +719,7 @@ static int ServeClientAsyncFork(const SOCKET s_client, const DWORD RpcAssocGroup
|
||||||
{
|
{
|
||||||
uint_fast8_t i;
|
uint_fast8_t i;
|
||||||
|
|
||||||
for (i = 0; i < vlmcsd_countof(signallist); i++)
|
for (i = 0; i < _countof(signallist); i++)
|
||||||
{
|
{
|
||||||
sigaction(signallist[i], &sa, NULL);
|
sigaction(signallist[i], &sa, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +789,8 @@ int runServer()
|
||||||
#endif // Standalone mode fully featured sockets
|
#endif // Standalone mode fully featured sockets
|
||||||
{
|
{
|
||||||
error = socket_errno;
|
error = socket_errno;
|
||||||
if (error == SOCKET_EINTR || error == SOCKET_ECONNABORTED) continue;
|
|
||||||
|
if (error == VLMCSD_EINTR || error == VLMCSD_ECONNABORTED) continue;
|
||||||
|
|
||||||
#ifdef _NTSERVICE
|
#ifdef _NTSERVICE
|
||||||
if (ServiceShutdown) return 0;
|
if (ServiceShutdown) return 0;
|
||||||
|
@ -1051,21 +804,11 @@ int runServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcAssocGroup++;
|
RpcAssocGroup++;
|
||||||
|
|
||||||
# if !defined(NO_LOG) && defined(_PEDANTIC)
|
|
||||||
if ((error = serveClientAsync(s_client, RpcAssocGroup)))
|
|
||||||
{
|
|
||||||
# ifdef USE_THREADS
|
|
||||||
logger("Warning: Could not create client thread: %s\n", vlmcsd_strerror(error));
|
|
||||||
# else // !USE_THREADS
|
|
||||||
logger("Warning: Could not fork client: %s\n", vlmcsd_strerror(error));
|
|
||||||
# endif // !USE_THREADS
|
|
||||||
}
|
|
||||||
# else // NO_LOG || !_PEDANTIC
|
|
||||||
serveClientAsync(s_client, RpcAssocGroup);
|
serveClientAsync(s_client, RpcAssocGroup);
|
||||||
# endif // NO_LOG || !_PEDANTIC
|
|
||||||
}
|
}
|
||||||
#endif // NO_SOCKETS
|
#endif // NO_SOCKETS
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_MSRPC
|
#endif // USE_MSRPC
|
|
@ -11,15 +11,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "output.h"
|
|
||||||
|
|
||||||
#if _MSC_VER
|
|
||||||
//typedef signed char int_fast8_t;
|
|
||||||
//typedef unsigned char BYTE;
|
|
||||||
//typedef UINT_PTR size_t;
|
|
||||||
//typedef unsigned long DWORD;
|
|
||||||
#define STDIN_FILENO 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send);
|
int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send);
|
||||||
|
|
||||||
|
@ -35,10 +28,6 @@ int listenOnAllAddresses();
|
||||||
BOOL addListeningSocket(const char *const addr);
|
BOOL addListeningSocket(const char *const addr);
|
||||||
__pure int_fast8_t checkProtocolStack(const int addressfamily);
|
__pure int_fast8_t checkProtocolStack(const int addressfamily);
|
||||||
|
|
||||||
#if HAVE_GETIFADDR
|
|
||||||
void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses);
|
|
||||||
#endif // HAVE_GETIFADDR
|
|
||||||
|
|
||||||
#endif // NO_SOCKETS
|
#endif // NO_SOCKETS
|
||||||
|
|
||||||
int runServer();
|
int runServer();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue