1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 00:04:57 +03:00

48 Commits

Author SHA1 Message Date
080edcdb81 v5.01.9662
Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
2018-10-30 16:47:37 +00:00
079ef10e1f Merge PR #789: gitlab-ci: add "vpntest" memory tests 2018-10-30 12:52:24 +01:00
b02dd7ca53 gitlab-ci: add "vpntest" memory tests 2018-10-30 01:30:11 +05:00
919cb2ae75 Merge PR #788: travis-ci: add "vpntest" memory checks 2018-10-29 20:33:42 +01:00
5f7d9b8c11 travis-ci: add "vpntest" memory checks 2018-10-29 23:21:08 +05:00
3411625177 Merge pull request #785 from chipitsine/gitlab_badge
Merge PR #785: README.md: add gitlab-ci badge
2018-10-29 20:56:48 +05:00
32ccec317a README.md: add gitlab-ci badge 2018-10-29 20:28:13 +05:00
7f8926e0c1 Merge PR #782: AppVeyor: run "vpntest" for ubuntu 18.04 2018-10-29 13:59:21 +01:00
1af74e50ad AppVeyor: run "vpntest" for ubuntu 18.04 2018-10-29 15:53:42 +05:00
8da2464831 Merge pull request #781 from chipitsine/BN_free
Merge PR #781: src/Mayaqua/Encrypt.c: fix memory leak occasionally found by valgrind
2018-10-29 14:22:45 +05:00
b5125e566c Merge pull request #780 from dnobori/181029_fixmemoryleak
Merge PR #780: Fix a single memory leak in loading the string table
2018-10-29 11:32:08 +05:00
5e75a1fb99 src/Mayaqua/Encrypt.c: fix memory leak occasionally found by valgrind 2018-10-29 10:52:56 +05:00
0e4f2a3864 Add .suo (Visual Studio user setting) file to the .gitignore file. 2018-10-29 14:49:09 +09:00
4e4db36c11 Fix a single memory leak in loading the string table. 2018-10-29 14:48:15 +09:00
18f7bfe33f Merge PR #776: AppVeyor: non interactive mode of journalctl 2018-10-28 16:46:09 +01:00
103b6eb194 AppVeyor: non interactive mode of journalctl 2018-10-28 20:25:56 +05:00
ae34141b7a Merge pull request #774 from chipitsine/master
Merge PR #774: vpntest: return non zero on invalid syntax
2018-10-27 10:16:13 +05:00
292670cfa2 vpntest: return non zero on invalid syntax 2018-10-27 09:55:42 +05:00
9ae379bc31 Merge PR #773: ci repair and refactoring 2018-10-26 15:08:20 +02:00
8908f4a933 app veyor: add "on_failure" linux script 2018-10-26 17:31:55 +05:00
60acfae417 gitlab-ci: drop 16.04 and 18.04 builds in favour of app veyor 2018-10-26 17:24:37 +05:00
092fe96676 app veyor: make it green again 2018-10-26 17:24:09 +05:00
1cb225c0ba Merge pull request #771 from chipitsine/travis_fix
Merge PR #771: travis-ci: fix osx build, remove unneeded "apt" plugin (it is unused since CPack)
2018-10-25 01:03:57 +05:00
ef6b15bda2 Merge PR #769: CMake: add support for Windows (Visual C++ 2017 toolset) 2018-10-24 21:43:45 +02:00
aff8566957 travis-ci: fix osx build, remove unneeded "apt" plugin (it is unused since CPack) 2018-10-25 00:33:58 +05:00
374ba7fc7d AppVeyor: add Visual Studio 2017 build, improve matrix 2018-10-24 21:25:57 +02:00
c1f522c10e CMake: add support for Windows (Visual C++ 2017 toolset) 2018-10-24 21:25:57 +02:00
5fe90bb180 hamcorebuilder: include all files on Windows 2018-10-24 21:21:36 +02:00
fe71635603 Merge pull request #770 from chipitsine/cmake_fix
Merge PR #770: CMake: change ${CMAKE_SOURCE_DIR}/tmp with ${CMAKE_BINARY_DIR}
2018-10-25 00:16:47 +05:00
97393bbe45 CMake: change ${CMAKE_SOURCE_DIR}/tmp with ${CMAKE_BINARY_DIR} 2018-10-24 23:47:17 +05:00
b34d036647 Merge pull request #767 from chipitsine/cmake_fix
Merge PR #767: CMake: add dynamic libraries to RPATH
2018-10-24 13:42:27 +05:00
7d1fced672 try to fix App Veyor 2018-10-24 00:33:19 +05:00
e50cf278cd CMake: add dynamic libraries to RPATH
Fixes #766
2018-10-24 00:32:41 +05:00
5b11e6bffd fix typo issued by the previous commit 2018-10-22 22:22:08 +05:00
a6ac9456b5 v5.01.9661 2018-10-22 21:57:21 +05:00
ddf4c28789 Merge PR #764: adjust systemd paths according to installation path 2018-10-22 14:51:17 +02:00
139fffe6e0 adjust systemd paths according to installation path 2018-10-22 10:55:12 +05:00
c1d6ddf361 Merge PR #761: CMake: build Cedar and Mayaqua as shared libraries, create "common" package 2018-10-20 14:38:59 +02:00
b72292edd1 Try to fix macOS build 2018-10-20 13:31:45 +02:00
3429e1bf31 CMake: build Cedar and Mayaqua as shared libraries, create "common" package 2018-10-20 13:12:49 +02:00
cf6eef4841 Merge pull request #757 from davidebeatrici/cmake-no-build-subdirectories
Merge PR #757: CMake: build all targets in the same directory, so that "hamcore.se2" doesn't have to be copied for each of them
2018-10-19 18:09:53 +05:00
99a029c7c4 Merge PR #759: Protocol.c: fix crash with OpenVPN when the certificate's common name is empty 2018-10-18 22:24:37 +02:00
f061557aad Protocol.c: fix crash with OpenVPN when the certificate's common name is empty 2018-10-18 21:21:37 +02:00
8173eb4509 CMake: build all targets in the same directory, so that "hamcore.se2" doesn't have to be copied for each of them 2018-10-18 02:02:17 +02:00
a3b5484587 Merge PR #756: src/Cedar/Logging.c: clean compiler warning 2018-10-17 13:15:27 +02:00
63513259c0 src/Cedar/Logging.c: clean compiler warning
warning: zero-length gnu_printf format string [-Wformat-zero-length]
2018-10-17 15:31:36 +05:00
966a5e6dea Merge PR #754: Cedar/Bridge.c: fix NULL pointer dereference in GetEthDeviceHash() 2018-10-16 10:21:20 +02:00
91c5d5feb8 Cedar/Bridge.c: fix NULL pointer dereference in GetEthDeviceHash() 2018-10-16 04:40:22 +02:00
34 changed files with 555 additions and 263 deletions

