Jakub Jelen
7bd850ab36
Remove bogus semicolons
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2022-06-09 09:08:02 +02:00
Sahana Prasad
4b3a6342db
Deprecate duplicate/ unused functions
...
and fix obvious naming mistakes, mostly in documentation
Signed-off-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2022-06-09 09:08:02 +02:00
Jakub Jelen
254bfd6d73
ssh_x11_client: Fix coverity reports
...
Thanks coverity
Fixes:
* CID 1488472: Security best practices violations (STRING_OVERFLOW)
* CID 1488471: Error handling issues (CHECKED_RETURN)
* CID 1472029: Error handling issues (NEGATIVE_RETURNS)
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2022-06-09 09:08:02 +02:00
Carlo Bramini
79ad989cf4
keygen2 requires also ${ARGP_LIBRARY}
...
Signed-off-by: Carlo Bramini <carlo_bramini@users.sourceforge.net>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-06-08 09:06:42 +02:00
Marco Fortina
88bc364c05
examples: Add 'ssh X11 client' sample
...
Signed-off-by: Marco Fortina <marco.fortina@atlantica.it>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2022-05-02 20:06:22 +02:00
Norbert Pocs
99c6eb305e
examples: Missing close for 'socket_fd' when error
...
Defect found by covscan
Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2021-11-09 09:36:34 +01:00
Norbert Pocs
63f97a3d03
Fix some compiler warnings
...
Covscan analyzer was used
Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2021-08-12 20:02:25 +02:00
Xiang Xiao
dbe504ea0a
Make the transfer buffer size configurable
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I5052bac703b5a0c289ca5c28569cadeb54d3d507
2021-06-16 11:56:44 +02:00
Jakub Jelen
aac975b7b2
Unbreak build on freebsd
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2021-06-07 11:28:29 +02:00
Andrew Wiley
6aa88e22d6
build samplesshd-cb example on Windows too
...
Signed-off-by: Andrew Wiley <wiley@outlook.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2021-06-04 22:27:51 -07:00
Andrew Wiley
bd7bef8b50
fix error checks on channel writes in samplesshd-cb example
...
Signed-off-by: Andrew Wiley <wiley@outlook.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2021-06-04 22:27:51 -07:00
Andrew Wiley
fb8d120bec
make GSSAPI optional in the samplesshd-cb example
...
Signed-off-by: Andrew Wiley <wiley@outlook.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2021-06-04 22:27:51 -07:00
Xiang Xiao
a8a74a70fa
examples/ssh_server_fork: Support the multi-client through pthread
...
so the same code base demo both multi-process and multi-thread model
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I98554a99b7a31586be37abde7c357f81a05c3d6e
2021-05-31 12:21:42 +02:00
Xiang Xiao
094aeeafbe
examples/ssh_server: Free the resource in the failure path
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I60f64b9eda3ba233a825b2c4fe19d5bf7eaf2fa3
2021-05-27 13:45:47 +02:00
Xiang Xiao
d2182bb7af
Replace the hardcode max path length with PATH_MAX
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: Icb1d36b48a759ec11dbaa4c09a39037a80ab0f85
2021-05-27 13:45:47 +02:00
Xiang Xiao
9b7c4307a4
examples/ssh_client: Fix the memory leak in RTOS environment
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I20108753cf0b86e18724171dc7b25790350edb08
2021-05-12 16:01:18 +02:00
Xiang Xiao
c9e6461546
examples/ssh_client: call ssh_init explicitly
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I52011de66a9e1a6a318fcb91fb7357cd97c534a3
2021-05-12 16:01:18 +02:00
Xiang Xiao
5c919c4edb
examples/ssh_server: Support the command line parser without argp package
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: Ia39a402e4684d2f0ef014b4effd255692b576ce3
2021-05-12 16:01:18 +02:00
Xiang Xiao
9bff4cb9b9
examples/ssh_server: Add -u and -P option
...
enable pass username and password from command line
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I6404b90a99253d3240f7a28827635b159ff6a574
2021-05-12 16:01:18 +02:00
Xiang Xiao
43a31b81f2
examples/libssh_scp: Remove the duplication of free(loc->host)
...
and free sources at the end of program
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: Ia6a51d52439722b46547449e85350b3193e5ba28
2021-05-12 16:01:18 +02:00
Xiang Xiao
46624648f9
examples/libssh_scp: call ssh_init and ssh_finalize explicitly
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I4c80904d40b068f47334c3116576de07782162f6
2021-05-12 16:01:18 +02:00
Xiang Xiao
e909bde2c5
examples/ssh_client: Check SIGWINCH is defined before using it
...
since not all POSIX platform support SIGWINCH signal
and remove the global variable chan
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I70217020c84b056270ed680008a1871383b5fc7b
2021-05-12 16:01:18 +02:00
Anderson Toshiyuki Sasaki
b0518552f1
examples: Tolerate incomplete writes in exec example
...
Previously, the exec example would fail if it could not write the whole
read buffer to stdout. With this changes, the exec example will be able
to write parts of the buffer until the whole buffer is written.
This makes the exec example to run when the stdout buffer is small.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2020-06-22 13:58:52 +02:00
Heiko Thiery
bee8ed82ab
cmake: Add autogenerated libssh_version.h
...
Set the cmake project verision to the autogenerated file to have a single
point to set the version. This will be included in the libssh.h file.
Pair-Programmed-With: Andreas Schneider <asn@cryptomilk.org>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2020-05-06 13:02:32 +02:00
Jakub Jelen
b88aa98550
Allow example client and server to process different configuration files
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2020-05-05 14:23:06 +02:00
Jakub Jelen
c2f64108a1
examples: Avoid unused parameter warnings and reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2020-04-20 14:14:33 +02:00
Jakub Jelen
58d53f1397
examples: Add missing includes
...
Fixes: T225
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2020-04-15 20:05:56 +02:00
Jakub Jelen
4b85934198
examples: Enable strict build
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-12-23 14:31:32 +01:00
Andreas Schneider
0938d397be
examples: Use SSH_STRING_FREE_CHAR()
...
Fixes T183
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-12-09 16:08:03 +01:00
Andreas Schneider
8d62257172
examples: Fix integer types in libssh_scp.c
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-12-09 16:08:03 +01:00
Andreas Schneider
0773696ee5
examples: Remove internal include from sshd_direct-tcpip.c
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-12-09 16:08:03 +01:00
Andreas Schneider
4ab0fb2b48
cmake: Do not use cached LIBSSH_PUBLIC_INCLUDE_DIRS
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-11-07 14:01:01 +01:00
Andreas Schneider
82c57c1f36
cmake: Create ssh library directly as libssh
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-11-07 14:01:00 +01:00
Anderson Toshiyuki Sasaki
29d360dc70
examples: Build keygen2 only if argp is available
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-11-07 14:00:15 +01:00
Anderson Toshiyuki Sasaki
b30875c6c7
examples: Added keygen2 example
...
The added example is an application which can generate keys of different
types using libssh.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-11-07 10:53:49 +01:00
Jakub Jelen
cc92e74309
examples: Load ED25519 key when loading all keys
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-07-30 16:19:27 +02:00
Andreas Schneider
0734bc490f
examples: Fix freeing the channel in ssh_client
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-07-08 17:26:21 +02:00
Andreas Schneider
b275045ac8
examples: Update header in ssh_client
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-07-08 15:02:38 +02:00
Andreas Schneider
b5a8547d91
exmples: Use SSH_CONNECTOR_STDINOUT in client example
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-07-08 14:58:59 +02:00
Anderson Toshiyuki Sasaki
b1ff11f416
examples: Check ssh_event_dopoll() return value
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-06-27 10:31:46 +02:00
Andreas Schneider
7e344ca052
examples: Fix a possible resource leak in sshd_direct-tcpip
...
CID 1398985
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-05-28 09:18:52 +02:00
Andreas Schneider
5a590dfb5f
examples: Fix unused parameter warnings in sshd_direct-tcpip
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2019-02-21 10:51:07 +01:00
Till Wimmer
881e1b4785
examples: Add direct-tcpip server sample
...
Signed-off-by: Till Wimmer <g4-lisz@tonarchiv.ch>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-20 16:39:31 +01:00
Jakub Jelen
5700477f3e
examples: Add simple way to generate key files from libssh
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-07 10:30:05 +01:00
Eric Bentley
83d86ef6a5
examples: add public key auth for specific key
...
There was no example of using a specific key for authentication so I added
one.
Signed-off-by: Eric Bentley <ebentley66@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 17:48:08 +01:00
Eric Bentley
db67fcbe88
examples: add public key authentication to ssh_server_fork
...
I noticed that there was no example showing server side public key encryption in the examples
so I added this one. I used authorizedkeys as a global to minimize the changes to the original
code as well as I was not sure the correct methodology of determining the .ssh directory location
for a user not using Linux. One code using the user parameter to determine the location to use
instead if desired.
Signed-off-by: Eric Bentley <ebentley66@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24 17:48:04 +01:00
Andreas Schneider
7e6b540277
exmpales: Init rc in ssh_server_fork
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-24 09:48:35 +02:00
Andreas Schneider
12ec1fed2f
examples: Zero fds in sshnetcat
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-24 09:48:35 +02:00
Andreas Schneider
0ff566b6dd
examples: Explicitly track auth state in samplesshd-kbdint
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-19 12:31:04 +02:00
Andreas Schneider
16b876d07f
examples: Use ssh_session_update_known_hosts() for updating known_hosts
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-16 08:58:31 +02:00