comparison process-packet.c @ 27:08da099e8337

- Rename common-packet.c to packet.c - buf_burn the unencrypted read/write payload buffers after use to avoid sensitive contents sitting in memory for too long
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 02:14:42 +0000
parents 0969767bca0d
children e2a1eaa19f22
comparison
equal deleted inserted replaced
26:0969767bca0d 27:08da099e8337
114 114
115 /* Kindly the protocol authors gave all the preauth packets type values 115 /* Kindly the protocol authors gave all the preauth packets type values
116 * less-than-or-equal-to 60 ( == MAX_UNAUTH_PACKET_TYPE ). 116 * less-than-or-equal-to 60 ( == MAX_UNAUTH_PACKET_TYPE ).
117 * NOTE: if the protocol changes and new types are added, revisit this 117 * NOTE: if the protocol changes and new types are added, revisit this
118 * assumption */ 118 * assumption */
119 if ( !ses.authdone && type > MAX_UNAUTH_PACKET_TYPE ) { 119 if ( !ses.authstate.authdone && type > MAX_UNAUTH_PACKET_TYPE ) {
120 dropbear_exit("received message %d before userauth", type); 120 dropbear_exit("received message %d before userauth", type);
121 } 121 }
122 122
123 for (i = 0; ; i++) { 123 for (i = 0; ; i++) {
124 if (ses.packettypes[i].type == 0) { 124 if (ses.packettypes[i].type == 0) {
136 /* TODO do something more here? */ 136 /* TODO do something more here? */
137 TRACE(("preauth unknown packet")); 137 TRACE(("preauth unknown packet"));
138 recv_unimplemented(); 138 recv_unimplemented();
139 139
140 out: 140 out:
141 buf_burn(ses.payload); /* Clear the memory to avoid swapping it out */
141 buf_free(ses.payload); 142 buf_free(ses.payload);
142 ses.payload = NULL; 143 ses.payload = NULL;
143 144
144 TRACE(("leave process_packet")); 145 TRACE(("leave process_packet"));
145 } 146 }