~ubuntu-branches/debian/stretch/dropbear/stretch

« back to all changes in this revision

Viewing changes to process-packet.c

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape, Matt Johnston, Gerrit Pape
  • Date: 2013-10-25 15:00:48 UTC
  • mfrom: (1.4.6)
  • Revision ID: package-import@ubuntu.com-20131025150048-3jq765x96xayk392
Tags: 2013.60-1
[ Matt Johnston ]
* New upstream release.

[ Gerrit Pape ]
* debian/diff/0004-cve-2013-4421.diff, 0005-user-disclosure.diff:
  remove; fixed upstream.
* debian/dropbear.postinst: don't fail if initramfs-tools it not
  installed (closes: #692653).

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        unsigned char type;
46
46
        unsigned int i;
47
47
 
48
 
        TRACE(("enter process_packet"))
 
48
        TRACE2(("enter process_packet"))
49
49
 
50
50
        type = buf_getbyte(ses.payload);
51
 
        TRACE(("process_packet: packet type = %d", type))
 
51
        TRACE(("process_packet: packet type = %d,  len %d", type, ses.payload->len))
52
52
 
53
53
        ses.lastpacket = type;
54
54
 
74
74
 
75
75
        /* This applies for KEX, where the spec says the next packet MUST be
76
76
         * NEWKEYS */
77
 
        if (ses.requirenext != 0) {
78
 
                if (ses.requirenext != type) {
79
 
                        /* TODO send disconnect? */
80
 
                        dropbear_exit("Unexpected packet type %d, expected %d", type,
81
 
                                        ses.requirenext);
 
77
        if (ses.requirenext[0] != 0) {
 
78
                if (ses.requirenext[0] != type
 
79
                                && (ses.requirenext[1] == 0 || ses.requirenext[1] != type)) {
 
80
                        dropbear_exit("Unexpected packet type %d, expected [%d,%d]", type,
 
81
                                        ses.requirenext[0], ses.requirenext[1]);
82
82
                } else {
83
83
                        /* Got what we expected */
84
 
                        ses.requirenext = 0;
 
84
                        ses.requirenext[0] = 0;
 
85
                        ses.requirenext[1] = 0;
85
86
                }
86
87
        }
87
88
 
123
124
        buf_free(ses.payload);
124
125
        ses.payload = NULL;
125
126
 
126
 
        TRACE(("leave process_packet"))
 
127
        TRACE2(("leave process_packet"))
127
128
}
128
129
 
129
130