Author: vlendec
Date: 2006-08-18 12:45:51 +0000 (Fri, 18 Aug 2006)
New Revision: 17603

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17603

Log:
Make net_ads_join_ok return NTSTATUS.

Thanks to Michael Adam <[EMAIL PROTECTED]>

hop, hop, hop... ;-)

Volker
Modified:
   branches/SAMBA_3_0/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c   2006-08-18 12:39:21 UTC (rev 
17602)
+++ branches/SAMBA_3_0/source/utils/net_ads.c   2006-08-18 12:45:51 UTC (rev 
17603)
@@ -812,23 +812,25 @@
        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 @@
  */
 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;
        }
 

Reply via email to