Following the behavior in auth_internal_hashed, the account will be created and
disabled, instead of returning an error telling password being nil when calling
saslprep().


-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/0bbe4395f6e1321cf0b8.1679352469%40EI08_MatisseX.
# HG changeset patch
# User Vitaly Orekhov <[email protected]>
# Date 1679352407 -10800
#      Tue Mar 21 01:46:47 2023 +0300
# Node ID 0bbe4395f6e1321cf0b8367e39a0a9c9c39085c6
# Parent  2f61ebcf37c03fe63313eab6eaed12089b2a6f0b
mod_auth_internal_plain: Fix user creation done via mod_admin_shell

Following the behavior in auth_internal_hashed, the account will be created and
disabled, instead of returning an error telling password being nil when calling
saslprep().

diff -r 2f61ebcf37c0 -r 0bbe4395f6e1 plugins/mod_auth_internal_plain.lua
--- a/plugins/mod_auth_internal_plain.lua	Fri Mar 17 15:11:26 2023 +0100
+++ b/plugins/mod_auth_internal_plain.lua	Tue Mar 21 01:46:47 2023 +0300
@@ -77,14 +77,17 @@
 end
 
 function provider.create_user(username, password)
+	local now = os.time();
+	if password == nil then
+		return accounts:set(username, { created = now; updated = now; disabled = true });
+	end
 	password = saslprep(password);
 	if not password then
 		return nil, "Password fails SASLprep.";
 	end
-	local now = os.time();
 	return accounts:set(username, {
 		password = password;
-		created = now, updated = now;
+		created = now; updated = now;
 	});
 end
 

Reply via email to