summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@us.ibm.com>2012-08-10 08:41:41 -0700
committerAndrew Bartlett <abartlet@samba.org>2012-08-15 11:44:43 +1000
commit4c8616f0c84bfd1b114df8bb158c06ca8d987d5a (patch)
tree2a2d6639d6af76a29f2575279b1e0f66678013b0
parentbdb1f23e1d082830bf887cad0a0b5fed946b8e32 (diff)
downloadsamba-4c8616f0c84bfd1b114df8bb158c06ca8d987d5a.tar.gz
samba-4c8616f0c84bfd1b114df8bb158c06ca8d987d5a.tar.bz2
samba-4c8616f0c84bfd1b114df8bb158c06ca8d987d5a.zip
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 <abartlet@samba.org>
-rw-r--r--nsswitch/wbinfo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 3f7036dcba..70a7b1547a 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;