Author: vlendec
Date: 2006-08-15 09:53:16 +0000 (Tue, 15 Aug 2006)
New Revision: 17551

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

Log:
Move some DEBUG to d_printf in interactive functions and return
NO_LOGON_SERVERS if no domain controller was found.

Thanks to Michael Adam <[EMAIL PROTECTED]>.

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


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap.c     2006-08-15 08:05:52 UTC (rev 
17550)
+++ branches/SAMBA_3_0/source/libads/ldap.c     2006-08-15 09:53:16 UTC (rev 
17551)
@@ -287,7 +287,7 @@
                goto got_connection;
        }
 
-       return ADS_ERROR_SYSTEM(errno?errno:ENOENT);
+       return ADS_ERROR_NT(NT_STATUS_NO_LOGON_SERVERS);
 
 got_connection:
        DEBUG(3,("Connected to LDAP server %s\n", inet_ntoa(ads->ldap_ip)));

Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c   2006-08-15 08:05:52 UTC (rev 
17550)
+++ branches/SAMBA_3_0/source/utils/net_ads.c   2006-08-15 09:53:16 UTC (rev 
17551)
@@ -278,7 +278,7 @@
                        second_time = True;
                        goto retry;
                } else {
-                       DEBUG(0,("ads_connect: %s\n", ads_errstr(status)));
+                       d_printf("%s.\n", ads_errstr(status));
                        ads_destroy(&ads);
                        return NULL;
                }
@@ -542,7 +542,7 @@
 
        rc = ads_find_user_acct(ads, &res, argv[0]);
        if (!ADS_ERR_OK(rc)) {
-               DEBUG(0, ("User %s does not exist\n", argv[0]));
+               d_printf("User %s does not exist.\n", argv[0]);
                ads_destroy(&ads);
                return -1;
        }
@@ -668,7 +668,7 @@
 
        rc = ads_find_user_acct(ads, &res, argv[0]);
        if (!ADS_ERR_OK(rc)) {
-               DEBUG(0, ("Group %s does not exist\n", argv[0]));
+               d_printf("Group %s does not exist.\n", argv[0]);
                ads_destroy(&ads);
                return -1;
        }
@@ -769,7 +769,7 @@
        }
 
        if (!(ctx = talloc_init("net_ads_leave"))) {
-               DEBUG(0, ("Could not initialise talloc context\n"));
+               d_fprintf(stderr, "Could not initialise talloc context.\n");
                return -1;
        }
 
@@ -1100,7 +1100,7 @@
        /* go ahead and setup the default salt */
 
        if ( (std_salt = kerberos_standard_des_salt()) == NULL ) {
-               DEBUG(0,("net_derive_salting_principal: failed to obtain 
stanard DES salt\n"));
+               d_fprintf(stderr, "net_derive_salting_principal: failed to 
obtain stanard DES salt\n");
                return False;
        }
 
@@ -1199,7 +1199,7 @@
        }
 
        if (!(ctx = talloc_init("net_ads_join"))) {
-               DEBUG(0, ("Could not initialise talloc context\n"));
+               d_fprintf(stderr, "Could not initialise talloc context.\n");
                goto fail;
        }
 
@@ -1240,7 +1240,8 @@
        password = talloc_strdup(ctx, tmp_password);
        
        if ( net_join_domain( ctx, ads->config.ldap_server_name, &ads->ldap_ip, 
&domain_sid, password ) != 0 ) {
-               d_fprintf(stderr, "Failed to join domain!\n");
+               /* There should be more detailed output here... */
+               d_fprintf(stderr, "call of net_join_domain failed\n");
                goto fail;
        }
        
@@ -1341,6 +1342,8 @@
        return 0;
 
 fail:
+       /* issue an overall failure message at the end. */
+       d_printf("Failed to join domain!\n");
        ads_destroy(&ads);
        return -1;
 }

Reply via email to