View File

@ -2,11 +2,13 @@ version: '{build}'
image:
- Visual Studio 2015
- Visual Studio 2017
- Ubuntu1604
- Ubuntu1804
skip_branch_with_pr: true
configuration: Release
skip_branch_with_pr: true
clone_depth: 1
init:
@ -14,16 +16,61 @@ init:
install: git submodule update --init --recursive
build_script:
- cmd: >-
src\BuildAll.cmd
exit %errorlevel%
- sh: >-
./configure && make package -C tmp
artifacts:
- path: output\pkg\*\*
name: Windows
- path: build/*.deb
name: Ubuntu
for:
-
matrix:
only:
- image: Visual Studio 2015
build_script:
- src\BuildAll.cmd
- exit %errorlevel%
artifacts:
- path: output\pkg\*\*
name: Windows
-
matrix:
only:
- image: Visual Studio 2017
init:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
before_build:
- configure
build_script:
- nmake
after_build:
- 7z a "%APPVEYOR_BUILD_FOLDER%\build\%APPVEYOR_PROJECT_NAME%_%APPVEYOR_BUILD_VERSION%_Windows_x64_%CONFIGURATION%.zip" "%APPVEYOR_BUILD_FOLDER%\build\*.exe"
- 7z a "%APPVEYOR_BUILD_FOLDER%\build\%APPVEYOR_PROJECT_NAME%_%APPVEYOR_BUILD_VERSION%_Windows_x64_%CONFIGURATION%.zip" "%APPVEYOR_BUILD_FOLDER%\build\hamcore.se2"
artifacts:
- path: build\%APPVEYOR_PROJECT_NAME%_%APPVEYOR_BUILD_VERSION%_Windows_x64_%CONFIGURATION%.zip
name: Windows
-
matrix:
only:
- image: Ubuntu1604
before_build:
- ./configure
build_script:
- make package -C tmp
after_build:
- .ci/appveyor_afterbuild.sh
on_failure:
- sudo journalctl -xe --no-pager
artifacts:
- path: build/*.deb
name: Ubuntu
-
matrix:
only:
- image: Ubuntu1804
before_build:
- ./configure
build_script:
- make package -C tmp
- .ci/memory-leak-test.sh
after_build:
- .ci/appveyor_afterbuild.sh
on_failure:
- sudo journalctl -xe --no-pager
artifacts:
- path: build/*.deb
name: Ubuntu

12
.ci/appveyor_afterbuild.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eux
sudo dpkg -i build/softether-common*.deb
sudo dpkg -i build/softether-vpnbridge*.deb
sudo dpkg -i build/softether-vpnclient*.deb
sudo dpkg -i build/softether-vpncmd*.deb
sudo dpkg -i build/softether-vpnserver*.deb
sudo systemctl restart softether-vpnserver

7
.ci/memory-leak-test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
set -eux
echo -n | ./build/vpntest s | grep -Fq 'NO MEMORY LEAKS'
echo -n | ./build/vpntest c | grep -Fq 'NO MEMORY LEAKS'
echo -n | ./build/vpntest b | grep -Fq 'NO MEMORY LEAKS'

2
.gitignore vendored
View File

@ -25,6 +25,7 @@ x64_Debug
*.user
*.ncb
*.opt
*.suo
!/src/BuildFiles/**/*
# Applied for 'developer_tools/stbchecker/'
@ -204,3 +205,4 @@ developer_tools/stbchecker/**/ASALocalRun/
developer_tools/stbchecker/**/*.binlog
developer_tools/stbchecker/**/*.nvuser
developer_tools/stbchecker/**/.mfractor/

