Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
ldap-auth
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Imran Hussain
ldap-auth
Commits
85884a6c
Commit
85884a6c
authored
1 year ago
by
Imran Hussain
Browse files
Options
Downloads
Patches
Plain Diff
filter out everything but A-Z a-z 0-9 . - _ from username
parent
9c8e7ad0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ldap-auth.php
+10
-2
10 additions, 2 deletions
ldap-auth.php
with
10 additions
and
2 deletions
ldap-auth.php
+
10
−
2
View file @
85884a6c
...
...
@@ -47,13 +47,21 @@ function ldapAuth($username, $password)
$username
=
implode
(
"@"
,
$s
);
}
// filter out everything but A-Z a-z 0-9 . - _ from username
$safeusername
=
preg_replace
(
"/[^A-Za-z0-9\.\-\_]/"
,
''
,
$username
);
// if safeusername isn't the same as username just error out
if
(
$safeusername
!=
$username
)
{
return
"nope"
;
}
// ldap servers
$sucsLDAPServer
=
'silver.sucs.swan.ac.uk'
;
$issLDAPServer
=
'192.168.10.16'
;
// how to bind
$sucsBindDn
=
"uid=
$username
,ou=People,dc=sucs,dc=org"
;
$issBindDn
=
"cn=
$username
,ou=Students,ou=Active,ou=Resources,o=Swansea"
;
$sucsBindDn
=
"uid=
$
safe
username
,ou=People,dc=sucs,dc=org"
;
$issBindDn
=
"cn=
$
safe
username
,ou=Students,ou=Active,ou=Resources,o=Swansea"
;
// Main auth
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment