Skip to content

Commit a8c9abe

Browse files
EtienneBarbierleenooks
authored andcommitted
Add option to list available password types - closes #143
1 parent 1c7340c commit a8c9abe

File tree

3 files changed

+50
-21
lines changed

3 files changed

+50
-21
lines changed

config/config.php.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,31 @@
7171
environments. */
7272
# $config->custom->password['no_random_crypt_salt'] = true;
7373

74+
/* If you want to restrict password available types (encryption algorithms)
75+
Should be subset of:
76+
array(
77+
''=>'clear',
78+
'bcrypt'=>'bcrypt',
79+
'blowfish'=>'blowfish',
80+
'crypt'=>'crypt',
81+
'ext_des'=>'ext_des',
82+
'md5'=>'md5',
83+
'k5key'=>'k5key',
84+
'md5crypt'=>'md5crypt',
85+
'sha'=>'sha',
86+
'smd5'=>'smd5',
87+
'ssha'=>'ssha',
88+
'sha256'=>'sha256',
89+
'ssha256'=>'ssha256',
90+
'sha384'=>'sha384',
91+
'ssha384'=>'ssha384',
92+
'sha512'=>'sha512',
93+
'ssha512'=>'ssha512',
94+
'sha256crypt'=>'sha256crypt',
95+
'sha512crypt'=>'sha512crypt',
96+
)*/
97+
# $config->custom->password['available_types'] = array(''=>'clear','md5'=>'md5');
98+
7499
/* PHP script timeout control. If php runs longer than this many seconds then
75100
PHP will stop with an Maximum Execution time error. Increase this value from
76101
the default if queries to your LDAP server are slow. The default is either

lib/config_default.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,30 @@ public function __construct() {
554554
'desc'=>'Disable random salt for crypt()',
555555
'default'=>false);
556556

557+
$this->default->password['available_types'] = array(
558+
'desc'=>'List of available password types used for encryption',
559+
'default'=>array(
560+
''=>'clear',
561+
'bcrypt'=>'bcrypt',
562+
'blowfish'=>'blowfish',
563+
'crypt'=>'crypt',
564+
'ext_des'=>'ext_des',
565+
'md5'=>'md5',
566+
'k5key'=>'k5key',
567+
'md5crypt'=>'md5crypt',
568+
'sha'=>'sha',
569+
'smd5'=>'smd5',
570+
'ssha'=>'ssha',
571+
'sha256'=>'sha256',
572+
'ssha256'=>'ssha256',
573+
'sha384'=>'sha384',
574+
'ssha384'=>'ssha384',
575+
'sha512'=>'sha512',
576+
'ssha512'=>'ssha512',
577+
'sha256crypt'=>'sha256crypt',
578+
'sha512crypt'=>'sha512crypt',
579+
));
580+
557581
/** Search display
558582
* By default, when searching you may display a list or a table of results.
559583
* Set this to 'table' to see table formatted results.

lib/functions.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,27 +2148,7 @@ function password_types() {
21482148
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
21492149
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
21502150

2151-
return array(
2152-
''=>'clear',
2153-
'bcrypt'=>'bcrypt',
2154-
'blowfish'=>'blowfish',
2155-
'crypt'=>'crypt',
2156-
'ext_des'=>'ext_des',
2157-
'md5'=>'md5',
2158-
'k5key'=>'k5key',
2159-
'md5crypt'=>'md5crypt',
2160-
'sha'=>'sha',
2161-
'smd5'=>'smd5',
2162-
'ssha'=>'ssha',
2163-
'sha256'=>'sha256',
2164-
'ssha256'=>'ssha256',
2165-
'sha384'=>'sha384',
2166-
'ssha384'=>'ssha384',
2167-
'sha512'=>'sha512',
2168-
'ssha512'=>'ssha512',
2169-
'sha256crypt'=>'sha256crypt',
2170-
'sha512crypt'=>'sha512crypt',
2171-
);
2151+
return $_SESSION[APPCONFIG]->getValue('password', 'available_types');
21722152
}
21732153

21742154
/**

0 commit comments

Comments
 (0)