Displaying 18 results from an estimated 18 matches for "ssh2_fx_ok".
2002 Mar 15
4
PATCH: sftp-server logging.
...t passwd *upw;
+ uid_t cuid;
+ pid_t ppid;
+ char *cuname;
+ #endif
+
/* portable attibutes, etc. */
typedef struct Stat Stat;
***************
*** 93,98 ****
--- 102,126 ----
return ret;
}
+ #ifdef SFTP_LOGGING
+ char*
+ status_to_logstr(int status)
+ {
+ switch (status) {
+ case SSH2_FX_OK:
+ return "Successful";
+ case SSH2_FX_NO_SUCH_FILE:
+ return "No such file or directory";
+ case SSH2_FX_PERMISSION_DENIED:
+ return "Permission denied.";
+ case SSH2_FX_BAD_MESSAGE:
+ return "Bad message";
+ default:
+ return "Un...
2007 Nov 11
1
ftp-server patch - restrict user to directory
...; 0) {
- closedir(dirp);
+
+ if(allowed_access(path, "opendir")) { /* RestrictDirectory ? */
+ logit("opendir \"%s\"", path);
+ dirp = opendir(path);
+ if (dirp == NULL) {
+ status = errno_to_portable(errno);
} else {
- send_handle(id, handle);
- status = SSH2_FX_OK;
+ handle = handle_new(HANDLE_DIR, path, 0, dirp);
+ if (handle < 0) {
+ closedir(dirp);
+ } else {
+ send_handle(id, handle);
+ status = SSH2_FX_OK;
+ }
}
+ } else
+ status = errno_to_portable(EPERM);
- }
if (status != SSH2_FX_OK)
send_status(id, status);
xfree(pat...
2004 Apr 05
9
link(2) to rename files in sftp
Is there an alternative to using link(2) to rename files in sftp-server?
Some users use sftp to upload files to a vfat partition on an sftp-server,
and then renaming doesn't work. This breaks konqueror, for example (from KDE,
which u), which upload files first with a ".part" extension and then renames
them removing this extension.
2003 Feb 05
2
Minor races in sftp-server.c
...;
oldpath = get_string(NULL);
newpath = get_string(NULL);
TRACE("rename id %u old %s new %s", id, oldpath, newpath);
/* fail if 'newpath' exists */
- if (stat(newpath, &st) == -1) {
- ret = rename(oldpath, newpath);
- status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
- }
+ if (link(oldpath, newpath) == -1)
+ status = errno_to_portable(errno);
+ else if (unlink(oldpath) == -1) {
+ status = errno_to_portable(errno);
+ /* clean spare link */
+ unlink(newpath);
+ } else
+ status = SSH2_FX_OK;
send_status(id, status);
xfree(oldpath);
xfree(newpath);
@@ -...
2006 May 15
1
[PATCH 8/12] openssh-4.3p2 return code check bugs
...ver.c 2006-05-08 15:42:04.795120304 -0500
@@ -408,9 +408,12 @@ process_close(void)
id = get_int();
handle = get_handle();
+ if (handle < 0)
+ goto out;
TRACE("close id %u handle %d", id, handle);
ret = handle_close(handle);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
+out:
send_status(id, status);
}
@@ -424,6 +427,8 @@ process_read(void)
id = get_int();
handle = get_handle();
+ if (handle < 0)
+ goto out;
off = get_int64();
len = get_int();
@@ -450,6 +455,7 @@ process_read(void)
}
}
}
+out:
if (status != SSH2_FX_OK)
send_stat...
2017 Sep 06
2
Disallow some sftp commands
...egards.
Ren?.
Patch below :
Note : This patch was written to be used on Centos6.9 which is using an
old openssh version.
diff openssh-5.3p1/sftp-server.c openssh-5.3p1.patched/sftp-server.c
949a950
993,994c1001,1004
< ret = rmdir(name);
< status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
---
> /*ret = rmdir(name);
> status = (ret == -1) ? errno_to_portable(errno) :
SSH2_FX_OK;
> */
> status = SSH2_FX_OK;
1040a1051,1053
> else if (S_ISDIR(sb.st_mode)) {
> status = SSH2_FX_OK;
> }
2002 Nov 05
2
[PATCH] fix sftp to preserve permissions and uid/gid
...d. Added code so that if is running
as root, uid and gid are preserved.
patch is based on Openssh 3.4p1.
*** sftp-client.c@@\main\1 Tue Oct 1 17:26:20 2002
--- sftp-client.c Tue Nov 5 10:22:52 2002
***************
*** 666,672 ****
status = get_status(conn->fd_in, id);
if (status != SSH2_FX_OK)
! error("Couldn't rename file \"%s\" to \"%s\": %s", oldpath,
newpath, fx2txt(status));
return(status);
--- 666,672 ----
status = get_status(conn->fd_in, id);
if (status != SSH2_FX_OK)
! error("Couldn't symlink file \"%s...
2001 May 24
1
chroot sftp-server [PATCH]
I'm working on setting up a semi-trusted sftp service, and to get it
working, I need chroot capability.
I've taken the /./ wuftpd magic token code from contrib/chroot.diff and
put it into the sftp server. The main problem is that privileges have
been dropped by the time the subsystem is exec'ed, so my patch requires
that sftp-server be setuid root. Not ideal, I know, but I drop all
2001 Jun 20
1
SFTP Logging Redux.
...tus = SSH2_FX_FAILURE;
} else {
@@ -790,6 +823,7 @@
id = get_int();
name = get_string(NULL);
TRACE("remove id %d name %s", id, name);
+ log("(%d/%d/%s) File deleted: %s", ppid, cuid, CUNAME, name);
ret = unlink(name);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
send_status(id, status);
@@ -810,6 +844,7 @@
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
a->perm & 0777 : 0777;
TRACE("mkdir id %d name %s mode 0%o", id, name, mode);
+ log("(%d/%d/%s) Directory created: %s", ppid, cuid, CUNAME, name);
ret =...
2002 Nov 05
0
[PATCH] Add readonly mode to scp, sftp_server
...- 816,826 ----
id = get_int();
name = get_string(NULL);
+ if (readonly) {
+ status = SSH2_FX_PERMISSION_DENIED;
+ send_status(id, status);
+ return;
+ }
TRACE("remove id %u name %s", id, name);
ret = unlink(name);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
***************
*** 820,825 ****
--- 839,849 ----
id = get_int();
name = get_string(NULL);
a = get_attrib();
+ if (readonly) {
+ status = SSH2_FX_PERMISSION_DENIED;
+ send_status(id, status);
+ return;
+ }
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
a->...
2009 Feb 12
2
[patch 1/3] add protocol extension to ATTR message
...e SSH2_FXE_EXTATTR_ATIME 0x00000040
+#define SSH2_FXE_EXTATTR_ATIMENSEC 0x00000080
+#define SSH2_FXE_EXTATTR_MTIME 0x00000100
+#define SSH2_FXE_EXTATTR_MTIMENSEC 0x00000200
+#define SSH2_FXE_EXTATTR_CTIME 0x00000400
+#define SSH2_FXE_EXTATTR_CTIMENSEC 0x00000800
+
/* status messages */
#define SSH2_FX_OK 0
#define SSH2_FX_EOF 1
Index: ssh/sftp-client.c
===================================================================
--- ssh.orig/sftp-client.c 2009-02-12 14:11:30.000000000 +0100
+++ ssh/sftp-client.c 2009-02-12 14:11:37.000000000 +0100
@@ -1201,6 +1201,7 @@ do_upload(struct sftp_conn *conn,...
2002 Nov 05
0
[PATCH] Add getlink command to sftp
...ssages that already exist in the protocol between client and
server.
This diff is based on OpenSSH 3.4p1.
*** sftp-client.c@@\main\1 Tue Oct 1 17:26:20 2002
--- sftp-client.c Wed Oct 23 15:57:34 2002
***************
*** 666,672 ****
status = get_status(conn->fd_in, id);
if (status != SSH2_FX_OK)
! error("Couldn't rename file \"%s\" to \"%s\": %s", oldpath,
newpath, fx2txt(status));
return(status);
--- 666,672 ----
status = get_status(conn->fd_in, id);
if (status != SSH2_FX_OK)
! error("Couldn't symlink file \"%s...
2009 Feb 12
2
[patch] hard link protocol extension for sftp
...oldpath);
+ buffer_put_cstring(&msg, newpath);
+ send_msg(conn->fd_out, &msg);
+ debug3("Sent message link at openssh.com \"%s\" -> \"%s\"",
+ oldpath, newpath);
+ buffer_free(&msg);
+
+ status = get_status(conn->fd_in, id);
+ if (status != SSH2_FX_OK)
+ error("Couldn't link file \"%s\" to \"%s\": %s", oldpath,
+ newpath, fx2txt(status));
+
+ return(status);
}
int
Index: ssh/sftp-client.h
===================================================================
--- ssh.orig/sftp-client.h 2009-02-10 14:54:58....
2004 Oct 25
1
Bug in sftp's chmod
Hi,
I've discovered that on OpenSSH_3.6.1p1 (the latest SSH available on
OSX, but I've also tried a couple of different linux distributions),
when you 'sftp' to it, and try to 'chmod' some file or directory, only
last three octal digits do actually matter.
Example:
sftp sshtest at localhost
Connecting to localhost...
sshtest at localhost's password:
sftp> ls -l
2006 Aug 19
0
[PATCH] add atomic rename extension to sftp-server
...g(NULL);
+ debug3("request %u: posix-rename", id);
+ logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath);
+ if (rename(oldpath, newpath) == -1)
+ send_status(id, errno_to_portable(errno));
+ else
+ send_status(id, SSH2_FX_OK);
+ xfree(oldpath);
+ xfree(newpath);
+}
+
+static void
process_extended(void)
{
u_int32_t id;
@@ -1096,6 +1113,8 @@ process_extended(void)
request = get_string(NULL);
if (strcmp(request, "statfs at openssh.org") == 0)
process_extended_statfs(id);
+ if (strcmp(request, "po...
2002 Jan 06
3
sftp/scp performance testing
Folks, I've noticed poor performance using sftp. If anyone has any
advice on how to improve performance, I'd like to hear it. Test simply
involved transferring a single 143MB MP3 file using defaults for all the
program configs. The opensshd 3.0.2p1 server is used in all tests.
Software:
openssh suite 3.0.2p1
psftp (putty sftp client) latest dev snapshot
pscp (putty scp client) latest
2012 Oct 23
4
Disable rm on sftp
...tus = SSH2_FX_FAILURE;
int ret;
id = get_int();
name = get_string(NULL);
debug3("request %u: remove", id);
logit("remove name \"%s\"", name);
if (readonly)
status = SSH2_FX_PERMISSION_DENIED;
else {
ret = unlink(name);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
}
send_status(id, status);
xfree(name);
}
To :
static void
process_remove(void)
{
char *name;
u_int32_t id;
int status = SSH2_FX_FAILURE;
int ret;
id = get_int();
name = get_string(NULL);
debug3("request %u: remove", id);
logit("remove name \"%s\"", name);
status...
2007 Dec 07
2
[PATCH] add statfs extension to sftp-server
And while we are at it, can you please comment on these patches as
well, originally submitted around one year ago.
Oh, and I think we can agree, that the secsh-filexfer standardization
is dead, so there's not much point in trying to support newer protocol
versions, which don't have statfs anyway.
Thanks,
Miklos
-----
This is needed to be able to support statfs operation on an SSH