changeset 5369:1a58a11407ac

mod_client_management: Fix error when last password change is unknown (or never) Fixes attempt to compare nil with number here, due to last_password_change being nil
author Kim Alvefur <zash@zash.se>
date Tue, 25 Apr 2023 22:06:08 +0200
parents 165ccec95585
children d9d52ad8c1ae
files mod_client_management/mod_client_management.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_client_management/mod_client_management.lua	Tue Apr 25 19:50:27 2023 +0200
+++ b/mod_client_management/mod_client_management.lua	Tue Apr 25 22:06:08 2023 +0200
@@ -206,7 +206,7 @@
 
 	-- Client has access if any password-based SASL mechanisms have been used since last password change
 	for mech, mech_last_used in pairs(client.mechanisms) do
-		if is_password_mechanism(mech) and mech_last_used >= last_password_change then
+		if is_password_mechanism(mech) and (not last_password_change or mech_last_used >= last_password_change) then
 			status.password = mech_last_used;
 		end
 	end