View File

@ -10,14 +10,8 @@
script:
- ./configure
- make package -C tmp
bionic:
<<: *ubuntu_def
image: ubuntu:bionic
xenial:
<<: *ubuntu_def
image: ubuntu:xenial
- dpkg -i build/softether-vpn*.deb
- .ci/memory-leak-test.sh
trusty:
<<: *ubuntu_def

7
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "src/Mayaqua/cpu_features"]
path = src/Mayaqua/cpu_features
[submodule "src/Mayaqua/3rdparty/cpu_features"]
path = src/Mayaqua/3rdparty/cpu_features
url = https://github.com/google/cpu_features.git
[submodule "src/Mayaqua/3rdparty/zlib"]
path = src/Mayaqua/3rdparty/zlib
url = https://github.com/madler/zlib.git

View File

@ -54,16 +54,12 @@ matrix:
directories:
- ${HOME}/Library/Caches/Homebrew
before_install:
- brew update && brew upgrade
- brew update
script:
- ./configure
- make -C tmp
- otool -L build/vpnserver/vpnserver
- sudo make -C tmp install
addons:
apt:
packages: [ debhelper, devscripts, fakeroot, cmake3, dh-exec ]
- otool -L build/vpnserver
- .ci/memory-leak-test.sh
cache:
directories:
@ -83,6 +79,6 @@ script:
- export LDFLAGS="-L${HOME}/opt/lib"
- ./configure
- make -C tmp
- ldd build/vpnserver/vpnserver
- sudo LD_LIBRARY_PATH="${HOME}/opt/lib:${LD_LIBRARY_PATH:-}" make -C tmp install
- ldd build/vpnserver
- if [ "${BUILD_DEB}" = "1" ]; then make package -C tmp; fi
- .ci/memory-leak-test.sh

View File

@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.7)
project(SoftEtherVPN
VERSION 5.01.9660
VERSION 5.01.9662
LANGUAGES C
)
set(default_build_type "Release")
# Check that submodules are present only if source was downloaded with git
if(EXISTS "${SoftEtherVPN_SOURCE_DIR}/.git" AND NOT EXISTS "${SoftEtherVPN_SOURCE_DIR}/src/Mayaqua/cpu_features/CMakeLists.txt")
if(EXISTS "${SoftEtherVPN_SOURCE_DIR}/.git" AND NOT EXISTS "${SoftEtherVPN_SOURCE_DIR}/src/Mayaqua/3rdparty/cpu_features/CMakeLists.txt")
message (FATAL_ERROR "Submodules are not initialized. Run\n\tgit submodule update --init --recursive")
endif()
@ -22,39 +22,51 @@ string(REGEX REPLACE "VERSION_MINOR ([0-9]+)" "\\1" CurrentBuild_MINOR ${temp})
string(REGEX MATCH "VERSION_BUILD ([0-9]+)" temp ${CurrentBuild})
string(REGEX REPLACE "VERSION_BUILD ([0-9]+)" "\\1" CurrentBuild_BUILD ${temp})
if (NOT ${PROJECT_VERSION} VERSION_EQUAL "${CurrentBuild_MAJOR}.${CurrentBuild_MINOR}.${CurrentBuild_BUILD}")
if(NOT ${PROJECT_VERSION} VERSION_EQUAL "${CurrentBuild_MAJOR}.${CurrentBuild_MINOR}.${CurrentBuild_BUILD}")
message (FATAL_ERROR "PROJECT_VERSION does not match to src/CurrentBuild.txt")
endif()
include(CheckIncludeFile)
Check_Include_File(sys/auxv.h HAVE_SYS_AUXV)
if(UNIX)
include(GNUInstallDirs)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
include(CheckIncludeFile)
Check_Include_File(sys/auxv.h HAVE_SYS_AUXV)
endif()
configure_file("${SoftEtherVPN_SOURCE_DIR}/AUTHORS.TXT" "${SoftEtherVPN_SOURCE_DIR}/src/bin/hamcore/authors.txt" COPYONLY)
set(BUILD_DIRECTORY ${SoftEtherVPN_SOURCE_DIR}/build)
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
add_subdirectory(src)
# Packaging
set(CPACK_COMPONENTS_ALL vpnserver vpnclient vpnbridge vpncmd)
set(CPACK_PACKAGE_DIRECTORY ${BUILD_DIRECTORY})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDOR "SoftEther")
set(CPACK_PACKAGE_NAME "softether")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${SoftEtherVPN_SOURCE_DIR}/description")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SoftEther VPN is an open-source cross-platform multi-protocol VPN program, created as an academic project in the University of Tsukuba.")
if(UNIX)
# Packaging
set(CPACK_COMPONENTS_ALL common vpnserver vpnclient vpnbridge vpncmd)
set(CPACK_PACKAGE_DIRECTORY ${BUILD_DIRECTORY})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDOR "SoftEther")
set(CPACK_PACKAGE_NAME "softether")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${SoftEtherVPN_SOURCE_DIR}/description")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SoftEther VPN is an open-source cross-platform multi-protocol VPN program, created as an academic project in the University of Tsukuba.")
# DEB
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_SECTION "net")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unknown")
# DEB
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
endif()
# RPM
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_SECTION "net")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unknown")
include(CPack)
# RPM
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
include(CPack)
endif()

