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

Diff for /src/usr.bin/ssh/packet.c between version 1.81 and 1.82

version 1.81, 2001/12/28 14:13:13 version 1.82, 2001/12/28 14:50:54
Line 610 
Line 610 
  */   */
   
 int  int
 packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)  packet_read_seqnr(u_int32_t *seqnr_p)
 {  {
         int type, len;          int type, len;
         fd_set *setp;          fd_set *setp;
Line 626 
Line 626 
         /* Stay in the loop until we have received a complete packet. */          /* Stay in the loop until we have received a complete packet. */
         for (;;) {          for (;;) {
                 /* Try to read a packet from the buffer. */                  /* Try to read a packet from the buffer. */
                 type = packet_read_poll_seqnr(payload_len_ptr, seqnr_p);                  type = packet_read_poll_seqnr(seqnr_p);
                 if (!compat20 && (                  if (!compat20 && (
                     type == SSH_SMSG_SUCCESS                      type == SSH_SMSG_SUCCESS
                     || type == SSH_SMSG_FAILURE                      || type == SSH_SMSG_FAILURE
Line 666 
Line 666 
 }  }
   
 int  int
 packet_read(int *payload_len_ptr)  packet_read(void)
 {  {
         return packet_read_seqnr(payload_len_ptr, NULL);          return packet_read_seqnr(NULL);
 }  }
   
 /*  /*
Line 677 
Line 677 
  */   */
   
 void  void
 packet_read_expect(int *payload_len_ptr, int expected_type)  packet_read_expect(int expected_type)
 {  {
         int type;          int type;
   
         type = packet_read(payload_len_ptr);          type = packet_read();
         if (type != expected_type)          if (type != expected_type)
                 packet_disconnect("Protocol error: expected packet type %d, got %d",                  packet_disconnect("Protocol error: expected packet type %d, got %d",
                     expected_type, type);                      expected_type, type);
Line 694 
Line 694 
  * SSH_MSG_DISCONNECT is handled specially here.  Also,   * SSH_MSG_DISCONNECT is handled specially here.  Also,
  * SSH_MSG_IGNORE messages are skipped by this function and are never returned   * SSH_MSG_IGNORE messages are skipped by this function and are never returned
  * to higher levels.   * to higher levels.
  *  
  * The returned payload_len does include space consumed by:  
  *      Packet length  
  *      Padding  
  *      Packet type  
  *      Check bytes  
  */   */
   
 static int  static int
 packet_read_poll1(int *payload_len_ptr)  packet_read_poll1(void)
 {  {
         u_int len, padded_len;          u_int len, padded_len;
         u_char *ucp, type;          u_char *ucp, type;
Line 776 
Line 770 
                     buffer_len(&compression_buffer));                      buffer_len(&compression_buffer));
         }          }
         type = buffer_get_char(&incoming_packet);          type = buffer_get_char(&incoming_packet);
         *payload_len_ptr = buffer_len(&incoming_packet);  
         return type;          return type;
 }  }
   
 static int  static int
 packet_read_poll2(int *payload_len_ptr, u_int32_t *seqnr_p)  packet_read_poll2(u_int32_t *seqnr_p)
 {  {
         static u_int32_t seqnr = 0;          static u_int32_t seqnr = 0;
         static u_int packet_length = 0;          static u_int packet_length = 0;
Line 887 
Line 880 
         type = buffer_get_char(&incoming_packet);          type = buffer_get_char(&incoming_packet);
         if (type == SSH2_MSG_NEWKEYS)          if (type == SSH2_MSG_NEWKEYS)
                 set_newkeys(MODE_IN);                  set_newkeys(MODE_IN);
         *payload_len_ptr = buffer_len(&incoming_packet);  
 #ifdef PACKET_DEBUG  #ifdef PACKET_DEBUG
         fprintf(stderr, "read/plain[%d]:\r\n", type);          fprintf(stderr, "read/plain[%d]:\r\n", type);
         buffer_dump(&incoming_packet);          buffer_dump(&incoming_packet);
Line 898 
Line 890 
 }  }
   
 int  int
 packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)  packet_read_poll_seqnr(u_int32_t *seqnr_p)
 {  {
         int reason;          int reason;
         u_char type;          u_char type;
Line 906 
Line 898 
   
         for (;;) {          for (;;) {
                 if (compat20) {                  if (compat20) {
                         type = packet_read_poll2(payload_len_ptr, seqnr_p);                          type = packet_read_poll2(seqnr_p);
                         if (type)                          if (type)
                                 DBG(debug("received packet type %d", type));                                  DBG(debug("received packet type %d", type));
                         switch (type) {                          switch (type) {
Line 933 
Line 925 
                                 break;                                  break;
                         }                          }
                 } else {                  } else {
                         type = packet_read_poll1(payload_len_ptr);                          type = packet_read_poll1();
                         switch (type) {                          switch (type) {
                         case SSH_MSG_IGNORE:                          case SSH_MSG_IGNORE:
                                 break;                                  break;
Line 960 
Line 952 
 }  }
   
 int  int
 packet_read_poll(int *payload_len_ptr)  packet_read_poll(void)
 {  {
         return packet_read_poll_seqnr(payload_len_ptr, NULL);          return packet_read_poll_seqnr(NULL);
 }  }
   
 /*  /*

Legend:
Removed from v.1.81  
changed lines
  Added in v.1.82