Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
die_coolen_jungs
our_own_cloud_project
Commits
1d520108
Commit
1d520108
authored
10 years ago
by
Arthur Schiwon
Browse files
Options
Downloads
Plain Diff
Merge pull request #9576 from owncloud/bcmath-check
LDAP Active Directory Primary Groups support depends on bcmath module
parents
6c28c9b1
537468f4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/user_ldap/lib/access.php
+6
-0
6 additions, 0 deletions
apps/user_ldap/lib/access.php
apps/user_ldap/tests/access.php
+29
-0
29 additions, 0 deletions
apps/user_ldap/tests/access.php
with
35 additions
and
0 deletions
apps/user_ldap/lib/access.php
+
6
−
0
View file @
1d520108
...
...
@@ -1298,6 +1298,12 @@ class Access extends LDAPUtility implements user\IUserTools {
*/
public
function
convertSID2Str
(
$sid
)
{
try
{
if
(
!
function_exists
(
'bcadd'
))
{
\OCP\Util
::
writeLog
(
'user_ldap'
,
'You need to install bcmath module for PHP to have support '
.
'for AD primary groups'
,
\OCP\Util
::
WARN
);
throw
new
\Exception
(
'missing bcmath module'
);
}
$srl
=
ord
(
$sid
[
0
]);
$numberSubID
=
ord
(
$sid
[
1
]);
$x
=
substr
(
$sid
,
2
,
6
);
...
...
This diff is collapsed.
Click to expand it.
apps/user_ldap/tests/access.php
+
29
−
0
View file @
1d520108
...
...
@@ -82,6 +82,10 @@ class Test_Access extends \PHPUnit_Framework_TestCase {
list
(
$lw
,
$con
,
$um
)
=
$this
->
getConnecterAndLdapMock
();
$access
=
new
Access
(
$con
,
$lw
,
$um
);
if
(
!
function_exists
(
'\bcadd'
))
{
$this
->
markTestSkipped
(
'bcmath not available'
);
}
$sidBinary
=
file_get_contents
(
__DIR__
.
'/data/sid.dat'
);
$sidExpected
=
'S-1-5-21-249921958-728525901-1594176202'
;
...
...
@@ -92,12 +96,37 @@ class Test_Access extends \PHPUnit_Framework_TestCase {
list
(
$lw
,
$con
,
$um
)
=
$this
->
getConnecterAndLdapMock
();
$access
=
new
Access
(
$con
,
$lw
,
$um
);
if
(
!
function_exists
(
'\bcadd'
))
{
$this
->
markTestSkipped
(
'bcmath not available'
);
}
$sidIllegal
=
'foobar'
;
$sidExpected
=
''
;
$this
->
assertSame
(
$sidExpected
,
$access
->
convertSID2Str
(
$sidIllegal
));
}
public
function
testConvertSID2StrNoBCMath
()
{
if
(
function_exists
(
'\bcadd'
))
{
$removed
=
false
;
if
(
function_exists
(
'runkit_function_remove'
))
{
$removed
=
!
runkit_function_remove
(
'\bcadd'
);
}
if
(
!
$removed
)
{
$this
->
markTestSkipped
(
'bcadd could not be removed for '
.
'testing without bcmath'
);
}
}
list
(
$lw
,
$con
,
$um
)
=
$this
->
getConnecterAndLdapMock
();
$access
=
new
Access
(
$con
,
$lw
,
$um
);
$sidBinary
=
file_get_contents
(
__DIR__
.
'/data/sid.dat'
);
$sidExpected
=
''
;
$this
->
assertSame
(
$sidExpected
,
$access
->
convertSID2Str
(
$sidBinary
));
}
public
function
testGetDomainDNFromDNSuccess
()
{
list
(
$lw
,
$con
,
$um
)
=
$this
->
getConnecterAndLdapMock
();
$access
=
new
Access
(
$con
,
$lw
,
$um
);
...
...
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