File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1072,12 +1072,16 @@ let _get_nbd_info ~__context ~self ~get_server_certificate =
10721072 if ips = [] then [] else
10731073 let cert = get_server_certificate ~host in
10741074 let port = 10809L in
1075- let subject = try match Certificates. hostnames_of_pem_cert cert with
1075+ let rec seek = function
10761076 | [] -> (
10771077 error " Found no subject DNS names in this hosts's certificate. Returning empty string as subject." ;
10781078 " "
10791079 )
1080- | name :: _ -> name
1080+ | last :: [] -> last (* Better to return a possible wildcard than nothing *)
1081+ | name :: xs -> if (String. contains name '*' ) then seek xs else name
1082+ in
1083+ let subject = try
1084+ seek (Certificates. hostnames_of_pem_cert cert)
10811085 with e -> (
10821086 error " get_nbd_info: failed to read subject from TLS certificate! Falling back to Host.hostname. Exn was %s" (ExnHelper. string_of_exn e);
10831087 Db.Host. get_hostname ~__context ~self: host
You can’t perform that action at this time.
0 commit comments