openSUSE / twopence

Twopence is a test executor
https://github.com/openSUSE/twopence
GNU General Public License v2.0
8 stars 14 forks source link

Deprecation: move from SCP to SFTP #73

Open nodeg opened 1 year ago

nodeg commented 1 year ago

According to libssh, SCP is deprecated and should be replaced with SFTP.

@deprecated Please use SFTP instead

https://git.libssh.org/projects/libssh.git/tree/src/scp.c#n40

When building twopence, the deprecation warnings can also be seen:

# make
make -C library all                                                                                                                                             
../subst.sh < version.h.in > version.h                                                                                                                          
cc -D_GNU_SOURCE -fPIC -Wall -O2 -g   -c -o twopence.o twopence.c               
cc -D_GNU_SOURCE -fPIC -Wall -O2 -g   -c -o ssh.o ssh.c                                                                                                         
ssh.c:855:9: warning: 'ssh_scp_write' is deprecated [-Wdeprecated-declarations]                                                                                 
    if (ssh_scp_write (trans->scp, buffer, size) != SSH_OK)                                                                                                     
        ^                                                                                                                                                       
/usr/local/include/libssh/libssh.h:579:1: note: 'ssh_scp_write' has been explicitly marked deprecated here                                                      
SSH_DEPRECATED LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);                                                                       
^                                                                                                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                            
#define SSH_DEPRECATED __attribute__ ((deprecated))                             
                                       ^                                        
ssh.c:883:16: warning: 'ssh_scp_read' is deprecated [-Wdeprecated-declarations]                                                                                 
    received = ssh_scp_read(trans->scp, buffer, size);                                                                                                          
               ^                                                                
/usr/local/include/libssh/libssh.h:573:1: note: 'ssh_scp_read' has been explicitly marked deprecated here                                                       
SSH_DEPRECATED LIBSSH_API int ssh_scp_read(ssh_scp scp, void *buffer, size_t size);                                                                             
^                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                            
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^                                                                                                                        
ssh.c:1049:5: warning: 'ssh_scp_close' is deprecated [-Wdeprecated-declarations]                                                                                
    ssh_scp_close(trans->scp);                                                                                                                                  
    ^                                                                                                                                                           
/usr/local/include/libssh/libssh.h:563:1: note: 'ssh_scp_close' has been explicitly marked deprecated here         
SSH_DEPRECATED LIBSSH_API int ssh_scp_close(ssh_scp scp);                                                                                                       
^                                                                                                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                            
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^                                                                                                                        
ssh.c:1050:5: warning: 'ssh_scp_free' is deprecated [-Wdeprecated-declarations]                                                                                 
    ssh_scp_free(trans->scp);                                                                                                                                   
    ^                                                                                                                                                           
/usr/local/include/libssh/libssh.h:565:1: note: 'ssh_scp_free' has been explicitly marked deprecated here                                                       
SSH_DEPRECATED LIBSSH_API void ssh_scp_free(ssh_scp scp);
^                                                                                                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'
#define SSH_DEPRECATED __attribute__ ((deprecated))
                                       ^ 
ssh.c:1083:16: warning: 'ssh_scp_new' is deprecated [-Wdeprecated-declarations]
  trans->scp = ssh_scp_new(trans->session, direction, remote_name);
               ^
/usr/local/include/libssh/libssh.h:568:1: note: 'ssh_scp_new' has been explicitly marked deprecated here
SSH_DEPRECATED LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
^
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'
#define SSH_DEPRECATED __attribute__ ((deprecated))
                                       ^ 
ssh.c:1086:7: warning: 'ssh_scp_init' is deprecated [-Wdeprecated-declarations]
  if (ssh_scp_init(trans->scp) != SSH_OK)
      ^
/usr/local/include/libssh/libssh.h:566:1: note: 'ssh_scp_init' has been explicitly marked deprecated here
SSH_DEPRECATED LIBSSH_API int ssh_scp_init(ssh_scp scp);
^
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'
#define SSH_DEPRECATED __attribute__ ((deprecated))
                                       ^ 
ssh.c:1098:9: warning: 'ssh_scp_new' is deprecated [-Wdeprecated-declarations]
  scp = ssh_scp_new(session, SSH_SCP_READ|SSH_SCP_RECURSIVE, remote_dirname);
        ^
