s3:net ads join: improve status evaluation for call to net_update_dns()
authorMichael Adam <obnox@samba.org>
Mon, 30 Jan 2012 13:15:14 +0000 (14:15 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 31 Jan 2012 16:00:30 +0000 (17:00 +0100)
untangle assignment from check and log error code in message if failed.

source3/utils/net_ads.c

index ecb04ceea611f7a671f25e8a1305c932c7fe6c87..15f2b54ee990c85be0a669c0dc1698ab75e0c19d 100644 (file)
@@ -1466,6 +1466,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
                /* We enter this block with user creds */
                ADS_STRUCT *ads_dns = NULL;
                int ret;
+               NTSTATUS status;
 
                ads_dns = ads_init(lp_realm(), NULL, r->in.dc_name);
 
@@ -1507,8 +1508,10 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
                        goto dns_done;
                }
 
-               if (!NT_STATUS_IS_OK(net_update_dns( ctx, ads_dns, NULL))) {
-                       d_fprintf( stderr, _("DNS update failed!\n"));
+               status = net_update_dns(ctx, ads_dns, NULL);
+               if (!NT_STATUS_IS_OK(status)) {
+                       d_fprintf( stderr, _("DNS update failed: %s\n"),
+                                 nt_errstr(status));
                }
 
                /* exit from this block using machine creds */