# HG changeset patch # User Daniel Atallah # Date 1179453095 0 # Node ID 2ea3c46a63fe76f4c908de21b4656d5b83f2622b # Parent 9a31b76280221376fe311d6d20a6fa9aa2f4b46e Fix an extra \r\n in the Authorization header. Fixes #965. diff -r 9a31b7628022 -r 2ea3c46a63fe libpurple/protocols/simple/simple.c --- a/libpurple/protocols/simple/simple.c Fri May 18 01:51:03 2007 +0000 +++ b/libpurple/protocols/simple/simple.c Fri May 18 01:51:35 2007 +0000 @@ -277,18 +277,18 @@ auth->nonce, noncecount, NULL, auth->digest_session_key); purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response); + ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); g_free(response); return ret; } else if(auth->type == 2) { /* NTLM */ if(auth->nc == 3 && auth->nonce) { /* TODO: Don't hardcode "purple" as the hostname */ ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags); - tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"\r\n", auth->opaque, auth->realm, auth->target, ret); + tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret); g_free(ret); return tmp; } - tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"\r\n", auth->realm, auth->target); + tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"", auth->realm, auth->target); return tmp; } @@ -298,7 +298,7 @@ auth->nonce, noncecount, NULL, auth->digest_session_key); purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response); + ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); g_free(response); return ret; } @@ -630,14 +630,12 @@ if(addheaders) addh = addheaders; if(sip->registrar.type && !strcmp(method, "REGISTER")) { buf = auth_header(sip, &sip->registrar, method, url); - auth = g_strdup_printf("Authorization: %s", buf); + auth = g_strdup_printf("Authorization: %s\r\n", buf); g_free(buf); purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); - } - - if(sip->proxy.type && strcmp(method, "REGISTER")) { + } else if(sip->proxy.type && strcmp(method, "REGISTER")) { buf = auth_header(sip, &sip->proxy, method, url); - auth = g_strdup_printf("Proxy-Authorization: %s", buf); + auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf); g_free(buf); purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); } @@ -984,8 +982,8 @@ state = xmlnode_get_child(isc, "state"); if(!state) { - purple_debug_info("simple", "process_incoming_message: no state found\n"); - xmlnode_free(isc); + purple_debug_info("simple", "process_incoming_message: no state found\n"); + xmlnode_free(isc); return; }