summaryrefslogtreecommitdiff
path: root/libguile-ssh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libguile-ssh: Fix building with libssh 0.8HEADmasterArtyom V. Poptsov2018-10-011-1/+6
| | | | | | | | | | | | | The 'libguile-ssh' library would fail to build due to missing 'libssh_threads' library that was removed libssh 0.8. This patch fixes that. Reported by lantw44 in <https://github.com/artyom-poptsov/guile-ssh/issues/9> * configure.ac: Add check for libssh 0.8 * libguile-ssh/Makefile.am: Don't use 'libssh_threads' library when building with libssh 0.8+. * NEWS: Update.
* libguile-ssh/channel-type.c (ptob_close): Bugfix: fix a segfaultArtyom V. Poptsov2018-08-073-1/+33
| | | | | | | | | | | | | | | 'ptob_close' would always get a segfault when it tried to free a closed channel. This patch fixes that by adding a check if a channel is already closed. Reported by Michael Bowcutt <mbowcutt@case.edu> in <https://github.com/artyom-poptsov/guile-ssh/issues/8> and Njagi Mwaniki in a personal email. * libguile-ssh/channel-type.c (ptob_close): Check if a channel is already closed before trying to close and free it. Improve logging. * libguile-ssh/log.c (_gssh_log_debug, _gssh_log_debug1): New procedures * libguile-ssh/log.h: Likewise.
* libguile-ssh: Always reset the channel and sftp streams when closing ports.Ludovic Courtès2017-06-162-2/+4
| | | | | | | | | | See <https://bugs.gnu.org/26976>. * libguile-ssh/channel-type.c (ptob_close): Move SCM_SETSTREAM(channel, NULL) outside of "#if USING_GUILE_BEFORE_2_2". * libguile-ssh/sftp-file-type.c (ptob_close): Likewise. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* session-func.c (guile_ssh_session_set): Throw an option with its valueArtyom V. Poptsov2017-06-041-2/+4
| | | | | * libguile-ssh/session-func.c (guile_ssh_session_set): Throw an option along with its value on an error.
* libguile-ssh/error.c: Add missing includesArtyom V. Poptsov2017-06-041-0/+1
|
* libguile-ssh/log.h: Add missing includes; use ifndefArtyom V. Poptsov2017-06-041-0/+7
|
* channel-func.c (guile_ssh_channel_open_forward): Log warningsArtyom V. Poptsov2017-05-231-1/+8
| | | | | | | * libguile-ssh/channel-func.c (guile_ssh_channel_open_forward): Log a warning if a forwarding channel could not be open. * tests/tunnel.scm ("port forwarding, direct, disconnected session"): New test case.
* channel-type.c (print_channel): Add a check for Guile 2.2Artyom V. Poptsov2017-05-222-0/+15
| | | | | | * libguile-ssh/channel-type.c (print_channel): Don't use 'SCM_PTAB_ENTRY' macro if Guile 2.2 is used. * libguile-ssh/channel-type.h (GSSH_VALIDATE_CHANNEL_DATA): Likewise.
* channel-func.c (guile_ssh_channel_get_exit_status): Handle freed channelsArtyom V. Poptsov2017-05-222-1/+4
| | | | | | | | | | | | | | * libguile-ssh/channel-func.c (guile_ssh_channel_get_exit_status): Throw 'wrong-type-arg' if a freed channel is passed as an argument. * libguile-ssh/channel-type.h (GSSH_VALIDATE_OPEN_CHANNEL): Check if a channel is freed. * tests/client-server.scm ("channel-get-exit-status, freed channel"): New test case. * tests/common.scm (test-error-with-log/=): Check error key and message properly. (test-error-with-log): Check an error key. (test-error-with-log/handler): Remove extra rules. * NEWS: Update.
* channel-type.c (print_channel): Bugfix: Handle freed channelsArtyom V. Poptsov2017-05-211-11/+17
| | | | | | | | | | | | Guile-SSH would always crash with SIGSEGV errors when tried to print a freed channel object (e.g. after calling 'close' on a channel). This patch fixes the bug. * libguile-ssh/channel-type.c (print_channel): Bugfix: Handle freed channels properly. * tests/client-server.scm ("channel-request-exec, printing a freed channel"): New test case. * NEWS: Update.
* log.c (_gssh_log_warning): New procedureArtyom V. Poptsov2017-05-213-0/+24
| | | | | | | * libguile-ssh/log.c (_gssh_log_warning): New procedure. * libguile-ssh/log.h: Likewise. * libguile-ssh/channel-func.c (guile_ssh_channel_get_exit_status): Issue a warning if 'ssh_channel_get_exit_status' failed to get the exit status.
* log.c (_gssh_log_error): New procedureArtyom V. Poptsov2017-05-213-10/+22
| | | | | | * libguile-ssh/log.c (_gssh_log_error): New procedure. * libguile-ssh/log.h: Likewise. * libguile-ssh/error.c (guile_ssh_error1): Use it.
* build: Generate and use libguile-ssh/config.h.Ludovic Courtès2017-04-3026-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other things, this allows us to work around broken guile-snarf handling of whitespace arguments in Guile 2.2.1: <https://bugs.gnu.org/25803>. * configure.ac: Use 'AC_CONFIG_HEADER'. * libguile-ssh/auth.c, libguile-ssh/channel-func.c, libguile-ssh/channel-main.c, libguile-ssh/channel-type.c, libguile-ssh/common.c, libguile-ssh/error.c, libguile-ssh/key-func.c, libguile-ssh/key-main.c, libguile-ssh/key-type.c, libguile-ssh/log.c, libguile-ssh/message-func.c, libguile-ssh/message-main.c, libguile-ssh/message-type.c, libguile-ssh/server-func.c, libguile-ssh/server-main.c, libguile-ssh/server-type.c, libguile-ssh/session-func.c, libguile-ssh/session-main.c, libguile-ssh/session-type.c, libguile-ssh/sftp-file-main.c, libguile-ssh/sftp-file-type.c, libguile-ssh/sftp-session-func.c, libguile-ssh/sftp-session-main.c, libguile-ssh/sftp-session-type.c, libguile-ssh/threads.c, libguile-ssh/version.c: Include <config.h>. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh: Adjust port code to Guile 2.2.Ludovic Courtès2017-04-233-52/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports Guile-SSH to the port API found in Guile 2.2. * libguile-ssh/common.h (USING_GUILE_BEFORE_2_2): New macro. * libguile-ssh/channel-type.c (channel_tag) [!USING_GUILE_BEFORE_2_2]: New definition. (read_from_channel_port, write_to_channel_port): New functions. (ptob_close): Add #if USING_GUILE_BEFORE_2_2. (guile_ssh_is_channel_p): Likewise. (equalp_channel): Condition on USING_GUILE_BEFORE_2_2. (_scm_from_channel_data): Add #if USING_GUILE_BEFORE_2_2. (_scm_to_channel_data): Likewise. (init_channel_type): Likewise. * libguile-ssh/sftp-file-type.c (sftp_file_tag) [!USING_GUILE_BEFORE_2_2]: New defintion. (read_from_sftp_file_port, write_to_sftp_file_port): New functions. (equalp_sftp_file): Condition on USING_GUILE_BEFORE_2_2. (print_sftp_file): Use 'scm_port_filename' instead of 'SCM_FILENAME'. (ptob_flush): Condition on USING_GUILE_BEFORE_2_2. (ptob_close, ptob_seek): Add #if USING_GUILE_BEFORE_2_2. (gssh_sftp_file_p): Likewise. (_scm_to_sftp_file_data, _scm_from_sftp_file): Likewise. (init_sftp_file_type): Likewise. * configure.ac: Request "2.2" before "2.0" in 'GUILE_PKG'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/sftp-file-type.c: Remove 'mark' and 'free' procedures.Ludovic Courtès2017-04-231-15/+0
| | | | | | | | | | | | | The mark function was unnecessary given that 'sftp_file_data' is allocated with 'scm_gc_malloc' and thus scanned by the GC. The free function was already a no-op. * libguile-ssh/sftp-file-type.c (mark_sftp_file): Remove. (free_sftp_file): Remove. (init_sftp_file_type): Remove call to 'scm_set_port_mark' and to 'scm_set_port_free'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/sftp-file-type.c (sftp_file_tag): Make 'static'.Ludovic Courtès2017-04-232-3/+1
| | | | | | | * libguile-ssh/sftp-file-type.c (sftp_file_tag): Make 'static'. * libguile-ssh/sftp-file-type.h (sftp_file_tag): Remove. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/channel-type.c: Remove 'mark' and 'free' procedures.Ludovic Courtès2017-04-231-15/+0
| | | | | | | | | | | | The mark function was unnecessary given that 'channel_data' is allocated with 'scm_gc_malloc' and thus scanned by the GC. The free function was already a no-op. * libguile-ssh/channel-type.c (mark_channel, free_channel): Remove. (init_channel_type): Remove call to 'scm_set_port_mark' and to 'scm_set_port_free'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/channel-type.c (channel_tag): Make 'static'.Ludovic Courtès2017-04-232-3/+1
| | | | | | | * libguile-ssh/channel-type.c (channel_tag): Make 'static' * libguile-ssh/channel-type.h (channel_tag): Remove. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* error.c (guile_ssh_error1): Print errors to the libssh logArtyom V. Poptsov2017-01-041-1/+11
| | | | * libguile-ssh/error.c (guile_ssh_error1): Print errors to the libssh log.
* sftp-file-type.c (ptob_close): Add missing 'return' statementArtyom V. Poptsov2016-11-201-1/+3
| | | | * libguile-ssh/sftp-file-type.c (ptob_close): Add missing 'return' statement.
* sftp-session-type.c (print_sftp_session): Add missing 'return' statementArtyom V. Poptsov2016-11-201-1/+2
| | | | | * libguile-ssh/sftp-session-type.c (print_sftp_session): Add missing 'return' statement.
* session-func.c (guile_ssh_session_get): Fix warningsArtyom V. Poptsov2016-11-061-2/+2
| | | | | * libguile-ssh/session-func.c (guile_ssh_session_get): Fix warnings: initialize variables with default values.
* channel-func.c (_ssh_result_to_symbol): Add assertion, fix warningArtyom V. Poptsov2016-11-061-0/+8
| | | | | | * libguile-ssh/channel-func.c (_ssh_result_to_symbol): Assert that the argument is one of the libssh valid return codes. Fix warning related to missed 'return' statement.
* channel-func.c (guile_ssh_channel_get_stream): Fix a warningArtyom V. Poptsov2016-11-061-0/+2
| | | | | * libguile-ssh/channel-func.c (guile_ssh_channel_get_stream): Fix a warning due to missed 'return' statement at the end of non-void procedure.
* build: Build with '-Wall'.Ludovic Courtès2016-11-061-0/+1
| | | | | | | * configure.ac: Set and substitute 'WARN_CFLAGS'. * libguile-ssh/Makefile.am (AM_CFLAGS): New variable. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh: Remove unused variables.Ludovic Courtès2016-11-064-6/+0
| | | | | | | | | | | | * libguile-ssh/auth.c (guile_ssh_userauth_public_key_x): Remove 'public_key'. * libguile-ssh/message-func.c (get_auth_req): Remove 'pkey_smob' and 'pkey_data'. * libguile-ssh/session-type.c (print_session): Remove 'smob_addr'. * libguile-ssh/sftp-file-type.c (print_sftp_file): Remove 'attr'. (ptob_flush): Remove 'fd'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/server-func.c: Add missing 'const'.Ludovic Courtès2016-11-061-4/+4
| | | | | | | | | | This is a followup to e490ba5226cedf22eb8f9166b5ac9fb5486c65f8. * libguile-ssh/server-func.c (set_sym_opt) (guile_ssh_server_set_x, guile_ssh_server_get): 'const'-qualify 'opt' and 'sd'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* channel.scm: Remove trailing bang from 'channel-send-eof'.Ludovic Courtès2016-11-061-2/+2
| | | | | | | | | | | | | | | | | This procedure merely does I/O without mutating its argument, so it does not deserve the trailing '!' (similar to Scheme's 'write', 'put-bytevector', etc. procedures). * libguile-ssh/channel-func.c (gssh_channel_send_eof_x): Rename to... (gssh_channel_send_eof): ... this. Change Scheme name to '%channel-send-eof'. Adjust caller. * modules/ssh/channel.scm (channel-send-eof!): Rename to... (channel-send-eof): ... this. * tests/client-server.scm ("channel-send-eof!"): Rename to... ("channel-send-eof"): ... this. Adjust accordingly. * doc/api-channels.texi (Channel Management): Adjust accordingly. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/key-type.c: Improve locality and constness.Ludovic Courtès2016-11-042-6/+4
| | | | | | | | * libguile-ssh/key-type.c (key_types): Mark as 'static const'. (mark_key_smob, free_key_smob, equalp_key): Mark as 'static'. * libguile-ssh/key-type.h (key_types): Remove declaration. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/common.h: 'const'-qualify pointers to 'symbol_mapping'.Ludovic Courtès2016-11-047-18/+18
| | | | | | | | | | | | | | | | | | | * libguile-ssh/common.h (_ssh_const_to_scm): Const-qualify 'types' parameter. (_scm_to_ssh_const): Likewise, and const-qualify return type. * libguile-ssh/common.c (_ssh_const_to_scm): (_scm_to_ssh_const): Adjust accordingly. * libguile-ssh/key-func.c (guile_ssh_string_to_public_key): Adjust accordingly. * libguile-ssh/key-type.c (_scm_to_ssh_key_type, guile_ssh_make_keypair): Likewise. * libguile-ssh/key-type.h (_scm_to_ssh_key_type): Likewise. * libguile-ssh/log.c (guile_ssh_write_log) (guile_ssh_set_log_verbosity_x): Likewise. * libguile-ssh/session-func.c (set_sym_opt): Likewise. (guile_ssh_session_set, guile_ssh_session_get): Likewise. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* libguile-ssh/key-type.c: Add mapping for ed25519 keys.Ludovic Courtès2016-11-041-0/+1
| | | | | | | * libguile-ssh/key-type.c (key_types): Add entry for 'SSH_KEYTYPE_ED25519'. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
* channel.scm (channel-send-eof!): New procedureArtyom V. Poptsov2016-10-301-0/+27
| | | | | | | | * modules/ssh/channel.scm (channel-send-eof!): New procedure. * libguile-ssh/channel-func.c (gssh_channel_send_eof_x): New procedure. * doc/api-channels.texi: Add description of 'channel-send-eof!'. * tests/client-server.scm ("channel-send-eof!"): New TC. * doc/version.texi, NEWS: Update.
* session-type.c (free_session): Improve a bitArtyom V. Poptsov2016-10-091-3/+3
| | | | * libguile-ssh/session-type.c (free_session): Use shorter argument names.
* libguile-ssh: Update some copyright datesArtyom V. Poptsov2016-10-093-3/+3
| | | | | * libguile-ssh/key-type.c, libguile-ssh/message-type.c, libguile-ssh/server-type.c: Update copyright dates.
* libguile-ssh: Bugfix: Fix SMOB freeing callbacksArtyom V. Poptsov2016-10-095-37/+12
| | | | | | | | | | | | | | | | | | The SMOB freeing callbacks would always fail to free any resources due to mistaken use of 'SCM_SMOB_PREDICATE' procedure -- the procedure doesn't work in these GC callbacks according to the documentation (see '(guile) Smobs') and always returns 'false' as the result when used in such context. The solution is to remove the check 'SCM_SMOB_PREDICATE' and just get the SMOB's data. Reported by: David Kastrup <dak@gnu.org> Reported by: Ludovic Courtès <ludo@gnu.org> * libguile-ssh/key-type.c, libguile-ssh/message-type.c, libguile-ssh/server-type.c, libguile-ssh/session-type.c, libguile-ssh/sftp-session-type.c: Bugfix: Fix SMOB freeing callbacks. * NEWS: Update.
* libguile-ssh: Bugfix: Check if smobs are already freedArtyom V. Poptsov2016-08-194-0/+20
| | | | | | | | * libguile-ssh/message-type.c (free_message): Bugfix: Check if the smob is already freed, don't try to free it once more. * libguile-ssh/server-type.c (free_server): Likewise. * libguile-ssh/session-type.c (free_session): Likewise. * libguile-ssh/sftp-session-type.c (free_sftp_session): Likewise.
* libguile-ssh/key-type.c (free_key_smob): Bugfix: Check smob typeArtyom V. Poptsov2016-08-191-1/+9
| | | | | | | | * libguile-ssh/key-type.c (free_key_smob): Bugfix: Check if the smob is already freed, don't try to free it once more. * tests/common.scm (test-begin-with-log): Set log verbosity to the highest level by default. * tests/key.scm: Perform test with logging.
* configure.ac: Check for libssh 0.7.3+Artyom V. Poptsov2016-02-251-0/+5
| | | | | | * configure.ac: Check for libssh 0.7.3+. * libguile-ssh/channel-func.c: Replace deprecated functions with new ones if libssh 0.7.3+ is used.
* log.c: Add missed includeArtyom V. Poptsov2016-02-241-0/+1
| | | | | * libguile-ssh/log.c: Include 'libssh/callbacks.h' where 'ssh_set_log_callback' procedure is declared.
* key-func.c: Add missed includeArtyom V. Poptsov2016-02-241-0/+1
| | | | | * libguile-ssh/key-func.c: Include 'error.h' header where 'guile_ssh_error1' is declared.
* channel-func.c: Add missed includeArtyom V. Poptsov2016-02-241-0/+1
| | | | | * libguile-ssh/channel-func.c: Include 'libssh/server.h' because it is needed for 'ssh_channel_request_send_exit_status' procedure.
* libguile-ssh: Add missed "threads.h" includeArtyom V. Poptsov2016-02-082-0/+2
| | | | | * libguile-ssh/sftp-file-main.c, libguile-ssh/sftp-session-main.c: Add missed "threads.h" include.
* libguile-ssh: Add missed "error.h" includeArtyom V. Poptsov2016-02-084-0/+4
| | | | | | * libguile-ssh/key-type.c, libguile-ssh/sftp-file-type.c, libguile-ssh/sftp-session-func.c, libguile-ssh/sftp-session-type.c: Add missed "error.h" include.
* Bugfix: Use regular procedures instead of non-static inlinesArtyom V. Poptsov2016-02-086-12/+12
| | | | | | | | | | | | | There are ill-defined non-static inlines that lead to linkage errors; it appears that these inlines are the root cause for errors that can be seen on Arch GNU/Linux. Replace them with regular procedures. Reported by: SaffronSnail in <https://github.com/artyom-poptsov/guile-ssh/issues/1> * libguile-ssh/common.c, libguile-ssh/common.h, libguile-ssh/error.c, libguile-ssh/error.h, libguile-ssh/key-func.h, libguile-ssh/key-type.c, libguile-ssh/key-type.h: Bugfix: Remove all non-static inlines; use regular procedures instead.
* key-func.h (public_key_to_ssh_string): RemoveArtyom V. Poptsov2016-02-081-3/+0
| | | | | * libguile-ssh/key-func.h (public_key_to_ssh_string): Remove the declaration because there function is not defined (and not used anywhere.)
* libguile-ssh/server-type.c: Add missed includeArtyom V. Poptsov2016-01-191-0/+1
| | | | * libguile-ssh/server-type.c: Add missed "common.h" include.
* libguile-ssh/Makefile.am: BugfixArtyom V. Poptsov2015-12-061-1/+1
| | | | | * libguile-ssh/Makefile.am (libguile_ssh_la_SOURCES): Bugfix: Remove unused 'sftp-session-main.h'.
* libguile-ssh/channel-type.c (print_channel): ImproveArtyom V. Poptsov2015-12-061-6/+3
| | | | | * libguile-ssh/channel-type.c (print_channel): Use 'scm_print_port_mode' procedure from Guile API so the mode will be printed right.
* libguile-ssh/channel-type.c (init_channel_type): Use 'scm_from_long'Artyom V. Poptsov2015-12-061-2/+2
|
* libguile-ssh/channel-type.c: Bugfix: Fix assertionArtyom V. Poptsov2015-12-061-3/+3
|