From 022aae6314d55e3efe91ba6ccabe4b205d473b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Fri, 26 Jul 2024 14:54:11 +0200 Subject: [PATCH] Invert bitwise operations --- src/Ltb/Directory/ActiveDirectory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ltb/Directory/ActiveDirectory.php b/src/Ltb/Directory/ActiveDirectory.php index ef781d4..bcb8d18 100644 --- a/src/Ltb/Directory/ActiveDirectory.php +++ b/src/Ltb/Directory/ActiveDirectory.php @@ -226,7 +226,7 @@ public function enableAccount($ldap, $dn) : bool { } if ($entry[0]['useraccountcontrol'] and ( $entry[0]['useraccountcontrol'][0] & 2)) { - $newUAC = $entry[0]['useraccountcontrol'][0] | 2; + $newUAC = $entry[0]['useraccountcontrol'][0] & ~2; $update = \Ltb\PhpLDAP::ldap_mod_replace($ldap, $dn, array( "userAccountControl" => $newUAC)); $errno = ldap_errno($ldap); @@ -255,7 +255,7 @@ public function disableAccount($ldap, $dn) : bool { } if ($entry[0]['useraccountcontrol'] and ( $entry[0]['useraccountcontrol'][0] ^ 2)) { - $newUAC = $entry[0]['useraccountcontrol'][0] & ~2; + $newUAC = $entry[0]['useraccountcontrol'][0] | 2; $update = \Ltb\PhpLDAP::ldap_mod_replace($ldap, $dn, array( "userAccountControl" => $newUAC)); $errno = ldap_errno($ldap);