From 62e2ce6286b2896a7cf496b2f58b883fc1864da1 Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Thu, 11 Jul 2019 11:02:23 +0800 Subject: [PATCH] change nullptr to NULL to build on CentOS7. --- server/tp_core/testssh/CMakeLists.txt | 23 ++--------------------- server/tp_core/testssh/testssh.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/server/tp_core/testssh/CMakeLists.txt b/server/tp_core/testssh/CMakeLists.txt index b20b34b..4a23a43 100644 --- a/server/tp_core/testssh/CMakeLists.txt +++ b/server/tp_core/testssh/CMakeLists.txt @@ -3,34 +3,15 @@ cmake_minimum_required(VERSION 3.5) MESSAGE(STATUS "=======================================================") MESSAGE(STATUS " testssh") MESSAGE(STATUS "=======================================================") -#MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}") -#MESSAGE(STATUS "current source directory is ${CMAKE_CURRENT_SOURCE_DIR}") include(../../../CMakeCfg.txt) -# ADD_DEFINITIONS( -# -DMG_ENABLE_THREADS -# -DMG_DISABLE_HTTP_DIGEST_AUTH -# -DMG_DISABLE_MQTT -# -DMG_DISABLE_SSI -# # -DMG_DISABLE_FILESYSTEM -# -DHAVE_CONFIG_H -# # -DCS_COMMON_MD5_H_ -# -DCS_DISABLE_MD5 -# ) - aux_source_directory(. DIR_SRCS) aux_source_directory(../../../common/libex/src DIR_SRCS) -# aux_source_directory(../../../external/mongoose DIR_SRCS) -# aux_source_directory(../../../external/jsoncpp/src/lib_json DIR_SRCS) -# list(REMOVE_ITEM DIR_SSH_SRCS "./dllmain.cpp") list(REMOVE_ITEM DIR_SRCS "./stdafx.cpp") include_directories( ../../../common/libex/include -# ../../../common/teleport -# ../../../external/mongoose -# ../../../external/jsoncpp/include ) include_directories( @@ -43,7 +24,7 @@ add_executable(testssh ${DIR_SRCS}) if (OS_LINUX) set(CMAKE_EXE_LINKER_FLAGS "-export-dynamic") - target_link_libraries(testssh ssh ssl crypto mbedx509 mbedtls mbedcrypto dl pthread rt util) + target_link_libraries(testssh ssh ssl crypto dl pthread rt util) elseif (OS_MACOS) - target_link_libraries(testssh ssh ssl crypto mbedx509 mbedtls mbedcrypto dl pthread util) + target_link_libraries(testssh ssh ssl crypto dl pthread util) endif () diff --git a/server/tp_core/testssh/testssh.cpp b/server/tp_core/testssh/testssh.cpp index 9e2f3ec..4d8c8a4 100644 --- a/server/tp_core/testssh/testssh.cpp +++ b/server/tp_core/testssh/testssh.cpp @@ -73,7 +73,7 @@ int main(int argc, char** argv) // get banner. const char* banner = ssh_get_issue_banner(sess); - if (banner != nullptr) { + if (banner != NULL) { printf("[INFO] server issue banner: %s\n", banner); } @@ -84,7 +84,7 @@ int main(int argc, char** argv) // first try interactive login mode if server allow. if (!ok && (auth_methods & SSH_AUTH_METHOD_INTERACTIVE) == SSH_AUTH_METHOD_INTERACTIVE) { retry_count = 0; - rc = ssh_userauth_kbdint(sess, nullptr, nullptr); + rc = ssh_userauth_kbdint(sess, NULL, NULL); for (;;) { if (rc == SSH_AUTH_SUCCESS) { ok = true; @@ -97,7 +97,7 @@ int main(int argc, char** argv) break; ex_sleep_ms(500); // Sleep(500); - rc = ssh_userauth_kbdint(sess, nullptr, nullptr); + rc = ssh_userauth_kbdint(sess, NULL, NULL); continue; } @@ -106,7 +106,7 @@ int main(int argc, char** argv) int nprompts = ssh_userauth_kbdint_getnprompts(sess); if (0 == nprompts) { - rc = ssh_userauth_kbdint(sess, nullptr, nullptr); + rc = ssh_userauth_kbdint(sess, NULL, NULL); continue; } @@ -123,14 +123,14 @@ int main(int argc, char** argv) } } - rc = ssh_userauth_kbdint(sess, nullptr, nullptr); + rc = ssh_userauth_kbdint(sess, NULL, NULL); } } // and then try password login mode if server allow. if (!ok && (auth_methods & SSH_AUTH_METHOD_PASSWORD) == SSH_AUTH_METHOD_PASSWORD) { retry_count = 0; - rc = ssh_userauth_password(sess, nullptr, password); + rc = ssh_userauth_password(sess, NULL, password); for (;;) { if (rc == SSH_AUTH_AGAIN) { retry_count += 1; @@ -138,7 +138,7 @@ int main(int argc, char** argv) break; ex_sleep_ms(100); // Sleep(100); - rc = ssh_userauth_password(sess, nullptr, password); + rc = ssh_userauth_password(sess, NULL, password); continue; } if (rc == SSH_AUTH_SUCCESS) {