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
d6a96489
Commit
d6a96489
authored
Dec 03, 2019
by
Francesc Guasch
Browse files
Merge branch 'develop' into refactor/1208_ldap
parents
29b5ed5d
c67cdeff
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
d6a96489
...
...
@@ -2250,7 +2250,7 @@ sub _kill_stale_process($self) {
.
"
AND pid IS NOT NULL
"
.
"
AND start_time IS NOT NULL
"
);
$sth
->
execute
(
time
-
5
*scalar
(
@domains
)
+
60
);
$sth
->
execute
(
time
-
5
*scalar
(
@domains
)
-
60
);
while
(
my
(
$id
,
$pid
,
$command
,
$start_time
)
=
$sth
->
fetchrow
)
{
if
(
$pid
==
$$
)
{
warn
"
HOLY COW! I should kill pid
$pid
stale for
"
.
(
time
-
$start_time
)
...
...
t/65_user_ldap.t
View file @
d6a96489
...
...
@@ -440,43 +440,56 @@ 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
};
sub
_replace_field
($entry, $field, $with_posix_group) {
my
$old_value
=
$entry
->
get_value
(
$field
);
die
"
Error: No
$field
found in LDAP entry in
"
.
Dummper
(
$user
)
die
"
Error: No
$field
found in LDAP entry in
"
.
$entry
->
get_value
('
cn
'
)
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
");
Ravada::Auth::LDAP::
init
();
my
$ldap
=
Ravada::Auth::LDAP::
_init_ldap_admin
();
$entry
->
replace
(
$field
=>
$new_value
);
my
$mesg
=
$entry
->
update
(
$ldap
);
die
$mesg
->
code
.
"
"
.
$mesg
->
error
if
$mesg
->
code
&&
$mesg
->
code
;
confess
$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
);
return
(
$old_value
,
$new_value
);
}
sub
test_uid_cn
($user, $with_posix_group) {
Ravada::Auth::LDAP::
init
();
my
$ldap
=
Ravada::Auth::LDAP::
_init_ldap_admin
();
my
$entry
=
$user
->
{
_ldap_entry
};
my
$field
=
'
uid
';
my
%data
=
(
cn
=>
$entry
->
get_value
('
cn
')
,
$field
=>
$entry
->
get_value
(
$field
)
);
test_login_fields
(
\
%data
);
my
(
$old_value
,
$new_value
)
=
_replace_field
(
$entry
,
$field
,
$with_posix_group
);
$data
{
$field
}
=
$new_value
;
test_login_fields
(
\
%data
);
$entry
->
replace
(
$field
=>
$old_value
);
$entry
->
update
(
$ldap
);
}
}
sub
test_login_fields
($data) {
my
$password
=
'
jameson
';
my
$login_ok
;
for
my
$field
(
sort
keys
%$data
)
{
my
$value
=
$data
->
{
$field
};
eval
{
$login_ok
=
Ravada::Auth::
login
(
$value
,
$password
)
};
is
(
$@
,'',"
$field
:
$value
");
ok
(
$login_ok
,
$value
);
}
}
sub
test_pass_storage
($with_posix_group) {
...
...
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