[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.76 and 1.77

version 1.76, 2001/12/19 17:16:13 version 1.77, 2001/12/20 22:50:24
Line 610 
Line 610 
  */   */
   
 int  int
 packet_read(int *payload_len_ptr)  packet_read_seqnr(int *payload_len_ptr, 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(payload_len_ptr);                  type = packet_read_poll_seqnr(payload_len_ptr, seqnr_p);
                 if (!compat20 && (                  if (!compat20 && (
                     type == SSH_SMSG_SUCCESS                      type == SSH_SMSG_SUCCESS
                     || type == SSH_SMSG_FAILURE                      || type == SSH_SMSG_FAILURE
Line 665 
Line 665 
         /* NOTREACHED */          /* NOTREACHED */
 }  }
   
   int
   packet_read(int *payload_len_ptr)
   {
           return packet_read_seqnr(payload_len_ptr, NULL);
   }
   
 /*  /*
  * Waits until a packet has been received, verifies that its type matches   * Waits until a packet has been received, verifies that its type matches
  * that given, and gives a fatal error and exits if there is a mismatch.   * that given, and gives a fatal error and exits if there is a mismatch.
Line 753 
Line 759 
   
         /* Test check bytes. */          /* Test check bytes. */
         if (len != buffer_len(&incoming_packet))          if (len != buffer_len(&incoming_packet))
                 packet_disconnect("packet_read_poll: len %d != buffer_len %d.",                  packet_disconnect("packet_read_poll1: len %d != buffer_len %d.",
                     len, buffer_len(&incoming_packet));                      len, buffer_len(&incoming_packet));
   
         ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4;          ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4;
Line 775 
Line 781 
 }  }
   
 static int  static int
 packet_read_poll2(int *payload_len_ptr)  packet_read_poll2(int *payload_len_ptr, 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 848 
Line 854 
                 DBG(debug("MAC #%d ok", seqnr));                  DBG(debug("MAC #%d ok", seqnr));
                 buffer_consume(&input, mac->mac_len);                  buffer_consume(&input, mac->mac_len);
         }          }
           if (seqnr_p != NULL)
                   *seqnr_p = seqnr;
         if (++seqnr == 0)          if (++seqnr == 0)
                 log("incoming seqnr wraps around");                  log("incoming seqnr wraps around");
   
Line 890 
Line 898 
 }  }
   
 int  int
 packet_read_poll(int *payload_len_ptr)  packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
 {  {
         int reason;          int reason;
         u_char type;          u_char type;
Line 898 
Line 906 
   
         for (;;) {          for (;;) {
                 if (compat20) {                  if (compat20) {
                         type = packet_read_poll2(payload_len_ptr);                          type = packet_read_poll2(payload_len_ptr, 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 949 
Line 957 
                         }                          }
                 }                  }
         }          }
   }
   
   int
   packet_read_poll(int *payload_len_ptr)
   {
           return packet_read_poll_seqnr(payload_len_ptr, NULL);
 }  }
   
 /*  /*

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77