[BACK]Return to packet.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / crypto / external / bsd / openssh / dist

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/crypto/external/bsd/openssh/dist/packet.c between version 1.1.1.19 and 1.1.1.20

version 1.1.1.19, 2018/04/06 18:56:09 version 1.1.1.20, 2018/08/26 07:40:52
Line 1 
Line 1 
 /* $OpenBSD: packet.c,v 1.269 2017/12/18 23:13:42 djm Exp $ */  /* $OpenBSD: packet.c,v 1.277 2018/07/16 03:09:13 djm Exp $ */
 /*  /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>   * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland   * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Line 57 
Line 57 
   
 #include <zlib.h>  #include <zlib.h>
   
 #include "buffer.h"     /* typedefs XXX */  
 #include "key.h"        /* typedefs XXX */  
   
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "crc32.h"  #include "crc32.h"
 #include "compat.h"  #include "compat.h"
Line 141  struct session_state {
Line 138  struct session_state {
         int compression_in_failures;          int compression_in_failures;
         int compression_out_failures;          int compression_out_failures;
   
         /*  
          * Flag indicating whether packet compression/decompression is  
          * enabled.  
          */  
         int packet_compression;  
   
         /* default maximum packet size */          /* default maximum packet size */
         u_int max_packet_size;          u_int max_packet_size;
   
Line 412  ssh_packet_start_discard(struct ssh *ssh
Line 403  ssh_packet_start_discard(struct ssh *ssh
 int  int
 ssh_packet_connection_is_on_socket(struct ssh *ssh)  ssh_packet_connection_is_on_socket(struct ssh *ssh)
 {  {
         struct session_state *state = ssh->state;          struct session_state *state;
         struct sockaddr_storage from, to;          struct sockaddr_storage from, to;
         socklen_t fromlen, tolen;          socklen_t fromlen, tolen;
   
         if (state->connection_in == -1 || state->connection_out == -1)          if (ssh == NULL || ssh->state == NULL)
                 return 0;                  return 0;
   
           state = ssh->state;
           if (state->connection_in == -1 || state->connection_out == -1)
                   return 0;
         /* filedescriptors in and out are the same, so it's a socket */          /* filedescriptors in and out are the same, so it's a socket */
         if (state->connection_in == state->connection_out)          if (state->connection_in == state->connection_out)
                 return 1;                  return 1;
Line 497  ssh_packet_get_connection_out(struct ssh
Line 491  ssh_packet_get_connection_out(struct ssh
 const char *  const char *
 ssh_remote_ipaddr(struct ssh *ssh)  ssh_remote_ipaddr(struct ssh *ssh)
 {  {
         const int sock = ssh->state->connection_in;          int sock;
   
         /* Check whether we have cached the ipaddr. */          /* Check whether we have cached the ipaddr. */
         if (ssh->remote_ipaddr == NULL) {          if (ssh->remote_ipaddr == NULL) {
                 if (ssh_packet_connection_is_on_socket(ssh)) {                  if (ssh_packet_connection_is_on_socket(ssh)) {
                           sock = ssh->state->connection_in;
                         ssh->remote_ipaddr = get_peer_ipaddr(sock);                          ssh->remote_ipaddr = get_peer_ipaddr(sock);
                         ssh->remote_port = get_peer_port(sock);                          ssh->remote_port = get_peer_port(sock);
                         ssh->local_ipaddr = get_local_ipaddr(sock);                          ssh->local_ipaddr = get_local_ipaddr(sock);
Line 616  ssh_packet_close_internal(struct ssh *ss
Line 611  ssh_packet_close_internal(struct ssh *ss
         cipher_free(state->receive_context);          cipher_free(state->receive_context);
         state->send_context = state->receive_context = NULL;          state->send_context = state->receive_context = NULL;
         if (do_close) {          if (do_close) {
                   free(ssh->local_ipaddr);
                   ssh->local_ipaddr = NULL;
                 free(ssh->remote_ipaddr);                  free(ssh->remote_ipaddr);
                 ssh->remote_ipaddr = NULL;                  ssh->remote_ipaddr = NULL;
                 free(ssh->state);                  free(ssh->state);
Line 702  start_compression_in(struct ssh *ssh)
Line 699  start_compression_in(struct ssh *ssh)
         return 0;          return 0;
 }  }
   
 int  
 ssh_packet_start_compression(struct ssh *ssh, int level)  
 {  
         int r;  
   
         if (ssh->state->packet_compression)  
                 return SSH_ERR_INTERNAL_ERROR;  
         ssh->state->packet_compression = 1;  
         if ((r = ssh_packet_init_compression(ssh)) != 0 ||  
             (r = start_compression_in(ssh)) != 0 ||  
             (r = start_compression_out(ssh, level)) != 0)  
                 return r;  
         return 0;  
 }  
   
 /* XXX remove need for separate compression buffer */  /* XXX remove need for separate compression buffer */
 static int  static int
 compress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out)  compress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out)
Line 1326  ssh_packet_read_seqnr(struct ssh *ssh, u
Line 1308  ssh_packet_read_seqnr(struct ssh *ssh, u
                         if ((r = select(state->connection_in + 1, setp,                          if ((r = select(state->connection_in + 1, setp,
                             NULL, NULL, timeoutp)) >= 0)                              NULL, NULL, timeoutp)) >= 0)
                                 break;                                  break;
                         if (errno != EAGAIN && errno != EINTR)                          if (errno != EAGAIN && errno != EINTR) {
                                 break;                                  r = SSH_ERR_SYSTEM_ERROR;
                                   goto out;
                           }
                         if (state->packet_timeout_ms == -1)                          if (state->packet_timeout_ms == -1)
                                 continue;                                  continue;
                         ms_subtract_diff(&start, &ms_remain);                          ms_subtract_diff(&start, &ms_remain);

Legend:
Removed from v.1.1.1.19  
changed lines
  Added in v.1.1.1.20

CVSweb <webmaster@jp.NetBSD.org>