[BACK]Return to clientloop.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/clientloop.c between version 1.39.2.2 and 1.39.2.3

version 1.39.2.2, 2001/02/19 17:18:48 version 1.39.2.3, 2001/03/21 19:46:24
Line 279 
Line 279 
                          */                           */
                         if ((u_char) buf[0] == escape_char)                          if ((u_char) buf[0] == escape_char)
                                 escape_pending = 1;                                  escape_pending = 1;
                         else {                          else
                                 buffer_append(&stdin_buffer, buf, 1);                                  buffer_append(&stdin_buffer, buf, 1);
                                 stdin_bytes += 1;  
                         }  
                 }                  }
                 leave_non_blocking();                  leave_non_blocking();
         }          }
Line 310 
Line 308 
                 packet_put_string(buffer_ptr(&stdin_buffer), len);                  packet_put_string(buffer_ptr(&stdin_buffer), len);
                 packet_send();                  packet_send();
                 buffer_consume(&stdin_buffer, len);                  buffer_consume(&stdin_buffer, len);
                   stdin_bytes += len;
                 /* If we have a pending EOF, send it now. */                  /* If we have a pending EOF, send it now. */
                 if (stdin_eof && buffer_len(&stdin_buffer) == 0) {                  if (stdin_eof && buffer_len(&stdin_buffer) == 0) {
                         packet_start(SSH_CMSG_EOF);                          packet_start(SSH_CMSG_EOF);
Line 420 
Line 419 
                 /* Note: we might still have data in the buffers. */                  /* Note: we might still have data in the buffers. */
                 snprintf(buf, sizeof buf, "select: %s\r\n", strerror(errno));                  snprintf(buf, sizeof buf, "select: %s\r\n", strerror(errno));
                 buffer_append(&stderr_buffer, buf, strlen(buf));                  buffer_append(&stderr_buffer, buf, strlen(buf));
                 stderr_bytes += strlen(buf);  
                 quit_pending = 1;                  quit_pending = 1;
         }          }
 }  }
Line 486 
Line 484 
                         snprintf(buf, sizeof buf, "Connection to %.300s closed by remote host.\r\n",                          snprintf(buf, sizeof buf, "Connection to %.300s closed by remote host.\r\n",
                                  host);                                   host);
                         buffer_append(&stderr_buffer, buf, strlen(buf));                          buffer_append(&stderr_buffer, buf, strlen(buf));
                         stderr_bytes += strlen(buf);  
                         quit_pending = 1;                          quit_pending = 1;
                         return;                          return;
                 }                  }
Line 494 
Line 491 
                  * There is a kernel bug on Solaris that causes select to                   * There is a kernel bug on Solaris that causes select to
                  * sometimes wake up even though there is no data available.                   * sometimes wake up even though there is no data available.
                  */                   */
                 if (len < 0 && errno == EAGAIN)                  if (len < 0 && (errno == EAGAIN || errno == EINTR))
                         len = 0;                          len = 0;
   
                 if (len < 0) {                  if (len < 0) {
Line 502 
Line 499 
                         snprintf(buf, sizeof buf, "Read from remote host %.300s: %.100s\r\n",                          snprintf(buf, sizeof buf, "Read from remote host %.300s: %.100s\r\n",
                                  host, strerror(errno));                                   host, strerror(errno));
                         buffer_append(&stderr_buffer, buf, strlen(buf));                          buffer_append(&stderr_buffer, buf, strlen(buf));
                         stderr_bytes += strlen(buf);  
                         quit_pending = 1;                          quit_pending = 1;
                         return;                          return;
                 }                  }
Line 536 
Line 532 
                                 /* Terminate the connection. */                                  /* Terminate the connection. */
                                 snprintf(string, sizeof string, "%c.\r\n", escape_char);                                  snprintf(string, sizeof string, "%c.\r\n", escape_char);
                                 buffer_append(berr, string, strlen(string));                                  buffer_append(berr, string, strlen(string));
                                 /*stderr_bytes += strlen(string); XXX*/  
   
                                 quit_pending = 1;                                  quit_pending = 1;
                                 return -1;                                  return -1;
Line 546 
Line 541 
                                 /* Print a message to that effect to the user. */                                  /* Print a message to that effect to the user. */
                                 snprintf(string, sizeof string, "%c^Z [suspend ssh]\r\n", escape_char);                                  snprintf(string, sizeof string, "%c^Z [suspend ssh]\r\n", escape_char);
                                 buffer_append(berr, string, strlen(string));                                  buffer_append(berr, string, strlen(string));
                                 /*stderr_bytes += strlen(string); XXX*/  
   
                                 /* Restore terminal modes and suspend. */                                  /* Restore terminal modes and suspend. */
                                 client_suspend_self(bin, bout, berr);                                  client_suspend_self(bin, bout, berr);
