Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sucs-site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sucssite
sucs-site
Compare revisions
9e43fafb3e1fe7270575704a31dc498da858283a to 99f489eda886dc441584f762a661c1c83c6a3426
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
sucssite/sucs-site
Select target project
No results found
99f489eda886dc441584f762a661c1c83c6a3426
Select Git revision
Swap
Target
sucssite/sucs-site
Select target project
osian/sucs-site
kais58/sucs-site
imranh/sucs-site
foshjedi2004/sucs-site
gigosaurus/sucs-site
matstn/sucs-site
ripp_/sucs-site
eggnog/sucs-site
sucssite/sucs-site
elbows/sucs-site
realitykiller/sucs-site
crox/sucs-site
vectre/sucs-site
welshbyte/sucs-site
paperclipman/sucs-site
15 results
9e43fafb3e1fe7270575704a31dc498da858283a
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Sha512 passwords
· dcc4902a
Imran Hussain
authored
3 years ago
dcc4902a
Merge branch 'sha512-passwords' into 'master'
· 99f489ed
Imran Hussain
authored
3 years ago
Sha512 passwords See merge request
!123
99f489ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/options.php
+3
-2
3 additions, 2 deletions
components/options.php
lib/member_functions.php
+14
-1
14 additions, 1 deletion
lib/member_functions.php
with
17 additions
and
3 deletions
components/options.php
View file @
99f489ed
...
...
@@ -5,6 +5,8 @@ require_once("../lib/validation.php");
require_once
(
"Net/MAC.php"
);
include_once
(
"../lib/date.php"
);
// password hash, renewal functions
include_once
(
"../lib/member_functions.php"
);
// Some Constants
// These could possibly be moved somewhere saner?
...
...
@@ -47,7 +49,7 @@ function changePassword($oldpass, $newpass1, $newpass2)
// if everything looks OK, attempt to make the change
$success
=
ldap_mod_replace
(
$ldap
,
"uid="
.
$session
->
username
.
",ou=People,dc=sucs,dc=org"
,
array
(
'userpassword'
=>
"
{
SHA
}
"
.
base64_encode
(
pack
(
"H*"
,
sha1
(
$newpass1
)))
))
;
array
(
'userpassword'
=>
"
{
CRYPT
}
"
.
cryptPassword
(
$newpass1
)));
ldap_close
(
$ldap
);
return
$success
;
...
...
@@ -214,7 +216,6 @@ function updateRenew()
return
FALSE
;
}
include_once
(
"../lib/member_functions.php"
);
renew_membership
(
$member
[
'username'
]);
$sucsDB
->
Execute
(
"update signup set activated=NOW(), username=? where id=?"
,
array
(
$member
[
'username'
],
$signup
[
'id'
]));
return
TRUE
;
...
...
This diff is collapsed.
Click to expand it.
lib/member_functions.php
View file @
99f489ed
...
...
@@ -29,6 +29,19 @@ function make_password($length = 8)
return
$password
;
}
// https://stackoverflow.com/a/44428794
function
cryptPassword
(
$password
,
$salt
=
""
,
$rounds
=
5000
)
{
if
(
$salt
==
""
)
{
// Generate random salt
$salt
=
substr
(
bin2hex
(
openssl_random_pseudo_bytes
(
16
)),
0
,
16
);
}
// $6$ specifies SHA512
$hash
=
crypt
(
$password
,
sprintf
(
'$6$rounds=%d$%s$'
,
$rounds
,
$salt
));
return
$hash
;
}
function
generateUid
()
{
...
...
@@ -63,7 +76,7 @@ function generateLdif($uid, $password, $type, $realname, $username)
// explode the realname
$nameexplode
=
explode
(
' '
,
trim
(
$realname
));
// hash the password
$ldappassword
=
"
{
SHA
}
"
.
base64_encode
(
pack
(
"H*"
,
sha1
(
$password
)
))
;
$ldappassword
=
"
{
CRYPT
}
"
.
cryptPassword
(
$password
);
// compile ldif
$ldif
=
"dn: uid="
.
$username
.
",ou=People,dc=sucs,dc=org
\n
"
;
$ldif
.
=
"uid: "
.
$username
.
"
\n
"
;
...
...
This diff is collapsed.
Click to expand it.