aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/priv.h
AgeCommit message (Collapse)AuthorFilesLines
6 daysDo not close socket passed through options on error conditionsHEADmasterJakub Jelen1-0/+1
Fixes: #244 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Sahana Prasad <sahana@redhat.com>
2024-03-06Issue #157: Use the current TTY's settings by default.Daniel Evers1-0/+8
When opening a PTY on the server, try to use the current TTY's settings (i.e. based on STDIN). If that fails or STDIN isn't a TTY, use default modes that avoid any character translation. Don't rely on stdin to be a TTY (breaks CI). Instead, open a PTY and temporarily use that as "fake" stdin. Signed-off-by: Daniel Evers (daniel.evers@utimaco.com) Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2023-07-11priv.h : Add compatibility code for WindowsEshan Kelkar1-0/+14
Compatibility code for mapping open, read, write, close and unlink to _open, _read, _write, _close and _unlink respectively on Windows was repeated in a lot of .c files. This commit adds that compatibility code to include/libssh/priv.h and removes it from the .c files (while ensuring that those .c files include priv.h) so that the compatibility code stays in one place, can be maintained easily and can be added easily to another source file by including priv.h in that file. Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-11-02Add external c declaration for c++Norbert Pocs1-0/+8
To make sure c++ name mangling works correctly c code should be noted "extern" Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-08-25misc: rename gettimeofday symbolTimo Rothenpieler1-1/+3
mingw does have this function, even though it appears to be deprecated. So the symbol has to have a different name, or linking becomes impossible. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-07-04Add constant SSH_ERRNO_MSG_MAXNorbert Pocs1-0/+1
Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-07-04Add ssh_strerror functionNorbert Pocs1-0/+2
- strerror_r for linux - strerror_s for windows Keep in mind that strerror_r has two versions: - XSI - GNU see manpage for more information Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-06-15Fix type mismatch warningsNorbert Pocs1-1/+1
Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2021-06-10windows: Define PATH_MAX to MAX_PATHXiang Xiao1-1/+5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Change-Id: Ib3358ecb029d93c263d3cb39da25e82a772ae2c7
2021-05-27Replace the hardcode max path length with PATH_MAXXiang Xiao1-0/+5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Change-Id: Icb1d36b48a759ec11dbaa4c09a39037a80ab0f85
2020-09-29priv.h: Fix typo in comment; “cound” → “count”Paul Capron1-1/+1
Signed-off-by: Paul Capron <paul@fragara.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2020-09-29priv.h: Fix “MAX_PACKAT_LEN” typo in #ifndef guardPaul Capron1-1/+1
The preprocessor guard was previously effectively inoperative; it used to read “MAX_PACKAT_LEN” (note the ‘A’!), now is ‘E’. Signed-off-by: Paul Capron <paul@fragara.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2020-04-09init: Introduce internal is_ssh_initialized()Anderson Toshiyuki Sasaki1-0/+3
The introduced function returns whether the library is initialized or not. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2020-02-12include: Remove PRIdS definitionsAndreas Schneider1-6/+0
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-12-11include: Rename __unused__ to __attr_unused__Andreas Schneider1-6/+6
This avoids a collision with valgrind.h Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-12-09base64: Fix size types of bin_to_base64()Andreas Schneider1-1/+1
Fixes T188 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-11-07server: Use really the negotiated signature typeJakub Jelen1-1/+11
Generally, when the extension negotiation is enabled and client supports SHA2 algorithms for RSA, they are supposed to be prioritized against the old SHA1. If it is not (ssh-rsa is listed in front of rsa-sha2-* hostkey algorithms during negotiation), the server wrongly tries to provide the new typo of signature, ignoring the negotiated algirithm This commit propagates the digest algorithm from negotiation to the actual signature functions, which were previously responsible for decision about the hash algorithm based just on the negotiated extensions. Fixes T191 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-06-27connect: Removed unused codeAnderson Toshiyuki Sasaki1-2/+0
The internal function ssh_connect_host() is not used. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-06-14priv.h: Add macro definitions for PRIx32 and PRIx64Anderson Toshiyuki Sasaki1-0/+12
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-21buffer: Fix regression introduced by 6c7eaa and c306a6Tilo Eckert1-6/+1
Buffer (un)packing was broken on compilers that are not gcc-compatible since the checks for an argument count of -1 have been removed from ssh_buffer_(un)pack(). This fix no longer uses GCC extensions for the __VA_NARG__ macro, but only plain C99. Note: The macro can no longer count empty argument lists (results in compile error) which was not needed anyway. Signed-off-by: Tilo Eckert <tilo.eckert@flam.de> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-01-09priv: Provide PRIu32 for Visual StudioJakub Jelen1-0/+4
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-30include: Add macro for unused arguments and variablesAndreas Schneider1-2/+16
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-24pki_crypto: Mark iqmp as unusedAndreas Schneider1-0/+2
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-17priv: Add ssize_t if not available with MSVCAndreas Schneider1-0/+8
Fixes T113 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Tested-by: Wolf Wolfswinkel <wolf.wolfswinkel@objectplus.nl>
2018-09-05config: Parse Match keywordJakub Jelen1-0/+2
Amends f818e63f8, which introduced the constants and matching of this configuration option, but did not implement the handling of the values which was causing the configuration parser failing for certain configurations. This commit exposes match_pattern_list() from match.c Red Hat Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1624425 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-29misc: Add strndup implementation if not provides by the OSAndreas Schneider1-0/+4
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-27error: Add ssh_reset_error() functionAndreas Schneider1-0/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-30include: Add arpa/inet.h for htonlAndreas Schneider1-0/+4
This should fix a build warning on FreeBSD. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29Rest in Peace SSHv1Andreas Schneider1-6/+5
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2018-06-28Remove vim modelines from all filesAndreas Schneider1-1/+0
If you want modelines use my vim plugin: https://github.com/cryptomilk/git-modeline.vim git config --add vim.modeline "ts=4 sw=4 et" Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-03-02priv: Implement explicit_bzero as a function if not availableAndreas Schneider1-15/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Alberto Aguirre <albaguirre@gmail.com>
2018-02-22priv: Fix explicit_bzero macro if we pass a functionAndreas Schneider1-1/+2
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-02-12src: Use explicit_bzero() if available on the platformAndreas Schneider1-21/+10
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-10-28Fix config.h includesAndreas Schneider1-1/+2
We need stdlib.h and string.h in priv.h for free() and memset(). Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-08-25packet: Fix fallthrough compiler warningsAndreas Schneider1-0/+8
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-08-24priv: Add macro for MAXAndreas Schneider1-0/+4
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07misc: Use simpler macros for htonll and ntohllAndreas Schneider1-0/+18
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-06cmake: Correctly check for sys/[u]time.hAndreas Schneider1-4/+0
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03priv: Fix client banner specification for libsshAndreas Schneider1-2/+2
BUG: https://red.libssh.org/issues/231 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02connector: Implement ssh_connector_except()Aris Adamantiadis1-0/+4
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02auth: Cleanup memory leak when using SSH agentStef Walter1-0/+2
In Cockpit we've seen this memory leak: at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5B76B03: ssh_userauth_agent (auth.c:778) by 0x40DD5A: cockpit_ssh_authenticate (cockpitsshtransport.c:327) BUG: https://red.libssh.org/issues/208 Signed-off-by: Stef Walter <stefw@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-10-20agent: Fix agent auth on big endian machinesAndreas Schneider1-0/+10
BUG: https://red.libssh.org/issues/204 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-06-30include: Add stdarg.h so we can check for va_copy macroAndreas Schneider1-0/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-06-24include: Add support for older MSVC versionsAndreas Schneider1-0/+4
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-05-05include: Fix variadic macro issues with MSVCAndreas Schneider1-1/+9
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-04-10bind: Correctly close sockets and invalidate them.Andreas Schneider1-0/+6
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-04-02cmake: Detect __func__ and __FUNCTION__ during configure stepAndreas Schneider1-2/+6
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-04-02include: We should use __func__ which is C99Andreas Schneider1-8/+6
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-08buffer: buffer_pack & unpack on non-gnu compilersAris Adamantiadis1-0/+5
2015-02-02buffer: Improve argument checking in ssh_buffer_pack()Andreas Schneider1-0/+24
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>