Line 656 
Line 650 
 void  void
 client_process_input(fd_set * readset)  client_process_input(fd_set * readset)
 {  {
         int ret;  
         int len;          int len;
         char buf[8192];          char buf[8192];
   
Line 673 
Line 666 
                         if (len < 0) {                          if (len < 0) {
                                 snprintf(buf, sizeof buf, "read: %.100s\r\n", strerror(errno));                                  snprintf(buf, sizeof buf, "read: %.100s\r\n", strerror(errno));
                                 buffer_append(&stderr_buffer, buf, strlen(buf));                                  buffer_append(&stderr_buffer, buf, strlen(buf));
                                 stderr_bytes += strlen(buf);  
                         }                          }
                         /* Mark that we have seen EOF. */                          /* Mark that we have seen EOF. */
                         stdin_eof = 1;                          stdin_eof = 1;
Line 694 
Line 686 
                          * Just append the data to buffer.                           * Just append the data to buffer.
                          */                           */
                         buffer_append(&stdin_buffer, buf, len);                          buffer_append(&stdin_buffer, buf, len);
                         stdin_bytes += len;  
                 } else {                  } else {
                         /*                          /*
                          * Normal, successful read.  But we have an escape character                           * Normal, successful read.  But we have an escape character
                          * and have to process the characters one by one.                           * and have to process the characters one by one.
                          */                           */
                         ret = process_escapes(&stdin_buffer, &stdout_buffer, &stderr_buffer, buf, len);                          if (process_escapes(&stdin_buffer, &stdout_buffer,
                         if (ret == -1)                              &stderr_buffer, buf, len) == -1)
                                 return;                                  return;
                         stdout_bytes += ret;  
                 }                  }
         }          }
 }  }
Line 729 
Line 719 
                                  */                                   */
                                 snprintf(buf, sizeof buf, "write stdout: %.50s\r\n", strerror(errno));                                  snprintf(buf, sizeof buf, "write stdout: %.50s\r\n", strerror(errno));
                                 buffer_append(&stderr_buffer, buf, strlen(buf));                                  buffer_append(&stderr_buffer, buf, strlen(buf));
                                 stderr_bytes += strlen(buf);  
                                 quit_pending = 1;                                  quit_pending = 1;
                                 return;                                  return;
                         }                          }
                 }                  }
                 /* Consume printed data from the buffer. */                  /* Consume printed data from the buffer. */
                 buffer_consume(&stdout_buffer, len);                  buffer_consume(&stdout_buffer, len);
                   stdout_bytes += len;
         }          }
         /* Write buffered output to stderr. */          /* Write buffered output to stderr. */
         if (FD_ISSET(fileno(stderr), writeset)) {          if (FD_ISSET(fileno(stderr), writeset)) {
Line 753 
Line 743 
                 }                  }
                 /* Consume printed characters from the buffer. */                  /* Consume printed characters from the buffer. */
                 buffer_consume(&stderr_buffer, len);                  buffer_consume(&stderr_buffer, len);
                   stderr_bytes += len;
         }          }
 }  }
   
Line 939 
Line 930 
         if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) {          if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) {
                 snprintf(buf, sizeof buf, "Connection to %.64s closed.\r\n", host);                  snprintf(buf, sizeof buf, "Connection to %.64s closed.\r\n", host);
                 buffer_append(&stderr_buffer, buf, strlen(buf));                  buffer_append(&stderr_buffer, buf, strlen(buf));
                 stderr_bytes += strlen(buf);  
         }          }
         /* Output any buffered data for stdout. */          /* Output any buffered data for stdout. */
         while (buffer_len(&stdout_buffer) > 0) {          while (buffer_len(&stdout_buffer) > 0) {
Line 950 
Line 940 
                         break;                          break;
                 }                  }
                 buffer_consume(&stdout_buffer, len);                  buffer_consume(&stdout_buffer, len);
                   stdout_bytes += len;
         }          }
   
         /* Output any buffered data for stderr. */          /* Output any buffered data for stderr. */
Line 961 
Line 952 
                         break;                          break;
                 }                  }
                 buffer_consume(&stderr_buffer, len);                  buffer_consume(&stderr_buffer, len);
                   stderr_bytes += len;
         }          }
   
         if (have_pty)          if (have_pty)
Line 995 
Line 987 
         char *data = packet_get_string(&data_len);          char *data = packet_get_string(&data_len);
         packet_integrity_check(plen, 4 + data_len, type);          packet_integrity_check(plen, 4 + data_len, type);
         buffer_append(&stdout_buffer, data, data_len);          buffer_append(&stdout_buffer, data, data_len);
         stdout_bytes += data_len;  
         memset(data, 0, data_len);          memset(data, 0, data_len);
         xfree(data);          xfree(data);
 }  }
Line 1006 
Line 997 
         char *data = packet_get_string(&data_len);          char *data = packet_get_string(&data_len);
         packet_integrity_check(plen, 4 + data_len, type);          packet_integrity_check(plen, 4 + data_len, type);
         buffer_append(&stderr_buffer, data, data_len);          buffer_append(&stderr_buffer, data, data_len);
         stdout_bytes += data_len;  
         memset(data, 0, data_len);          memset(data, 0, data_len);
         xfree(data);          xfree(data);
 }  }

Legend:
Removed from v.1.39.2.2  
changed lines
  Added in v.1.39.2.3