[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Wed Dec 15 12:02:45 MST 2010


The branch, v3-6-test has been updated
       via  858c790 Fix bug 7866 - "net" in v3-6-test broken.
      from  d6d907d Protect the onefs sendfile from EAGAIN/EWOULDBLOCK.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 858c790e56555dac4c014c4ab723c563ffa129a9
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 15 10:57:23 2010 -0800

    Fix bug 7866 - "net" in v3-6-test broken.
    
    Someone wasn't careful about testing when not running as root :-).
    (cherry picked from commit 921104e7a462c9552fcd04372d852325b457c827)

-----------------------------------------------------------------------

Summary of changes:
 source3/utils/net.c        |    6 +++---
 source3/utils/net_ads.c    |   13 +++++++++++++
 source3/utils/net_lookup.c |    6 ++++++
 3 files changed, 22 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/utils/net.c b/source3/utils/net.c
index 44119dc..13eed2f 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -924,11 +924,11 @@ static struct functable net_func[] = {
 		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);
 
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 858830f..0b2165d 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -968,6 +968,12 @@ static int net_ads_leave(struct net_context *c, int argc, const char **argv)
 		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"));
@@ -1348,6 +1354,13 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 		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;
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 0a85da3..2afa75c 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -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)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list