diff options
Diffstat (limited to 'libssh')
| -rw-r--r-- | libssh/CMakeLists.txt | 38 | ||||
| -rw-r--r-- | libssh/channels.c | 2 | ||||
| -rw-r--r-- | libssh/libssh.def | 208 | ||||
| -rw-r--r-- | libssh/libssh.map | 215 | ||||
| -rw-r--r-- | libssh/scp.c | 13 | ||||
| -rw-r--r-- | libssh/session.c | 5 |
6 files changed, 27 insertions, 454 deletions
diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt index fa8eb413..9274f6f3 100644 --- a/libssh/CMakeLists.txt +++ b/libssh/CMakeLists.txt @@ -73,6 +73,9 @@ if (GCRYPT_LIBRARY) ) endif (GCRYPT_LIBRARY) +if (WITH_VISIBILITY_HIDDEN) + set(LIBSSH_SHARED_CFLAGS "-fvisibility=hidden") +endif (WITH_VISIBILITY_HIDDEN) set(libssh_SRCS agent.c @@ -104,7 +107,6 @@ set(libssh_SRCS socket.c string.c wrapper.c - libssh.map ) if (WITH_SFTP) @@ -136,13 +138,6 @@ if (WITH_SERVER) ) endif (WITH_SERVER) -if (MSVC) - set(libssh_SRCS - ${libssh_SRCS} - libssh.def - ) -endif (MSVC) - include_directories( ${LIBSSH_PUBLIC_INCLUDE_DIRS} ${LIBSSH_PRIVATE_INCLUDE_DIRS} @@ -161,31 +156,24 @@ set_target_properties( ${LIBRARY_SOVERSION} OUTPUT_NAME ssh + DEFINE_SYMBOL + LIBSSH_EXPORTS + COMPILE_FLAGS + ${LIBSSH_SHARED_CFLAGS} ) -if (UNIX AND CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - set_target_properties( - ${LIBSSH_SHARED_LIBRARY} - PROPERTIES - LINK_FLAGS - -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libssh.map -) -endif (UNIX AND CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - install( TARGETS ${LIBSSH_SHARED_LIBRARY} - DESTINATION - ${LIB_INSTALL_DIR} - COMPONENT - libraries + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + COMPONENT libraries ) if (WITH_STATIC_LIB) add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS}) - target_link_libraries(${LIBSSH_STATIC_LIBRARY} ${LIBSSH_LINK_LIBRARIES}) - set_target_properties( ${LIBSSH_STATIC_LIBRARY} PROPERTIES @@ -193,8 +181,8 @@ if (WITH_STATIC_LIB) ${LIBRARY_VERSION} SOVERSION ${LIBRARY_SOVERSION} - OUTPUT_NAME - ssh + COMPILE_FLAGS + "-DLIBSSH_STATIC" ) install( diff --git a/libssh/channels.c b/libssh/channels.c index c603d7ab..c006d248 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -1335,6 +1335,7 @@ error: return rc; } +#ifndef _WIN32 /** * @brief Accept an X11 forwarding channel. * @@ -1372,6 +1373,7 @@ ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms) { return NULL; } +#endif /** * @brief Set environement variables. diff --git a/libssh/libssh.def b/libssh/libssh.def deleted file mode 100644 index 7b0ea799..00000000 --- a/libssh/libssh.def +++ /dev/null @@ -1,208 +0,0 @@ -LIBRARY libssh -EXPORTS -buffer_free -buffer_get -buffer_get_len -buffer_new -channel_change_pty_size -channel_close -channel_free -channel_get_exit_status -channel_get_session -channel_is_closed -channel_is_eof -channel_is_open -channel_new -channel_open_forward -channel_open_session -channel_poll -channel_read -channel_read_buffer -channel_read_nonblocking -channel_request_env -channel_request_exec -channel_request_pty -channel_request_pty_size -channel_request_sftp -channel_request_shell -channel_request_subsystem -channel_request_x11 -channel_accept_x11 -channel_select -channel_send_eof -channel_set_blocking -channel_write -channel_write_stderr -privatekey_free -privatekey_from_file -publickey_free -publickey_from_file -publickey_from_privatekey -publickey_to_string -sftp_async_read -sftp_async_read_begin -sftp_attributes_free -sftp_canonicalize_path -sftp_chmod -sftp_chown -sftp_close -sftp_closedir -sftp_dir_eof -sftp_extensions_get_count -sftp_extensions_get_data -sftp_extensions_get_name -sftp_file_set_blocking -sftp_file_set_nonblocking -sftp_free -sftp_fstat -sftp_get_error -sftp_init -sftp_lstat -sftp_mkdir -sftp_new -sftp_open -sftp_opendir -sftp_read -sftp_readdir -sftp_readlink -sftp_rename -sftp_rewind -sftp_rmdir -sftp_seek -sftp_seek64 -sftp_server_init -sftp_server_new -sftp_server_version -sftp_setstat -sftp_stat -sftp_symlink -sftp_tell -sftp_tell64 -sftp_unlink -sftp_utimes -sftp_write -ssh_accept -ssh_auth_list -ssh_bind_accept -ssh_bind_fd_toaccept -ssh_bind_free -ssh_bind_get_fd -ssh_bind_listen -ssh_bind_new -ssh_bind_set_blocking -ssh_bind_set_fd -ssh_bind_set_options -ssh_clean_pubkey_hash -ssh_connect -ssh_copyright -ssh_disconnect -ssh_finalize -ssh_get_disconnect_message -ssh_get_error -ssh_get_error_code -ssh_get_fd -ssh_get_hexa -ssh_get_issue_banner -ssh_get_openssh_version -ssh_get_pubkey -ssh_get_pubkey_hash -ssh_get_random -ssh_get_status -ssh_get_version -ssh_init -ssh_is_server_known -ssh_log -ssh_message_auth_password -ssh_message_auth_publickey -ssh_message_auth_reply_pk_ok -ssh_message_auth_reply_success -ssh_message_auth_set_methods -ssh_message_auth_user -ssh_message_channel_request_channel -ssh_message_channel_request_command -ssh_message_channel_request_env_name -ssh_message_channel_request_env_value -ssh_message_channel_request_open_destination -ssh_message_channel_request_open_destination_port -ssh_message_channel_request_open_originator -ssh_message_channel_request_open_originator_port -ssh_message_channel_request_open_reply_accept -ssh_message_channel_request_pty_height -ssh_message_channel_request_pty_pxheight -ssh_message_channel_request_pty_pxwidth -ssh_message_channel_request_pty_term -ssh_message_channel_request_pty_width -ssh_message_channel_request_reply_success -ssh_message_channel_request_subsystem -ssh_message_free -ssh_message_get -ssh_message_reply_default -ssh_message_retrieve -ssh_message_service_reply_success -ssh_message_service_service -ssh_message_subtype -ssh_message_type -ssh_new -ssh_options_allow_ssh1 -ssh_options_allow_ssh2 -ssh_options_copy -ssh_options_free -ssh_options_getopt -ssh_options_new -ssh_options_set_auth_callback -ssh_options_set_banner -ssh_options_set_bind -ssh_options_set_dsa_server_key -ssh_options_set_fd -ssh_options_set_host -ssh_options_set_identity -ssh_options_set_known_hosts_file -ssh_options_set_log_function -ssh_options_set_log_verbosity -ssh_options_set_port -ssh_options_set_rsa_server_key -ssh_options_set_ssh_dir -ssh_options_set_status_callback -ssh_options_set_timeout -ssh_options_set_username -ssh_options_set_wanted_algos -ssh_print_hexa -ssh_scp_close -ssh_scp_free -ssh_scp_init -ssh_scp_new -ssh_scp_push_file -ssh_scp_write -ssh_select -ssh_service_request -ssh_set_blocking -ssh_set_fd_except -ssh_set_fd_toread -ssh_set_fd_towrite -ssh_set_message_callback -ssh_set_options -ssh_silent_disconnect -ssh_userauth_agent_pubkey -ssh_userauth_autopubkey -ssh_userauth_kbdint -ssh_userauth_kbdint_getinstruction -ssh_userauth_kbdint_getname -ssh_userauth_kbdint_getnprompts -ssh_userauth_kbdint_getprompt -ssh_userauth_kbdint_setanswer -ssh_userauth_list -ssh_userauth_none -ssh_userauth_offer_pubkey -ssh_userauth_password -ssh_userauth_pubkey -ssh_version -ssh_write_knownhost -string_burn -string_copy -string_data -string_fill -string_free -string_from_char -string_len -string_new -string_to_char diff --git a/libssh/libssh.map b/libssh/libssh.map deleted file mode 100644 index 26e2fb11..00000000 --- a/libssh/libssh.map +++ /dev/null @@ -1,215 +0,0 @@ -SSH_0.3 { - global: - buffer_free; - buffer_get; - buffer_get_len; - buffer_new; - channel_change_pty_size; - channel_close; - channel_free; - channel_get_exit_status; - channel_get_session; - channel_is_closed; - channel_is_eof; - channel_is_open; - channel_new; - channel_open_forward; - channel_open_session; - channel_poll; - channel_read; - channel_read_buffer; - channel_read_nonblocking; - channel_request_env; - channel_request_exec; - channel_request_pty; - channel_request_pty_size; - channel_request_sftp; - channel_request_shell; - channel_request_subsystem; - channel_select; - channel_send_eof; - channel_set_blocking; - channel_write; - privatekey_free; - privatekey_from_file; - publickey_free; - publickey_from_file; - publickey_from_privatekey; - publickey_to_string; - sftp_async_read; - sftp_async_read_begin; - sftp_attributes_free; - sftp_canonicalize_path; - sftp_chmod; - sftp_chown; - sftp_close; - sftp_closedir; - sftp_dir_eof; - sftp_file_set_blocking; - sftp_file_set_nonblocking; - sftp_free; - sftp_fstat; - sftp_get_error; - sftp_init; - sftp_lstat; - sftp_mkdir; - sftp_new; - sftp_open; - sftp_opendir; - sftp_read; - sftp_readdir; - sftp_readlink; - sftp_rename; - sftp_rewind; - sftp_rmdir; - sftp_seek; - sftp_seek64; - sftp_server_init; - sftp_server_new; - sftp_server_version; - sftp_setstat; - sftp_stat; - sftp_symlink; - sftp_tell; - sftp_tell64; - sftp_unlink; - sftp_utimes; - sftp_write; - ssh_accept; - ssh_auth_list; - ssh_bind_accept; - ssh_bind_fd_toaccept; - ssh_bind_free; - ssh_bind_get_fd; - ssh_bind_listen; - ssh_bind_new; - ssh_bind_set_blocking; - ssh_bind_set_fd; - ssh_bind_set_options; - ssh_clean_pubkey_hash; - ssh_connect; - ssh_copyright; - ssh_disconnect; - ssh_finalize; - ssh_get_disconnect_message; - ssh_get_error; - ssh_get_error_code; - ssh_get_fd; - ssh_get_hexa; - ssh_get_issue_banner; - ssh_get_openssh_version; - ssh_get_pubkey; - ssh_get_pubkey_hash; - ssh_get_random; - ssh_get_status; - ssh_get_version; - ssh_init; - ssh_is_server_known; - ssh_log; - ssh_message_auth_password; - ssh_message_auth_publickey; - ssh_message_auth_reply_pk_ok; - ssh_message_auth_reply_success; - ssh_message_auth_set_methods; - ssh_message_auth_user; - ssh_message_channel_request_open_reply_accept; - ssh_message_channel_request_reply_success; - ssh_message_free; - ssh_message_get; - ssh_message_reply_default; - ssh_message_retrieve; - ssh_message_service_reply_success; - ssh_message_service_service; - ssh_message_subtype; - ssh_message_type; - ssh_new; - ssh_options_allow_ssh1; - ssh_options_allow_ssh2; - ssh_options_copy; - ssh_options_free; - ssh_options_getopt; - ssh_options_new; - ssh_options_set_auth_callback; - ssh_options_set_banner; - ssh_options_set_bind; - ssh_options_set_dsa_server_key; - ssh_options_set_fd; - ssh_options_set_host; - ssh_options_set_identity; - ssh_options_set_known_hosts_file; - ssh_options_set_log_function; - ssh_options_set_log_verbosity; - ssh_options_set_port; - ssh_options_set_rsa_server_key; - ssh_options_set_ssh_dir; - ssh_options_set_status_callback; - ssh_options_set_timeout; - ssh_options_set_username; - ssh_options_set_wanted_algos; - ssh_print_hexa; - ssh_select; - ssh_service_request; - ssh_set_blocking; - ssh_set_fd_except; - ssh_set_fd_toread; - ssh_set_fd_towrite; - ssh_set_options; - ssh_silent_disconnect; - ssh_userauth_agent_pubkey; - ssh_userauth_autopubkey; - ssh_userauth_kbdint; - ssh_userauth_kbdint_getinstruction; - ssh_userauth_kbdint_getname; - ssh_userauth_kbdint_getnprompts; - ssh_userauth_kbdint_getprompt; - ssh_userauth_kbdint_setanswer; - ssh_userauth_list; - ssh_userauth_none; - ssh_userauth_offer_pubkey; - ssh_userauth_password; - ssh_userauth_pubkey; - ssh_version; - ssh_write_knownhost; - string_burn; - string_copy; - string_data; - string_fill; - string_free; - string_from_char; - string_len; - string_new; - string_to_char; - local: - *; -}; - -SSH_0.4 { - global: - channel_write_stderr; - channel_request_x11; - channel_accept_x11; - ssh_scp_close; - ssh_scp_free; - ssh_scp_init; - ssh_scp_new; - ssh_scp_push_file; - ssh_scp_write; - sftp_extensions_get_count; - sftp_extensions_get_data; - sftp_extensions_get_name; - ssh_message_channel_request_channel; - ssh_message_channel_request_command; - ssh_message_channel_request_env_name; - ssh_message_channel_request_env_value; - ssh_message_channel_request_open_destination; - ssh_message_channel_request_open_destination_port; - ssh_message_channel_request_open_originator; - ssh_message_channel_request_open_originator_port; - ssh_message_channel_request_pty_height; - ssh_message_channel_request_pty_pxheight; - ssh_message_channel_request_pty_pxwidth; - ssh_message_channel_request_pty_term; - ssh_message_channel_request_pty_width; - ssh_message_channel_request_subsystem; - ssh_set_message_callback; -} SSH_0.3; diff --git a/libssh/scp.c b/libssh/scp.c index 878b6cb6..c0ebac08 100644 --- a/libssh/scp.c +++ b/libssh/scp.c @@ -43,9 +43,14 @@ ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location){ ssh_scp_free(scp); return NULL; } + scp->location=strdup(location); + if (scp->location == NULL) { + ssh_set_error(session,SSH_FATAL,"Error allocating memory for ssh_scp"); + ssh_scp_free(scp); + return NULL; + } scp->session=session; scp->mode=mode; - scp->location=strdup(location); scp->channel=NULL; scp->state=SSH_SCP_NEW; return scp; @@ -54,7 +59,7 @@ ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location){ int ssh_scp_init(ssh_scp scp){ int r; char execbuffer[1024]; - u_int8_t code; + uint8_t code; if(scp->state != SSH_SCP_NEW){ ssh_set_error(scp->session,SSH_FATAL,"ssh_scp_init called under invalid state"); return SSH_ERROR; @@ -126,7 +131,7 @@ void ssh_scp_free(ssh_scp scp){ int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, const char *perms){ char buffer[1024]; int r; - u_int8_t code; + uint8_t code; if(scp->state != SSH_SCP_WRITE_INITED){ ssh_set_error(scp->session,SSH_FATAL,"ssh_scp_push_file called under invalid state"); return SSH_ERROR; @@ -158,7 +163,7 @@ int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, const char int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len){ int w; //int r; - //u_int8_t code; + //uint8_t code; if(scp->state != SSH_SCP_WRITE_WRITING){ ssh_set_error(scp->session,SSH_FATAL,"ssh_scp_write called under invalid state"); return SSH_ERROR; diff --git a/libssh/session.c b/libssh/session.c index bc7c453f..e85bd5fb 100644 --- a/libssh/session.c +++ b/libssh/session.c @@ -97,8 +97,9 @@ void ssh_cleanup(SSH_SESSION *session) { SAFE_FREE(session->serverbanner); SAFE_FREE(session->clientbanner); SAFE_FREE(session->banner); - buffer_reinit(session->in_buffer); - buffer_reinit(session->out_buffer); + buffer_free(session->in_buffer); + buffer_free(session->out_buffer); + session->in_buffer=session->out_buffer=NULL; crypto_free(session->current_crypto); crypto_free(session->next_crypto); ssh_socket_free(session->socket); |
