Two patches to testparm 3.0.0rc4

Jay Fenlason fenlason at redhat.com
Wed Sep 17 16:30:26 GMT 2003


The first makes it emit an error message if it is called with a
machine name but no machine IP address (instead of silently ignoring
the machine name).

The second tests both the global and per-share access control before
saying that access to a share is allowed.  This matches the observed
behavior of smbd, where if the global "host allow" etc do not allow
access to the share, the per-share access control cannot override it.

			-- JF
--- samba-3.0.0rc4/source/utils/testparm.c.testparm	2003-09-11 14:05:45.000000000 -0400
+++ samba-3.0.0rc4/source/utils/testparm.c	2003-09-16 17:13:26.000000000 -0400
@@ -226,7 +226,11 @@
 
 	cname = poptGetArg(pc);
 	caddr = poptGetArg(pc);
-	
+
+	if ( cname && ! caddr ) {
+		printf ( "ERROR: You must specify both a machine name and an IP address.\n" );
+	}
+
 	if (new_local_machine) {
 		set_local_machine_name(new_local_machine, True);
 	}
@@ -345,8 +349,9 @@
 	if(cname && caddr){
 		/* this is totally ugly, a real `quick' hack */
 		for (s=0;s<1000;s++) {
-			if (VALID_SNUM(s)) {		 
-				if (allow_access(lp_hostsdeny(s), lp_hostsallow(s), cname, caddr)) {
+			if (VALID_SNUM(s)) {
+				if (   allow_access ( lp_hostsdeny(-1), lp_hostsallow(-1), cname, caddr )
+				    && allow_access(lp_hostsdeny(s), lp_hostsallow(s), cname, caddr)) {
 					printf("Allow connection from %s (%s) to %s\n",
 						   cname,caddr,lp_servicename(s));
 				} else {



More information about the samba-technical mailing list