s3:net ads join: check for success of fetching machine password in dns update block
authorMichael Adam <obnox@samba.org>
Mon, 30 Jan 2012 13:05:59 +0000 (14:05 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 31 Jan 2012 16:00:30 +0000 (17:00 +0100)
log and cleanup accordingly if failed

source3/utils/net_ads.c

index 22486ea7fbdeab32c997d7b93b82289eac5d8527..ddfe10b9143c34851c4bcc4c81bb571e9c79a194 100644 (file)
@@ -1486,6 +1486,11 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 
                ads_dns->auth.password = secrets_fetch_machine_password(
                        r->out.netbios_domain_name, NULL, NULL);
+               if (ads_dns->auth.password == NULL) {
+                       d_fprintf(stderr, _("DNS update failed: out of memory\n"));
+                       goto dns_done;
+               }
+
                ads_dns->auth.realm = SMB_STRDUP(r->out.dns_domain_name);
                strupper_m(ads_dns->auth.realm);
                ads_kinit_password(ads_dns);