# HG changeset patch # User jond578@gmail.com # Date 1313507208 0 # Node ID a13744df700c17c5a76f55b4ee1aa43a4e67fe6b # Parent e972e2161bf5bedd541f397320140e1902cd75ec Fix NTLM endianness issue. Fixes #14163 committer: Ethan Blanton diff -r e972e2161bf5 -r a13744df700c COPYRIGHT --- 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 diff -r e972e2161bf5 -r a13744df700c libpurple/ntlm.c --- 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);