Someone wasn't careful about testing when not running as root :-).
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Dec 15 20:45:25 CET 2010 on sn-devel-104
c->opt_password = getenv("PASSWD");
}
+ /* Failing to init the msg_ctx isn't a fatal error. Only
+ root-level things (joining/leaving domains etc.) will be denied. */
+
c->msg_ctx = messaging_init(c, procid_self(),
event_context_init(c));
- if (c->msg_ctx == NULL) {
- exit(1);
- }
rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
use_in_memory_ccache();
}
+ if (!c->msg_ctx) {
+ d_fprintf(stderr, _("Could not initialise message context. "
+ "Try running as root\n"));
+ return -1;
+ }
+
werr = libnet_init_UnjoinCtx(ctx, &r);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, _("Could not initialise unjoin context.\n"));
goto fail;
}
+ if (!c->msg_ctx) {
+ d_fprintf(stderr, _("Could not initialise message context. "
+ "Try running as root\n"));
+ werr = WERR_ACCESS_DENIED;
+ goto fail;
+ }
+
/* Do the domain join here */
r->in.domain_name = domain;
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)) {