Software /
code /
prosody
Comparison
util/sasl/scram.lua @ 4204:edd7b0610c2c
util.sasl.scram: Fix bug in validate_username function. (Thanks Florob)
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Thu, 24 Feb 2011 18:56:19 +0100 |
parent | 4113:65482a852c4d |
child | 4368:916834f22d1b |
comparison
equal
deleted
inserted
replaced
4203:e3d937eec3fa | 4204:edd7b0610c2c |
---|---|
77 end | 77 end |
78 | 78 |
79 local function validate_username(username) | 79 local function validate_username(username) |
80 -- check for forbidden char sequences | 80 -- check for forbidden char sequences |
81 for eq in username:gmatch("=(.?.?)") do | 81 for eq in username:gmatch("=(.?.?)") do |
82 if eq ~= "2D" and eq ~= "3D" then | 82 if eq ~= "2C" and eq ~= "3D" then |
83 return false | 83 return false |
84 end | 84 end |
85 end | 85 end |
86 | 86 |
87 -- replace =2D with , and =3D with = | 87 -- replace =2C with , and =3D with = |
88 username = username:gsub("=2D", ","); | 88 username = username:gsub("=2C", ","); |
89 username = username:gsub("=3D", "="); | 89 username = username:gsub("=3D", "="); |
90 | 90 |
91 -- apply SASLprep | 91 -- apply SASLprep |
92 username = saslprep(username); | 92 username = saslprep(username); |
93 return username; | 93 return username; |