From 1922de0fe27492c09d2f188c2c7e54a4b364bbad Mon Sep 17 00:00:00 2001 From: MutonUfoAI Date: Wed, 11 Apr 2018 13:01:49 +0200 Subject: [PATCH] Ldap plugin fix AD UserChangePassword https://github.com/MutonUfoAI/pgina/issues/107 --- Plugins/LdapPlugin/Ldap/Plugin.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugins/LdapPlugin/Ldap/Plugin.cs b/Plugins/LdapPlugin/Ldap/Plugin.cs index a1bc5ea7..67d7f944 100755 --- a/Plugins/LdapPlugin/Ldap/Plugin.cs +++ b/Plugins/LdapPlugin/Ldap/Plugin.cs @@ -358,13 +358,21 @@ public BooleanResult ChangePassword(SessionProperties properties, ChangePassword { if (entry.Method.HasFlag(Methods.ADPWD)) { + bool ADpwd = false; + string pwdmessage = ""; foreach (string server in hosts) { - if (Abstractions.WindowsApi.pInvokes.UserChangePassword(server, userInfo.Username, userInfo.oldPassword, userInfo.Password) == "") + pwdmessage = Abstractions.WindowsApi.pInvokes.UserChangePassword(server, userInfo.Username, userInfo.oldPassword, userInfo.Password); + if (pwdmessage == "") { + ADpwd = true; break; } } + if (!ADpwd) + { + return new BooleanResult { Success = false, Message = "Failed to change password.\n" + pwdmessage }; + } continue; }