Displaying 20 results from an estimated 57 matches for "oldpath".
Did you mean:
ldpath
2003 Feb 05
2
Minor races in sftp-server.c
There are a couple of races in sftp-server as this patch shows:
--- sftp-server.c 28 Jan 2003 18:06:53 -0000 1.1.1.2
+++ sftp-server.c 5 Feb 2003 19:19:42 -0000
@@ -832,19 +832,22 @@
process_rename(void)
{
u_int32_t id;
- struct stat st;
char *oldpath, *newpath;
- int ret, status = SSH2_FX_FAILURE;
+ int status;
id = get_int();
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...
2009 Feb 12
2
[patch] hard link protocol extension for sftp
...ts |= SFTP_EXT_LINK;
+ known = 1;
}
if (known) {
debug2("Server supports extension \"%s\" revision %s",
@@ -731,6 +736,39 @@ do_rename(struct sftp_conn *conn, char *
newpath, fx2txt(status));
return(status);
+}
+
+int
+do_link(struct sftp_conn *conn, char *oldpath, char *newpath)
+{
+ Buffer msg;
+ u_int status, id;
+
+ buffer_init(&msg);
+
+ /* Send link request */
+ id = conn->msg_id++;
+ if ((conn->exts & SFTP_EXT_LINK) == 0) {
+ error("Server does not support link at openssh.com extension");
+ return -1;
+ }
+
+ buffer_put_char(...
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
2007 Nov 11
1
ftp-server patch - restrict user to directory
...dname) == NULL) {
+ send_status(id, errno_to_portable(errno));
+ } else {
+ Stat s;
+ attrib_clear(&s.attrib);
+ s.name = s.long_name = resolvedname;
+ send_names(id, 1, &s);
+ }
+ } else
+ send_status(id, errno_to_portable(EPERM));
+
xfree(path);
}
@@ -982,6 +1144,14 @@
oldpath = get_string(NULL);
newpath = get_string(NULL);
debug3("request %u: rename", id);
+
+ if( ! allowed_access(oldpath, "rename") || ! allowed_access(newpath, "rename")) { /* RestrictDirectory ? */
+ send_status(id, errno_to_portable(EPERM));
+ xfree(oldpath);
+ xfr...
2002 Mar 15
4
PATCH: sftp-server logging.
...K;
! #ifdef SFTP_LOGGING
! log("(%d/%d/%s) Directory deleted: %s.", ppid, cuid, CUNAME, name);
! #endif
! }
send_status(id, status);
xfree(name);
}
***************
*** 885,891 ****
/* fail if 'newpath' exists */
if (stat(newpath, &st) == -1) {
ret = rename(oldpath, newpath);
! status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
}
send_status(id, status);
xfree(oldpath);
--- 1037,1057 ----
/* fail if 'newpath' exists */
if (stat(newpath, &st) == -1) {
ret = rename(oldpath, newpath);
! if (ret == -1) {
! status =...
2014 Jan 01
0
Soft chroot jail for sftp-server
...FAILURE);
> else {
> s.name = s.long_name = jailed_resolvedname;
> send_names(id, 1, &s);
> }
> free(jailed_resolvedname);
> }
> else {
> s.name = s.long_name = resolvedname;
> send_names(id, 1, &s);
> }
>
1070a1249,1250
> oldpath = jail_to_actual(oldpath);
> newpath = jail_to_actual(newpath);
1131a1312
> path = jail_to_actual(path);
1156a1338,1339
> oldpath = jail_to_actual(oldpath);
> newpath = jail_to_actual(newpath);
1178a1362,1363
> oldpath = jail_to_actual(oldpath);
> newpath = jail_to_actual(ne...
2001 Jun 20
1
SFTP Logging Redux.
..._int();
name = get_string(NULL);
TRACE("rmdir id %d name %s", id, name);
+ log("(%d/%d/%s) Directory deleted: %s", ppid, cuid, CUNAME, name);
ret = rmdir(name);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
send_status(id, status);
@@ -869,6 +905,7 @@
oldpath = get_string(NULL);
newpath = get_string(NULL);
TRACE("rename id %d old %s new %s", id, oldpath, newpath);
+ log("(%d/%d/%s) File/Dir renamed: %s -> %s", ppid, cuid, CUNAME, oldpath, newpath);
/* fail if 'newpath' exists */
if (stat(newpath, &st) == -1) {...
2006 Aug 19
0
[PATCH] add atomic rename extension to sftp-server
...===========================================
--- ssh.orig/sftp-server.c 2006-08-19 16:49:03.000000000 +0200
+++ ssh/sftp-server.c 2006-08-19 16:51:26.000000000 +0200
@@ -1087,6 +1087,23 @@ process_extended_statfs(u_int32_t id)
}
static void
+process_extended_posix_rename(u_int32_t id)
+{
+ char *oldpath, *newpath;
+
+ oldpath = get_string(NULL);
+ newpath = get_string(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...
2013 Jun 04
1
[PATCH] add restricted mode to sftp-server
Hello.
These patches add a new mode of operation for the sftp server.
It is located between the ordinary, unrestricted mode and read-only mode.
It allows you to add files to the server, but only if these files do
not exist on the server before.
Changes to existing files - are prohibited.
Please review them, maybe these patches will be useful not only to me.
Thank you.
-------------- next part
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.
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
2019 Jan 18
0
[klibc:master] rename, renameat: Use renameat2() system call
...har *, mode_t, dev_t);
<?> int mknodat(int, const char *, mode_t, dev_t);
<?> int chmod(const char *, mode_t);
diff --git a/usr/klibc/rename.c b/usr/klibc/rename.c
index 587c26f..d76b739 100644
--- a/usr/klibc/rename.c
+++ b/usr/klibc/rename.c
@@ -5,7 +5,7 @@
int rename(const char *oldpath, const char *newpath)
{
- return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath);
+ return renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
}
#endif /* __NR_rename */
diff --git a/usr/klibc/renameat.c b/usr/klibc/renameat.c
new file mode 100644
index 0000000..10c8882
--- /dev/null
+++ b/usr/...
2002 Nov 05
0
[PATCH] Add readonly mode to scp, sftp_server
...{
+ status = SSH2_FX_PERMISSION_DENIED;
+ send_status(id, status);
+ return;
+ }
TRACE("rmdir id %u name %s", id, name);
ret = rmdir(name);
status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
***************
*** 881,886 ****
--- 910,920 ----
id = get_int();
oldpath = get_string(NULL);
newpath = get_string(NULL);
+ if (readonly) {
+ status = SSH2_FX_PERMISSION_DENIED;
+ send_status(id, status);
+ return;
+ }
TRACE("rename id %u old %s new %s", id, oldpath, newpath);
/* fail if 'newpath' exists */
if (stat(newpath, &st)...
2002 Nov 05
0
[PATCH] Add getlink command to sftp
....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\" to \"%s\": %s", oldpath,
newpath, fx2txt(status));
return(sta...
2004 May 04
2
[Bug 861] Swapped parameters of SSH_FXP_SYMLINK packet of SFTP protocol
....
Can you confirm this?
http://www.openssh.org/txt/draft-ietf-secsh-filexfer-02.txt
The SSH_FXP_SYMLINK request will create a symbolic link on the
server. It is of the following format
uint32 id
string linkpath
string targetpath
The latest (CVS) sftp-server.c:
873: oldpath = get_string(NULL);
874: newpath = get_string(NULL);
875: TRACE("symlink id %u old %s new %s", id, oldpath, newpath);
876: /* this will fail if 'newpath' exists */
877: ret = symlink(oldpath, newpath);
The same bug is obviously even in OpenSSH SFTP client:
The latest...
2002 Nov 05
2
[PATCH] fix sftp to preserve permissions and uid/gid
....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\" to \"%s\": %s", oldpath,
newpath, fx2txt(status));
return(sta...
2018 Jul 17
1
[PATCH klibc 1/2] rename, renameat: Use renameat2() system call
...od.o poll.o rename.o renameat.o \
+ stat.o \
lchown.o link.o rmdir.o unlink.o utimes.o lstat.o mkdir.o \
readlink.o select.o symlink.o pipe.o \
ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \
--- a/usr/klibc/rename.c
+++ b/usr/klibc/rename.c
@@ -5,7 +5,7 @@
int rename(const char *oldpath, const char *newpath)
{
- return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath);
+ return renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
}
#endif /* __NR_rename */
--- /dev/null
+++ b/usr/klibc/renameat.c
@@ -0,0 +1,12 @@
+#include <fcntl.h>
+#include <stdio.h>
+
+#ifndef __NR...
2013 Oct 09
0
[PATCH 1/1] Porting klibc to AArch64
...mov x0, sp
+ mov x1, #0
bl __libc_init
.size _start,.-_start
diff --git a/usr/klibc/arch/aarch64/link.c b/usr/klibc/arch/aarch64/link.c
index 7a04e27..f1dedfb 100644
--- a/usr/klibc/arch/aarch64/link.c
+++ b/usr/klibc/arch/aarch64/link.c
@@ -3,5 +3,5 @@
int link(const char *oldpath, const char *newpath)
{
- return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath);
+ return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
}
diff --git a/usr/klibc/arch/aarch64/mknod.c b/usr/klibc/arch/aarch64/mknod.c
index 61836e4..cf7aca2 100644
--- a/usr/klibc/arch/aarch64/mknod.c
+++ b/...
2013 Nov 08
0
[PATCH 2/3] syscalls: Add syscalls needed by arm64
...ndif /* __NR_lchown */
diff --git a/usr/klibc/link.c b/usr/klibc/link.c
new file mode 100644
index 0000000..1d4b70e
--- /dev/null
+++ b/usr/klibc/link.c
@@ -0,0 +1,12 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#ifndef __NR_link
+
+int link(const char *oldpath, const char *newpath)
+{
+ return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
+}
+
+#endif /* __NR_link */
diff --git a/usr/klibc/lstat.c b/usr/klibc/lstat.c
new file mode 100644
index 0000000..0282eec
--- /dev/null
+++ b/usr/klibc/lstat.c
@@ -0,0 +1,17 @@
+#include <fcntl.h>
+#include...
2013 Nov 12
0
[klibc:master] syscalls: Add syscalls needed by arm64
...ndif /* __NR_lchown */
diff --git a/usr/klibc/link.c b/usr/klibc/link.c
new file mode 100644
index 0000000..1d4b70e
--- /dev/null
+++ b/usr/klibc/link.c
@@ -0,0 +1,12 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#ifndef __NR_link
+
+int link(const char *oldpath, const char *newpath)
+{
+ return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
+}
+
+#endif /* __NR_link */
diff --git a/usr/klibc/lstat.c b/usr/klibc/lstat.c
new file mode 100644
index 0000000..3288a33
--- /dev/null
+++ b/usr/klibc/lstat.c
@@ -0,0 +1,14 @@
+#include <fcntl.h>
+#include...