summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
authordjm <djm>2003-01-14 11:24:47 +0000
committerdjm <djm>2003-01-14 11:24:47 +0000
commit0072c74a2ed4a07d871c3f707e9861e5aaa4271d (patch)
treeccd118c97c4838910e9c4f65abdd2bf98b2f43f9 /sftp-client.c
parent588c8578d1657c5d807ce0fa2708cfc4d68edd7a (diff)
downloadopenssh-0072c74a2ed4a07d871c3f707e9861e5aaa4271d.tar.gz
- djm@cvs.openbsd.org 2003/01/14 10:58:00
[sftp-client.c sftp-int.c] Don't try to upload or download non-regular files. Report from apoloval@pantuflo.escet.urjc.es; ok markus@
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 3fac22be..8c12dae1 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
/* XXX: copy between two remote sites */
#include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.40 2003/01/10 08:48:15 djm Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.41 2003/01/14 10:58:00 djm Exp $");
#include "openbsd-compat/sys-queue.h"
@@ -767,8 +767,8 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
mode = 0666;
if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) &&
- (a->perm & S_IFDIR)) {
- error("Cannot download a directory: %s", remote_path);
+ (!S_ISREG(a->perm))) {
+ error("Cannot download non-regular file: %s", remote_path);
return(-1);
}
@@ -1002,6 +1002,11 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
close(local_fd);
return(-1);
}
+ if (!S_ISREG(sb.st_mode)) {
+ error("%s is not a regular file", local_path);
+ close(local_fd);
+ return(-1);
+ }
stat_to_attrib(&sb, &a);
a.flags &= ~SSH2_FILEXFER_ATTR_SIZE;