]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - psftp.c
It's a new year.
[PuTTY.git] / psftp.c
diff --git a/psftp.c b/psftp.c
index c7a8486bb2a8192041a55c8619fa58b2fddf803b..1d331603cbf7f5ea67a641466ce1eba546c9d670 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -668,21 +668,19 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
     if (restart) {
        char decbuf[30];
        struct fxp_attrs attrs;
-       int ret;
 
        req = fxp_fstat_send(fh);
         pktin = sftp_wait_for_reply(req);
        ret = fxp_fstat_recv(pktin, req, &attrs);
 
        if (!ret) {
-           close_rfile(file);
            printf("read size of %s: %s\n", outfname, fxp_error());
-           return 0;
+            goto cleanup;
        }
        if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
-           close_rfile(file);
            printf("read size of %s: size was not given\n", outfname);
-           return 0;
+            ret = 0;
+            goto cleanup;
        }
        offset = attrs.size;
        uint64_decimal(offset, decbuf);
@@ -735,6 +733,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
 
     xfer_cleanup(xfer);
 
+  cleanup:
     req = fxp_close_send(fh);
     pktin = sftp_wait_for_reply(req);
     fxp_close_recv(pktin, req);
@@ -1035,6 +1034,7 @@ int sftp_cmd_ls(struct sftp_command *cmd)
        char *tmpdir;
        int len, check;
 
+        sfree(unwcdir);
        wildcard = stripslashes(dir, 0);
        unwcdir = dupstr(dir);
        len = wildcard - dir;
@@ -1257,7 +1257,9 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple)
            fname = canonify(origwfname);
 
            if (!fname) {
+                sftp_finish_wildcard_matching(swcm);
                printf("%s: canonify: %s\n", origwfname, fxp_error());
+               sfree(origwfname);
                sfree(unwcfname);
                return 0;
            }
@@ -2233,6 +2235,7 @@ struct sftp_command *sftp_getcmd(FILE *fp, int mode, int modeflags)
        cmd->obey = sftp_cmd_quit;
        if ((mode == 0) || (modeflags & 1))
            printf("quit\n");
+        sfree(line);
        return cmd;                    /* eof */
     }
 
@@ -2475,6 +2478,18 @@ void modalfatalbox(char *fmt, ...)
 
     cleanup_exit(1);
 }
+void nonfatal(char *fmt, ...)
+{
+    char *str, *str2;
+    va_list ap;
+    va_start(ap, fmt);
+    str = dupvprintf(fmt, ap);
+    str2 = dupcat("Error: ", str, "\n", NULL);
+    sfree(str);
+    va_end(ap);
+    fputs(str2, stderr);
+    sfree(str2);
+}
 void connection_fatal(void *frontend, char *fmt, ...)
 {
     char *str, *str2;
@@ -2652,9 +2667,11 @@ static void usage(void)
     printf("  -1 -2     force use of particular SSH protocol version\n");
     printf("  -4 -6     force use of IPv4 or IPv6\n");
     printf("  -C        enable compression\n");
-    printf("  -i key    private key file for authentication\n");
+    printf("  -i key    private key file for user authentication\n");
     printf("  -noagent  disable use of Pageant\n");
     printf("  -agent    enable use of Pageant\n");
+    printf("  -hostkey aa:bb:cc:...\n");
+    printf("            manually specify a host key (may be repeated)\n");
     printf("  -batch    disable all interactive prompts\n");
     cleanup_exit(1);
 }
@@ -2706,6 +2723,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
            /* Use `host' as a bare hostname. */
            conf_set_str(conf, CONF_host, host);
        }
+        conf_free(conf2);
     } else {
        /* Patch in hostname `host' to session details. */
        conf_set_str(conf, CONF_host, host);
@@ -2868,6 +2886,9 @@ void cmdline_error(char *p, ...)
     exit(1);
 }
 
+const int share_can_be_downstream = TRUE;
+const int share_can_be_upstream = FALSE;
+
 /*
  * Main program. Parse arguments etc.
  */