Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
1efa8dfa
Commit
1efa8dfa
authored
Nov 28, 2019
by
Francesc Guasch
Browse files
test(auth): check login with uid or cn
Necessary for PR #1206 by @OlivierLM
parent
b28c9ed6
Changes
1
Hide whitespace changes
Inline
Side-by-side
t/65_user_ldap.t
View file @
1efa8dfa
...
...
@@ -438,6 +438,45 @@ sub test_posix_group {
}
sub
test_uid_cn
($user, $with_posix_group) {
my
$password
=
'
jameson
';
my
$ldap
=
Ravada::Auth::LDAP::
_init_ldap_admin
();
my
$login_ok
;
for
my
$field
(
qw(uid cn)
)
{
diag
("
Testing login with
$field
");
my
$entry
=
$user
->
{
_ldap_entry
};
my
$old_value
=
$entry
->
get_value
(
$field
);
die
"
Error: No
$field
found in LDAP entry in
"
.
Dummper
(
$user
)
if
!
$old_value
;
eval
{
$login_ok
=
Ravada::Auth::
login
(
$old_value
,
$password
)
};
is
(
$@
,'',
$old_value
);
ok
(
$login_ok
,
$old_value
);
next
if
$field
eq
'
cn
';
my
$new_value
=
new_domain_name
();
diag
("
Testing login with
$field
$new_value
, posix_group=
$with_posix_group
");
$entry
->
replace
(
$field
=>
$new_value
);
my
$mesg
=
$entry
->
update
(
$ldap
);
die
$mesg
->
code
.
"
"
.
$mesg
->
error
if
$mesg
->
code
&&
$mesg
->
code
;
_add_to_posix_group
(
$new_value
,
$with_posix_group
);
eval
{
$login_ok
=
Ravada::Auth::
login
(
$new_value
,
$password
)
};
is
(
$@
,'',"
$field
:
$new_value
")
or
exit
;
ok
(
$login_ok
,
$new_value
);
$entry
->
replace
(
$field
=>
$old_value
);
$entry
->
update
(
$ldap
);
}
}
SKIP:
{
test_filter
();
my
$file_config
=
"
t/etc/ravada_ldap.conf
";
...
...
@@ -478,6 +517,8 @@ SKIP: {
test_user_bind
(
$user
,
$fly_config
,
$with_posix_group
);
test_uid_cn
(
$user
,
$with_posix_group
);
remove_users
();
};
unlink
(
$fly_config
)
if
-
e
$fly_config
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment