summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--sftp.c24
2 files changed, 16 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c5a374dc..82b1d8024 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,11 @@
44 [readconf.c readconf.h sshconnect2.c] 44 [readconf.c readconf.h sshconnect2.c]
45 promote rekeylimit to a int64 so it can hold the maximum useful limit 45 promote rekeylimit to a int64 so it can hold the maximum useful limit
46 of 2^32; report and patch from Jan.Pechanec AT Sun.COM, ok dtucker@ 46 of 2^32; report and patch from Jan.Pechanec AT Sun.COM, ok dtucker@
47 - djm@cvs.openbsd.org 2008/01/20 00:38:30
48 [sftp.c]
49 When uploading, correctly handle the case of an unquoted filename with
50 glob metacharacters that match a file exactly but not as a glob, e.g. a
51 file called "[abcd]". report and test cases from duncan2nd AT gmx.de
47 52
4820080119 5320080119
49 - (djm) Silence noice from expr in ssh-copy-id; patch from 54 - (djm) Silence noice from expr in ssh-copy-id; patch from
@@ -3572,4 +3577,4 @@
3572 OpenServer 6 and add osr5bigcrypt support so when someone migrates 3577 OpenServer 6 and add osr5bigcrypt support so when someone migrates
3573 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 3578 passwords between UnixWare and OpenServer they will still work. OK dtucker@
3574 3579
3575$Id: ChangeLog,v 1.4828 2008/02/10 11:25:52 djm Exp $ 3580$Id: ChangeLog,v 1.4829 2008/02/10 11:26:24 djm Exp $
diff --git a/sftp.c b/sftp.c
index db0a8d9af..861c3db05 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.98 2007/12/12 05:04:03 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.99 2008/01/20 00:38:30 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -434,17 +434,6 @@ is_dir(char *path)
434} 434}
435 435
436static int 436static int
437is_reg(char *path)
438{
439 struct stat sb;
440
441 if (stat(path, &sb) == -1)
442 fatal("stat %s: %s", path, strerror(errno));
443
444 return(S_ISREG(sb.st_mode));
445}
446
447static int
448remote_is_dir(struct sftp_conn *conn, char *path) 437remote_is_dir(struct sftp_conn *conn, char *path)
449{ 438{
450 Attrib *a; 439 Attrib *a;
@@ -532,6 +521,7 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
532 glob_t g; 521 glob_t g;
533 int err = 0; 522 int err = 0;
534 int i; 523 int i;
524 struct stat sb;
535 525
536 if (dst) { 526 if (dst) {
537 tmp_dst = xstrdup(dst); 527 tmp_dst = xstrdup(dst);
@@ -540,7 +530,7 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
540 530
541 memset(&g, 0, sizeof(g)); 531 memset(&g, 0, sizeof(g));
542 debug3("Looking up %s", src); 532 debug3("Looking up %s", src);
543 if (glob(src, 0, NULL, &g)) { 533 if (glob(src, GLOB_NOCHECK, NULL, &g)) {
544 error("File \"%s\" not found.", src); 534 error("File \"%s\" not found.", src);
545 err = -1; 535 err = -1;
546 goto out; 536 goto out;
@@ -555,7 +545,13 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
555 } 545 }
556 546
557 for (i = 0; g.gl_pathv[i] && !interrupted; i++) { 547 for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
558 if (!is_reg(g.gl_pathv[i])) { 548 if (stat(g.gl_pathv[i], &sb) == -1) {
549 err = -1;
550 error("stat %s: %s", g.gl_pathv[i], strerror(errno));
551 continue;
552 }
553
554 if (!S_ISREG(sb.st_mode)) {
559 error("skipping non-regular file %s", 555 error("skipping non-regular file %s",
560 g.gl_pathv[i]); 556 g.gl_pathv[i]);
561 continue; 557 continue;