pidgin/android/libpurple

Fix NTLM endianness issue.

2011-08-16, Jon Goldberg
2710edaebd02
Parents b1662f03fa07
Children 2bee5f0cd993
Fix NTLM endianness issue.

Fixes #14163


committer: Ethan Blanton
--- a/COPYRIGHT Tue Aug 16 15:03:35 2011 +0000
+++ b/COPYRIGHT Tue Aug 16 15:06:48 2011 +0000
@@ -197,6 +197,7 @@
Gustavo Giráldez
Richard Gobeille
Ian Goldberg
+Jon Goldberg
Matthew Goldstein
Michael Golden
Charlie Gordon
--- a/libpurple/ntlm.c Tue Aug 16 15:03:35 2011 +0000
+++ b/libpurple/ntlm.c Tue Aug 16 15:06:48 2011 +0000
@@ -111,14 +111,16 @@
gchar *
purple_ntlm_gen_type1(const gchar *hostname, const gchar *domain)
{
- int hostnamelen;
- int domainlen;
+ int hostnamelen,host_off;
+ int domainlen,dom_off;
unsigned char *msg;
struct type1_message *tmsg;
gchar *tmp;
hostnamelen = strlen(hostname);
domainlen = strlen(domain);
+ host_off = sizeof(struct type1_message);
+ dom_off = sizeof(struct type1_message) + hostnamelen;
msg = g_malloc0(sizeof(struct type1_message) + hostnamelen + domainlen);
tmsg = (struct type1_message*)msg;
tmsg->protocol[0] = 'N';
@@ -132,11 +134,11 @@
tmsg->type = GUINT32_TO_LE(0x00000001);
tmsg->flags = GUINT32_TO_LE(0x0000b203);
tmsg->dom_len1 = tmsg->dom_len2 = GUINT16_TO_LE(domainlen);
- tmsg->dom_off = GUINT32_TO_LE(sizeof(struct type1_message) + hostnamelen);
+ tmsg->dom_off = GUINT32_TO_LE(dom_off);
tmsg->host_len1 = tmsg->host_len2 = GUINT16_TO_LE(hostnamelen);
- tmsg->host_off = GUINT32_TO_LE(sizeof(struct type1_message));
- memcpy(msg + tmsg->host_off, hostname, hostnamelen);
- memcpy(msg + tmsg->dom_off, domain, domainlen);
+ tmsg->host_off = GUINT32_TO_LE(host_off);
+ memcpy(msg + host_off, hostname, hostnamelen);
+ memcpy(msg + dom_off, domain, domainlen);
tmp = purple_base64_encode(msg, sizeof(struct type1_message) + hostnamelen + domainlen);
g_free(msg);