]> andersk Git - openssh.git/blobdiff - scp.c
- (stevesk) [auth1.c] fix password auth for protocol 1 when
[openssh.git] / scp.c
diff --git a/scp.c b/scp.c
index e603646b6ad68fa3373fb7dcfeb62ddfca1bb8a2..83e7769d6458380b2a3ba0f59e697c51c79a524c 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.84 2001/09/19 19:24:19 stevesk Exp $");
+RCSID("$OpenBSD: scp.c,v 1.86 2001/12/05 03:56:39 itojun Exp $");
 
 #include "xmalloc.h"
 #include "atomicio.h"
@@ -503,6 +503,11 @@ source(argc, argv)
                len = strlen(name);
                while (len > 1 && name[len-1] == '/')
                        name[--len] = '\0';
+               if (strchr(name, '\n') != NULL) {
+                       run_err("%s: skipping, filename contains a newline",
+                           name);
+                       goto next;
+               }
                if ((fd = open(name, O_RDONLY, 0)) < 0)
                        goto syserr;
                if (fstat(fd, &stb) < 0) {
@@ -543,14 +548,13 @@ syserr:                   run_err("%s: %s", name, strerror(errno));
 #ifdef HAVE_LONG_LONG_INT
                snprintf(buf, sizeof buf, "C%04o %lld %s\n",
                    (u_int) (stb.st_mode & FILEMODEMASK),
-                   (long long) stb.st_size, last);
+                   (long long)stb.st_size, last);
 #else
                /* XXX: Handle integer overflow? */
                snprintf(buf, sizeof buf, "C%04o %lu %s\n",
                    (u_int) (stb.st_mode & FILEMODEMASK),
                    (u_long) stb.st_size, last);
 #endif
-
                if (verbose_mode) {
                        fprintf(stderr, "Sending file modes: %s", buf);
                        fflush(stderr);
@@ -925,7 +929,7 @@ screwup:
 }
 
 int
-response()
+response(void)
 {
        char ch, *cp, resp, rbuf[2048];
 
@@ -958,7 +962,7 @@ response()
 }
 
 void
-usage()
+usage(void)
 {
        (void) fprintf(stderr,
            "usage: scp [-pqrvBC46] [-F config] [-S ssh] [-P port] [-c cipher] [-i identity]\n"
@@ -1035,7 +1039,7 @@ allocbuf(bp, fd, blksize)
        int fd, blksize;
 {
        size_t size;
-#ifdef HAVE_ST_BLKSIZE
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
        struct stat stb;
 
        if (fstat(fd, &stb) < 0) {
@@ -1047,9 +1051,9 @@ allocbuf(bp, fd, blksize)
        else
                size = blksize + (stb.st_blksize - blksize % stb.st_blksize) %
                    stb.st_blksize;
-#else /* HAVE_ST_BLKSIZE */
+#else /* HAVE_STRUCT_STAT_ST_BLKSIZE */
        size = blksize;
-#endif /* HAVE_ST_BLKSIZE */
+#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
        if (bp->cnt >= size)
                return (bp);
        if (bp->buf == NULL)
This page took 0.032862 seconds and 4 git commands to generate.