From 4c8616f0c84bfd1b114df8bb158c06ca8d987d5a Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Fri, 10 Aug 2012 08:41:41 -0700 Subject: [PATCH] wbinfo: Improve output of wbinfo --ping-dc Use wbcPingDc2 to get the DC name and print it. Cleanup error messages: Remove "Could not ping our DC", there is always a more specific message. Avoid printing "failed to call wbcPingDc" in case the ping has been attempted and it returns an error, the error is already printed. Signed-off-by: Andrew Bartlett --- nsswitch/wbinfo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index 3f7036dcbad..70a7b1547a4 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -831,16 +831,19 @@ static bool wbinfo_ping_dc(void) { wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct wbcAuthErrorInfo *error = NULL; + char *dcname = NULL; - wbc_status = wbcPingDc(NULL, &error); + wbc_status = wbcPingDc2(NULL, &error, &dcname); - d_printf("checking the NETLOGON dc connection %s\n", + d_printf("checking the NETLOGON dc connection to \"%s\" %s\n", + dcname ? dcname : "", WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); if (wbc_status == WBC_ERR_AUTH_ERROR) { d_fprintf(stderr, "error code was %s (0x%x)\n", error->nt_string, error->nt_status); wbcFreeMemory(error); + return false; } if (!WBC_ERROR_IS_OK(wbc_status)) { d_fprintf(stderr, "failed to call wbcPingDc: %s\n", @@ -2371,7 +2374,6 @@ int main(int argc, char **argv, char **envp) break; case 'P': if (!wbinfo_ping_dc()) { - d_fprintf(stderr, "Could not ping our DC\n"); goto done; } break; -- 2.34.1