mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
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>
This commit is contained in:
parent
bdb1f23e1d
commit
4c8616f0c8
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user