]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2001/02/06 23:30:28
authormouring <mouring>
Fri, 9 Feb 2001 02:58:04 +0000 (02:58 +0000)
committermouring <mouring>
Fri, 9 Feb 2001 02:58:04 +0000 (02:58 +0000)
     [sftp-client.c]
     replace arc4random with counter for request ids; ok markus@

ChangeLog
sftp-client.c

index 92920984183e540061a8c2ec147c5f758668a81e..1566a75eab5772a22932d8a8ca47861da04b4f7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      [ssh.c]
      reorder -{1,2,4,6} options. ok markus@
  - (bal) Missing 'const' in readpass.h
+ - (bal) OpenBSD Sync (so at least the thing compiles for 2.3.2 =)
+   - djm@cvs.openbsd.org 2001/02/06 23:30:28
+     [sftp-client.c]
+     replace arc4random with counter for request ids; ok markus@
 
 20010208
  - (djm) Don't delete external askpass program in make uninstall target.
index e4282384147fea5e906cf3df401c3e81c10d02b9..e8b9007fecad45e38580bd87a997fd139020522a 100644 (file)
@@ -29,7 +29,7 @@
 /* XXX: copy between two remote sites */
 
 #include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.3 2001/02/04 15:32:25 stevesk Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.4 2001/02/06 23:30:28 djm Exp $");
 
 #include "ssh.h"
 #include "buffer.h"
@@ -48,6 +48,9 @@ RCSID("$OpenBSD: sftp-client.c,v 1.3 2001/02/04 15:32:25 stevesk Exp $");
 /* XXX: what should this be? */
 #define COPY_SIZE      8192
 
+/* Message ID */
+static u_int msg_id = 1;
+
 void
 send_msg(int fd, Buffer *m)
 {
@@ -255,7 +258,7 @@ do_close(int fd_in, int fd_out, char *handle, u_int handle_len)
 
        buffer_init(&msg);
 
-       id = arc4random();
+       id = msg_id++;
        buffer_put_char(&msg, SSH2_FXP_CLOSE);
        buffer_put_int(&msg, id);
        buffer_put_string(&msg, handle, handle_len);
@@ -278,7 +281,7 @@ do_ls(int fd_in, int fd_out, char *path)
        u_int type, id, handle_len, i, expected_id;
        char *handle;
 
-       id = arc4random();
+       id = msg_id++;
 
        buffer_init(&msg);
        buffer_put_char(&msg, SSH2_FXP_OPENDIR);
@@ -295,7 +298,7 @@ do_ls(int fd_in, int fd_out, char *path)
        for(;;) {
                int count;
 
-               expected_id = ++id;
+               id = expected_id = msg_id++;
 
                debug3("Sending SSH2_FXP_READDIR I:%d", id);
 
@@ -365,7 +368,7 @@ do_rm(int fd_in, int fd_out, char *path)
 
        debug2("Sending SSH2_FXP_REMOVE \"%s\"", path);
 
-       id = arc4random();
+       id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_REMOVE, path, strlen(path));
        status = get_status(fd_in, id);
        if (status != SSH2_FX_OK)
@@ -378,7 +381,7 @@ do_mkdir(int fd_in, int fd_out, char *path, Attrib *a)
 {
        u_int status, id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_attrs_request(fd_out, id, SSH2_FXP_MKDIR, path,
            strlen(path), a);
 
@@ -394,7 +397,7 @@ do_rmdir(int fd_in, int fd_out, char *path)
 {
        u_int status, id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_RMDIR, path, strlen(path));
 
        status = get_status(fd_in, id);
@@ -409,7 +412,7 @@ do_stat(int fd_in, int fd_out, char *path)
 {
        u_int id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_STAT, path, strlen(path));
        return(get_decode_stat(fd_in, id));
 }
@@ -419,7 +422,7 @@ do_lstat(int fd_in, int fd_out, char *path)
 {
        u_int id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_LSTAT, path, strlen(path));
        return(get_decode_stat(fd_in, id));
 }
@@ -430,7 +433,7 @@ do_fstat(int fd_in, int fd_out, char *handle,
 {
        u_int id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_FSTAT, handle, handle_len);
        return(get_decode_stat(fd_in, id));
 }
@@ -440,7 +443,7 @@ do_setstat(int fd_in, int fd_out, char *path, Attrib *a)
 {
        u_int status, id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_attrs_request(fd_out, id, SSH2_FXP_SETSTAT, path,
            strlen(path), a);
 
@@ -458,7 +461,7 @@ do_fsetstat(int fd_in, int fd_out, char *handle, u_int handle_len,
 {
        u_int status, id;
 
-       id = arc4random();
+       id = msg_id++;
        send_string_attrs_request(fd_out, id, SSH2_FXP_FSETSTAT, handle,
            handle_len, a);
 
@@ -477,7 +480,7 @@ do_realpath(int fd_in, int fd_out, char *path)
        char *filename, *longname;
        Attrib *a;
 
-       expected_id = id = arc4random();
+       expected_id = id = msg_id++;
        send_string_request(fd_out, id, SSH2_FXP_REALPATH, path,
            strlen(path));
 
@@ -525,7 +528,7 @@ do_rename(int fd_in, int fd_out, char *oldpath, char *newpath)
        buffer_init(&msg);
 
        /* Send rename request */
-       id = arc4random();
+       id = msg_id++;
        buffer_put_char(&msg, SSH2_FXP_RENAME);
        buffer_put_int(&msg, id);
        buffer_put_cstring(&msg, oldpath);
@@ -588,7 +591,7 @@ do_download(int fd_in, int fd_out, char *remote_path, char *local_path,
        buffer_init(&msg);
 
        /* Send open request */
-       id = arc4random();
+       id = msg_id++;
        buffer_put_char(&msg, SSH2_FXP_OPEN);
        buffer_put_int(&msg, id);
        buffer_put_cstring(&msg, remote_path);
@@ -611,7 +614,7 @@ do_download(int fd_in, int fd_out, char *remote_path, char *local_path,
                u_int len;
                char *data;
 
-               expected_id = ++id;
+               id = expected_id = msg_id++;
 
                buffer_clear(&msg);
                buffer_put_char(&msg, SSH2_FXP_READ);
@@ -713,7 +716,7 @@ do_upload(int fd_in, int fd_out, char *local_path, char *remote_path,
        buffer_init(&msg);
 
        /* Send open request */
-       id = arc4random();
+       id = msg_id++;
        buffer_put_char(&msg, SSH2_FXP_OPEN);
        buffer_put_int(&msg, id);
        buffer_put_cstring(&msg, remote_path);
This page took 0.580565 seconds and 5 git commands to generate.