This commit is contained in:
commit
72d0c73f9e
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
50
0001-Map-permission-field-to-type-field.patch
Normal file
50
0001-Map-permission-field-to-type-field.patch
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
From a07e57e2ed6d402d1f3d4b8449ee4f4ab2108ce7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Schneider <mail@cynapses.org>
|
||||||
|
Date: Wed, 20 Aug 2008 18:37:33 +0200
|
||||||
|
Subject: [PATCH] Map permission field to type field.
|
||||||
|
|
||||||
|
---
|
||||||
|
libssh/sftp.c | 23 +++++++++++++++++++++++
|
||||||
|
1 files changed, 23 insertions(+), 0 deletions(-)
|
||||||
|
|
||||||
|
Index: libssh-0.2/libssh/sftp.c
|
||||||
|
===================================================================
|
||||||
|
--- libssh-0.2.orig/libssh/sftp.c
|
||||||
|
+++ libssh-0.2/libssh/sftp.c
|
||||||
|
@@ -24,6 +24,8 @@ MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include "libssh/priv.h"
|
||||||
|
@@ -580,6 +582,27 @@ SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_
|
||||||
|
if(buffer_get_u32(buf,&attr->permissions)!=sizeof(u32))
|
||||||
|
break;
|
||||||
|
attr->permissions=ntohl(attr->permissions);
|
||||||
|
+
|
||||||
|
+ switch (attr->permissions & S_IFMT) {
|
||||||
|
+ case S_IFSOCK:
|
||||||
|
+ case S_IFBLK:
|
||||||
|
+ case S_IFCHR:
|
||||||
|
+ case S_IFIFO:
|
||||||
|
+ attr->type = SSH_FILEXFER_TYPE_SPECIAL;
|
||||||
|
+ break;
|
||||||
|
+ case S_IFLNK:
|
||||||
|
+ attr->type = SSH_FILEXFER_TYPE_SYMLINK;
|
||||||
|
+ break;
|
||||||
|
+ case S_IFREG:
|
||||||
|
+ attr->type = SSH_FILEXFER_TYPE_REGULAR;
|
||||||
|
+ break;
|
||||||
|
+ case S_IFDIR:
|
||||||
|
+ attr->type = SSH_FILEXFER_TYPE_DIRECTORY;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ attr->type = SSH_FILEXFER_TYPE_UNKNOWN;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
if(flags & SSH_FILEXFER_ATTR_ACMODTIME){
|
||||||
|
if(buffer_get_u32(buf,&attr->atime)!=sizeof(u32))
|
366
0002-Add-errno-mapping.patch
Normal file
366
0002-Add-errno-mapping.patch
Normal file
@ -0,0 +1,366 @@
|
|||||||
|
From b0b78a34891489b26aaabf71975bed4bc533c9cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Schneider <mail@cynapses.org>
|
||||||
|
Date: Wed, 20 Aug 2008 18:38:25 +0200
|
||||||
|
Subject: [PATCH] Add errno mapping.
|
||||||
|
|
||||||
|
---
|
||||||
|
libssh/sftp.c | 252 ++++++++++++++++++++++++++++++++++++++++++++------------
|
||||||
|
1 files changed, 198 insertions(+), 54 deletions(-)
|
||||||
|
|
||||||
|
Index: libssh-0.2/libssh/sftp.c
|
||||||
|
===================================================================
|
||||||
|
--- libssh-0.2.orig/libssh/sftp.c
|
||||||
|
+++ libssh-0.2/libssh/sftp.c
|
||||||
|
@@ -22,6 +22,7 @@ the Free Software Foundation, Inc., 59 T
|
||||||
|
MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
+#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
@@ -393,6 +394,17 @@ SFTP_DIR *sftp_opendir(SFTP_SESSION *sft
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return NULL;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_PERMISSION_DENIED:
|
||||||
|
+ errno = EACCES;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
return NULL;
|
||||||
|
@@ -709,10 +721,20 @@ SFTP_ATTRIBUTES *sftp_readdir(SFTP_SESSI
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return NULL;
|
||||||
|
- if(status->status==SSH_FX_EOF){
|
||||||
|
- dir->eof=1;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_PERMISSION_DENIED:
|
||||||
|
+ errno = EACCES;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_EOF:
|
||||||
|
+ dir->eof = 1;
|
||||||
|
status_msg_free(status);
|
||||||
|
return NULL;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL,"Unknown error status : %d",status->status);
|
||||||
|
status_msg_free(status);
|
||||||
|
@@ -789,12 +811,29 @@ static int sftp_handle_close(SFTP_SESSIO
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return -1;
|
||||||
|
- if(status->status != SSH_FX_OK){
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
- err=-1;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_INVALID_HANDLE:
|
||||||
|
+ errno = EBADF;
|
||||||
|
+ break;
|
||||||
|
+#if 0
|
||||||
|
+ case SSH_FX_NO_SPACE_ON_FILESYSTEM:
|
||||||
|
+ errno = ENOSPC;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_QUOTA_EXCEEDED:
|
||||||
|
+ errno = EDQUOT;
|
||||||
|
+ break:
|
||||||
|
+#endif
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
+ status_msg_free(status);
|
||||||
|
+ return err;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return err;
|
||||||
|
+ return -1;
|
||||||
|
default:
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL,"Received message %d during sftp_handle_close!",msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -868,6 +907,23 @@ SFTP_FILE *sftp_open(SFTP_SESSION *sftp,
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return NULL;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_FILE_ALREADY_EXISTS:
|
||||||
|
+ errno = EEXIST;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_PERMISSION_DENIED:
|
||||||
|
+ errno = EACCES;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OP_UNSUPPORTED:
|
||||||
|
+ errno = EINVAL;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
return NULL;
|
||||||
|
@@ -925,14 +981,21 @@ int sftp_read(SFTP_FILE *handle, void *d
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return -1;
|
||||||
|
- if(status->status != SSH_FX_EOF){
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
- err=-1;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_INVALID_HANDLE:
|
||||||
|
+ errno = EBADF;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_EOF:
|
||||||
|
handle->eof=1;
|
||||||
|
+ status_msg_free(status);
|
||||||
|
+ return err ? err : 0;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return err?err:0;
|
||||||
|
+ return -1;
|
||||||
|
case SSH_FXP_DATA:
|
||||||
|
datastring=buffer_get_ssh_string(msg->payload);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -992,13 +1055,22 @@ int sftp_write(SFTP_FILE *file, void *da
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return -1;
|
||||||
|
- if(status->status != SSH_FX_OK){
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
- err=-1;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_INVALID_HANDLE:
|
||||||
|
+ errno = EBADF;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
+ file->offset+=len;
|
||||||
|
+ status_msg_free(status);
|
||||||
|
+ return err ? err : len;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server : %s",status->errormsg);
|
||||||
|
file->offset+=len;
|
||||||
|
status_msg_free(status);
|
||||||
|
- return (err?err:len);
|
||||||
|
+ return -1;
|
||||||
|
default:
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL,"Received message %d during write!",msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -1044,14 +1116,27 @@ int sftp_rm(SFTP_SESSION *sftp, char *fi
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if (!status)
|
||||||
|
return -1;
|
||||||
|
- if (status->status != SSH_FX_OK) {
|
||||||
|
- /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
- status_msg_free(status);
|
||||||
|
- return -1;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_FILE_ALREADY_EXISTS:
|
||||||
|
+ errno = EEXIST;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OP_UNSUPPORTED:
|
||||||
|
+ errno = EINVAL;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
+ status_msg_free(status);
|
||||||
|
+ return 0;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return 0; /* at this point, everything turned out OK */
|
||||||
|
+ return -1;
|
||||||
|
} else {
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL, "Received message %d when attempting to remove file", msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -1083,18 +1168,21 @@ int sftp_rmdir(SFTP_SESSION *sftp, char
|
||||||
|
{
|
||||||
|
status = parse_status_msg(msg);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
- if (!status)
|
||||||
|
- {
|
||||||
|
+ if (!status) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- else if (status->status != SSH_FX_OK) /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
- {
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
status_msg_free(status);
|
||||||
|
- return -1;
|
||||||
|
+ return 0;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return 0; /* at this point, everything turned out OK */
|
||||||
|
+ return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -1111,6 +1199,7 @@ int sftp_mkdir(SFTP_SESSION *sftp, char
|
||||||
|
STRING *path = string_from_char(directory);
|
||||||
|
SFTP_MESSAGE *msg = NULL;
|
||||||
|
STATUS_MESSAGE *status = NULL;
|
||||||
|
+ SFTP_ATTRIBUTES *errno_attr = NULL;
|
||||||
|
|
||||||
|
buffer_add_u32(buffer, id);
|
||||||
|
buffer_add_ssh_string(buffer, path);
|
||||||
|
@@ -1127,17 +1216,30 @@ int sftp_mkdir(SFTP_SESSION *sftp, char
|
||||||
|
/* by specification, this command's only supposed to return SSH_FXP_STATUS */
|
||||||
|
status = parse_status_msg(msg);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
- if (!status)
|
||||||
|
- return -1;
|
||||||
|
- else
|
||||||
|
- if (status->status != SSH_FX_OK) {
|
||||||
|
- /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_FAILURE:
|
||||||
|
+ /*
|
||||||
|
+ * mkdir always returns a failure, even if the path already exists.
|
||||||
|
+ * To be POSIX conform and to be able to map it to EEXIST a stat
|
||||||
|
+ * call should be issued here
|
||||||
|
+ */
|
||||||
|
+ errno_attr = sftp_lstat(sftp, directory);
|
||||||
|
+ if (errno_attr != NULL) {
|
||||||
|
+ errno = EEXIST;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
status_msg_free(status);
|
||||||
|
- return -1;
|
||||||
|
+ return 0;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return 0; /* at this point, everything turned out OK */
|
||||||
|
+ return -1;
|
||||||
|
} else {
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL, "Received message %d when attempting to make directory", msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -1172,14 +1274,24 @@ int sftp_rename(SFTP_SESSION *sftp, char
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if (!status)
|
||||||
|
return -1;
|
||||||
|
- else if (status->status != SSH_FX_OK) {
|
||||||
|
- /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_FILE_ALREADY_EXISTS:
|
||||||
|
+ errno = EEXIST;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OP_UNSUPPORTED:
|
||||||
|
+ errno = EINVAL;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
status_msg_free(status);
|
||||||
|
- return -1;
|
||||||
|
+ return 0;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return 0; /* at this point, everything turned out OK */
|
||||||
|
+ return -1;
|
||||||
|
} else {
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL, "Received message %d when attempting to rename", msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -1212,14 +1324,27 @@ int sftp_setstat(SFTP_SESSION *sftp, cha
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if (!status)
|
||||||
|
return -1;
|
||||||
|
- else if (status->status != SSH_FX_OK) {
|
||||||
|
- /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
- ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_PERMISSION_DENIED:
|
||||||
|
+ errno = EACCES;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_INVALID_HANDLE:
|
||||||
|
+ errno = EBADF;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_OK:
|
||||||
|
status_msg_free(status);
|
||||||
|
- return -1;
|
||||||
|
+ return 0;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
+ /* status should be SSH_FX_OK if the command was successful, if it didn't, then there was an error */
|
||||||
|
+ ssh_set_error(sftp->session,SSH_REQUEST_DENIED, "sftp server: %s", status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
- return 0; /* at this point, everything turned out OK */
|
||||||
|
+ return -1;
|
||||||
|
} else {
|
||||||
|
ssh_set_error(sftp->session,SSH_FATAL, "Received message %d when attempting to set stats", msg->packet_type);
|
||||||
|
sftp_message_free(msg);
|
||||||
|
@@ -1302,6 +1427,17 @@ SFTP_ATTRIBUTES *sftp_xstat(SFTP_SESSION
|
||||||
|
sftp_message_free(msg);
|
||||||
|
if(!status)
|
||||||
|
return NULL;
|
||||||
|
+ switch (status->status) {
|
||||||
|
+ case SSH_FX_NO_SUCH_FILE:
|
||||||
|
+ errno = ENOENT;
|
||||||
|
+ break;
|
||||||
|
+ case SSH_FX_PERMISSION_DENIED:
|
||||||
|
+ errno = EACCES;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ ssh_say(1, "%s:%d - handle status: %d\n", __FILE__, __LINE__, status->status);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
ssh_set_error(sftp->session,SSH_REQUEST_DENIED,"sftp server: %s",status->errormsg);
|
||||||
|
status_msg_free(status);
|
||||||
|
return NULL;
|
3
libssh-0.2.tar.bz2
Normal file
3
libssh-0.2.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9818572980459427e3b5bfdf3ad5e94a43e086e9989f126ec1a250d454094136
|
||||||
|
size 235758
|
53
libssh-paths.patch
Normal file
53
libssh-paths.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
Index: Makefile.in
|
||||||
|
===================================================================
|
||||||
|
--- Makefile.in (revisión: 119)
|
||||||
|
+++ Makefile.in (copia de trabajo)
|
||||||
|
@@ -7,12 +7,12 @@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
-bindir = $(exec_prefix)/bin
|
||||||
|
-incldir= $(prefix)/include
|
||||||
|
-infodir = $(prefix)/info
|
||||||
|
-libdir = $(prefix)/lib
|
||||||
|
-mandir = $(prefix)/share/man
|
||||||
|
-docdir = $(prefix)/share/doc
|
||||||
|
+bindir = @bindir@
|
||||||
|
+incldir= @includedir@
|
||||||
|
+infodir = @infodir@
|
||||||
|
+libdir = @libdir@
|
||||||
|
+mandir = @mandir@
|
||||||
|
+docdir = @docdir@
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@ -Iinclude -Wall
|
||||||
|
Index: libssh/Makefile.in
|
||||||
|
===================================================================
|
||||||
|
--- libssh/Makefile.in (revisión: 119)
|
||||||
|
+++ libssh/Makefile.in (copia de trabajo)
|
||||||
|
@@ -12,11 +12,11 @@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
-bindir = $(exec_prefix)/bin
|
||||||
|
-incldir= $(prefix)/include
|
||||||
|
-infodir = $(prefix)/info
|
||||||
|
-libdir = $(prefix)/lib/
|
||||||
|
-mandir = $(prefix)/man/man1
|
||||||
|
+bindir = @bindir@
|
||||||
|
+incldir= @includedir@
|
||||||
|
+infodir = @infodir@
|
||||||
|
+libdir = @libdir@
|
||||||
|
+mandir = @mandir@/man1
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@ -Wall -g -I../include/
|
||||||
|
@@ -36,7 +36,7 @@
|
||||||
|
all: libssh.so
|
||||||
|
|
||||||
|
libssh.la: $(OBJECTS) libssh.vers
|
||||||
|
- $(LIBTOOL) --mode=link $(CC) -o libssh.la -export-dynamic -version-info $(LIBSSH_CURRENT):$(LIBSSH_REVISION):$(LIBSSH_AGE) -rpath $(libdir) $(OBJECTS:.o=.lo) $(LIBS) $(LIBSSH_LDFLAGS) $(LIBSSH_VERS) $(LDFLAGS)
|
||||||
|
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o libssh.la -export-dynamic -version-info $(LIBSSH_CURRENT):$(LIBSSH_REVISION):$(LIBSSH_AGE) -rpath $(libdir) $(OBJECTS:.o=.lo) $(LIBS) $(LIBSSH_LDFLAGS) $(LIBSSH_VERS)
|
||||||
|
|
||||||
|
libssh.so: libssh.la
|
||||||
|
libssh.a: libssh.la
|
1
libssh-rpmlintrc
Normal file
1
libssh-rpmlintrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
addFilter("libssh-2.* shlib-policy-name-error")
|
32
libssh.changes
Normal file
32
libssh.changes
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 7 21:19:07 CEST 2008 - aj@suse.de
|
||||||
|
|
||||||
|
- Disable parallel build since it breaks the build.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 30 14:02:58 CEST 2008 - ro@suse.de
|
||||||
|
|
||||||
|
- add rpmlintrc (desired package name is already taken by another
|
||||||
|
package)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 30 13:49:00 CEST 2008 - ro@suse.de
|
||||||
|
|
||||||
|
- fix debug package requires
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Sep 30 12:41:19 CEST 2008 - ro@suse.de
|
||||||
|
|
||||||
|
- fixed filelist
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Aug 21 11:26:29 CEST 2008 - anschneider@suse.de
|
||||||
|
|
||||||
|
- Map the permissions field to the type field for sftp v3.
|
||||||
|
- Add errno mapping for sftp functions
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Aug 20 16:08:57 CEST 2008 - anschneider@suse.de
|
||||||
|
|
||||||
|
- initial libssh2 package
|
||||||
|
|
179
libssh.spec
Normal file
179
libssh.spec
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
#
|
||||||
|
# spec file for package libssh (Version 0.2)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
# norootforbuild
|
||||||
|
|
||||||
|
Url: http://0xbadc0de.be/wiki/libssh:libssh
|
||||||
|
|
||||||
|
Name: libssh
|
||||||
|
BuildRequires: doxygen openssl-devel
|
||||||
|
License: LGPL v2.1 or later
|
||||||
|
Group: System/Libraries
|
||||||
|
Version: 0.2
|
||||||
|
Release: 3
|
||||||
|
Summary: SSH library
|
||||||
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
|
Source1: libssh-rpmlintrc
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
Patch00: libssh-paths.patch
|
||||||
|
Patch01: 0001-Map-permission-field-to-type-field.patch
|
||||||
|
Patch02: 0002-Add-errno-mapping.patch
|
||||||
|
%define debug_package_requires libssh-2 = %{version}-%{release}
|
||||||
|
|
||||||
|
%description
|
||||||
|
The ssh library was designed to be used by programmers needing a
|
||||||
|
working SSH implementation by the mean of a library. The complete
|
||||||
|
control of the client is made by the programmer. With libssh, you can
|
||||||
|
remotely execute programs, transfer files, use a secure and transparent
|
||||||
|
tunnel for your remote programs. With its Secure FTP implementation,
|
||||||
|
you can play with remote files easily, without third-party programs
|
||||||
|
others than libcrypto (from openssl).
|
||||||
|
|
||||||
|
This package provides libssh from http://0xbadc0de.be/ that should not
|
||||||
|
be confused with libssh2 available from http://www.libssh2.org (libssh2
|
||||||
|
package)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Aris Adamantiadis <aris@0xbadc0de.be>
|
||||||
|
Nick Zitzmann <seiryu@comcast.net>
|
||||||
|
|
||||||
|
%package -n libssh-2
|
||||||
|
License: LGPL v2.1 or later
|
||||||
|
Group: System/Libraries
|
||||||
|
Summary: SSH library
|
||||||
|
|
||||||
|
%description -n libssh-2
|
||||||
|
The ssh library was designed to be used by programmers needing a
|
||||||
|
working SSH implementation by the mean of a library. The complete
|
||||||
|
control of the client is made by the programmer. With libssh, you can
|
||||||
|
remotely execute programs, transfer files, use a secure and transparent
|
||||||
|
tunnel for your remote programs. With its Secure FTP implementation,
|
||||||
|
you can play with remote files easily, without third-party programs
|
||||||
|
others than libcrypto (from openssl).
|
||||||
|
|
||||||
|
This package provides libssh from http://0xbadc0de.be/ that should not
|
||||||
|
be confused with libssh2 available from http://www.libssh2.org (libssh2
|
||||||
|
package)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Aris Adamantiadis <aris@0xbadc0de.be>
|
||||||
|
Nick Zitzmann <seiryu@comcast.net>
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
License: LGPL v2.1 or later
|
||||||
|
Group: Development/Libraries/C and C++
|
||||||
|
Summary: SSH library development headers
|
||||||
|
Requires: libssh-2 = %{version}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Development headers for the SSH library.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Aris Adamantiadis <aris@0xbadc0de.be>
|
||||||
|
Nick Zitzmann <seiryu@comcast.net>
|
||||||
|
|
||||||
|
%package devel-doc
|
||||||
|
License: LGPL v2.1 or later
|
||||||
|
Group: Development/Languages/C and C++
|
||||||
|
Summary: SSH library api documentation
|
||||||
|
|
||||||
|
%description devel-doc
|
||||||
|
Documentation for libssh development.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Aris Adamantiadis <aris@0xbadc0de.be>
|
||||||
|
Nick Zitzmann <seiryu@comcast.net>
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
%patch00
|
||||||
|
%patch01 -p1
|
||||||
|
%patch02 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
autoreconf -fi
|
||||||
|
%configure \
|
||||||
|
--docdir=%{_docdir} \
|
||||||
|
--disable-static \
|
||||||
|
--with-pic
|
||||||
|
%{__make}
|
||||||
|
%{__make} doc
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{__make} DESTDIR=%{buildroot} install
|
||||||
|
%{__make} DESTDIR=%{buildroot} install-doc
|
||||||
|
|
||||||
|
%post -n libssh-2
|
||||||
|
/sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -n libssh-2
|
||||||
|
/sbin/ldconfig
|
||||||
|
|
||||||
|
%clean
|
||||||
|
%{__rm} -rf %{buildroot}
|
||||||
|
|
||||||
|
%files -n libssh-2
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_libdir}/libssh.so.*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc AUTHORS README CHANGELOG
|
||||||
|
%dir %{_includedir}/libssh/
|
||||||
|
%attr(0644,root,root) %{_includedir}/libssh/*
|
||||||
|
%{_libdir}/libssh.so
|
||||||
|
%exclude %{_libdir}/libssh.la
|
||||||
|
|
||||||
|
%files devel-doc
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%dir %{_docdir}/libssh
|
||||||
|
%dir %{_docdir}/libssh/html
|
||||||
|
%attr(0644,root,root) %{_docdir}/libssh/html/*
|
||||||
|
%dir %{_docdir}/libssh/examples
|
||||||
|
%attr(0644,root,root) %{_docdir}/libssh/examples/*
|
||||||
|
%attr(0644,root,root) %{_mandir}/man?/ssh_*
|
||||||
|
%exclude %{_mandir}/man?/buffer_struct.3*
|
||||||
|
%exclude %{_mandir}/man?/bug.3*
|
||||||
|
%exclude %{_mandir}/man?/deprecated.3*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Oct 07 2008 aj@suse.de
|
||||||
|
- Disable parallel build since it breaks the build.
|
||||||
|
* Tue Sep 30 2008 ro@suse.de
|
||||||
|
- add rpmlintrc (desired package name is already taken by another
|
||||||
|
package)
|
||||||
|
* Tue Sep 30 2008 ro@suse.de
|
||||||
|
- fix debug package requires
|
||||||
|
* Tue Sep 30 2008 ro@suse.de
|
||||||
|
- fixed filelist
|
||||||
|
* Thu Aug 21 2008 anschneider@suse.de
|
||||||
|
- Map the permissions field to the type field for sftp v3.
|
||||||
|
- Add errno mapping for sftp functions
|
||||||
|
* Wed Aug 20 2008 anschneider@suse.de
|
||||||
|
- initial libssh2 package
|
Loading…
Reference in New Issue
Block a user