From 900fe6a6258b441d54f88400996235ce25ab7f83 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 18 Aug 2006 12:45:51 +0000 Subject: r17603: Make net_ads_join_ok return NTSTATUS. Thanks to Michael Adam hop, hop, hop... ;-) Volker (This used to be commit 47facab798bdc6e20b2620972f1b8f2338fac239) --- source3/utils/net_ads.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 8303e22a3b..2fbe088653 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -812,23 +812,25 @@ done: return ret; } -static int net_ads_join_ok(void) +static NTSTATUS net_ads_join_ok(void) { ADS_STRUCT *ads = NULL; + ADS_STATUS status; if (!secrets_init()) { DEBUG(1,("Failed to initialise secrets database\n")); - return -1; + return NT_STATUS_ACCESS_DENIED; } net_use_machine_password(); - if (!ADS_ERR_OK(ads_startup(True, &ads))) { - return -1; + status = ads_startup(True, &ads); + if (!ADS_ERR_OK(status)) { + return ads_ntstatus(status); } ads_destroy(&ads); - return 0; + return NT_STATUS_OK; } /* @@ -836,11 +838,14 @@ static int net_ads_join_ok(void) */ int net_ads_testjoin(int argc, const char **argv) { + NTSTATUS status; use_in_memory_ccache(); /* Display success or failure */ - if (net_ads_join_ok() != 0) { - fprintf(stderr,"Join to domain is not valid\n"); + status = net_ads_join_ok(); + if (!NT_STATUS_IS_OK(status)) { + fprintf(stderr,"Join to domain is not valid: %s\n", + get_friendly_nt_error_msg(status)); return -1; } -- cgit