Skip to content

Commit f7d3a23

Browse files
authored
Merge pull request xapi-project#257 from robhoes/ely-bugfix
CA-235358: Fix AD users in child domains cannot log in to XenCenter 7
2 parents e176904 + 40a0a3a commit f7d3a23

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ocaml/auth/extauth_plugin_ADpbis.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,11 @@ struct
389389
let authenticate_username_password username password =
390390
(* first, we try to authenticated user against our external user database *)
391391
(* pbis_common will raise an Auth_failure if external authentication fails *)
392-
let user = List.hd (List.rev (String.split_f (fun c -> c = '\\') username)) in
393-
let domain = get_joined_domain_name () in
392+
let (domain, user) = match (String.split_f (fun c -> c = '\\') username) with
393+
| [domain; user] -> (domain, user)
394+
| [user] -> (get_joined_domain_name(), user)
395+
| _ -> raise (Auth_signature.Auth_service_error (Auth_signature.E_GENERIC,"Invalid username " ^ username))
396+
in
394397
let (_: (string * string) list) = pbis_common "/opt/pbis/bin/lsa" ["authenticate-user";"--user";user;"--domain";domain;"--password";password] in
395398
(* no exception raised, then authentication succeeded, *)
396399
(* now we return the authenticated user's id *)

0 commit comments

Comments
 (0)