preceeded more global vars with g_

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@436 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Jay Sorg 2003-07-28 21:41:12 +00:00
parent 694bd388a4
commit de7a67cd41
5 changed files with 31 additions and 31 deletions

View File

@ -28,7 +28,7 @@
#define CHANNEL_FLAG_SHOW_PROTOCOL 0x10 #define CHANNEL_FLAG_SHOW_PROTOCOL 0x10
extern BOOL use_rdp5; extern BOOL use_rdp5;
extern BOOL encryption; extern BOOL g_encryption;
VCHANNEL g_channels[MAX_CHANNELS]; VCHANNEL g_channels[MAX_CHANNELS];
unsigned int g_num_channels; unsigned int g_num_channels;
@ -71,7 +71,7 @@ channel_init(VCHANNEL * channel, uint32 length)
{ {
STREAM s; STREAM s;
s = sec_init(encryption ? SEC_ENCRYPT : 0, length + 8); s = sec_init(g_encryption ? SEC_ENCRYPT : 0, length + 8);
s_push_layer(s, channel_hdr, 8); s_push_layer(s, channel_hdr, 8);
return s; return s;
} }
@ -96,7 +96,7 @@ channel_send(STREAM s, VCHANNEL * channel)
out_uint32_le(s, length); out_uint32_le(s, length);
out_uint32_le(s, flags); out_uint32_le(s, flags);
data = s->end = s->p + thislength; data = s->end = s->p + thislength;
sec_send_to_channel(s, encryption ? SEC_ENCRYPT : 0, channel->mcs_id); sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
/* subsequent segments copied (otherwise would have to generate headers backwards) */ /* subsequent segments copied (otherwise would have to generate headers backwards) */
while (remaining > 0) while (remaining > 0)
@ -105,12 +105,12 @@ channel_send(STREAM s, VCHANNEL * channel)
remaining -= thislength; remaining -= thislength;
flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0; flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
s = sec_init(encryption ? SEC_ENCRYPT : 0, thislength + 8); s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
out_uint32_le(s, length); out_uint32_le(s, length);
out_uint32_le(s, flags); out_uint32_le(s, flags);
out_uint8p(s, data, thislength); out_uint8p(s, data, thislength);
s_mark_end(s); s_mark_end(s);
sec_send_to_channel(s, encryption ? SEC_ENCRYPT : 0, channel->mcs_id); sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
data += thislength; data += thislength;
} }

View File

@ -26,7 +26,7 @@
#include "crypto/rc4.h" #include "crypto/rc4.h"
#endif #endif
extern char username[16]; extern char g_username[16];
extern char hostname[16]; extern char hostname[16];
static uint8 g_licence_key[16]; static uint8 g_licence_key[16];
@ -174,7 +174,7 @@ licence_process_demand(STREAM s)
return; return;
} }
licence_send_request(null_data, null_data, username, hostname); licence_send_request(null_data, null_data, g_username, hostname);
} }
/* Send an authentication response packet */ /* Send an authentication response packet */

View File

@ -41,7 +41,7 @@
#endif #endif
char title[32] = ""; char title[32] = "";
char username[16]; char g_username[16];
char hostname[16]; char hostname[16];
char keymapname[16]; char keymapname[16];
int keylayout = 0x409; /* Defaults to US keyboard layout */ int keylayout = 0x409; /* Defaults to US keyboard layout */
@ -51,10 +51,10 @@ int height = 600;
int tcp_port_rdp = TCP_PORT_RDP; int tcp_port_rdp = TCP_PORT_RDP;
int server_bpp = 8; int server_bpp = 8;
int win_button_size = 0; /* If zero, disable single app mode */ int win_button_size = 0; /* If zero, disable single app mode */
BOOL bitmap_compression = True; BOOL g_bitmap_compression = True;
BOOL sendmotion = True; BOOL sendmotion = True;
BOOL orders = True; BOOL g_orders = True;
BOOL encryption = True; BOOL g_encryption = True;
BOOL packet_encryption = True; BOOL packet_encryption = True;
BOOL desktop_save = True; BOOL desktop_save = True;
BOOL fullscreen = False; BOOL fullscreen = False;
@ -188,7 +188,7 @@ main(int argc, char *argv[])
#endif #endif
case 'u': case 'u':
STRNCPY(username, optarg, sizeof(username)); STRNCPY(g_username, optarg, sizeof(g_username));
username_option = 1; username_option = 1;
break; break;
@ -268,11 +268,11 @@ main(int argc, char *argv[])
break; break;
case 'b': case 'b':
orders = False; g_orders = False;
break; break;
case 'e': case 'e':
encryption = False; g_encryption = False;
break; break;
case 'E': case 'E':
packet_encryption = False; packet_encryption = False;
@ -341,7 +341,7 @@ main(int argc, char *argv[])
return 1; return 1;
} }
STRNCPY(username, pw->pw_name, sizeof(username)); STRNCPY(g_username, pw->pw_name, sizeof(g_username));
} }
if (hostname[0] == 0) if (hostname[0] == 0)
@ -385,7 +385,7 @@ main(int argc, char *argv[])
/* By setting encryption to False here, we have an encrypted login /* By setting encryption to False here, we have an encrypted login
packet but unencrypted transfer of other packets */ packet but unencrypted transfer of other packets */
if (!packet_encryption) if (!packet_encryption)
encryption = False; g_encryption = False;
DEBUG(("Connection successful.\n")); DEBUG(("Connection successful.\n"));

22
rdp.c
View File

