File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
app/Classes/LDAP/Attribute Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,13 @@ protected static function helpers(): Collection
5252 public static function hash (string $ password ): ?Attribute \Password \Base
5353 {
5454 $ m = [];
55- preg_match ('/^{([A -Z0-9]+)}(.*)$/ ' ,$ password ,$ m );
55+ preg_match ('/^{([a-zA -Z0-9]+)}(.*)$/ ' ,$ password ,$ m );
5656
57- $ hash = \Arr::get ($ m ,1 ,'*clear* ' );
57+ $ hash = strtoupper ($ x =\Arr::get ($ m ,1 ,'*clear* ' ));
58+
59+ // If our hash in the password is not in upper case, then convert it, as we use uppercase hashes to find the right class
60+ if ($ hash !== $ x )
61+ $ password = preg_replace ('/^{ ' .$ x .'}/ ' ,'{ ' .$ hash .'} ' ,$ password );
5862
5963 if (($ potential =static ::helpers ()->filter (fn ($ hasher )=>str_starts_with ($ hasher ::key,$ hash )))->count () > 1 ) {
6064 foreach ($ potential as $ item ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ final class Crypt extends Base
1111
1212 public static function subid (string $ password ): bool
1313 {
14- return preg_match ('/^[\da-zA-Z ]{2}/ ' ,self ::password ($ password ));
14+ return preg_match ('/^[\w ]{2}/ ' ,self ::password ($ password ));
1515 }
1616
1717 public function compare (string $ source ,string $ compare ): bool
Original file line number Diff line number Diff line change 165165 ],
166166 sprintf ('userpassword.%s%s.* ' ,\App \Ldap \Entry::TAG_NOTAG ,\App \Ldap \Entry::TAG_HELPER ) => [
167167 'nullable ' ,
168- 'min:4 '
168+ 'min:3 '
169169 ],
170170 sprintf ('userpassword.%s.* ' ,\App \Ldap \Entry::TAG_NOTAG ) => [
171171 'nullable ' ,
You can’t perform that action at this time.
0 commit comments