vnc: code cleanup

master
Jay Sorg 8 years ago
parent 57905d71ad
commit 9a517b34f0

@ -2530,6 +2530,34 @@ g_htoi(char *str)
return rv;
}
/*****************************************************************************/
/* returns number of bytes copied into out_str */
int APP_CC
g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str,
int bytes_out_str)
{
int rv;
int index;
char *lout_str;
const tui8 *lbytes;
rv = 0;
lbytes = (const tui8 *) bytes;
lout_str = out_str;
for (index = 0; index < num_bytes; index++)
{
if (bytes_out_str < 3)
{
break;
}
g_snprintf(lout_str, bytes_out_str, "%2.2x", lbytes[index]);
lout_str += 2;
bytes_out_str -= 2;
rv += 2;
}
return rv;
}
/*****************************************************************************/
int APP_CC
g_pos(const char *str, const char *to_find)

@ -134,6 +134,8 @@ int APP_CC g_strcasecmp(const char* c1, const char* c2);
int APP_CC g_strncasecmp(const char* c1, const char* c2, int len);
int APP_CC g_atoi(const char* str);
int APP_CC g_htoi(char* str);
int APP_CC g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str,
int bytes_out_str);
int APP_CC g_pos(const char* str, const char* to_find);
int APP_CC g_mbstowcs(twchar* dest, const char* src, int n);
int APP_CC g_wcstombs(char* dest, const twchar* src, int n);

@ -697,20 +697,9 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
}
else if (type == SESMAN_SESSION_TYPE_XVNC)
{
if (s->guid != 0)
{
char guid_str[64];
char *pguid_str;
int index;
pguid_str = guid_str;
for (index = 0; index < 16; index++)
{
g_snprintf(pguid_str, 4, "%2.2x", s->guid[index]);
pguid_str += 2;
}
guid_str[32] = 0;
env_check_password_file(passwd_file, guid_str);
}
char guid_str[64];
g_bytes_to_hexstr(s->guid, 16, guid_str, 64);
env_check_password_file(passwd_file, guid_str);
xserver_params = list_create();
xserver_params->auto_free = 1;

@ -1097,15 +1097,7 @@ lib_mod_connect(struct vnc *v)
if (v->got_guid)
{
char guid_str[64];
char *pguid_str;
int index;
pguid_str = guid_str;
for (index = 0; index < 16; index++)
{
g_snprintf(pguid_str, 4, "%2.2x", v->guid[index]);
pguid_str += 2;
}
guid_str[32] = 0;
g_bytes_to_hexstr(v->guid, 16, guid_str, 64);
rfbHashEncryptBytes(s->data, guid_str);
}
else

@ -565,7 +565,7 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid)
self->mod->mod_set_param(self->mod, "keylayout", text);
if (guid != 0)
{
self->mod->mod_set_param(self->mod, "guid", (char*)guid);
self->mod->mod_set_param(self->mod, "guid", (char *) guid);
}
for (i = 0; i < self->login_names->count; i++)

Loading…
Cancel
Save