aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-29 15:14:59 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-29 15:14:59 +0000
commit7a2c71b1b5bb4d6f5de542dc09e4f56a95f5db46 (patch)
tree411383dacac42fe751da5c898927a08198537034
parent428e9e1313cf9f935298b903adb2214d2b339f11 (diff)
parente20fe5e4675cb489a24664b8d465e6c445077ed9 (diff)
downloadprosody-7a2c71b1b5bb4d6f5de542dc09e4f56a95f5db46.tar.gz
prosody-7a2c71b1b5bb4d6f5de542dc09e4f56a95f5db46.zip
Merfe from Tobias
-rw-r--r--util-src/encodings.c6
-rw-r--r--util/sasl.lua5
2 files changed, 5 insertions, 6 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c
index ac24ebcf..5fe2c805 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -7,19 +7,17 @@
#define _CRT_SECURE_NO_DEPRECATE
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "lua.h"
#include "lauxlib.h"
/***************** BASE64 *****************/
-#define uint unsigned int
-
static const char code[]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static void base64_encode(luaL_Buffer *b, uint c1, uint c2, uint c3, int n)
+static void base64_encode(luaL_Buffer *b, unsigned int c1, unsigned int c2, unsigned int c3, int n)
{
unsigned long tuple=c3+256UL*(c2+256UL*c1);
int i;
diff --git a/util/sasl.lua b/util/sasl.lua
index 0f03647f..f1d01aed 100644
--- a/util/sasl.lua
+++ b/util/sasl.lua
@@ -11,6 +11,7 @@ local math = require "math"
local type = type
local error = error
local print = print
+local idna_ascii = require "util.encodings".idna.to_ascii
module "sasl"
@@ -130,7 +131,7 @@ local function new_digest_md5(realm, password_handler)
elseif Y == false then return "failure", "account-disabled" end
local A1 = Y..":"..response["nonce"]..":"..response["cnonce"]--:authzid
- local A2 = "AUTHENTICATE:"..protocol.."/"..domain
+ local A2 = "AUTHENTICATE:"..protocol.."/"..idna_ascii(domain)
local HA1 = md5(A1, true)
local HA2 = md5(A2, true)
@@ -140,7 +141,7 @@ local function new_digest_md5(realm, password_handler)
if response_value == response["response"] then
-- calculate rspauth
- A2 = ":"..protocol.."/"..domain
+ A2 = ":"..protocol.."/"..idna_ascii(domain)
HA1 = md5(A1, true)
HA2 = md5(A2, true)