Mercurial > dropbear
comparison process-packet.c @ 641:2b1bb792cd4d dropbear-tfm
- Update tfm changes to current default tip
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 21 Nov 2011 19:52:28 +0800 |
parents | a98a2138364a |
children | 9a5438271556 |
comparison
equal
deleted
inserted
replaced
640:76097ec1a29a | 641:2b1bb792cd4d |
---|---|
50 type = buf_getbyte(ses.payload); | 50 type = buf_getbyte(ses.payload); |
51 TRACE(("process_packet: packet type = %d", type)) | 51 TRACE(("process_packet: packet type = %d", type)) |
52 | 52 |
53 ses.lastpacket = type; | 53 ses.lastpacket = type; |
54 | 54 |
55 ses.last_packet_time = time(NULL); | |
56 | |
55 /* These packets we can receive at any time */ | 57 /* These packets we can receive at any time */ |
56 switch(type) { | 58 switch(type) { |
57 | 59 |
58 case SSH_MSG_IGNORE: | 60 case SSH_MSG_IGNORE: |
59 goto out; | 61 goto out; |
61 goto out; | 63 goto out; |
62 | 64 |
63 case SSH_MSG_UNIMPLEMENTED: | 65 case SSH_MSG_UNIMPLEMENTED: |
64 /* debugging XXX */ | 66 /* debugging XXX */ |
65 TRACE(("SSH_MSG_UNIMPLEMENTED")) | 67 TRACE(("SSH_MSG_UNIMPLEMENTED")) |
66 dropbear_exit("received SSH_MSG_UNIMPLEMENTED"); | 68 dropbear_exit("Received SSH_MSG_UNIMPLEMENTED"); |
67 | 69 |
68 case SSH_MSG_DISCONNECT: | 70 case SSH_MSG_DISCONNECT: |
69 /* TODO cleanup? */ | 71 /* TODO cleanup? */ |
70 dropbear_close("Disconnect received"); | 72 dropbear_close("Disconnect received"); |
71 } | 73 } |
72 | 74 |
73 ses.last_packet_time = time(NULL); | |
74 | |
75 /* This applies for KEX, where the spec says the next packet MUST be | 75 /* This applies for KEX, where the spec says the next packet MUST be |
76 * NEWKEYS */ | 76 * NEWKEYS */ |
77 if (ses.requirenext != 0) { | 77 if (ses.requirenext != 0) { |
78 if (ses.requirenext != type) { | 78 if (ses.requirenext != type) { |
79 /* TODO send disconnect? */ | 79 /* TODO send disconnect? */ |
80 dropbear_exit("unexpected packet type %d, expected %d", type, | 80 dropbear_exit("Unexpected packet type %d, expected %d", type, |
81 ses.requirenext); | 81 ses.requirenext); |
82 } else { | 82 } else { |
83 /* Got what we expected */ | 83 /* Got what we expected */ |
84 ses.requirenext = 0; | 84 ses.requirenext = 0; |
85 } | 85 } |
97 /* Kindly the protocol authors gave all the preauth packets type values | 97 /* Kindly the protocol authors gave all the preauth packets type values |
98 * less-than-or-equal-to 60 ( == MAX_UNAUTH_PACKET_TYPE ). | 98 * less-than-or-equal-to 60 ( == MAX_UNAUTH_PACKET_TYPE ). |
99 * NOTE: if the protocol changes and new types are added, revisit this | 99 * NOTE: if the protocol changes and new types are added, revisit this |
100 * assumption */ | 100 * assumption */ |
101 if ( !ses.authstate.authdone && type > MAX_UNAUTH_PACKET_TYPE ) { | 101 if ( !ses.authstate.authdone && type > MAX_UNAUTH_PACKET_TYPE ) { |
102 dropbear_exit("received message %d before userauth", type); | 102 dropbear_exit("Received message %d before userauth", type); |
103 } | 103 } |
104 | 104 |
105 for (i = 0; ; i++) { | 105 for (i = 0; ; i++) { |
106 if (ses.packettypes[i].type == 0) { | 106 if (ses.packettypes[i].type == 0) { |
107 /* end of list */ | 107 /* end of list */ |