Comparison

plugins/mod_auth_internal_hashed.lua @ 3189:d686abb6b069

mod_auth_internal_hashed: Added SCRAM-SHA-1 support for SASL.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 07 Jun 2010 03:07:58 +0500
parent 3187:a475fbce1990
child 3204:7a15cbf23c5b
child 3205:2dcd826bbbc6
comparison
equal deleted inserted replaced
3188:c690e3c5105c 3189:d686abb6b069
115 if not prepped_username then 115 if not prepped_username then
116 log("debug", "NODEprep failed on username: %s", username); 116 log("debug", "NODEprep failed on username: %s", username);
117 return "", nil; 117 return "", nil;
118 end 118 end
119 return usermanager.test_password(prepped_username, password, realm), true; 119 return usermanager.test_password(prepped_username, password, realm), true;
120 end,
121 scram_sha_1 = function(username, realm)
122 local credentials = datamanager.load(username, host, "accounts") or {};
123 if credentials.password then
124 usermanager.set_password(username, credentials.password);
125 credentials = datamanager.load(username, host, "accounts") or {};
126 end
127 local salted_password, iteration_count, salt = credentials.hashpass, credentials.iteration_count, credentials.salt;
128 salted_password = salted_password and salted_password:gsub("..", function(x) return string.char(tonumber(x, 16)); end);
129 return salted_password, iteration_count, salt, true;
120 end 130 end
121 }; 131 };
122 return new_sasl(realm, testpass_authentication_profile); 132 return new_sasl(realm, testpass_authentication_profile);
123 end 133 end
124 134