@@ -1238,59 +1238,6 @@ module ConfigHosts = struct
12381238 |> write_string_to_file path
12391239end
12401240
1241- module DNSSync = struct
1242- let task_name = " Sync hostname with DNS"
1243-
1244- type t = Register | Unregister
1245-
1246- let handle op hostname netbios_name domain =
1247- (* By default, hostname should equal to netbios_name, just register it to DNS server*)
1248- try
1249- let ops =
1250- match op with Register -> " register" | Unregister -> " unregister"
1251- in
1252- let netbios_fqdn = Printf. sprintf " %s.%s" netbios_name domain in
1253- let args = [" ads" ; " dns" ] @ [ops] @ [" --machine-pass" ] in
1254- Helpers. call_script net_cmd (args @ [netbios_fqdn]) |> ignore ;
1255- if hostname <> netbios_name then
1256- let hostname_fqdn = Printf. sprintf " %s.%s" hostname domain in
1257- (* netbios_name is compressed, op on extra hostname *)
1258- Helpers. call_script net_cmd (args @ [hostname_fqdn]) |> ignore
1259- with e ->
1260- debug " Register/unregister with DNS failed %s" (ExnHelper. string_of_exn e)
1261-
1262- let register hostname netbios_name domain =
1263- handle Register hostname netbios_name domain
1264-
1265- let unregister hostname netbios_name domain =
1266- handle Unregister hostname netbios_name domain
1267-
1268- let sync () =
1269- Server_helpers. exec_with_new_task " sync hostname with DNS"
1270- @@ fun __context ->
1271- let host = Helpers. get_localhost ~__context in
1272- let service_name =
1273- Db.Host. get_external_auth_service_name ~__context ~self: host
1274- in
1275- let netbios_name =
1276- Db.Host. get_external_auth_configuration ~__context ~self: host
1277- |> fun config -> List. assoc_opt " netbios_name" config
1278- in
1279- let hostname = Db.Host. get_hostname ~__context ~self: host in
1280- match netbios_name with
1281- | Some netbios ->
1282- register hostname netbios service_name
1283- | None ->
1284- debug " Netbios name is none, skip sync hostname to DNS"
1285-
1286- let trigger_sync ~start =
1287- debug " Trigger task: %s" task_name ;
1288- Scheduler. add_to_queue task_name
1289- (Scheduler. Periodic ! Xapi_globs. winbind_dns_sync_interval) start sync
1290-
1291- let stop_sync () = Scheduler. remove_from_queue task_name
1292- end
1293-
12941241let build_netbios_name ~config_params =
12951242 let key = " netbios-name" in
12961243 match List. assoc_opt key config_params with
@@ -1657,7 +1604,6 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
16571604 [get_localhost_name () ]
16581605 in
16591606 (* Trigger right now *)
1660- DNSSync. trigger_sync ~start: 0. ;
16611607 Winbind. set_machine_account_encryption_type netbios_name ;
16621608 debug " Succeed to join domain %s" service_name
16631609 with
@@ -1697,12 +1643,9 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
16971643 let user = List. assoc_opt " user" config_params in
16981644 let pass = List. assoc_opt " pass" config_params in
16991645 let {service_name; netbios_name; _} = get_domain_info_from_db () in
1700- DNSSync. stop_sync () ;
17011646 ( match netbios_name with
17021647 | Some netbios ->
1703- ConfigHosts. leave ~domain: service_name ~name: netbios ;
1704- let hostname = get_localhost_name () in
1705- DNSSync. unregister hostname netbios service_name
1648+ ConfigHosts. leave ~domain: service_name ~name: netbios
17061649 | _ ->
17071650 ()
17081651 ) ;
@@ -1731,7 +1674,6 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
17311674 RotateMachinePassword. trigger_rotate ~start: 5. ;
17321675 Winbind. check_ready_to_serve ~timeout: 300. ;
17331676 Winbind. flush_cache () ;
1734- DNSSync. trigger_sync ~start: 5. ;
17351677
17361678 let {service_name; netbios_name; _} = get_domain_info_from_db () in
17371679 match netbios_name with
0 commit comments