/usr/local/include/libssh/libssh.h:568:1: note: 'ssh_scp_new' has been explicitly marked deprecated here
SSH_DEPRECATED LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
^
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'
#define SSH_DEPRECATED __attribute__ ((deprecated))
                                       ^ 
ssh.c:1100:7: warning: 'ssh_scp_init' is deprecated [-Wdeprecated-declarations]
   && ssh_scp_init(scp) == SSH_OK
      ^
/usr/local/include/libssh/libssh.h:566:1: note: 'ssh_scp_init' has been explicitly marked deprecated here
SSH_DEPRECATED LIBSSH_API int ssh_scp_init(ssh_scp scp);
^                                                                                                                                                     [107/7044]
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                        
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^           
ssh.c:1163:7: warning: 'ssh_scp_pull_request' is deprecated [-Wdeprecated-declarations]                                                                     
  if (ssh_scp_pull_request(trans->scp) != SSH_SCP_REQUEST_NEWFILE)                                                                                              
      ^                                                                         
/usr/local/include/libssh/libssh.h:569:1: note: 'ssh_scp_pull_request' has been explicitly marked deprecated here                 
SSH_DEPRECATED LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);                                                                                                
^                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                        
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^           
ssh.c:1165:10: warning: 'ssh_scp_request_get_size' is deprecated [-Wdeprecated-declarations]                                                                
  size = ssh_scp_request_get_size(trans->scp);                                                                                                                  
         ^                                                                                        
/usr/local/include/libssh/libssh.h:576:1: note: 'ssh_scp_request_get_size' has been explicitly marked deprecated here             
SSH_DEPRECATED LIBSSH_API size_t ssh_scp_request_get_size(ssh_scp scp);                                                                                         
^                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                        
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^                                                          
ssh.c:1170:7: warning: 'ssh_scp_accept_request' is deprecated [-Wdeprecated-declarations]                                                                   
  if (ssh_scp_accept_request(trans->scp) != SSH_OK)                            
      ^                                                                                           
/usr/local/include/libssh/libssh.h:562:1: note: 'ssh_scp_accept_request' has been explicitly marked deprecated here               
SSH_DEPRECATED LIBSSH_API int ssh_scp_accept_request(ssh_scp scp);                                                                                              
^                                                                                                 
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'                                                                        
#define SSH_DEPRECATED __attribute__ ((deprecated))                                                                                                             
                                       ^                                        
ssh.c:1182:7: warning: 'ssh_scp_pull_request' is deprecated [-Wdeprecated-declarations]                                                                     
  if (ssh_scp_pull_request(trans->scp) != SSH_SCP_REQUEST_EOF)                                                                                                  
      ^                                                                                                                                                         
/usr/local/include/libssh/libssh.h:569:1: note: 'ssh_scp_pull_request' has been explicitly marked deprecated here                 
SSH_DEPRECATED LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);                                                                                                
^                                                                                                                                                               
/usr/local/include/libssh/libssh.h:86:40: note: expanded from macro 'SSH_DEPRECATED'  
define SSH_DEPRECATED __attribute__ ((deprecated))
                                       ^ 
ssh.c:303:1: warning: unused function '__twopence_ssh_transaction_set_exit_status' [-Wunused-function]                                                          
__twopence_ssh_transaction_set_exit_status(twopence_ssh_transaction_t *trans, int exit_status)
^
17 warnings generated.
(...)
Bischoff commented 1 year ago

Hum. Interesting. I wonder what motivated that deprecation.

nodeg commented 1 year ago

The commit that indroduced that said:

See also https://lists.mindrot.org/pipermail/openssh-unix-dev/2021-September/039616.html Fixes #91

Issue 91 mentions the following:

The latest version of OpenSSH 8.7 was released with a possibility to use SCP commandline tool with SFTP protocol under the hood to provide simpler transition for users and to avoid messing with the ancient protocol. The SCP caused a lot of pain, CVEs and issues also for libssh so we should mark the SCP API deprecated for next release to discourage its use. In the long term, we should also consider disabling it at a build time as an option to remove it in the future.