1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-31 00:03:08 +03:00

libssh2_scp_send, libssh2_scp_send_ex: add deprecation warning

Also:
- switch to non-deprecated alternative in examples.
- add pointers and deprecation warning to libssh2_scp_send man page.

Cherry-picked from #1484
This commit is contained in:
Viktor Szakats
2024-11-27 00:36:24 +01:00
parent 4fbd592314
commit 7027604505
10 changed files with 25 additions and 15 deletions

View File

@ -46,6 +46,8 @@ At next SONAME bump
libssh2_channel_receive_window_adjust() libssh2_channel_receive_window_adjust()
libssh2_poll() libssh2_poll()
libssh2_poll_channel_read() libssh2_poll_channel_read()
libssh2_scp_send()
libssh2_scp_send_ex()
libssh2_session_startup() (libssh2_session_handshake() is the replacement) libssh2_session_startup() (libssh2_session_handshake() is the replacement)
libssh2_banner_set() (libssh2_session_banner_set() is the replacement) libssh2_banner_set() (libssh2_session_banner_set() is the replacement)

View File

@ -14,9 +14,13 @@ libssh2_scp_send(LIBSSH2_SESSION *session, const char *path,
.SH DESCRIPTION .SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_scp_send_ex(3)\fP. underlying function \fIlibssh2_scp_send_ex(3)\fP.
This macro has been deemed deprecated since libssh2 1.2.6. See
\fIlibssh2_scp_send64(3)\fP.
.SH RETURN VALUE .SH RETURN VALUE
See \fIlibssh2_scp_send_ex(3)\fP See \fIlibssh2_scp_send_ex(3)\fP
.SH ERRORS .SH ERRORS
See \fIlibssh2_scp_send_ex(3)\fP See \fIlibssh2_scp_send_ex(3)\fP
.SH SEE ALSO .SH SEE ALSO
.BR libssh2_scp_send_ex(3) .BR libssh2_scp_send_ex(3),
.BR libssh2_scp_send64(3)

View File

@ -152,8 +152,8 @@ int main(int argc, char *argv[])
} }
/* Send a file via scp. The mode parameter must only have permissions! */ /* Send a file via scp. The mode parameter must only have permissions! */
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777, channel = libssh2_scp_send64(session, scppath, fileinfo.st_mode & 0777,
(size_t)fileinfo.st_size); fileinfo.st_size, 0, 0);
if(!channel) { if(!channel) {
char *errmsg; char *errmsg;

View File

@ -206,8 +206,8 @@ int main(int argc, char *argv[])
/* Send a file via scp. The mode parameter must only have permissions! */ /* Send a file via scp. The mode parameter must only have permissions! */
do { do {
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777, channel = libssh2_scp_send64(session, scppath, fileinfo.st_mode & 0777,
(size_t)fileinfo.st_size); fileinfo.st_size, 0, 0);
if(!channel && if(!channel &&
libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) { libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {

View File

@ -335,7 +335,7 @@ int main(int argc, char *argv[])
} }
/* Other channel types are supported via: /* Other channel types are supported via:
* libssh2_scp_send() * libssh2_scp_send64()
* libssh2_scp_recv2() * libssh2_scp_recv2()
* libssh2_channel_direct_tcpip() * libssh2_channel_direct_tcpip()
*/ */

View File

@ -219,7 +219,7 @@ skip_shell:
} }
/* Other channel types are supported via: /* Other channel types are supported via:
* libssh2_scp_send() * libssh2_scp_send64()
* libssh2_scp_recv2() * libssh2_scp_recv2()
* libssh2_channel_direct_tcpip() * libssh2_channel_direct_tcpip()
*/ */

View File

@ -1058,17 +1058,19 @@ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session,
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session, LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session,
const char *path, const char *path,
libssh2_struct_stat *sb); libssh2_struct_stat *sb);
#ifndef LIBSSH2_NO_DEPRECATED
LIBSSH2_DEPRECATED(1.2.6, "Use libssh2_scp_send64()")
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session,
const char *path, int mode, const char *path, int mode,
size_t size, long mtime, size_t size, long mtime,
long atime); long atime);
#define libssh2_scp_send(session, path, mode, size) \
libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
#endif
LIBSSH2_API LIBSSH2_CHANNEL * LIBSSH2_API LIBSSH2_CHANNEL *
libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode, libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
libssh2_int64_t size, time_t mtime, time_t atime); libssh2_int64_t size, time_t mtime, time_t atime);
#define libssh2_scp_send(session, path, mode, size) \
libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
/* DEPRECATED */ /* DEPRECATED */
LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
unsigned int *dest_len, unsigned int *dest_len,

View File

@ -1401,6 +1401,7 @@
d path * value options(*string) const char * d path * value options(*string) const char *
d sb likeds(libssh2_struct_stat) d sb likeds(libssh2_struct_stat)
/if not defined(LIBSSH2_NO_DEPRECATED)
d libssh2_scp_send_ex... d libssh2_scp_send_ex...
d pr * extproc('libssh2_scp_send_ex') LIBSSH2_CHANNEL * d pr * extproc('libssh2_scp_send_ex') LIBSSH2_CHANNEL *
d session * value LIBSSH2_SESSION * d session * value LIBSSH2_SESSION *
@ -1409,6 +1410,7 @@
d size value like(libssh2_Csize_t) d size value like(libssh2_Csize_t)
d mtime value like(libssh2_Clong) d mtime value like(libssh2_Clong)
d atime value like(libssh2_Clong) d atime value like(libssh2_Clong)
/endif
d libssh2_scp_send64... d libssh2_scp_send64...
d pr * extproc('libssh2_scp_send64') LIBSSH2_CHANNEL * d pr * extproc('libssh2_scp_send64') LIBSSH2_CHANNEL *

View File

@ -794,9 +794,7 @@ scp_recv_error:
#ifndef LIBSSH2_NO_DEPRECATED #ifndef LIBSSH2_NO_DEPRECATED
/* /*
* libssh2_scp_recv * libssh2_scp_recv (DEPRECATED, DO NOT USE!)
*
* DEPRECATED
* *
* Open a channel and request a remote file via SCP. This receives files * Open a channel and request a remote file via SCP. This receives files
* larger than 2 GB, but is unable to report the proper size on platforms * larger than 2 GB, but is unable to report the proper size on platforms
@ -1153,8 +1151,9 @@ scp_send_error:
return NULL; return NULL;
} }
#ifndef LIBSSH2_NO_DEPRECATED
/* /*
* libssh2_scp_send_ex * libssh2_scp_send_ex (DEPRECATED, DO NOT USE!)
* *
* Send a file using SCP. Old API. * Send a file using SCP. Old API.
*/ */
@ -1168,6 +1167,7 @@ libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode,
(time_t)mtime, (time_t)atime)); (time_t)mtime, (time_t)atime));
return ptr; return ptr;
} }
#endif
/* /*
* libssh2_scp_send64 * libssh2_scp_send64