Fix bug 7866 - "net" in v3-6-test broken.
[ira/wip.git] / source3 / utils / net_lookup.c
index 0a85da346fd7ffe55f88bc2e77310007036c0dc6..2afa75c609e2c1e9a14287cf2de44e8b694cb3fd 100644 (file)
@@ -410,6 +410,12 @@ static int net_lookup_dsgetdcname(struct net_context *c, int argc, const char **
                site_name = argv[2];
        }
 
+        if (!c->msg_ctx) {
+               d_fprintf(stderr, _("Could not initialise message context. "
+                       "Try running as root\n"));
+               return -1;
+        }
+
        status = dsgetdcname(mem_ctx, c->msg_ctx, domain_name, NULL, site_name,
                             flags, &info);
        if (!NT_STATUS_IS_OK(status)) {