1
1
Граф коммитов

48 Коммитов

Автор SHA1 Сообщение Дата
Andreas Schneider
f525fdb2e1 sftp: Check for NULL path and give correct error
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-11-09 11:41:58 +01:00
Andreas Schneider
f0ddde4826 Fix config.h includes
We need stdlib.h and string.h in priv.h for free() and memset().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2017-10-28 14:31:37 +02:00
Pino Toscano
bc78383fac sftp: Fix memory leak in sftp_fstat
When parsing the result of a successful fstat call, make sure to free
the resulting reply message.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-10-22 16:03:33 +02:00
Tilo Eckert
1cc1a352fc sftp: Add support for append in sftp_open()
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
2016-10-08 10:50:38 +02:00
Tilo Eckert
cfe7065ce1 sftp: Do not always set SSH_FXF_READ
Comparison ((flags & O_RDONLY) == O_RDONLY) is always true.
Also, O_RDWR, O_WRONLY and O_RDONLY are mutually exclusive => no need to check all of them

Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
2016-10-08 10:45:30 +02:00
Andreas Schneider
f561e6bcb3 sftp: Correctly check for EOF else keep spinning if there is no data
This fixes an issue introduced with
dbf72ffba2

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-10-07 13:36:58 +02:00
Andreas Schneider
155a155d1d sftp: Add sftp_fsync() function
BUG: https://red.libssh.org/issues/141

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-10-06 16:26:52 +02:00
Jeremy Cross
dbf72ffba2 sftp: ensure sftp_packet_read recognizes channel EOF to avoid infinite loop
Signed-off-by: Jeremy Cross <jcross@bomgar.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-09-09 11:39:32 +02:00
Andreas Schneider
412c501442 sftp: Use calloc() instead of malloc()/memset()
This is calloc() is faster then calling memset().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-04 14:56:22 +02:00
Fabiano Fidêncio
05fd0acf45 buffer: do not use ssh_buffer_get_rest_len()
As ssh_buffer_get_len() actually calls ssh_buffer_get_rest_len(), let's
just use the first one. This is a preparatory step for removing
ssh_buffer_get_rest_len().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
954341dd1f buffer: rename ssh_buffer_get_rest() to ssh_buffer_get()
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:07 +01:00
Fabiano Fidêncio
adc8c20ac1 cleanup: use ssh_ prefix in the buffer (non-static) functions
Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:07 +01:00
Tilo Eckert
672c3be9ed sftp: Fix incorrect handling of received length fields
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
2015-08-01 10:52:57 +03:00
Tilo Eckert
71d86be42e define our own platform-independent S_IF macros
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-07-30 10:47:34 +02:00
Tilo Eckert
267fe02088 fix file mode checks in sftp_open()
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-07-30 10:46:34 +02:00
Andreas Schneider
ca501df8c8 sftp: Fix size check
CID: #1296588

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-05-05 11:26:40 +02:00
Andreas Schneider
4b9916136d sftp: Add bound check for size
CID: #1238630

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-05-04 17:54:01 +02:00
Kevin Fan
b5dc8197f7 Fix leak of sftp->ext when sftp_new() fails
Signed-off-by: Kevin Fan <kevinfan@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-04-14 20:56:56 +02:00
Andreas Schneider
af0dd3fb02 sftp: Fix a possible integer overflow.
CID: #1238630

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
2015-01-14 15:20:49 +01:00
Andreas Schneider
ce02f6576a sftp: Use a declared variable for data len.
CID: #1238632

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
2015-01-14 15:20:46 +01:00
Tobias Klauser
15d71a8c51 sftp: Fix memory leak on realloc failure
If realloc of sftp->ext->name or sftp->ext->data fails, the memory
previously allocated for the respective member is leaked. Fix this by
storing the return value of realloc() in a temporary variable which only
gets assigned to the respective sftp->ext member on success.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-01-14 10:22:55 +01:00
Aris Adamantiadis
6019cf1bed Fix sftp endianess bugs
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-08-06 10:08:25 +02:00
Aris Adamantiadis
c341da03d3 buffers: adapt sftp.c to ssh_buffer_(un)pack()
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-08-06 09:51:00 +02:00
Joseph Southwell
6bbdaceaca src: Define MAX_BUF_SIZE globally and use it.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-02-02 22:19:46 +01:00
Andreas Schneider
cb9786b3ae src: Rename buffer_add_data() to ssh_buffer_add_data(). 2014-01-19 20:55:55 +01:00
Andreas Schneider
2fe59071b2 src: Do not use deprecated functions. 2014-01-16 15:27:46 +01:00
Andreas Schneider
6fe51b13fb src: Update my mail address. 2014-01-07 16:08:23 +01:00
Andreas Schneider
c64ec43eef src: Remove enter_function() and leave_function(). 2013-07-14 13:31:24 +02:00
Andreas Schneider
ebdd0c6ac1 src: Migrate to SSH_LOG. 2013-07-14 12:44:26 +02:00
Aris Adamantiadis
31a129ee9e sftp: more flexibility on channels
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2013-07-13 15:01:17 +02:00
Andreas Schneider
571dc42335 CVE-2012-4559: Make sure we don't free name and longname twice on error. 2012-11-14 17:36:24 +01:00
Andreas Schneider
188c596803 sftp: Don't leak owner and group in sftp_parse_attr_4. 2012-10-12 08:07:01 +02:00
Andreas Schneider
ff53664f54 sftp: Fix a possible null pointer dereference in sftp_async_read. 2012-10-07 22:03:35 +02:00
Andreas Schneider
22f607649d sftp: Harden sftp_extension_supported() against null pointers. 2012-10-05 11:12:14 +02:00
Andreas Schneider
b5c4b090da sftp: Fix a memory on error in sftp_opendir(). 2012-10-05 11:12:13 +02:00
Andreas Schneider
782b2e37c6 build: Fix missing struct in_addr warning. 2012-07-17 18:16:07 +02:00
Andreas Schneider
a92c97b2e1 sftp: Fix bug in sftp_mkdir not returning on error.
resolves: #84
2012-07-17 18:12:44 +02:00
Andreas Schneider
47226d9d44 sftp: Fix memory leak in sftp_free() on server.
Thanks to Tom Judge for the report.
2012-02-04 21:06:37 +01:00
Andreas Schneider
33754c391f priv: Start to remove enter_function. 2011-09-18 21:37:17 +02:00
Andreas Schneider
c19c638d74 error: Use macros for error functions. 2011-09-17 10:38:08 +02:00
Jonas Jonsson
d1df255df4 sftp: Handle short reads of sftp_async_read().
sftp_async_read() and sftp_async_read_begin() assume that the whole read
will be successful but when this is not the case, the offset will be
wrong.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2011-08-29 10:05:26 +02:00
Andreas Schneider
c483418b82 sftp: Reset eof on seek operations.
This fixes bug #48.
2011-05-26 11:22:11 +02:00
Andreas Schneider
ef658b4bef Fix assertion with Visual Studio because of %zu. 2011-04-15 19:02:21 +02:00
Mark Riordan
29bb718a93 sftp: Fixed double-free in sftp_unlink(). 2011-04-08 10:59:05 +02:00
Andreas Schneider
7c728acd12 sftp: Fixed a memory leak in sftp_xstat.
Thanks to dsc for the bug report.
2010-12-27 17:52:24 +01:00
Aris Adamantiadis
338a3d9b05 Removed references to ssh_buffer_get_begin 2010-10-03 12:07:00 +02:00
Aris Adamantiadis
c4e67730a3 Convert sftp.c to ssh_channel_read 2010-10-01 21:41:56 +02:00
Andreas Schneider
f7842e3a4b misc: Rename libssh/ to src/ 2010-09-06 14:28:38 +02:00