[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3230-gcd5d13d

Michael Adam obnox at samba.org
Tue Jul 15 11:07:49 GMT 2008


The branch, v3-3-test has been updated
       via  cd5d13dec0153c64d541e85bd13138b738cf50af (commit)
       via  6cafee7e6ae02a32a9f2ddf313d2a20224fa22fe (commit)
       via  5b8a4c33482917a1ef7071df224957ba831d853a (commit)
      from  32f4b1443af12026c419684be45a7d8b96ccfaac (commit)

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


- Log -----------------------------------------------------------------
commit cd5d13dec0153c64d541e85bd13138b738cf50af
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jul 15 13:01:54 2008 +0200

    testparm: refactor the per-share logic checks out into do_per_share_checks().
    
    Just to enhance clearness of the code.
    
    Michael

commit 6cafee7e6ae02a32a9f2ddf313d2a20224fa22fe
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jul 15 12:55:57 2008 +0200

    testparm: skip the per-share logic checks when --skip-logic-checks is specified.
    
    Michael

commit 5b8a4c33482917a1ef7071df224957ba831d853a
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jul 15 12:52:25 2008 +0200

    testparm: rename -g|--skip-global-ckecks to -l|--skip-logic-checks
    
    as suggested by Karolin.
    
    That is what it really means. And per-share logic tests will be
    disabled by the same switch, too...
    
    Michael

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

Summary of changes:
 source/script/tests/test_testparm_s3.sh |    2 +-
 source/utils/testparm.c                 |  133 ++++++++++++++++--------------
 2 files changed, 72 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/script/tests/test_testparm_s3.sh b/source/script/tests/test_testparm_s3.sh
index 875f138..0962ca0 100755
--- a/source/script/tests/test_testparm_s3.sh
+++ b/source/script/tests/test_testparm_s3.sh
@@ -6,7 +6,7 @@
 # and the macro expansions.
 
 TEMP_CONFFILE=${LIBDIR}/smb.conf.tmp
-TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt --skip-global-checks"
+TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt --skip-logic-checks"
 
 incdir=`dirname $0`
 . $incdir/test_functions.sh
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index 018993c..212dcf0 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -202,6 +202,72 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
 	return ret;
 }   
 