View File

@ -1,6 +1,6 @@
# SoftEther VPN
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) [![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) [![Coverity Scan Build Status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) [![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) [![gitlab-ci build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/build.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines) [![Coverity Scan Build Status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)
- [SoftEther VPN](#softether-vpn)
- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository)

33
configure.cmd Normal file
View File

@ -0,0 +1,33 @@
@echo off
echo ---------------------------------------------------------------------
echo SoftEther VPN for Windows
echo.
echo Copyright (c) SoftEther VPN Project at University of Tsukuba, Japan.
echo Copyright (c) Daiyuu Nobori. All Rights Reserved.
echo.
echo This program is free software; you can redistribute it and/or
echo modify it under the terms of the GNU General Public License
echo version 2 as published by the Free Software Foundation.
echo.
echo Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.
echo ---------------------------------------------------------------------
echo.
echo Welcome to the corner-cutting configure script !
echo.
if not exist "tmp" (
mkdir tmp
)
cd tmp
cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..
if %errorlevel% == 0 (
echo.
echo The Makefile is generated. Run 'nmake' to build SoftEther VPN.
) else (
cd ..
)

View File

@ -1,38 +1,20 @@
include(GNUInstallDirs)
if(UNIX)
# Creates wrapper scripts and installs them in the user's binaries directory, which is usually "/usr/local/bin".
# This is required because symlinks use the folder they are in as working directory.
macro(install_wrapper_script component target)
get_filename_component(file_name ${target} NAME)
# Creates wrapper scripts and installs them in the user's binaries directory, which is usually "/usr/local/bin".
# This is required because symlinks use the folder they are in as working directory.
macro(install_wrapper_script component target)
get_filename_component(file_name ${target} NAME)
file(WRITE ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "#!/bin/sh\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "${target} \"$@\"\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "exit $?\n")
file(WRITE ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "#!/bin/sh\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "${target} \"$@\"\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "exit $?\n")
install(FILES ${CMAKE_SOURCE_DIR}/tmp/script/${file_name}
COMPONENT ${component}
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endmacro(install_wrapper_script)
macro(install_systemd_service component file_path binary_path)
get_filename_component(file_name ${file_path} NAME)
get_filename_component(binary_directory ${binary_path} DIRECTORY)
file(READ ${file_path} FILE_CONTENT)
string(REPLACE "[DIRECTORY]" ${binary_directory} FILE_CONTENT ${FILE_CONTENT})
string(REPLACE "[BINARY]" ${binary_path} FILE_CONTENT ${FILE_CONTENT})
file(WRITE ${CMAKE_SOURCE_DIR}/tmp/systemd/${file_name} ${FILE_CONTENT})
if(EXISTS "/lib/systemd/system")
install(FILES ${CMAKE_SOURCE_DIR}/tmp/systemd/${file_name}
install(FILES ${CMAKE_SOURCE_DIR}/tmp/script/${file_name}
COMPONENT ${component}
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endmacro(install_systemd_service)
endmacro(install_wrapper_script)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG -DDEBUG)
@ -43,7 +25,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DCPU_64)
set(COMPILER_ARCHITECTURE "x64")
add_definitions(-DCPU_64)
else()
set(COMPILER_ARCHITECTURE "x86")
endif()
add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_SAFE -DTHREADSAFE -D_FILE_OFFSET_BITS=64)
@ -52,7 +37,7 @@ add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_S
include_directories(.)
if(WIN32)
message(FATAL_ERROR "Windows compilation via CMake is currently not supported.")
add_definitions(-DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS)
endif()
if(UNIX)
@ -101,111 +86,47 @@ add_subdirectory(hamcorebuilder)
# vpnserver
add_subdirectory(vpnserver)
get_target_property(VPNSERVER_RUNTIME_OUTPUT_DIRECTORY vpnserver RUNTIME_OUTPUT_DIRECTORY)
# vpnclient
add_subdirectory(vpnclient)
get_target_property(VPNCLIENT_RUNTIME_OUTPUT_DIRECTORY vpnclient RUNTIME_OUTPUT_DIRECTORY)
# vpnbridge
add_subdirectory(vpnbridge)
get_target_property(VPNBRIDGE_RUNTIME_OUTPUT_DIRECTORY vpnbridge RUNTIME_OUTPUT_DIRECTORY)
# vpncmd
add_subdirectory(vpncmd)
get_target_property(VPNCMD_RUNTIME_OUTPUT_DIRECTORY vpncmd RUNTIME_OUTPUT_DIRECTORY)
# vpntest
add_subdirectory(vpntest)
get_target_property(VPNTEST_RUNTIME_OUTPUT_DIRECTORY vpntest RUNTIME_OUTPUT_DIRECTORY)
# hamcore.se2 archive file
add_custom_target(hamcore-archive-build
ALL
COMMAND hamcorebuilder ${CMAKE_SOURCE_DIR}/src/bin/hamcore/ ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2
COMMAND hamcorebuilder "${CMAKE_SOURCE_DIR}/src/bin/hamcore/" "${BUILD_DIRECTORY}/hamcore.se2"
DEPENDS hamcorebuilder
COMMENT "Building hamcore.se2 archive file..."
VERBATIM
)
# Copy hamcore.se2 to vpnserver's directory
add_custom_command(TARGET hamcore-archive-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2 ${VPNSERVER_RUNTIME_OUTPUT_DIRECTORY}
)
if(WIN32)
# PenCore
add_subdirectory(PenCore)
add_dependencies(hamcore-archive-build PenCore)
# Copy hamcore.se2 to vpnclient's directory
add_custom_command(TARGET hamcore-archive-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2 ${VPNCLIENT_RUNTIME_OUTPUT_DIRECTORY}
)
# vpnsmgr
add_subdirectory(vpnsmgr)
# Copy hamcore.se2 to vpnbridge's directory
add_custom_command(TARGET hamcore-archive-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2 ${VPNBRIDGE_RUNTIME_OUTPUT_DIRECTORY}
)
# vpncmgr
add_subdirectory(vpncmgr)
endif()
# Copy hamcore.se2 to vpncmd's directory
add_custom_command(TARGET hamcore-archive-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2 ${VPNCMD_RUNTIME_OUTPUT_DIRECTORY}
)
# Copy hamcore.se2 to vpntest's directory
add_custom_command(TARGET hamcore-archive-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tmp/hamcore.se2 ${VPNTEST_RUNTIME_OUTPUT_DIRECTORY}
)
# Copy "vpnserver" directory to /usr/lib(exec)/softether/, install launch script and systemd service
install(DIRECTORY ${VPNSERVER_RUNTIME_OUTPUT_DIRECTORY}
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether"
PATTERN "*"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install_wrapper_script("vpnserver" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnserver/vpnserver")
install_systemd_service("vpnserver" "${CMAKE_SOURCE_DIR}/systemd/softether-vpnserver.service" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnserver/vpnserver")
# Copy "vpnclient" directory to /usr/lib(exec)/softether/, install launch script and systemd service
install(DIRECTORY ${VPNCLIENT_RUNTIME_OUTPUT_DIRECTORY}
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether"
PATTERN "*"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install_wrapper_script("vpnclient" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnclient/vpnclient")
install_systemd_service("vpnclient" "${CMAKE_SOURCE_DIR}/systemd/softether-vpnclient.service" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnclient/vpnclient")
# Copy "vpnbridge" directory to /usr/lib(exec)/softether/, install launch script and systemd service
install(DIRECTORY ${VPNBRIDGE_RUNTIME_OUTPUT_DIRECTORY}
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether"
PATTERN "*"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install_wrapper_script("vpnbridge" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnbridge/vpnbridge")
install_systemd_service("vpnbridge" "${CMAKE_SOURCE_DIR}/systemd/softether-vpnbridge.service" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnbridge/vpnbridge")
# Copy "vpncmd" directory to /usr/lib(exec)/softether/, install launch script and systemd service
install(DIRECTORY ${VPNCMD_RUNTIME_OUTPUT_DIRECTORY}
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether"
PATTERN "*"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install_wrapper_script("vpncmd" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpncmd/vpncmd")
# Print message after installing the targets
install(CODE "message(\"\n----------------------------------------------------------------------------------------------------------------------------\")")
install(CODE "message(\"Build completed successfully.\n\")")
install(CODE "message(\"Execute 'vpnserver start' to run the SoftEther VPN Server background service.\")")
install(CODE "message(\"Execute 'vpnbridge start' to run the SoftEther VPN Bridge background service.\")")
install(CODE "message(\"Execute 'vpnclient start' to run the SoftEther VPN Client background service.\")")
install(CODE "message(\"Execute 'vpncmd' to run the SoftEther VPN Command-Line Utility to configure VPN Server, VPN Bridge or VPN Client.\")")
install(CODE "message(\"----------------------------------------------------------------------------------------------------------------------------\n\")")
if(UNIX)
# Print message after installing the targets
install(CODE "message(\"\n----------------------------------------------------------------------------------------------------------------------------\")")
install(CODE "message(\"Build completed successfully.\n\")")
install(CODE "message(\"Execute 'vpnserver start' to run the SoftEther VPN Server background service.\")")
install(CODE "message(\"Execute 'vpnbridge start' to run the SoftEther VPN Bridge background service.\")")
install(CODE "message(\"Execute 'vpnclient start' to run the SoftEther VPN Client background service.\")")
install(CODE "message(\"Execute 'vpncmd' to run the SoftEther VPN Command-Line Utility to configure VPN Server, VPN Bridge or VPN Client.\")")
install(CODE "message(\"----------------------------------------------------------------------------------------------------------------------------\n\")")
endif()

View File

@ -136,19 +136,23 @@ UINT GetEthDeviceHash()
{
#ifdef OS_UNIX
// UNIX
UINT num;
UINT num = 0;
UINT i;
char tmp[4096];
UCHAR hash[SHA1_SIZE];
TOKEN_LIST *t = GetEthList();
num = t->NumTokens;
tmp[0] = 0;
for (i = 0;i < t->NumTokens;i++)
if (t != NULL)
{
StrCat(tmp, sizeof(tmp), t->Token[i]);
num = t->NumTokens;
for (i = 0; i < t->NumTokens; i++)
{
StrCat(tmp, sizeof(tmp), t->Token[i]);
}
FreeToken(t);
}
FreeToken(t);
Sha0(hash, tmp, StrLen(tmp));

View File

@ -1,22 +1,37 @@
file(GLOB SOURCES_CEDAR "*.c")
file(GLOB HEADERS_CEDAR "*.h")
add_library(cedar STATIC ${SOURCES_CEDAR} ${HEADERS_CEDAR})
if(WIN32)
enable_language(CXX)
file(GLOB SOURCES_CEDAR_CPP "*.cpp")
endif()
if(WIN32)
add_library(cedar STATIC ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
else()
add_library(cedar SHARED ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
endif()
set_target_properties(cedar
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
find_library(LIB_READLINE readline)
find_package(Curses REQUIRED)
if(WIN32)
target_include_directories(cedar PRIVATE winpcap)
endif()
target_link_libraries(cedar ${LIB_READLINE} ${CURSES_LIBRARIES})
if(UNIX)
find_library(LIB_READLINE readline)
find_package(Curses REQUIRED)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_link_libraries(cedar pcap)
target_link_libraries(cedar PRIVATE ${LIB_READLINE} ${CURSES_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_link_libraries(cedar PRIVATE mayaqua pcap)
endif()
endif()
# Version
@ -54,3 +69,11 @@ message(STATUS "Build time: ${BUILD_HOUR}:${BUILD_MINUTE}:${BUILD_SECOND}")
add_definitions(-DBUILD_DATE_D=${BUILD_DAY} -DBUILD_DATE_M=${BUILD_MONTH} -DBUILD_DATE_Y=${BUILD_YEAR})
add_definitions(-DBUILD_DATE_HO=${BUILD_HOUR} -DBUILD_DATE_MI=${BUILD_MINUTE} -DBUILD_DATE_SE=${BUILD_SECOND})
if(UNIX)
install(TARGETS cedar
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()

View File

@ -2287,7 +2287,7 @@ void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UI
break;
default: // Without switching
snprintf(str, size, "");
snprintf(str, size, "%s");
break;
}

View File

@ -7094,8 +7094,7 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
{
return NULL;
}
wcstombs(cn_username, x->subject_name->CommonName, 127);
cn_username[127] = '\0';
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);
PackAddStr(p, "username", cn_username);
}
else

View File

@ -1,5 +1,5 @@
VERSION_MAJOR 5
VERSION_MINOR 1
VERSION_BUILD 9660
VERSION_BUILD 9662
BUILD_NAME unstable
BUILD_DATE 20181015_142500
BUILD_DATE 20181030_164618

1
src/Mayaqua/3rdparty/zlib vendored Submodule

View File

@ -1,47 +1,87 @@
file(GLOB SOURCES_MAYAQUA "*.c")
file(GLOB HEADERS_MAYAQUA "*.h")
add_library(mayaqua STATIC ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
if(WIN32)
add_library(mayaqua STATIC ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
else()
add_library(mayaqua SHARED ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
endif()
target_include_directories(mayaqua PUBLIC .)
set_target_properties(mayaqua
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
if(WIN32)
add_subdirectory(3rdparty/zlib)
# In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv)
target_include_directories(mayaqua PRIVATE win32_inc)
target_include_directories(mayaqua PRIVATE 3rdparty/zlib)
if(HAVE_SYS_AUXV)
add_subdirectory(cpu_features)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/x64_${CMAKE_BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/x64_${CMAKE_BUILD_TYPE}"
)
else()
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/Win32_${CMAKE_BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/Win32_${CMAKE_BUILD_TYPE}"
)
endif()
target_link_libraries(mayaqua PRIVATE zlibstatic ${LIB_SSL} ${LIB_CRYPTO})
endif()
target_include_directories(mayaqua PRIVATE cpu_features/include)
if(UNIX)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
target_link_libraries(mayaqua OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
# In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv)
if(HAVE_SYS_AUXV)
target_link_libraries(mayaqua cpu_features)
else()
add_definitions(-DSKIP_CPU_FEATURES)
endif()
find_library(LIB_RT rt)
if(LIB_RT)
target_link_libraries(mayaqua rt)
endif()
if(LIB_ICONV)
target_link_libraries(mayaqua ${LIB_ICONV})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(mayaqua nsl socket)
find_library(LIB_RT rt)
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
if(HAVE_SYS_AUXV)
add_subdirectory(3rdparty/cpu_features)
set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(mayaqua PRIVATE cpu_features)
else()
add_definitions(-DSKIP_CPU_FEATURES)
endif()
if(LIB_RT)
target_link_libraries(mayaqua PRIVATE rt)
endif()
if(LIB_ICONV)
target_link_libraries(mayaqua PRIVATE ${LIB_ICONV})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(mayaqua PRIVATE nsl socket)
endif()
install(TARGETS mayaqua
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()

View File

@ -2357,6 +2357,7 @@ bool RsaCheck()
ret = BN_set_word(e, RSA_F4);
if (ret == 0)
{
BN_free(e);
Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf));
return false;
}
@ -2366,6 +2367,7 @@ bool RsaCheck()
{
rsa = RSA_new();
ret = RSA_generate_key_ex(rsa, bit, e, NULL);
BN_free(e);
}
Unlock(openssl_lock);
if (ret == 0)
@ -2438,6 +2440,7 @@ bool RsaGen(K **priv, K **pub, UINT bit)
ret = BN_set_word(e, RSA_F4);
if (ret == 0)
{
BN_free(e);
Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf));
return false;
}
@ -2447,6 +2450,7 @@ bool RsaGen(K **priv, K **pub, UINT bit)
{
rsa = RSA_new();
ret = RSA_generate_key_ex(rsa, bit, e, NULL);
BN_free(e);
}
Unlock(openssl_lock);
if (ret == 0)

View File

@ -945,6 +945,8 @@ TABLE *ParseTableLine(char *line, char *prefix, UINT prefix_size, LIST *replace_
UniReplaceStrEx(tmp, tmp_size, tmp, (wchar_t *)r->name, r->unistr, false);
}
Free(unistr);
unistr = CopyUniStr(tmp);
Free(tmp);

View File

@ -0,0 +1,14 @@
if(NOT WIN32)
message(FATAL_ERROR "PenCore is needed only on Windows.")
endif()
add_library(PenCore SHARED pencore.c pencore.rc)
set_target_properties(PenCore
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
)
target_link_libraries(PenCore cedar mayaqua)

View File

@ -164,7 +164,11 @@ int main(int argc, char *argv[])
Print("\nProcessing...\n");
#ifdef WIN32
BuildHamcore(dst_filename, src_dir, false);
#else
BuildHamcore(dst_filename, src_dir, true);
#endif
Print("\nDone.\n");
}

View File

@ -1,10 +1,41 @@
add_executable(vpnbridge vpnbridge.c)
set(VPNBRIDGE_SOURCES vpnbridge.c)
if(WIN32)
set(VPNBRIDGE_SOURCES ${VPNBRIDGE_SOURCES} vpnbridge.rc)
endif()
add_executable(vpnbridge ${VPNBRIDGE_SOURCES})
set_target_properties(vpnbridge
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnbridge"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnbridge"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnbridge"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpnbridge cedar mayaqua)
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnbridge
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnbridge" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnbridge/vpnbridge")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnbridge.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service
COMPONENT "vpnbridge"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -1,10 +1,41 @@
add_executable(vpnclient vpncsvc.c)
set(VPNCLIENT_SOURCES vpncsvc.c vpncsvc.h)
if(WIN32)
set(VPNCLIENT_SOURCES ${VPNCLIENT_SOURCES} vpnclient.rc)
endif()
add_executable(vpnclient ${VPNCLIENT_SOURCES})
set_target_properties(vpnclient
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnclient"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnclient"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnclient"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpnclient cedar mayaqua)
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnclient
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnclient" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnclient/vpnclient")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnclient.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service
COMPONENT "vpnclient"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -1,10 +1,33 @@
add_executable(vpncmd vpncmd.c)
set(VPNCMD_SOURCES vpncmd.c)
if(WIN32)
set(VPNCMD_SOURCES ${VPNCMD_SOURCES} vpncmd.rc)
endif()
add_executable(vpncmd ${VPNCMD_SOURCES})
set_target_properties(vpncmd
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpncmd"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpncmd"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpncmd"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpncmd cedar mayaqua)
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script
install(TARGETS vpncmd
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpncmd" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpncmd/vpncmd")
endif()

View File

@ -0,0 +1,22 @@
if(NOT WIN32)
message(FATAL_ERROR "VPN Client Manager is available only for Windows.")
endif()
set(VPNCMGR_SOURCES vpncmgr.c vpncmgr.rc)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNCMGR_SOURCES ${VPNCMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNCMGR_SOURCES ${VPNCMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
add_executable(vpncmgr WIN32 ${VPNCMGR_SOURCES})
set_target_properties(vpncmgr
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpncmgr cedar mayaqua)

View File

@ -1,10 +1,41 @@
add_executable(vpnserver vpnserver.c)
set(VPNSERVER_SOURCES vpnserver.c)
if(WIN32)
set(VPNSERVER_SOURCES ${VPNSERVER_SOURCES} vpnserver.rc)
endif()
add_executable(vpnserver ${VPNSERVER_SOURCES})
set_target_properties(vpnserver
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnserver"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnserver"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpnserver"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpnserver cedar mayaqua)
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnserver
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnserver" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnserver/vpnserver")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnserver.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service
COMPONENT "vpnserver"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -0,0 +1,22 @@
if(NOT WIN32)
message(FATAL_ERROR "VPN Server Manager is available only for Windows.")
endif()
set(VPNSMGR_SOURCES vpnsmgr.c vpnsmgr.rc)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNSMGR_SOURCES ${VPNSMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNSMGR_SOURCES ${VPNSMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
add_executable(vpnsmgr WIN32 ${VPNSMGR_SOURCES})
set_target_properties(vpnsmgr
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpnsmgr cedar mayaqua)

View File

@ -1,10 +1,20 @@
add_executable(vpntest vpntest.c vpntest.h)
set(VPNTEST_SOURCES vpntest.c vpntest.h)
if(WIN32)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNTEST_SOURCES ${VPNTEST_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNTEST_SOURCES ${VPNTEST_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
endif()
add_executable(vpntest ${VPNTEST_SOURCES})
set_target_properties(vpntest
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpntest"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpntest"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}/vpntest"
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpntest cedar mayaqua)

View File

@ -101,11 +101,12 @@ TEST_LIST test_list[] =
};
// Test function
void TestMain(char *cmd)
int TestMain(char *cmd)
{
char tmp[MAX_SIZE];
bool first = true;
bool exit_now = false;
int status = 0;
Print("SoftEther VPN Project\n");
Print("vpntest: VPN Server / VPN Client / VPN Bridge test program\n");
@ -204,6 +205,7 @@ void TestMain(char *cmd)
}
if (b == false)
{
status = 2;
Print("Invalid Command: %s\n\n", cmd);
}
}
@ -216,6 +218,7 @@ void TestMain(char *cmd)
}
}
Print("Exiting...\n\n");
return status;
}
// Main function
@ -225,6 +228,7 @@ int main(int argc, char *argv[])
UINT i;
char cmd[MAX_SIZE];
char *s;
int status = 0;
InitProcessCallOnce();
@ -252,10 +256,10 @@ int main(int argc, char *argv[])
EnableProbe(true);
InitCedar();
SetHamMode();
TestMain(cmdline);
status = TestMain(cmdline);
FreeCedar();
FreeMayaqua();
return 0;
return status;
}

View File

@ -1,13 +1,13 @@
[Unit]
Description=SoftEther VPN Bridge
After=network.target auditd.service
ConditionPathExists=![DIRECTORY]/do_not_run
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/do_not_run
[Service]
Type=forking
EnvironmentFile=-[DIRECTORY]
ExecStart=[BINARY] start
ExecStop=[BINARY] stop
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/vpnbridge start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/vpnbridge stop
KillMode=process
Restart=on-failure
@ -16,7 +16,7 @@ PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-[DIRECTORY]
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]

View File

@ -1,13 +1,13 @@
[Unit]
Description=SoftEther VPN Client
After=network.target auditd.service
ConditionPathExists=![DIRECTORY]/do_not_run
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/do_not_run
[Service]
Type=forking
EnvironmentFile=-[DIRECTORY]
ExecStart=[BINARY] start
ExecStop=[BINARY] stop
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/vpnclient start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/vpnclient stop
KillMode=process
Restart=on-failure
@ -16,7 +16,7 @@ PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-[DIRECTORY]
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]

View File

@ -1,13 +1,13 @@
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=![DIRECTORY]/do_not_run
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-[DIRECTORY]
ExecStart=[BINARY] start
ExecStop=[BINARY] stop
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/vpnserver start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
@ -16,7 +16,7 @@ PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-[DIRECTORY]
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]