change nullptr to NULL to build on CentOS7.

pull/173/head
Apex Liu 2019-07-11 11:02:23 +08:00
parent 08b682192e
commit 62e2ce6286
2 changed files with 9 additions and 28 deletions

View File

@ -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 ()

View File

@ -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) {