Mercurial > dropbear
comparison process-packet.c @ 165:0cfba3034be5
Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 02 Jan 2005 20:25:56 +0000 |
parents | 837f9172df09 |
children | 695413c59b6a |
comparison
equal
deleted
inserted
replaced
161:b9d3f725e00b | 165:0cfba3034be5 |
---|---|
43 void process_packet() { | 43 void process_packet() { |
44 | 44 |
45 unsigned char type; | 45 unsigned char type; |
46 unsigned int i; | 46 unsigned int i; |
47 | 47 |
48 TRACE(("enter process_packet")); | 48 TRACE(("enter process_packet")) |
49 | 49 |
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 /* These packets we can receive at any time */ | 55 /* These packets we can receive at any time */ |
56 switch(type) { | 56 switch(type) { |
57 | 57 |
58 case SSH_MSG_IGNORE: | 58 case SSH_MSG_IGNORE: |
59 case SSH_MSG_DEBUG: | 59 case SSH_MSG_DEBUG: |
60 TRACE(("received SSH_MSG_IGNORE or SSH_MSG_DEBUG")); | 60 TRACE(("received SSH_MSG_IGNORE or SSH_MSG_DEBUG")) |
61 goto out; | 61 goto out; |
62 | 62 |
63 case SSH_MSG_UNIMPLEMENTED: | 63 case SSH_MSG_UNIMPLEMENTED: |
64 /* debugging XXX */ | 64 /* debugging XXX */ |
65 TRACE(("SSH_MSG_UNIMPLEMENTED")); | 65 TRACE(("SSH_MSG_UNIMPLEMENTED")) |
66 dropbear_exit("received SSH_MSG_UNIMPLEMENTED"); | 66 dropbear_exit("received SSH_MSG_UNIMPLEMENTED"); |
67 | 67 |
68 case SSH_MSG_DISCONNECT: | 68 case SSH_MSG_DISCONNECT: |
69 /* TODO cleanup? */ | 69 /* TODO cleanup? */ |
70 dropbear_close("Disconnect received"); | 70 dropbear_close("Disconnect received"); |
85 } | 85 } |
86 | 86 |
87 /* Check if we should ignore this packet. Used currently only for | 87 /* Check if we should ignore this packet. Used currently only for |
88 * KEX code, with first_kex_packet_follows */ | 88 * KEX code, with first_kex_packet_follows */ |
89 if (ses.ignorenext) { | 89 if (ses.ignorenext) { |
90 TRACE(("Ignoring packet, type = %d", type)); | 90 TRACE(("Ignoring packet, type = %d", type)) |
91 ses.ignorenext = 0; | 91 ses.ignorenext = 0; |
92 goto out; | 92 goto out; |
93 } | 93 } |
94 | 94 |
95 | 95 |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 /* TODO do something more here? */ | 117 /* TODO do something more here? */ |
118 TRACE(("preauth unknown packet")); | 118 TRACE(("preauth unknown packet")) |
119 recv_unimplemented(); | 119 recv_unimplemented(); |
120 | 120 |
121 out: | 121 out: |
122 buf_burn(ses.payload); /* Clear the memory to avoid swapping it out */ | 122 buf_burn(ses.payload); /* Clear the memory to avoid swapping it out */ |
123 buf_free(ses.payload); | 123 buf_free(ses.payload); |
124 ses.payload = NULL; | 124 ses.payload = NULL; |
125 | 125 |
126 TRACE(("leave process_packet")); | 126 TRACE(("leave process_packet")) |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 | 130 |
131 /* This must be called directly after receiving the unimplemented packet. | 131 /* This must be called directly after receiving the unimplemented packet. |