--- sourceforge.net/trunk/rdesktop/rdp.c 2002/09/17 09:55:03 176 +++ sourceforge.net/trunk/rdesktop/rdp.c 2002/12/10 17:24:27 283 @@ -1,7 +1,7 @@ /* rdesktop: A Remote Desktop Protocol client. Protocol services - RDP layer - Copyright (C) Matthew Chapman 1999-2001 + Copyright (C) Matthew Chapman 1999-2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,6 +79,13 @@ } in_uint16_le(rdp_s, length); + /* 32k packets are really 8, keepalive fix */ + if (length == 0x8000) + { + next_packet += 8; + *type = 0; + return rdp_s; + } in_uint16_le(rdp_s, pdu_type); in_uint8s(rdp_s, 2); /* userid */ *type = pdu_type & 0xf; @@ -196,7 +203,7 @@ /* Send a synchronisation PDU */ static void -rdp_send_synchronise() +rdp_send_synchronise(void) { STREAM s; @@ -434,7 +441,7 @@ /* Send a confirm active PDU */ static void -rdp_send_confirm_active() +rdp_send_confirm_active(void) { STREAM s; uint16 caplen = @@ -601,18 +608,29 @@ static void process_palette(STREAM s) { - HCOLOURMAP hmap; + COLOURENTRY *entry; COLOURMAP map; - uint8 *colours; + HCOLOURMAP hmap; + int i; in_uint8s(s, 2); /* pad */ in_uint16_le(s, map.ncolours); in_uint8s(s, 2); /* pad */ - in_uint8p(s, colours, (map.ncolours * 3)); - map.colours = (COLOURENTRY *) colours; + + map.colours = xmalloc(3 * map.ncolours); + + for (i = 0; i < map.ncolours; i++) + { + entry = &map.colours[i]; + in_uint8(s, entry->red); + in_uint8(s, entry->green); + in_uint8(s, entry->blue); + } hmap = ui_create_colourmap(&map); ui_set_colourmap(hmap); + + xfree(map.colours); } /* Process an update PDU */ @@ -681,7 +699,7 @@ /* Process incoming packets */ void -rdp_main_loop() +rdp_main_loop(void) { uint8 type; STREAM s; @@ -701,6 +719,9 @@ process_data_pdu(s); break; + case 0: + break; + default: unimpl("PDU %d\n", type); } @@ -721,7 +742,7 @@ /* Disconnect from the RDP layer */ void -rdp_disconnect() +rdp_disconnect(void) { sec_disconnect(); }