Comparison

util/prosodyctl.lua @ 5524:e9090966c803

util.prosodyctl: Initialize storagemanager on the host before initializing usermanager. This fixes brokenness when the auth provider opens the store on load (as they all do since eeea0eb2602a) (thanks nulani)
author Matthew Wild <mwild1@gmail.com>
date Sat, 27 Apr 2013 13:11:03 +0100
parent 5379:27de7cc94111
child 5776:bd0ff8ae98a8
child 6356:fb1535328ac7
comparison
equal deleted inserted replaced
5522:3912c9264ef0 5524:e9090966c803
138 138
139 local host_session = prosody.hosts[host]; 139 local host_session = prosody.hosts[host];
140 if not host_session then 140 if not host_session then
141 return false, "no-such-host"; 141 return false, "no-such-host";
142 end 142 end
143
144 storagemanager.initialize_host(host);
143 local provider = host_session.users; 145 local provider = host_session.users;
144 if not(provider) or provider.name == "null" then 146 if not(provider) or provider.name == "null" then
145 usermanager.initialize_host(host); 147 usermanager.initialize_host(host);
146 end 148 end
147 storagemanager.initialize_host(host);
148 149
149 local ok, errmsg = usermanager.create_user(user, password, host); 150 local ok, errmsg = usermanager.create_user(user, password, host);
150 if not ok then 151 if not ok then
151 return false, errmsg; 152 return false, errmsg;
152 end 153 end
153 return true; 154 return true;
154 end 155 end
155 156
156 function user_exists(params) 157 function user_exists(params)
157 local user, host, password = nodeprep(params.user), nameprep(params.host), params.password; 158 local user, host, password = nodeprep(params.user), nameprep(params.host), params.password;
159
160 storagemanager.initialize_host(host);
158 local provider = prosody.hosts[host].users; 161 local provider = prosody.hosts[host].users;
159 if not(provider) or provider.name == "null" then 162 if not(provider) or provider.name == "null" then
160 usermanager.initialize_host(host); 163 usermanager.initialize_host(host);
161 end 164 end
162 storagemanager.initialize_host(host);
163 165
164 return usermanager.user_exists(user, host); 166 return usermanager.user_exists(user, host);
165 end 167 end
166 168
167 function passwd(params) 169 function passwd(params)