+/**
+ * per-share logic tests
+ */
+static void do_per_share_checks(int s)
+{
+	const char **deny_list = lp_hostsdeny(s);
+	const char **allow_list = lp_hostsallow(s);
+	int i;
+
+	if(deny_list) {
+		for (i=0; deny_list[i]; i++) {
+			char *hasstar = strchr_m(deny_list[i], '*');
+			char *hasquery = strchr_m(deny_list[i], '?');
+			if(hasstar || hasquery) {
+				fprintf(stderr,"Invalid character %c in hosts deny list (%s) for service %s.\n",
+					   hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) );
+			}
+		}
+	}
+
+	if(allow_list) {
+		for (i=0; allow_list[i]; i++) {
+			char *hasstar = strchr_m(allow_list[i], '*');
+			char *hasquery = strchr_m(allow_list[i], '?');
+			if(hasstar || hasquery) {
+				fprintf(stderr,"Invalid character %c in hosts allow list (%s) for service %s.\n",
+					   hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) );
+			}
+		}
+	}
+
+	if(lp_level2_oplocks(s) && !lp_oplocks(s)) {
+		fprintf(stderr,"Invalid combination of parameters for service %s. \
+			   Level II oplocks can only be set if oplocks are also set.\n",
+			   lp_servicename(s) );
+	}
+
+	if (lp_map_hidden(s) && !(lp_create_mask(s) & S_IXOTH)) {
+		fprintf(stderr,"Invalid combination of parameters for service %s. \
+			   Map hidden can only work if create mask includes octal 01 (S_IXOTH).\n",
+			   lp_servicename(s) );
+	}
+	if (lp_map_hidden(s) && (lp_force_create_mode(s) & S_IXOTH)) {
+		fprintf(stderr,"Invalid combination of parameters for service %s. \
+			   Map hidden can only work if force create mode excludes octal 01 (S_IXOTH).\n",
+			   lp_servicename(s) );
+	}
+	if (lp_map_system(s) && !(lp_create_mask(s) & S_IXGRP)) {
+		fprintf(stderr,"Invalid combination of parameters for service %s. \
+			   Map system can only work if create mask includes octal 010 (S_IXGRP).\n",
+			   lp_servicename(s) );
+	}
+	if (lp_map_system(s) && (lp_force_create_mode(s) & S_IXGRP)) {
+		fprintf(stderr,"Invalid combination of parameters for service %s. \
+			   Map system can only work if force create mode excludes octal 010 (S_IXGRP).\n",
+			   lp_servicename(s) );
+	}
+#ifdef HAVE_CUPS
+	if (lp_printing(s) == PRINT_CUPS && *(lp_printcommand(s)) != '\0') {
+		 fprintf(stderr,"Warning: Service %s defines a print command, but \
+rameter is ignored when using CUPS libraries.\n",
+			   lp_servicename(s) );
+	}
+#endif
+}
+
  int main(int argc, const char *argv[])
 {
 	const char *config_file = get_dyn_CONFIGFILE();
@@ -217,7 +283,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
 	const char *cname;
 	const char *caddr;
 	static int show_defaults;
-	static int skip_global_checks = 0;
+	static int skip_logic_checks = 0;
 
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
@@ -225,7 +291,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
 		{"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
 		{"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
 		{"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters with encoding"},
-		{"skip-global-checks", 'g', POPT_ARG_NONE, &skip_global_checks, 1, "Skip the global checks"},
+		{"skip-logic-checks", 'l', POPT_ARG_NONE, &skip_logic_checks, 1, "Skip the global checks"},
 		{"show-all-parameters", '\0', POPT_ARG_VAL, &show_all_parameters, True, "Show the parameters, type, possible values" },
 		{"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
 		{"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
@@ -278,7 +344,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
 
 	fprintf(stderr,"Loaded services file OK.\n");
 
-	if (skip_global_checks == 0) {
+	if (skip_logic_checks == 0) {
 		ret = do_global_checks();
 	}
 
@@ -293,65 +359,8 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
 	}
 
 	for (s=0;s<1000;s++) {
-		if (VALID_SNUM(s)) {
-			const char **deny_list = lp_hostsdeny(s);
-			const char **allow_list = lp_hostsallow(s);
-			int i;
-			if(deny_list) {
-				for (i=0; deny_list[i]; i++) {
-					char *hasstar = strchr_m(deny_list[i], '*');
-					char *hasquery = strchr_m(deny_list[i], '?');
-					if(hasstar || hasquery) {
-						fprintf(stderr,"Invalid character %c in hosts deny list (%s) for service %s.\n",
-							   hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) );
-					}
-				}
-			}
-
-			if(allow_list) {
-				for (i=0; allow_list[i]; i++) {
-					char *hasstar = strchr_m(allow_list[i], '*');
-					char *hasquery = strchr_m(allow_list[i], '?');
-					if(hasstar || hasquery) {
-						fprintf(stderr,"Invalid character %c in hosts allow list (%s) for service %s.\n",
-							   hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) );
-					}
-				}
-			}
-
-			if(lp_level2_oplocks(s) && !lp_oplocks(s)) {
-				fprintf(stderr,"Invalid combination of parameters for service %s. \
-					   Level II oplocks can only be set if oplocks are also set.\n",
-					   lp_servicename(s) );
-			}
-
-			if (lp_map_hidden(s) && !(lp_create_mask(s) & S_IXOTH)) {
-				fprintf(stderr,"Invalid combination of parameters for service %s. \
-					   Map hidden can only work if create mask includes octal 01 (S_IXOTH).\n",
-					   lp_servicename(s) );
-			}
-			if (lp_map_hidden(s) && (lp_force_create_mode(s) & S_IXOTH)) {
-				fprintf(stderr,"Invalid combination of parameters for service %s. \
-					   Map hidden can only work if force create mode excludes octal 01 (S_IXOTH).\n",
-					   lp_servicename(s) );
-			}
-			if (lp_map_system(s) && !(lp_create_mask(s) & S_IXGRP)) {
-				fprintf(stderr,"Invalid combination of parameters for service %s. \
-					   Map system can only work if create mask includes octal 010 (S_IXGRP).\n",
-					   lp_servicename(s) );
-			}
-			if (lp_map_system(s) && (lp_force_create_mode(s) & S_IXGRP)) {
-				fprintf(stderr,"Invalid combination of parameters for service %s. \
-					   Map system can only work if force create mode excludes octal 010 (S_IXGRP).\n",
-					   lp_servicename(s) );
-			}
-#ifdef HAVE_CUPS
-			if (lp_printing(s) == PRINT_CUPS && *(lp_printcommand(s)) != '\0') {
-				 fprintf(stderr,"Warning: Service %s defines a print command, but \
-print command parameter is ignored when using CUPS libraries.\n",
-					   lp_servicename(s) );
-			}
-#endif
+		if (VALID_SNUM(s) && (skip_logic_checks == 0)) {
+			do_per_share_checks(s);
 		}
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list