@ -21,10 +21,10 @@
#include "rdesktop.h" #include "rdesktop.h"
extern uint16 g_mcs_userid; extern uint16 g_mcs_userid;
extern char username[16]; extern char g_username[16];
extern BOOL bitmap_compression; extern BOOL g_bitmap_compression;
extern BOOL orders; extern BOOL g_orders;
extern BOOL encryption; extern BOOL g_encryption;
extern BOOL desktop_save; extern BOOL desktop_save;
extern BOOL use_rdp5; extern BOOL use_rdp5;
extern uint16 server_rdp_version; extern uint16 server_rdp_version;
@ -84,7 +84,7 @@ rdp_init_data(int maxlen)
{ {
STREAM s; STREAM s;
s = sec_init(encryption ? SEC_ENCRYPT : 0, maxlen + 18); s = sec_init(g_encryption ? SEC_ENCRYPT : 0, maxlen + 18);
s_push_layer(s, rdp_hdr, 18); s_push_layer(s, rdp_hdr, 18);
return s; return s;
@ -111,7 +111,7 @@ rdp_send_data(STREAM s, uint8 data_pdu_type)
out_uint8(s, 0); /* compress_type */ out_uint8(s, 0); /* compress_type */
out_uint16(s, 0); /* compress_len */ out_uint16(s, 0); /* compress_len */
sec_send(s, encryption ? SEC_ENCRYPT : 0); sec_send(s, g_encryption ? SEC_ENCRYPT : 0);
} }
/* Output a string in Unicode */ /* Output a string in Unicode */
@ -144,7 +144,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
int len_ip = 2 * strlen("127.0.0.1"); int len_ip = 2 * strlen("127.0.0.1");
int len_dll = 2 * strlen("C:\\WINNT\\System32\\mstscax.dll"); int len_dll = 2 * strlen("C:\\WINNT\\System32\\mstscax.dll");
int packetlen = 0; int packetlen = 0;
uint32 sec_flags = encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO; uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO;
STREAM s; STREAM s;
if (!use_rdp5 || 1 == server_rdp_version) if (!use_rdp5 || 1 == server_rdp_version)
@ -387,7 +387,7 @@ rdp_out_bitmap_caps(STREAM s)
out_uint16_le(s, 600); /* Desktop height */ out_uint16_le(s, 600); /* Desktop height */
out_uint16(s, 0); /* Pad */ out_uint16(s, 0); /* Pad */
out_uint16(s, 0); /* Allow resize */ out_uint16(s, 0); /* Allow resize */
out_uint16_le(s, bitmap_compression ? 1 : 0); /* Support compression */ out_uint16_le(s, g_bitmap_compression ? 1 : 0); /* Support compression */
out_uint16(s, 0); /* Unknown */ out_uint16(s, 0); /* Unknown */
out_uint16_le(s, 1); /* Unknown */ out_uint16_le(s, 1); /* Unknown */
out_uint16(s, 0); /* Pad */ out_uint16(s, 0); /* Pad */
@ -546,7 +546,7 @@ static void
rdp_send_confirm_active(void) rdp_send_confirm_active(void)
{ {
STREAM s; STREAM s;
uint32 sec_flags = encryption ? (RDP5_FLAG | SEC_ENCRYPT) : RDP5_FLAG; uint32 sec_flags = g_encryption ? (RDP5_FLAG | SEC_ENCRYPT) : RDP5_FLAG;
uint16 caplen = uint16 caplen =
RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER + RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER +
RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE + RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE +
@ -898,10 +898,10 @@ BOOL
rdp_connect(char *server, uint32 flags, char *domain, char *password, rdp_connect(char *server, uint32 flags, char *domain, char *password,
char *command, char *directory) char *command, char *directory)
{ {
if (!sec_connect(server, username)) if (!sec_connect(server, g_username))
return False; return False;
rdp_send_logon_info(flags, domain, username, password, command, directory); rdp_send_logon_info(flags, domain, g_username, password, command, directory);
return True; return True;
} }

View File

@ -37,7 +37,7 @@ extern char hostname[16];
extern int width; extern int width;
extern int height; extern int height;
extern int keylayout; extern int keylayout;
extern BOOL encryption; extern BOOL g_encryption;
extern BOOL g_licence_issued; extern BOOL g_licence_issued;
extern BOOL use_rdp5; extern BOOL use_rdp5;
extern int server_bpp; extern int server_bpp;
@ -480,7 +480,7 @@ sec_out_mcs_data(STREAM s)
/* Client encryption settings */ /* Client encryption settings */
out_uint16_le(s, SEC_TAG_CLI_CRYPT); out_uint16_le(s, SEC_TAG_CLI_CRYPT);
out_uint16_le(s, 12); /* length */ out_uint16_le(s, 12); /* length */
out_uint32_le(s, encryption ? 0x3 : 0); /* encryption supported, 128-bit supported */ out_uint32_le(s, g_encryption ? 0x3 : 0); /* encryption supported, 128-bit supported */
out_uint32(s, 0); /* Unknown */ out_uint32(s, 0); /* Unknown */
DEBUG_RDP5(("g_num_channels is %d\n", g_num_channels)); DEBUG_RDP5(("g_num_channels is %d\n", g_num_channels));
@ -800,7 +800,7 @@ sec_recv(void)
while ((s = mcs_recv(&channel)) != NULL) while ((s = mcs_recv(&channel)) != NULL)
{ {
if (encryption || !g_licence_issued) if (g_encryption || !g_licence_issued)
{ {
in_uint32_le(s, sec_flags); in_uint32_le(s, sec_flags);
@ -844,7 +844,7 @@ sec_connect(char *server, char *username)
return False; return False;
// sec_process_mcs_data(&mcs_data); // sec_process_mcs_data(&mcs_data);
if (encryption) if (g_encryption)
sec_establish_key(); sec_establish_key();
xfree(mcs_data.data); xfree(mcs_data.data);
return True; return True;