From 7f87d58900c2adf4d79f4dc7859a96f1d00d819b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 10 Jan 2011 17:25:00 +0100 Subject: s3: Add wbinfo --dc-info wbinfo --dc-info prints the current DC name and IP address. This helps diagnosing problems that might happen when a later wbinfo --ping-dc fails. This patch started out by using the SAF and NBT cache entires, but those are relatively short-lived. So I decided to invent a new gencache entry with a very long timeout. We need to go via the gencache because when for some reason a winbind child process is stuck, we can't query it for the current DC it's connected to. This must eventually go away again when we have a fully async winbind. Autobuild-User: Volker Lendecke Autobuild-Date: Wed Jan 19 08:40:28 CET 2011 on sn-devel-104 --- nsswitch/wbinfo.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'nsswitch/wbinfo.c') diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index 6ff66f8f3c..caa37f3c9e 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -787,6 +787,31 @@ static bool wbinfo_check_secret(const char *domain) return true; } +/* Find the currently connected DCs */ + +static bool wbinfo_dc_info(const char *domain_name) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + size_t i, num_dcs; + const char **dc_names, **dc_ips; + + wbc_status = wbcDcInfo(domain_name, &num_dcs, + &dc_names, &dc_ips); + if (!WBC_ERROR_IS_OK(wbc_status)) { + printf("Could not find dc info %s\n", + domain_name ? domain_name : "our domain"); + return false; + } + + for (i=0; i